RS-232 Serial to USB Keyboard Inputs

I need to build a cable adapter that will take an RS-232 serial input and convert it to an HID keyboard output.

Our local library has updated their software, but want's to keep using their old scanning kiosks. Their new software uses barcode readers that emulate a USB keyboard and just dump text into a field in the software. Their old system uses an RS-232 serial link that spits out the code at 1200 baud to a comm port that was monitored by the old software. Both of these are one-way data only from the scanner to the computer. I have decoded both signals and they are essentially the same, just the scanned data followed by CR and LF (Carriage return and Line Feed).

A normal USB to serial adapter does not work as the new software can't accept data from comm port like the old software.

I want to build a cable that plugs into the computer USB port for power and emulates a keyboard. The other end has a DB9 port on for the serial connection to plug into. I will print a larger back-shell for the DB9 connector that will hopefully house all the circuitry. For the ones I deploy, I'll fill it them with potting epoxy it for durability. My goal is to keep this as small and cheap as possible so we can update all the stations.

It looks like the smallest Arduino capable of keyboard emulation is the Pro Micro. I'm planning on using the SparkFun MAX3232 breakout board to convert the RS-232 signals down to the Pro Micro's serial pins.

Questions:

  1. Is there anything off the shelf that can do this already?
  2. Can the Pro Micro use the serial port on pins 0/1 independently of the USB when emulating a keyboard?
  3. Is there anything better hardware wise I should be looking at than the Pro Mico and MAX3232?
  4. If I have a unique code sent over serial that is detected and triggers the Keyboard.end() command, would that put the USB port back into normal mode so I can update programs on the Pro Micro?

Thank you for your help in advance!

  1. Can the Pro Micro use the serial port on pins 0/1 independently of the USB when emulating a keyboard?

Yes.

  1. If I have a unique code sent over serial that is detected and triggers the Keyboard.end() command, would that put the USB port back into normal mode so I can update programs on the Pro Micro?

Add a reset button to the Pro Micro then just double click the button to put the Pro Micro in upload mode. Connect the button between RESET and ground.

Lots of ready built adaptors
https://www.amazon.co.uk/s

Your approach seems sound to me.

Those ready made cables are not what OP is looking for - he needs to convert the output to HID Keyboard output. Those cables convert it to a virtual COM port.

This may be a demo of the desired function. Read from serial then write out as USB HID keyboard. The demo increments the ASCII code by 1 which can easily be removed.

Thank you everyone for validation of my plan.

Thank you for the feedback and link gbafamily! I did not think the program side of this would be difficult, but that's about 10 times easier than I would have guessed!

I will be ordering some parts soon and let you all know how this works out!

Hi @CubDriver,

Just curious if your serial to USB keyboard converter project has gone anywhere, or if you found some hardware that already exists that does this?

cheers,
Mac

1 Like