Getting Data from a barcode scanner into Node Red

I got two devices appropriate in node red, but with non of them happen anything

Unbenannt

At the moment you donā€™t know if you have

  1. A functioning scanner and the challenge is getting that data into Node-RED
  2. A faulty scanner

My suggestion would be to step back. And check that the scanner is communicating with your raspberry pi. You can use an app called minicom, there are lots of guides online if you google ā€œminicom raspberry piā€
You will need to stop Node-RED first as only one application can access a serial port.

The barcode-scanner.js is expecting node-usb-barcode-scanner to be in the node_modules directory in the node-red-contrib-barcode-scanner directory. Is that where yours is?
Try running Node-RED from the command line with node-red-pi -v and seeing what error messages come up. My code is a bit messya as I threw it together very quickly and havenā€™t had the time to go back and sort it out.

I checked it again and I think there is a Problem with downloading the nmp node-usb-barcode-scannerā€¦
there is also no difference between ā€œnpm install ā€¦ā€ and ā€œnpm i ā€¦ā€
Spi@raspberrypi:~/.node-red/node_modules/node-red-contrib-barcode-scanner $ npm install node-usb-barcode-scanner
npm WARN checkPermissions Missing write access to /home/pi/.node-red/node_modules/node-red-contrib-barcode-scanner
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

npm ERR! path /home/pi/.node-red/node_modules/node-red-contrib-barcode-scanner
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access ā€˜/home/pi/.node-red/node_modules/node-red-contrib-barcode-scannerā€™
npm ERR! { Error: EACCES: permission denied, access ā€˜/home/pi/.node-red/node_modules/node-red-contrib-barcode-scannerā€™
npm ERR! stack: ā€˜Error: EACCES: permission denied, access ā€˜/home/pi/.node-red/node_modules/node-red-contrib-barcode-scannerā€™ā€™,
npm ERR! errno: -13,
npm ERR! code: ā€˜EACCESā€™,
npm ERR! syscall: ā€˜accessā€™,
npm ERR! path: ā€˜/home/pi/.node-red/node_modules/node-red-contrib-barcode-scannerā€™ }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2018-06-22T08_06_54_424Z-debug.log

I suspect that at some stage you have used sudo to install a local node, so you have set the permissions on the files to root. Run these commands to reset ownership back to pi

sudo chown -R pi:pi /home/pi/

That will set the ownership of all files in the home folder back to pi

Also, when you install a node, make sure you are in the '.node-red' directory. From your log you are in the
.node-red
-->node_modules
---->node-red-contrib-barcode-scanner
directory which mess up the nstall because you will end up with the code being in:
.node-red
-->node_modules
---->node-red-contrib-barcode-scanner
------>node_modules
-------->node-red-contrib-barcode-scanner
so make sure you are just in the .node-red directory.

@zenofmud

this is why i was trying that..

oops, my mistake. I thought you were installing node-red-contrib-barcode-scanner

humā€¦thatā€™s interesting.
Question: in the manual is there any barcode for ā€œEnter setup modeā€ or something like this?

No, there is not such a barcode

Sorry for my poor english I use a npm serialport into node-red with usb 19200, 8,n,1 ingenico ipp320 pinpad and works.

1 Like

If anyone is still interested in this I have forked an old project into this one: https://www.npmjs.com/package/node-red-contrib-usbhid-reader

Follow the instructions on readme and you will be able to parse the data from your HID device

2 Likes

This is the correct solution. First I was able to get scanned barcode info output in Microsoft word when the scanner was configured in HID mode. After changing to serial mode and using serial node, I was still not able to get data in Node-red for quite sometime. The issue was that I had chosen "/n" as the split character. As soon as I changed it over to 100ms, everything started working fine.

Dear Anil,
I need help on exactly same topic. I have done the split setting to 100ms as well. Still I am not getting any data from scanner.
Please let me know which scanner model you are using. I want a handheld wireless scanner which can work with Node Red Serial Port. Please send your scanner details.
I have already tried Henex HC-3208R and LENVII - CW200. I can connect these to RPi and get output in text editor. But these does not work with Node Red on Raspberry Pi Raspbian OS.
Thanks in advance.

Please dont cross post - it just confuses matters.

Plus, this post is very old.