Make a portable barcode scanner with an arduino and a cuecat
Around the turn of the century, there was a company whose business model included giving away free barcode scanners that emulate keyboards. A relatively easy mod to these cuecat scanners removed the encryption and made them suitable for scanning the barcodes on books and the like.

One thing that kept me from ever seriously using it to catalog all my books was the fact that being a keyboard emulator, a cuecat required me to lug a laptop around to read the output. A recent conversation with a friend about the daunting task of inventorying hundreds of books made me think, "wouldn't it be nice to have a smaller device that would would store all the data for later transfer to a computer?"

So I built this device, an arduino and waveshield based box that the cuecat can plug into that will store scanned data on an SD card. The SD card can then be popped out and mounted onto a computer. The scanned data will appear as text files on the card.

For extra fun, it plays a goofy^H^H^H^H^H impressive startup sound to let you know it has successfully been turned on, and meows (it is a cueCAT after all) to let you know when it has successfully read a barcode.



Step 1: What you will need

Make a portable barcode scanner with an arduino and a cuecat
Besides the cueCat, this project consists of a Wave shield from Adafruit industries to provide an SD card reader, an arduino, and a case to hold it together. Any PS2 keyboard emulating barcode reader could be used instead of the cuecat, as long as it is designed to look like a keyboard.

You will need the following tools
  • Soldering iron
  • dremel or other tool to cut and shape the enclosure
  • Diagonal cutters
  • Hot glue gun (optional)
  • Helping Hands to hold the board while soldering (optional, but recommended)
  • Multimeter (mostly for assembling the wave shield)
  • You will need the following parts
  • Solder
  • Hot glue (optional)
  • Heat shrink tubing (optional)
  • Arduino Duemilanove or clone (I'm using the ATMega328 version, don't know if the 168 has enough ram or not)
  • cuecat PS2 version (or other PS2 barcode scanner)
  • Female PS2 connector (only if not using a CueCat or if you don't want to mutilate yours)
  • Wave shield
  • 8 ohm speaker
  • 1GB SD card
  • battery holder
  • batteries
  • enclosure
  • wire (required for Wave shield)
  • Some sound files in .wav format
  • While ordering the wave shield kit from from Adafruit industries, I also ordered the Arduino and the SD card from them for convenience. If this is your first time using an arduino, there are some nifty starter kits there to get you started on other fun projects. This project is designed to allow you to remove the arduino for use elsewhere when not used in the scanner.

    The speaker came from radio shack (part #273-092) but an 8 ohm speaker salvaged from a toy would probably work as well if not better. The battery holder I had lying around, but also probably came from radio shack.

    As detailed later, the female PS2 connector was cut off the cuecat itself.

    While I started this project with the intent of "let's use that old CueCat" I couldn't actually find mine, so I bought a "new" one off of ebay. When purchasing one, it is extremely important that you get one of the original PS2 models. Some of the ones for sale at places like library thing are USB and those WILL NOT WORK with this project.

    For the enclosure I used a box from pactec, model PS36-150, which fit everything nicely with only a few modifications.

    Step 2: Assemble the waveshield

    Make a portable barcode scanner with an arduino and a cuecat
    I can't hope do a better job of explaining how to put the wave shield kit together than the official instructions. In subsequent steps I'll be describing a few simple modifications to wave shield but first we need a working wave shield. As advertised, this kit is pretty easy to put together, even for a beginner. If this is your first such kit, be sure to follow the "learn to solder" tutorials at the beginning of the instructions.

    The only additional comment I have to add to the assembly instructions is that when I put mine together, I chose to solder the jumper wires UNDERNEATH the board, not on top. This was mostly because I wasn't sure how much clearance on top I would need, and I thought it looked slightly neater. This change is completely optional.

    After assembling the wave shield, you should be able to connect it to the arduino, plug in some speakers or headphones, load one of the sample apps onto the arduino and any required sounds on the SD card, and verify you can play sounds with your arduino.

    Do this first to make sure everything works before moving on to modify the shield.

    Step 3: Acquire Female PS2 connector

    Make a portable barcode scanner with an arduino and a cuecat
    Designed to be plugged in between a keyboard and a computer, a CueCat has a female PS2 connector to plug a keyboard into. Since I needed something to break out the PS2 connections to and didn't want to sacrifice an keyboard extension cable (even if I did have one), I cut this off of my CueCat. This was fine because I don't plan to ever plug this cuecat into anything else again.

    Alternately, I could have just cut both heads off and wired it directly to the arduino, but having a separate connector is neater and means that I only have to provide enough strain relief to protect against a tug too weak to unplug the cuecat. i.e. if I drop the box, the CueCat will just become unplugged, not tear out the guts of the box.

    If you are using some other PS2 scanner or just don't want to cut the tail of your CueCat, you will need to find female connector that you can break out into separate wires. The easiest thing would probably be to get a keyboard extension cable and cut the end off you need.

    Step 4: Wire PS2 connector to wave shield

    Make a portable barcode scanner with an arduino and a cuecat
    Make a portable barcode scanner with an arduino and a cuecat
    On of the many nice features of the wave shield is that it provides copies of all the arduino pins (even those not used by it) in a row right next to the connectors. This provides a way to add other connections to the arduino through the shield.

    When connecting to the breakout pins on the wave shield, really I was wiring the PS2 connector to the arduino, but by making the connection to the wave shield and letting it pass the connections to the arduino, it becomes easier to remove the arduino for other things. By making all the connections in this way, this project allows the arduino to just pop out whenever desired.

    PS2 connectors have 6 pins, but only 4 of them are used for keyboard connections. A multimeter is handy to figure out which wire goes with each pin. After stripping a couple of inches of insulation off of the connector, I noted which color wire went to which pin on the connector.

    Pin 3 on the PS2 connector is the ground wire which should go to the GND pin on the shield. Pin 4 should be connected to the "+5V" connector right by the GND.

    Pins 1 and 5 are serial data and clock pins (more about that in the software step) and need to be connected to a digital I/O from the arduino. Since the digital I/O pins are on the other side of the board, the cable would have to be split apart by several inches which I was loath to do.

    The pins labeled "analog" are right by the ground and power pins and are much more convenient. Fortunately, despite their names, the analog pins can be used as additional digital pins. In addition to their standard names the analog pins can be referred to as digital pins 14-19. I.e. Analog 0 is Digital I/O 14, Analog 1 is Digital I/O 15.

    I wired the data pin (PS2 pin 1) to Analog 0 (I/O 14) and the clock pin (PS2 pin 5) to Analog 1 (I/O 15).

    Because all the connections are all together, I was able to wrap the whole thing up with some heat shrink tubing. To provide strain relief, I like to put a bit of hot glue on the connections. Before I did this, I used my multimeter to make sure that this glue is not a conductor of electricity. This makes for an uglier (unless you are hiding a even uglier solder job) board, but helps on wear and tear on the connection. Since I occasionally remove the arduino, the wires get moved around some and the strain relief helps insure that the wires don't break off.

    Step 5: Wire battery to thumb wheel

    Make a portable barcode scanner with an arduino and a cuecat
    Make a portable barcode scanner with an arduino and a cuecat
    During testing and programming the arduino gets its power from the USB cable, but to make it portable we need to add batteries.

    The aduino has a separate power input suitable to run off of battery power. Like I did with the PS2 connectors, I made the connections on the wave shield, in order to make it easier to remove the arduino.

    The project also needs an on/off switch, which a cool undocumented* feature of the wave shield provides. The thumb wheel that controls the volume also has a "stop" that will click off when you turn it all the way down. A separate electrical connection is made between two pins when the wheel is not in that positions, and the wave shield has those connections broken out; perfect to complete the circuit from the batteries to the arduino.

    I used four AA batteries to provide 6 volts to the arduino, interrupted by the thumbwheel switch on the ground line.

    The positive wire from the batteries is wired to the "VIN" pin on the wave shield, which connects directly to the corresponding pin on the arduino.

    The negative (ground) wire is connected to the "SW" pin on the wave shield. This pin is right above the reset switch and below the 5th and 6th Digital IO pins. To provide strain relief I put a drop of hot glue.

    Now to turn the scanner off, one has to just turn the volume down until it clicks.


    * It's not really undocumented, it's labeled in the schematics, I just didn't notice this until after I figured it out on my own.

    Step 6: Wire speaker

    Make a portable barcode scanner with an arduino and a cuecat
    In addition to the headphone jack, the wave shield has places to directly solder a speaker. These are the unlabeled pads right between the jack and IC3, directly below the capacitor labeled C9.

    It doesn't matter which wire goes where, just wire the two speaker wires to these two pads in either order.


    Step 7: Declaw CueCat

    Make a portable barcode scanner with an arduino and a cuecat
    Make a portable barcode scanner with an arduino and a cuecat
    If you are using some other PS2 barcode scanner, you can skip this step.

    Out of the box, the CueCat outputs encrypted data. The algorithm for decrypting this data is well known so I originally attempted to take the data from the cuecat and decrypt it in software. This should have been easy but I ran into some problems with unexpected (non printing) characters showing up in the data stream. No doubt a more robust keyboard input implementation than the simple routine I was using would have properly filtered them out, but I grew frustrated and said to myself, "There is ZERO chance that I would actually ever need to have the encrypted version."

    So I set out to "declaw" my cat.

    A problem I ran into is that there were a number of different models of cuecat, each with a different modification that needs to be made. Googleing "declaw cuecat" returned lots of pages, but none of them were appropriate. I finally searched for the model number printed on the board and found that searching for "k023a016 cuecat" took me to a page that described a pin that needed to be cut for my particular CueCat.

    http://digilander.libero.it/electrons/CueKitty/68-1965.html

    The moral of this story is don't go chopping up your CueCat based on this picture alone, make sure you research your particular CueCat model.

    Once I cut this pin with the tip of a knife, my cuecat started returning nice little strings of numbers that corresponded to the barcodes, instead of the gobledygook it was returning before.


    Step 8: Copy sound files to SD card

    Make a portable barcode scanner with an arduino and a cuecat
    I originally used the wave shield in this project simply because I wanted the ability to write to an SD card. Since the wave shield uses an SD card to store the sounds it plays, I (correctly) assumed I could hack it to write files too.

    But after I got into the project, I started to think "what a shame to waste the ability to play sounds" and "gee, it would be nice to know when it's finished initializing everything or successfully scanned something".

    So I mixed up an over-the-top startup sound using audacity and saved it to the sd card from a computer. I also saved a few samples of cat meowing to use as "beeps" to play after a successful scan. All these files are just copied on to the fat formatted SD card with no directories (to simplify access). Any card formatted as described on the wave shield site should work. The code I wrote uses an array to store the names of the "beep" sounds and chooses one of them at random.

    Step 9: Compile and upload software

    Make a portable barcode scanner with an arduino and a cuecat
    The code I wrote to drive this thing came from three sources.

    This page at the Arduino playground provided a stub that I based the routines to read the scanner output on. The code to play the sounds relies on the waverp library and the code to write to the SD card uses the sdfatlib library.

    Compiling and uploading the sketch (code) to the arduino is beyond the scope of this instructable. The instructions on the arduino page are pretty comprehensive.

    You will need to install the two libraries into your arduino environment and then compile the cuecatlog.pde sketch.

    Edit the line that defines the beeps to list the beep files you have put on the card.

    char* beeps[] = {"meow01.wav","meow10.wav","meow11.wav"};

    Upload the compiled sketch and you should be able to test scanning. You will know it is ready to scan when you hear your startup sound complete, and a successful scan should play one of your beeps.

    While plugged into the usb cable to upload the sketch, you can also see debugging messages from the scanner in the arduino IDE serial monitor window. The software will print vaguely informative messages as it does its various tasks.

    Every time the device starts up it checks to see if there are any files named "BARLOGXX.TXT" where XX is a number between 00 and 99. If it doesn't find any, it creates "BARLOG00.TXT". Once it finds that list or creates the first file, it check the last one to see if it has any data. If the file is NOT empty, it creates a new one, using the next available number. If the file is empty, it opens it to write data to. This behavior keeps it from creating lots of extra empty files if you turn the unit on and off without scanning anything.

    Make a portable barcode scanner with an arduino and a cuecat
    cucatlog.zip253 KB

    Step 10: Modify enclosure and mount

    Make a portable barcode scanner with an arduino and a cuecat
    Make a portable barcode scanner with an arduino and a cuecat
    Make a portable barcode scanner with an arduino and a cuecat
    Make a portable barcode scanner with an arduino and a cuecat
    Make a portable barcode scanner with an arduino and a cuecat
    Make a portable barcode scanner with an arduino and a cuecat
    The box I was using (a model PS36-150 from pactec) ALMOST fit everything, but required a few modifications. Obviously, you can use any enclosure big enough to hold everything, you just need to be able to make whatever changes to fit (and support) everything, and to allow access to the cable and the thumbwheel.

    This box has a post to allow the box to be screwed together in the center. The snaps on the side hold the box together just fine and the post was in my way, so I cut it off with a cutting wheel on my dremel. I then glued that post down to the side and bottom after I noticed that it was the perfect size to brace the arduino from sliding sideways.

    I also glued the battery pack down to the bottom.

    The post and battery pack, combined with the little rubber feet that Adafruit provides with their arduinos, hold the whole thing tightly in place when the lid is on; it doesn't rattle around at all.

    To mount the speaker, I drilled three small holes into the side and glued the speaker over them, in such a way that the lid still shut.

    I cut a notch in one side for the PS2 connector with the dremel and slid the cable in. A nice grommet here would probably make it look more professional, but friction seems to do the job of keeping it in place.

    Finally, using a pen I marked the inside of the lid at the spot where it was blocking the thumbwheel and used the dremel to carve out a slot for the thumbwheel to protrude. It's not pretty in the closeup, but seen from above it looks fine and has a satisfying feel under the thumb.

    Step 11: Use it

    Make a portable barcode scanner with an arduino and a cuecat
    To use the scanner you just turn it on, scan all your barcodes, and then turn it off when you are done. When ready to use the data, you can remove the card and mount it on a computer. Each scanning session will appear as a different file, numbered in the order they were made. Inside each text file will be the decoded bar codes, one per line.

    If you are scanning books, the contents of the text files can be imported at the library thing to quickly update your catalog.

    There are a number of enhancements and variations that could be made to this project for other uses.

    * Any ps2 keyboard could be plugged in store other data (if you don't mind not seeing what you are typing)
    * The software could be changed to speak each of the read digits instead of just playing a beep sound.
    * It could configured to play specific sounds in response to certain inputs, perhaps for some sort of game or treasure hunt.
    * the headphone jack could extended out to the enclosure, so headphones or external speakers could be used instead of the built in one.
    * Removing the SD card requires opening the device. A different case design could expose the SD card slot to allow it to be removed without opening the box.

     
     

    Tag cloud

    make build easy simple arduino making homemade solar laser printed portable cheap mini building custom cardboard wooden create super lego turn paracord chocolate your paper light intel