I am working on a Raspberry PI and am trying to find a way so that when the end user presses a button a command is executed for the module and and it starts to scan.
It is a Waveshare barcode scanner module.
This is the only clue (see image) I have from the manual
and as it needs it to be via UART I have to use the GPIO pins.
The module requires the pins: VCC (5V); TXD; RXD; GND (Ground)
I have found found a kind of solution on the arduino forum (Sending UART command to barcode scanner - Programming Questions - Arduino Forum) but I don't know how to implement it to node-RED and it's still unclear to me how he managed to do it.
Please note that I am not very familiar with coding and the exec node is kind of a mystery to me so if anyone could be so kind to help me it would be much appreciated.
Is there a reason why you cannot use the USB interface of the module?
Also note: If the module uses 5V on the TX or RX you will have to use a level converter to connect it to your Pi, which is strictly 3.3V.
Thanks for your reply
Sorry I thougth that UART command can only be sent by the TXD-RXD pins. If it's not the case I suppose I can manage it somehow if it's essentially more simple.
I'm not sure what you mean by needing a level converter
On the manufacturer's site (Barcode Scanner Module, 1D/2D Codes Reader) under specifications they wrote "Operating voltage: 5V" and the PI has a 5V (and a 3.3V) pin.
But does it use 5V on the UART pins? If it does you should not connect it to the Pi GPIO's, as they only tolerate 3.3V.
Much easier to use the USB interface.
I really don't know as they only wrote
"Operating voltage: 5V"
But I've connected it to the USB port so it's not a problem.
As fkristofb writes and it says in the manual it is 5V ttl. You cannot connect 5v ttl to the gpio pins, otherwise you will destroy the raspberry pi.
I haven't found out what kind of usb adapter comes with your scanner, but it says in the manual that if you want to connect it to a PC, you must use TTL. A usb to ttl adapter gives you a virtual serial port under the pi, but of course it must be a version that supports 5V.
Check under /dev if the supplied usb adapter creates a serial port, if not get such an adapter.