EDIT. We have found out the hard way that the node required for this post is broken in newer versions of NPM / Nodejs.
groov EPIC firmware bumped those versions around 1.4.0, so anything newer will not be able to use these instructions.
If we find or hear about a workaround / fix we will update this post.
Here are some detailed instructions for installing the node-red-contrib-usbhid Node-RED package on a groov EPIC. The flow at the bottom of this post can be used to get generic USB barcode scanner input in a Node-RED flow so you can use it in PAC Control, groov View, log it in a database, or anywhere else that you might need it.
- Open a new shell session.
- Get a required USB library:
a.sudo apt-get update
b.sudo apt-get install libusb-1.0-dev
- Give the Node-RED âdevâ user permission to access USB:
a.sudo mkdir -p /etc/udev/rules.d
b.sudo nano /etc/udev/rules.d/85-pure-data.rules
c. Add the following rule:
SUBSYSTEM=="usb", GROUP="input", MODE="777"
Usectrl+o
to save the file and thenctrl+x
to exit the text editor
d.sudo groupadd -f input
e.sudo gpasswd -a dev input
- Close shell and install node-red-contrib-usbhid through the Node-RED package manager.
- Import and deploy the flow pasted below.
- Get the ID information for your scanner device:
a. Inject the âGet USB Device IDsâ flow, check the debug pane to see whatâs already there
b. Plug in your USB scanner and run the flow again
c. Note the âVIDâ and âPIDâ for the new device in the debug pane
d. Open the âBarcode Scannerâ node and use the pencil to update the âConnectionâ settings
e. Type or paste in the VID and PID for your USB scanner and name the new connection - Redeploy the flow and now any scanned codes should show up in the debug pane after 1s!
[{"id":"632a3966.4e64e8","type":"inject","z":"45a3a637.29c0e8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":500,"y":440,"wires":[["14f877c5.78cd48"]]},{"id":"167e060f.1502ba","type":"debug","z":"45a3a637.29c0e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":890,"y":440,"wires":[]},{"id":"14f877c5.78cd48","type":"getHIDdevices","z":"45a3a637.29c0e8","name":"Get USB Device IDs","x":700,"y":440,"wires":[["167e060f.1502ba"]]},{"id":"500d4560.c8462c","type":"HIDdevice","z":"45a3a637.29c0e8","connection":"12763923.7040f7","name":"Barcode Scanner","x":430,"y":520,"wires":[["5d269865.5134c8"],[]]},{"id":"5d269865.5134c8","type":"join","z":"45a3a637.29c0e8","name":"Create Array","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":630,"y":520,"wires":[["d0e87266.42154"]]},{"id":"d0e87266.42154","type":"function","z":"45a3a637.29c0e8","name":"extract barcode","func":"var data = ''; // initialize output string\nfor(i = 0; i < msg.payload.length - 2; i+=2) { // get every other character for 1D barcodes\n next = msg.payload[i][3] - 29; // offset for integer numbers\n if(next < 0) next = String.fromCharCode(next + 122); // offset for ascii characters\n if(next == 15) data += ' '; // handle any space characters\n else if(next == 10) data += 0; // 10 is used in place of zero, since 0 means \"nothing\"\n else data += next;\n}\nreturn { payload : data };","outputs":1,"noerr":0,"x":800,"y":520,"wires":[["64f6799b.cbd528"]]},{"id":"64f6799b.cbd528","type":"debug","z":"45a3a637.29c0e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":970,"y":520,"wires":[]},{"id":"12763923.7040f7","type":"HIDConfig","z":"","vid":"1155","pid":"22352","name":"Inateck BCST-33 1D Barcode Scanner"}]
Happy coding!