# Barcode scan 28 alphanumeric characters

**URL:** <https://discourse.nodered.org/t/barcode-scan-28-alphanumeric-characters/3190>\
**Category:** Hardware\
**Created:** [16 September 2018 14:20 UTC](https://discourse.nodered.org/t/barcode-scan-28-alphanumeric-characters/3190 "2018-09-16T14:20:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcojass](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@marcojass](https://discourse.nodered.org/u/marcojass)\
**Post date:** [16 September 2018 14:20 UTC](https://discourse.nodered.org/t/barcode-scan-28-alphanumeric-characters/3190/1 "2018-09-16T14:20:37Z")

</div>

Hi guys  
I use a barcode scanner into a beaglbeone with node-red , specially usb-hid contrib node.

It function perfectly apart for 2 cases:

- a 28 digit lenght barcode
- alphanumeric barcode  
Can you helo me to solve that 2 cases ?  
I bought 3 different readers but without any success

Thanks

---

<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:** [16 September 2018 14:49 UTC](https://discourse.nodered.org/t/barcode-scan-28-alphanumeric-characters/3190/2 "2018-09-16T14:49:02Z")

</div>

What barcode scanner are you using?  
What does it do with those two cases?

---

<div class="post-metadata">

**Author:** ![marcojass](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@marcojass](https://discourse.nodered.org/u/marcojass)\
**Post date:** [16 September 2018 15:26 UTC](https://discourse.nodered.org/t/barcode-scan-28-alphanumeric-characters/3190/3 "2018-09-16T15:26:47Z")

</div>

I tried a Taotronic scan and the

a Aibecy Barcode Scanner Portable Wireless 1D/2D/QR Bar Lettore di Codici con Ricevitore USB 2100 Codice Capacità per PC POS Android iOS

In allo foto the casse the reader skip some characters  
Sometimes it reads correctly all the 28

---

<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:** [16 September 2018 15:39 UTC](https://discourse.nodered.org/t/barcode-scan-28-alphanumeric-characters/3190/4 "2018-09-16T15:39:04Z")

</div>

Do they read correctly if you use the scanners WITHOUT Node-RED?

---

<div class="post-metadata">

**Author:** ![marcojass](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@marcojass](https://discourse.nodered.org/u/marcojass)\
**Post date:** [16 September 2018 16:04 UTC](https://discourse.nodered.org/t/barcode-scan-28-alphanumeric-characters/3190/5 "2018-09-16T16:04:38Z")

</div>

I didn’t try

---

<div class="post-metadata">

**Author:** ![marcojass](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@marcojass](https://discourse.nodered.org/u/marcojass)\
**Post date:** [16 September 2018 16:05 UTC](https://discourse.nodered.org/t/barcode-scan-28-alphanumeric-characters/3190/6 "2018-09-16T16:05:29Z")

</div>

Can you suggest an app to test it ? On Windows or Linux ?

Thanks

---

<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:** [16 September 2018 16:11 UTC](https://discourse.nodered.org/t/barcode-scan-28-alphanumeric-characters/3190/7 "2018-09-16T16:11:19Z")

</div>

No. If you find the same issue with all three scanners it would suggest the software is at fault.  
As they are all using the same software. So try changing the software and see if they then read correctly. If they do you then need to open an issue with either the node-red-node or the underlying library it uses (where the problem is more likely to reside), and in it you would need to include examples of a barcode that cannot be correctly read. Currently this doesn't appear to be a solvable issue in Node-RED.

---

<div class="post-metadata">

**Author:** ![marcojass](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@marcojass](https://discourse.nodered.org/u/marcojass)\
**Post date:** [16 September 2018 20:55 UTC](https://discourse.nodered.org/t/barcode-scan-28-alphanumeric-characters/3190/8 "2018-09-16T20:55:43Z")

</div>

Hello  
I tried with a PC software and it does read correctoly.

Mu node-red cose is:

var buffer = msg.payload;  
var len = buffer.length;  
var i=0;  
var value="";  
var valuefinal = "";  
var chars ="1234567890";  
while(i\<len)  
{  
var sub = buffer[i];  
if(sub \>= 0x1e && sub \<= 0x27 )  
//if(sub !== "")  
value = value + chars.charAt(sub - 0x1e);

```
    i+=1;
}

```

msg.payload= value;  
return msg;

Then I use batchder ad a string covnersion. The node-red clipboard is:

[{"id":"b6f97b89.a04878","type":"function","z":"93f35d7f.df912","name":"READ MAIN BARCODE","func":"var buffer = msg.payload;\nvar len = buffer.length;\nvar i=0;\nvar value="";\nvar valuefinal = "";\nvar chars ="1234567890";\nwhile(i\<len)\n {\n var sub = buffer[i];\n if(sub \>= 0x1e && sub \<= 0x27 )\n //if(sub !== "") \n value = value + chars.charAt(sub - 0x1e);\n \n i+=1;\n }\nmsg.payload= value;\nreturn msg;\n","outputs":1,"noerr":0,"x":736,"y":531,"wires":[["6b9c49cc.fd8db"]]},{"id":"5d548a87.40ed5c","type":"HIDdevice","z":"93f35d7f.df912","connection":"ba271608.0846c","name":"READER 2","x":487.75,"y":539.75,"wires":[["b6f97b89.a04878"],[]]},{"id":"6b9c49cc.fd8db","type":"batcher","z":"93f35d7f.df912","name":"BATCHER BUF","maxTopics":"1","maxMessagesPerTopic":"10","maxDelay":"100","x":965.36669921875,"y":530.5,"wires":[["a80033e.eb389d"]]},{"id":"a80033e.eb389d","type":"string","z":"93f35d7f.df912","name":"COVERT TO STRING","methods":[{"name":"append","params":[{"type":"str","value":""}]},{"name":"strip","params":[{"type":"str","value":","}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":1223.7666015625,"y":529.4833068847656,"wires":[["4bc16739.52f13","dc0206d0.c49838"]]},{"id":"ba271608.0846c","type":"HIDConfig","z":"","vid":"5050","pid":"24","name":"READER 1"}]

Thabks a lot

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [16 September 2018 22:12 UTC](https://discourse.nodered.org/t/barcode-scan-28-alphanumeric-characters/3190/9 "2018-09-16T22:12:32Z")

</div>

Hi - please edit your post and properly format your code block - its hard to read otherwise.

Put three back-tick characters (```) on a newline before and after the code block - and likewise your Node-RED flow JSON.
