13 September, 2014

BarCode Scanner + Arduino USB Shield

By Mauricio Hidalgo

In the world industry , a lot of products are identified by barcodes, is one of the most effective methods to identify products, papers, stickers, among many other things, is for this reason that implementing a system for reading bar codes independent of a computer allows greater flexibility to these devices, is why I wanted to bring this little test that will allow many projects related to barcodes, be more flexible and portable.

 

Developing an Arduino project with BarCode Scanner + Arduino USB Shield

In this test I used the code that kindly shows us Olegon Mazurov on their website www.circuitsathome.com  and I have made some modifications, because it did not work well for my barcode scanner “Datalogic QuickScan” and I have not found more information on the web about the use of barcode readers with the USB port connected to a separate host as USB Host Shield of Arduino.

I implemented the following circuit:

The following is the code from Oleg Mazurov with the modifications that I have made to work with my barcode scanner and other different  bar codes scanners:

Bar Code Scanner + Arduino Host Shield code

It is necessary to consider the recommendation of Oleg Mazurov in verifying the parameters of our device, which identify the CLASS and communication PROTOCOL as follows:

Intf. Class:            03
Intf. Subclass:         01
Intf. Protocol:         01

If your code reader does not match the above information after verification, is posible that you may not implement the code that we work here, so is important to check with your example of USB Host Shield 2.0 library called “USB_desc”.

For the USB_desc example appears in the example menu, you must first attach the USB Host Shield 2.0 library in the libraries folder of Arduino software.

Basically what Oleghe Mazurov did in his code was to take the communication code of a USB keyboard, he make some modifications to the barcode reader and adding LCD control code. The example to control USB keyboard also find it on the USB Host Shield library 2.0 with the name “USBHIDBootKbd”.

The following video is a step by step of the changes that I have made in the code of Oleg Mazurov and description of the operation of barcode scanner .

The following are links related to this video:

Barcode Scaner + USB Host Shield Code

 libreria USB Host Shield 2.0

I hope that this article will be very useful for your future projects and if you liked it please share it.