Barcode scan 28 alphanumeric characters

#1

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

0 Likes

#2

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

0 Likes

#3

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

0 Likes

#4

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

0 Likes

#5

I didn’t try

0 Likes

#6

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

Thanks

0 Likes

#7

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.

0 Likes

#8

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

0 Likes

#9

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.

0 Likes