Interfacing a PS2 barcode scanner with Arduino

Hey everyone,

To introduce myself, I'm new to Arduino, haven't gotten myself a kit yet but I'm very interested in it!

I was thinking about building a project that is able to scan and verify barcodes.
Let's say I have got a list of decoded barcode strings saved in a .txt file on a FAT formatted SD card, like this:

code1
code2
code3

Now lets say the barcode scanner scanned a barcode that decodes to the string "code1", it would be sent to Arduino and compared to the contents of the .txt file. If it exists, a green LED turns on and deletes the line so I know it's been scanned. If it doesn't a red LED turns on to indicate the barcode is unknown.

Now I've looked at:
http://www.arduino.cc/playground/Main/PS2Keyboard
(Remove spaces)
From there I should be able to catch the data sent by the scanner.

Using this:
http://www.ladyada.net/make/waveshield/
(Remove spaces)
I should be able to read from a SD card.

The only problem is that I'm not familiar with the Arduino coding language AT ALL. So I was just wondering, would this project be possible using Arduino?

Thanks!

First, you've made your first post. Now, you can modify it. Fix the links so that they actually work.

Second, tell us more about this barcode scanner. How would the barcode information get sent to the Arduino?

How would new scanned data get added to the card?

Would this be possible? Depends on the barcode scanner. Sounds like fun, though.

Yes, this project is certainly possible using Arduino.

As PaulS says, it depends on what kind of barcode scanner you have. If you have one with a PS/2 connector, you are ready to use the PS/2 keyboard library that you already found. If your scanner has a USB connector, you will likely want to get an adapter like the one at http://sewelldirect.com/USB-to-PS2-Adapter.asp to convert it to PS/2 format.

In either case, my experience with the CueCat and with the Arduino PS/2 keyboard library (but not both at the same time ... hmmm ... yet!) shows that the scans will come in to the Arduino as if their corresponding codes were typed on a PS/2 keyboard.

I predict a very high probability of success with this project once you learn how to code for the Arduino. Start with the simple examples at http://arduino.cc/en/Tutorial/HomePage and work your way in to it. The fact that you already found two relevant components, and understand that combining them is the way to go, is testament to your ability to make this happen!

[edit]Adafruit also has a somewhat simpler data logging shield that may be more appropriate for you. I have no experience with it myself, but I presume you can read from it as well as write to it.[/edit]

Thanks for your quick reply guys!

@PaulS
Sorry, since I'm new to the forum I'm not allowed to post links yet so I added some spaces between the characters.

@TBAr
Thanks for the useful for info and positive reply! I have looked at the data logging shield and it looks promising! I'm not sure about the USB to PS2 connector though, I somewhere read that's not possible but I'll have to research that again. Probably just easier if I get a PS2 one.

So basically what I'm going to buy is:

  • Arduino Duemilanove ATmega168
  • USB 2.0 cable to connect Arduino to my PC
  • Adafruit Data logging shield v1.0
  • PS2 barcode scanner
  • Battery holder for 5.0V (Right?) power supply, powers both Arduino and barcode scanner
  • Lots of spare time to practice and make this work

That's all, right? If so I'll order them soon and experiment.

Oh and does anyone know whether Adafruit ships worldwide? I tried to find it on their website but couldn't find it without registering and going through the whole checkout process.

Thanks!

@PaulS
Sorry, since I'm new to the forum I'm not allowed to post links yet so I added some spaces between the characters.

I know that you are new to the forum. But, go back and look at your post. See that link that says modify?

Click it, and edit the first post to make the links valid. That way, anyone that wants to help doesn't have to cut and paste and edit the pasted data before hitting enter.

You are then more likely to get help.

would this project be possible using Arduino?

Yes.

So basically what I'm going to buy is:

  • Arduino Duemilanove ATmega168
  • USB 2.0 cable to connect Arduino to my PC
  • Adafruit Data logging shield v1.0
  • PS2 barcode scanner
  • Battery holder for 5.0V (Right?) power supply, powers both Arduino and barcode scanner
  • Lots of spare time to practice and make this work

I recommend an Arduino Duemilanove with ATmega328, not the 168 version. The SD shield library is on the large side to begin with, so you'll appreciate having the extra space for your own code.

Note that Adafruit's data logging shield does not come with an SD card. Like the USB cable, you may already have one that you can use.

You'll also need more than 5.0V of battery supply. I have driven a PS/2 keyboard with a 9V battery through the Arduino's 5V regulator, but it's only useful for development, since the battery won't last long with real use.

Adafruit ships worldwide, no problem with that. There is an "estimate shipping" button on the shopping cart page without registering or checking out.

Let me know where you end up buying your last item. I'm looking for some of that myself. :wink:

  • Lots of spare time to practice and make this work

Let me know where you end up buying your last item. I'm looking for some of that myself.

That's readily available - but prohibitively expensive.

@PaulS
Done

@Mowcius
Thanks.

@TBAr
Thanks for the advice! In that case, I will definitely get a ATmega328 instead of 168.
You're right, forgot about the SD card gotta get one of those too, won't require that much space though.
As a power supply I suppose I could temporarily use an AA battery pack but I'll have to find something which last longer at some point. Do you have any idea how long I can both run the Arduino and PS2 barcode scanner for using a simple AA battery pack?

Adafruit charges me almost $10,- for shipping, don't have much of a choice here so I'll have to go for that! Thanks btw, found the button...

And PaulS has pretty much already answered your last question :stuck_out_tongue:

Thanks guys going to order my parts soon and will keep you up to date

Ok, go for it.

Remember that the recommended input voltage through the barrel connector jack is 7-12V and get enough of a battery pack to support that.

Keep us posted in the forum with your progress. We love to see applications.