Getting data from barcode scanner with PS/2 connection

Hello,

The past few days I’ve been trying to connect a barcode scanner with my Arduino Uno, but I have failed.
I connect the barcode scanner to my Arduino using a USB to PS/2 adaptor.
I tried three different codes to get the barcodes read from the barcode scanner but none of them worked.
1st: Using PS2Keyboard library and connecting the Datapin to pin 3 and Clockpin to pin 2 (the pins stay the same for the rest)
2nd: I followed a tutorial from instructibles .
3rd: Using the example from arduino playground.

2 and 3 are basically the same but anyway.

To make sure the adaptor is working (or at least the code) I tested it with a keyboard (using the PS2Keyboard library). Actually, two keyboards. With the first one I couldn’t get any input, but with the second one, which was a microsoft keyboard, worked perfectly (don’t know why though).

I cannot provide any links for the barcode scanner because I can only find it from e-shops from my country (non-englsih). It has a manual with some barcodes-options and it has Transmission Modes for USB mode (USBHID) and PS/2 mode.

When I connect the barcode scanner via a USB port with my PC it works perfectly. Haven’t tested it with a PS/2 on my PC though.

So, anyone knows what may be the problem?
Of course I have searched the forums but found nothing to help me.

Thank you in advance.

I connect the barcode scanner to my Arduino using a USB to PS/2 adaptor.

That probably don't work. Please provide a link to that adaptor, most I know work just for mice or keyboards but USB has a lot more device types. Also provide a link to the scanner you're using because there are a lot of different ways to connect such a scanner to the USB interface.

pylon: That probably don't work. Please provide a link to that adaptor, most I know work just for mice or keyboards but USB has a lot more device types. Also provide a link to the scanner you're using because there are a lot of different ways to connect such a scanner to the USB interface.

Here is the link for the adaptor. As I mentioned earlier I can't provide the link for it as it will not be in english and google.translate can't translate it because it can't retrieve it over a secure connection. I'll provide the information of the barcode from the link here: USB Barcode Scanner NI–lcb960

  • Code type 1D
  • CCD type
  • Plug n Play

A comment from the tutorial I provided shows that it was done using a PS/2 adaptor.

I am not surprised you cannot get it to work. It won't. If the bar code reader is really PS/2 interface, it connects directly to the Arduino. But you also need to supply the PS/2 device with 5 volts DC. Look at PS/2 specs.

I have a device using a PS/2 keyboard and the libraries you are using and the pins you are using and it works just fine.

Paul

What do you want to achieve with your project? Is the usage of an ARM platform as the Raspberry Pi an option? If yes, it's much easier to use the USB based scanner as it's probably recognized immediately and available as a standard input device.