SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By Duane Degn
#138834
I have some notes on how to use SparkFun's Barcode Scanner USB (SEN-09166)with a microcontroller in the comments section of the product page. I thought it would be easier to answer questions about using the scanner here in the forum instead of within the commnets.

Here's a link to the product page: http://www.sparkfun.com/products/9166

Here's what I've written about it so far:
This barcode reader can also transmit data using a serial connection. I just got this to work with a microcontroller. I used a Category 5 cable to plug into the reader. Power (5V) is pin 6 (of the 8P8C modular plug). Ground is pin 3 and the data line is pin 8. I turned the handshaking off so I didn’t need any other wires. There might be CTS and RTS wires as well. This is great. I’m going to put barcodes on everything.
Don’t modify the cable that comes with the barcode reader to use it as a serial cable. The cable it comes with doesn’t have enough wires (or at least not in the right place) for a serial connection. Use an eight wire Cat5 cable. The reader needs to be configured with the barcodes in the manual to switch to serial mode.
Using barcodes with my work is going to save me a lot of time.
I was correct, this barcode scanner has saved me a lot of time. It has completely changed the way I run my chemistry lab. All my vials and bottles have barcodes on them so I can scan the two containers when I'm transfering from one container to another.

There was a recent question in the comments from "member#261580":
You said you are using pin 8 for the data line with UART output correct? I am not receiving serial on that line, but rather pin 2. Is the serial output from that line in LSB first or MSB first and is it inverted or not? Also, does the serial start with the first part of what is read by the barcode scanner or do you get a bunch of nonsense data first?
I used the pin numbering found here:
http://en.wikipedia.org/wiki/TIA/EIA-568#Wiring

The data pin will change after scanning the "SERIAL MODE" barcode on page 10 of the manual. I also used the following barcodes on page 13 "SERIAL HANDSHAKE-NONE" and "SERIAL BAUD RATE-9600(DEFAULT)"

I found a less expensive barcode reader on eBay that will work with the same modifications.
http://www.ebay.com/itm/ws/eBayISAPI.dl ... OU:US:1123

The eBay reader doesn't look as nice as SF's but it is faster at reading barcodes. The connector at the bottom where I plug the Cat5 cable is rotated 180 degrees from the orientation of the socket on the SF reader. This shouldn't matter unless you're trying to add a battery/transmitter module to the bottom of the reader (like I am) and you're using the connector to help hold the module in place.

I'm using this reader with a Parallax Propeller microcontroller. Since the Propeller is a 3.3V device I use a 10K Ohm resisitor in series with the scanner's data line.

I'm adding a link to this thread in the scanner's comment section.
By Duane Degn
#138844
It looks like member#261580 figured out his problem because the comment has been edited to:
Works nicely on a microcontroller!
This comment was a reply to my comment:
You can use this with a microcontroller. You do need to make a different cable. A Cat5 cable works fine. You also need to configure the barcode scanner with the “Serial Mode” barcode on the bottom of page 10 in the User’s Manual. I also used “Serial Handshake-None” on page 13 (so I didn’t have to figure out which pins to use for flow control). There are also barcodes to set the baud rate on page 13. An earlier comment of mine lists the pins of a Cat5 connector to use with a microcontroller. Since the barcode scanner uses TTL to communicate you may need a series resistor on the data line if you’re using a 3.3V microcontroller. I’m using a 10K ohm resistor with my Propeller chips.
I wont quote all the questions and replies given in the comment section here so it would be a good idea to read the comment section if you're thinking about purchasing one of these barcode readers.

If anyone has other questions about using the barcode reader with a microcontroller, I'd prefer to answer them here in the forum.

I keep an index of some of my electronics and robot projects here (post #2 lists my projects):
http://forums.parallax.com/showthread.p ... Index-Test
A lot of the projects use SparkFun parts but since I use the Propeller microcontroller, I generally "hang out" at Parallax's forum more than SparkFun's.