Introduction: 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

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
  1. Solder
  2. Hot glue (optional)
  3. Heat shrink tubing (optional)
  4. Arduino Duemilanove or clone (I'm using the ATMega328 version, don't know if the 168 has enough ram or not)
  5. cuecat PS2 version (or other PS2 barcode scanner)
  6. Female PS2 connector (only if not using a CueCat or if you don't want to mutilate yours)
  7. Wave shield
  8. 8 ohm speaker
  9. 1GB SD card
  10. battery holder
  11. batteries
  12. enclosure
  13. wire (required for Wave shield)
  14. 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

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

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

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

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

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

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.

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

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

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.

Step 10: Modify Enclosure and Mount

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

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.


NishantV7 made it!(author)2016-01-18

This side nishant vakil from chattisgarh a state in india i really appreciate the projection of yours about these machine and as u know ,India by ways is encouraging corruption so being a responsible citizen and an entrepreneur i would like to provide these barcode machines to as much indians as i can and that is too without pushing them for affordable costs..if u have any suggestions or can help me out with these upcoming project then it would be my pleasure.plz feel free to drop your valuable recommendations at

cobourgdave made it!(author)2013-09-29

Really great job! I liked your approach of merging devices to get to the design target. Nice intro to bar codes. Especially liked you mods, clean, simple and more than just ingenious. I second your use of Google or ...whatever, to research the device using serial numbers as well as model numbers. Manufacturing changes are frequent during the life of a product, making mods a crap shoot without these checks.

mkanoap made it!(author)2013-09-30


jones111 made it!(author)2013-08-14

here, I just leaned something about several kinds of barcode scanners . just share with you, I hope you will like it.

geraldkrug made it!(author)2011-08-04

This is such a great thing you made.
Here is a blue tooth device that may work for you...

Please let me know if the blue tooth could work with your device.

I have a barcode database online now and the cuecat would be so cool to
get people to use barcodes.

TheWanderer made it!(author)2010-12-05

I was wondering, is there a way to make it play a specific noise for a specific bar code?

mkanoap made it!(author)2010-12-06


The code stores incoming characters into a buffer. When it receives an "enter" character it saves the buffer to the disk, clears the buffer, and then plays a random sound.

It wouldn't be too hard to include a check before the "clear the buffer" step to compare the string with whatever code you wanted to trigger the sound. I was kind of thinking of printing a few barcodes on the box and doing just that.

The limiting factor would be the memory on the arduino. If you were storing the strings to compare it with in the code and you had a lot of them, you would eat up program memory pretty fast. One way around that might be to save sounds with the name of the number to compare against and do something like:

if (play.sound (buffer+".wav") then
# horray, it worked
# play random beep because the play sound routine returned an error

(that is not a real code example)

yoyology made it!(author)2010-05-10

I wonder. Would it be possible to make a CueCat look like a bluetooth keyboard?  Then you could scan anything within 10 meters and the numbers would appear on your computer as if typed. No need for the SD card (as long as everything's happening inside your home).

What I'd love would be if I could get a CueCat to communicate with my BlackBerry.  That's what I use to keep track of my reading, and scanning would make it much quicker.

Plus, I could call it a BlackCat.  How could that not be cool?  :-)

mkanoap made it!(author)2010-05-11

I have no experience with them, but there are bluetooth arduinos.  They are not cheap, but are slightly less then bluetooth scanners.

Since the code I have prints the number to the serial port in addition to writing it to the card, it wouldn't have to be modified much to work in the way you describe.  The trickiest part would be getting the blackberry to store the output of the serial BT connection.

Since in this config you wouldn't even need the SD card, you could omit the wave shield entirely and cut out all the parts of the code that refer to it.  The only downside is you would lose the ridiculous sound feedback.

gradof6b made it!(author)2010-02-10

I don't get it. So you scan the book and it tells you what it is, but what if you lend it to someone and scan it again does it just take it back out of the list?

mkanoap made it!(author)2010-02-10

My device is not doing any of the lookups itself.

All this thing is doing is storing the numbers on a text file for use with other things.  I'm using the numbers stored to build a catalog of books using the library thing service ( which will look up the numbers to find out what books go with them.  But you could use the data in other ways.

Normally, you add your books to library thing one at a time, but if you happen to have a text file with a couple of hundred ISBN numbers it, it will import them all at once.

gmoon made it!(author)2010-02-10

Ah, neat stuff!

I have two cuecats myself--one "declawed" (ha) and one "stock," as a backup. They are an excellent (and cheap) way to get into barcoding.

FYI for other builders: It should be noted that there are USB cuecats, too, which wouldn't work with this project...

mkanoap made it!(author)2010-02-10

Thanks!  I had been meaning to use mine for 10 years now, but was put off by the logistics of carrying a laptop around my library.  But I always thought it was cool.

I talked about not using a USB model at the bottom of the requirements page, but you are right, that's not obvious enough.  I'll edit to make it a little more plain.

mkanoap made it!(author)2010-02-10

I wonder if couldn't be used to make USB version.

It's not obvious to me which arduino pins it is using, so I'm not sure if it could be stacked with a wave shield.

gmoon made it!(author)2010-02-10

Yeah--who knows?

I'm not sure anyone's reverse engineered the USB version (the driver / software part.) But I know next-to-nothing about the USB cuecats...

skifter22 made it!(author)2010-02-10

Cool project!

FYI - I did a quick Google Search for "Female PS2 Connector" and turned up a variety of sources, among them:

10 pack for $8 - not bad!

mkanoap made it!(author)2010-02-10

Nice.    I'm not sure what I would do with the other 9, probably make one that accepted input from 5 or 6 different inputs at once. :)

It looks like that connector might be mounted directly in your enclosure (space permitting) allowing it to be a little sleeker without the protruding tail.

skifter22 made it!(author)2010-02-10

Given my luck with fine soldering I'd prolly need at least 4 or 5 to burn up before I got one right... LOL

Also found these with a bit more digging:


Should make chassis mounting on the enclosure purely academic...


About This Instructable




Bio: He's just this guy, you know?
More by mkanoap:Create an electronic puzzle boxGrowing up with halloweenBuild an electronic polyhedral die
Add instructable to: