I've got a bog standard barcode scanner with a USB output and I'm trying to figure out how to connect it to a PIC.
Basically, the idea is that I use the scanner to scan a barcode and the barcode is then passed to the PIC which in turn uses the barcode to do either lock or unlock a solenoid lock (the lock is something I'm going to work on later).
So I've been looking at ways to try and connect the barcode scanner to the PIC with somewhat limited success. So far it seems like one way might be to convert the USB output to an RS232 output and then connect it to the PIC and try to interpret the output but I'm not entirely sure whether that will work, or even how to do it.
So I was wondering if anyone had any ideas on a simple way I could go about connecting the scanner to the PIC please. Is the idea I have so far any good and, if so, are there any good ways to go about doing it? Or is it just needlessly complicated and is there a better way of doing it?
Thanks very much.
Best Answer
You would be better off with a barcode reader with serial or PS/2 interface. Sometimes it is as easy as swapping the cable for a different one to change the interface type, depends on your barcode scanner model.
If you really want to use the USB barcode reader, you need either
Even with these hardware solutions it would still take some effort to implement enumeration, the HID device class and so on.
Outside the scope of your question and probably more expensive than a serial or PS/2 barcode scanner, but there is a precompiled firmware for FTDI's Vinculum chips that bridges an USB HID device to a microcontroller's SPI interface, see USB HID to SPI Master Sample Application ROM.