Game Room barcode scanner with Linux and ARM
This post continues the story started in http://zachu.fi/en/game-room-maximum-gaming-with-puppet-and-raspberry-pi/.
When we first started running the Game Room, we noticed that every youth who has the membership card of the Helsinki Youth Department has also a barcode on it. We didn’t know anyone in our department really using the barcode for anything, but there was that anyway. We bought a Zebex Z-3051HS barcode scanner and made a guestbook system using the scanner. The scanner is always in scanning mode on a stand and it registers users who show the scanner their barcode. Later on we also made our waitingline system use the barcode also. If I remember correctly, that scanner worked like a dream under Linux and Windows systems and we had no problems with it until…
Since we started having these smaller Game Rooms around the city, we wanted them to have our barcode system also. We couldn’t find these same Zebex Z-3051HS scanners anymore, but there was similar Z-3151HS versions. With quick testing under Windows environment the scanner seemed to work just like the we had before. The only difference was that this new scanner took all the power needed from USB and the previous one had possibility to put an external power source in it. That wasn’t problem for us, since we didn’t need an external power source.
Of course like in every project, this project started to have problems when we first tried to put it on production. We realized that this new barcode scanner didn’t have the same “scan always when placed on a stand”-mode. For some reason the scanner didn’t keep the scanner light on all the time but turned it off and on again about once in a second. Mostly this was annoying feature and not something we couldn’t live with. The real problem was when we tried to read a barcode with the reader. Without any obvious logic, the scanner seemed to drop a digits while scanning. The barcodes worked just right when scanning on Windows environment, but on Linux the problems occured. With a bit of Googling we found an old bug report about it and it seemed that there was no fix for it.
After playing around with the problem a bit we did find a solution. We were able to put our scanner to Virtual COM Port mode and we found a neat serial port X11 keyboard emulator for barcode scanners called Softwedge and some precompiled deb files. Thanks for the kind developer of Softwedge, we got our barcode scanner working just fine under Linux environments too! Using of that program isn’t hard. You just run it with command softwedge -c /dev/ttyACM0 or whatever the tty for your scanner is.
Since we’re starting to use Raspberry Pi as our waitingline client machines, we needed the Softwedge for ARM too. I couldn’t find an precompiled ARM version of the software, so I compiled it for Raspberry by myself. That and the precompiled deb files from the previous url can be found in this softwedge_0.1-1.tar.gz package I stored under this site.
Problems in using barcode scanners with Raspberry Pi didn’t stop at the lack of compiled Softwedge ARM packages. After testing the scanner with Raspberry, I noticed that the scanner eats a lot of current and the power supply I used at the time wasn’t keeping up with the consumption. The system kept crashing when I tried to scan something. At the time I was using my cellphone chargers as a power source for the Raspi, and apparently my 500 mA charger wasn’t enough for both the scanner and the Raspberry. After changing the power adapter to a 700 mA cellphone charger the system seemed stable and didn’t crash anymore. So keep the power consumption in mind while working with Raspberry Pi.