Shop OBEX P1 Docs P2 Docs Learn Events
Barcode scanner (USB) to BS2 — Parallax Forums

Barcode scanner (USB) to BS2

Hi,

Is it possible to connect a USB barcode scanner or USB VFD cashier pole display to BS2?
I am asking this as it is hard to find RS232 interface for such devices nowadays.
Has anyone done this before?

Regards,
Bronson

Comments

  • You can't directly connect a USB device to a BS2. The BS2 is not capable of acting as a USB host. Depending on the USB device, you might be able to use a Parallax Memory Stick Datalogger as the USB host and control that with the BS2. A USB device that uses a serial or HID (Human Interface Device) connection would work. A barcode scanner is likely to do so, but you'll have to do some experimenting to find out which internal register is which and what settings to use.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-11-25 05:17
    I've purchased several different HID barcode scanners and both models I purchased could be converted to serial devices by scanning a configuration barcode in the manual.

    I couldn't use the cable that came with the scanner but it was relatively easy to make one with an Ethernet cable. Here's some information on this subject.

    Once converted, the barcode scanner output a TTL serial signal at whatever baud I had configured it.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-11-25 09:15
    Ummm. that BarCode scanner just might be a PS2 interfacing device with a USB plug on it.

    Since the Propeller does PS2 keyboards and mice, it may also to a PS2 barcode scanner. I have wanted to try it for ages, but never got around to commiting to the cost of a barcode scanner. Even the PS2 compatible ones used to be not cheap.

    That seems to have changed.. $20-30.00 USD
    http://www.ebay.com/bhp/ps2-barcode-scanner

    Just be careful about the PS2 SPI interface. It is not 8bit. As I recall it is 12 bit in one direction and 13bit in the other. Parallax OBEX code for mouse and keyboard may need to be modified to get what you need.

    In theory, you could use a Propeller to provide an adapter to RS232.
  • This one looks like it should have a TTL output.

    You can see how the USB cable has a USB connector on one end, and (what looks like) a RJ45 connector on the other end.

    The cable which comes with the scanner doesn't have connections in the right location so you can't modify the cable included to work with the Basic Stamp. You can adapt an Ethernet cable to work with the scanner. I added a servo connector to one end of a Ethernet cable and I use the scanner with a Prop. The two I've used both output a 5V TTL normal serial protocol.

    The first scanner I modified to use as a serial device was this one from SparkFun. I purchased a $30 scanner from ebay and the same conversion trick worked on it. The inexpensive scanner performs better than the more expensive one.

    There are directions how to made the serial cable in the comments of the SparkFun scanner. Just look for my comments (ddegn).
  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-11-25 16:36
    Here's a link to the manual of the SparkFun scanner (warning large pdf). In the manual you'll find barcodes to change the scanner's mode. These same barcodes worked on the scanner I purchased from ebay.

    The manual does not provide any clues on how to actually use the scanner in serial mode but opened up one of my scanners and found the pin which outputs the serial signal. Apparently flow control is possible but I didn't try to find the flow control pin(s). I just scanned the "no flow control" barcode in the manual.
  • Duane Degn wrote: »
    I just scanned the "no flow control" barcode in the manual.

    Does this mean that if I go to a store and trick the cashier into scanning the right barcode, or scan it myself at a self-checkout lane, I can break/misconfigure their barcode scanner? Or do you have to put it into a special configuration mode first?

  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-11-25 19:56
    Does this mean that if I go to a store and trick the cashier into scanning the right barcode, or scan it myself at a self-checkout lane, I can break/misconfigure their barcode scanner? Or do you have to put it into a special configuration mode first?

    There's wasn't any sort of configuration mode. I don't know what sort of precautions retailers take but the barcode readers I used were not identical to the ones used at most stores.

    I'd keep a few barcode closeby as I worked. I would often turn the beeper off or on and I also set the scanner to "continuous" or "twinkle" modes. "Twinkle" mode was almost as convenient as "continuous" mode but it used much less power.

    Here are some of my frequently used modes.

    BarcodeModes.PNG

    I could print barcodes with a Brother label printer. Adding barcodes to my vials and bottles made my chemistry lab much more efficient. My balances and spectrometer had serial output so I could scan barcodes and press "record" buttons on the equipment and get a nice digital record (saved to a SD card) of the various tests I was working on.

    Barcodes and the Propeller where huge time savers.
    515 x 613 - 154K
  • Check out LS1220 Scan Engines as they are RS232 based and easy to use. I have a few of them myself. They are on eBay frequently for anywhere from $25 to $150 depending on condition. I would recommend this one for $40 that has a cable, stand, and power supply (that's a sweet deal):
    http://www.ebay.com/itm/SYMBOL-LS-1220-I300A-BARCODE-SCANNER/201456534354

    Here's a link to the LS1220 product page:
    http://www.symbol.com/product.php?productID=279&tab=Data Sheet

    279_LS1220MS.jpg
  • Wow! Many responses.
    Thanks for all the inputs.
    I will try the memory stick Datalogger first.

    Bronson
  • ColeyColey Posts: 1,108
    Or you could use one of these.....

    I've used them loads of times, they work great.

    hobbytronics.co.uk/usb-host-keyboard

    usb-host-board-23-500x500.jpg
  • Coley wrote: »
    Or you could use one of these.....

    I've used them loads of times, they work great.

    hobbytronics.co.uk/usb-host-keyboard

    usb-host-board-23-500x500.jpg

    Coley,

    Thanks for the info.
    Have you ever used it for barcode scanner or pole display?

    Bronson

  • ColeyColey Posts: 1,108
    edited 2015-11-27 01:14
    I use it with Motorola 3307 scan engine which enumerates as a HID keyboard. It converts the key codes into ASCII and transmits over serial. It's in an application that combines a Propeller too. The host board is a 16 bit PIC.
Sign In or Register to comment.