# Getting Data from a barcode scanner into Node Red

**URL:** https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914
**Category:** General
**Created:** [19 June 2018 08:55 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914 "2018-06-19T08:55:20Z")
**Posts on this page:** 16
**Page:** 2

<div class="post-metadata">

### Author: ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)
#### Post date: [22 June 2018 06:31 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914/21 "2018-06-22T06:31:36Z")

</div>

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

![Unbenannt](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/0d887bac297ea396fbea779bea1250cac73b35ff.JPG)

---

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [22 June 2018 06:58 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914/22 "2018-06-22T06:58:13Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Steampunk\_Prof](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@Steampunk\_Prof](https://discourse.nodered.org/u/Steampunk_Prof)
#### Post date: [22 June 2018 07:50 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914/23 "2018-06-22T07:50:11Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)
#### Post date: [22 June 2018 08:18 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914/24 "2018-06-22T08:18:28Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [22 June 2018 08:43 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914/25 "2018-06-22T08:43:58Z")

</div>

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

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

```

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

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [22 June 2018 08:52 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914/26 "2018-06-22T08:52:37Z")

</div>

> [@YT2310](#):
>
> Spi@raspberrypi:~/.node-red/node\_modules/node-red-contrib-barcode-scanner $ npm install node-usb-barcode-scanner

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.

---

<div class="post-metadata">

### Author: ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)
#### Post date: [22 June 2018 09:11 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914/27 "2018-06-22T09:11:01Z")

</div>

@zenofmud

> [@Steampunk\_Prof](#):
>
> In my .node-red/node\_modules directory I have a directory called node-red-contrib-barcode-scanner. In that are barcode-scanner.html, barcode-scanner.js and package.json. Also into here you’ll need to do npm install node-usb-barcode-scanner.

this is why i was trying that..

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [22 June 2018 11:32 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914/28 "2018-06-22T11:32:57Z")

</div>

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

---

<div class="post-metadata">

### Author: ![machadotiago](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/machadotiago/32/23776_2.png) [@machadotiago](https://discourse.nodered.org/u/machadotiago)
#### Post date: [22 June 2018 17:38 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914/29 "2018-06-22T17:38:49Z")

</div>

hum…that’s interesting.  
Question: in the manual is there any barcode for “Enter setup mode” or something like this?

---

<div class="post-metadata">

### Author: ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)
#### Post date: [25 June 2018 05:51 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914/30 "2018-06-25T05:51:19Z")

</div>

> [@machadotiago](#):
>
> Question: in the manual is there any barcode for “Enter setup mode” or something like this?

No, there is not such a barcode

---

<div class="post-metadata">

### Author: ![aco7342](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/aco7342/32/649_2.png) [@aco7342](https://discourse.nodered.org/u/aco7342)
#### Post date: [27 June 2018 22:20 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914/31 "2018-06-27T22:20:50Z")

</div>

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

---

<div class="post-metadata">

### Author: ![robertsLando](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/robertslando/32/6937_2.png) [@robertsLando](https://discourse.nodered.org/u/robertsLando)
#### Post date: [14 July 2020 06:49 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914/32 "2020-07-14T06:49:18Z")

</div>

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](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

---

<div class="post-metadata">

### Author: ![anilsagar](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@anilsagar](https://discourse.nodered.org/u/anilsagar)
#### Post date: [16 March 2021 04:30 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914/33 "2021-03-16T04:30:16Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![saxenaramesh](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@saxenaramesh](https://discourse.nodered.org/u/saxenaramesh)
#### Post date: [17 March 2022 17:10 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914/34 "2022-03-17T17:10:20Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [17 March 2022 20:55 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914/35 "2022-03-17T20:55:38Z")

</div>

Please dont cross post - it just confuses matters.

Plus, this post is very old.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [17 March 2022 20:55 UTC](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914/36 "2022-03-17T20:55:42Z")

</div>



[Previous page](https://discourse.nodered.org/t/getting-data-from-a-barcode-scanner-into-node-red/914.md?page=1)
