Barcode scanner

I have installed USB hid device and connected by barcode scanner by using the GETHID DEVICES the product id and vendor is obtaines and pasted in the HID Devices block but still the connection seems to be disconnected. Please help me....

here is my flow..

[{"id":"729f8468.b47dbc","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"632a3966.4e64e8","type":"inject","z":"729f8468.b47dbc","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":140,"wires":[["14f877c5.78cd48"]]},{"id":"167e060f.1502ba","type":"debug","z":"729f8468.b47dbc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":570,"y":140,"wires":[]},{"id":"14f877c5.78cd48","type":"getHIDdevices","z":"729f8468.b47dbc","name":"Get USB Device IDs","x":380,"y":120,"wires":[["167e060f.1502ba"]]},{"id":"500d4560.c8462c","type":"HIDdevice","z":"729f8468.b47dbc","connection":"12763923.7040f7","name":"Barcode Scanner","x":110,"y":220,"wires":[["5d269865.5134c8"],[]]},{"id":"5d269865.5134c8","type":"join","z":"729f8468.b47dbc","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":310,"y":220,"wires":[["d0e87266.42154"]]},{"id":"d0e87266.42154","type":"function","z":"729f8468.b47dbc","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":480,"y":220,"wires":[["64f6799b.cbd528"]]},{"id":"64f6799b.cbd528","type":"debug","z":"729f8468.b47dbc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":650,"y":220,"wires":[]},{"id":"12763923.7040f7","type":"HIDConfig","vid":"1112","pid":"58","name":"Inateck BCST-33 1D Barcode Scanner"}]

Some barcode scanners can be configured to emulate a serial port which is easier than going with the USB Hid way.

1 Like

I have a project running on a Raspi using the RaspiKeyboard node. If this fits your requirements i can provide more info.

Can u please share me

But he particular voyage 1250g doesn't response to serial communication

This is a part of a program that scans a barcode and sends the scanned number to a vide recorder to be used as metadata.
Scanner is USB-type, program is written to scan numbers only but can be extended.
The scanner returns numbers according to keyboard rows/columns. Google for keyboard scan codes.

[{"id":"7ca6e4f9.5af774","type":"rpi-keyboard","z":"197d4b8a.b9c364","name":"","x":270,"y":520,"wires":[["c0dec102.7a94","71f7f7c0.bdd5d"]]},{"id":"bdf9e908.6ab278","type":"ui_text","z":"197d4b8a.b9c364","group":"e137936d.bca7a","order":1,"width":0,"height":0,"name":"","label":"raw text","format":"{{msg.payload}}","layout":"row-spread","x":1140,"y":520,"wires":[]},{"id":"c0dec102.7a94","type":"function","z":"197d4b8a.b9c364","name":"key scan decoder","func":"var msg2 = {};\nvar incoming = msg.payload;\nvar action = msg.action;    // a 'down' indicates start of number\ncoi1= [\"\",\"\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"0\",\"-\",\"+\",\"\",\"\",\"Q\",\"W\",\"E\",\"R\",\"T\",\"Z\",\"U\",\"I\",\"O\",\"P\",\"\",\"\",\"\",\"\",\"A\",\"S\",\"D\",\"F\",\"G\",\"H\",\"J\",\"K\",\"L\",\"\",\"\",\"\",\"\",\"\",\"Y\",\"X\",\"C\",\"V\",\"B\",\"N\",\"M\",\",\",\".\"];\nif (action === \"down\") {\n    // coi0= [\"\",\"\",\"!\",\"\",\"§\",\"$\",\"%\",\"&\",\"/\",\"(\",\")\",\"=\",\"-\",\"+\",\"\",\"\",\"Q\",\"W\",\"E\",\"R\",\"T\",\"Z\",\"U\",\"I\",\"O\",\"P\",\"\",\"\",\"\",\"\",\"A\",\"S\",\"D\",\"F\",\"G\",\"H\",\"J\",\"K\",\"L\",\"\",\"\",\"\",\"\",\"\",\"Y\",\"X\",\"C\",\"V\",\"B\",\"N\",\"M\",\",\",\".\"];\n        if (incoming === 42) {\n        // marker character for characters, not numbers\n        // ignore it here\n    }\n    else if (incoming === 28) {\n        // finished, send collection\n        var outstr = flow.get(\"collect\");\n        msg.payload = outstr;\n        msg2.payload = 0;\n        //flow.set(\"collect\",\"\");\n        return [msg,msg2];\n    }\n    else {\n        collected = flow.get(\"collect\");\n        collected = collected + coi1[incoming];\n        flow.set(\"collect\",collected);\n    }\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":520,"wires":[["bdf9e908.6ab278","71f7f7c0.bdd5d"],[]]},{"id":"7fc623f1.56a044","type":"comment","z":"197d4b8a.b9c364","name":"Barcode reader","info":"enthält noch nicht getestete Teile\nY-Z muß noch geprüft werden\nSonderzeichen müssen geprüft werden\n\nhttp://online-barcode-generator.net/","x":280,"y":400,"wires":[]},{"id":"71f7f7c0.bdd5d","type":"debug","z":"197d4b8a.b9c364","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":710,"y":440,"wires":[]},{"id":"e137936d.bca7a","type":"ui_group","name":"Vars and results","tab":"fe2dedb6.c42208","order":2,"disp":true,"width":"6","collapse":false},{"id":"fe2dedb6.c42208","type":"ui_tab","name":"Setup and Test","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

It support only in raspberry pi it dosent supports t my windows 7 system and barcoe scanner

Have you put your barcode scanner into USB HID mode by scanning the barcode on page 11 of the manual?

Pete.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.