Barcode Scanner w/ PS/2 to TTL For Electron

This Is my first particle project and im trying to use a barcode scanner (https://www.adafruit.com/product/1202) with a PS/2 connection to scan codes against a database so bear with me :joy: .

I want to use a PS/2 to TTL Converter (https://www.adafruit.com/product/1136) to connect the barcode scanner. I understand that the barcode returns data like a keyboard sequence but most examples online had used a usb connector to an arduino.

I know the general layout of the pins but I’m unsure how the electron would take data from the converter and how exactly It displays TTL.

Has anyone tried to make a similar device or has had any experience with using PS/2 To TTL converters?
As well as if there are any libraries I should look at?

Any kind of advice would be great! :grin:
Thanks!

You probably want to read up on the PS/2 protocol: http://www.burtonsys.com/ps2_chapweske.htm

Each key press is sent as a single byte wrapped in a frame. So you will received 11-12 bits for each key press. I’m not sure if there’s a library to read that in on a GPIO pin. If not, then you will have to poll the GPIO like using a soft serial and figure out each keypress based on that polling.

I’m surprised that Adafruit doesn’t have a library for that.

It looks like that converter module handles the decoding in hardware. You should just get ASCII data out, no decoding necessary. Connect the TX pin on the module to the RX pin on the Photon/Electron and read the data out at 57600 baud or 115200 baud depending on how you set up the other pins.

2 Likes

I have long ago written a PS/2 library to support PS/2 mice to be connected to Particle devices - this should work for keyboard emulation too.
https://build.particle.io/libs/PS2Communication/0.0.7

With that you wouldn’t need the extra converter.

3 Likes

So if i was using the PS/2 port how would i connect it? is there such a way to use the USB male connector or would i have to find a PS/2 connector to my BB