How to make Arduino UNO appear as a reverse PS/2 keyboard?

Goal is to use an UNO board connected to usb of PC #1 and output to a PS/2 cable and plug that into PC #2

Now if anyone knows of a device that does this already? Please let me know.

PC 1 runs a script that will output keystrokes. the UNO only needs to translate what is sent by USB and output to the PS/2. This would be like connecting a PS/2 keyboard into PC #2 and hitting keys. Have seen some details of the keyboard protocol, that when the PC boots up it tries to find the PS2 keyboard, looking for the ACK or? signals and then it sends a command to turn on the Numlock mode light?

And that the PS/2 device generates the clock and the host will control the data line or hold it low for (time interval)

The other functions the UNO needs to do are

  1. send info to an LCD display that says step 1, 2, 3 for status, or some error message
  2. drive a relay board
    and then
  3. accept commands from the PC 1 usb port; and listen for the host on the keyboard line PC 2 to ask if its there and reply, and follow the timing requirements.

Have tried to find code examples, anything will help, any reference info, any snippets or ideas are appreciated, thanks!

From : Keyboard - Arduino Reference

Notes and Warnings
These core libraries allow the 32u4 and SAMD based boards (Leonardo, Esplora, Zero, Due and MKR Family) to appear as a native Mouse and/or Keyboard to a connected computer.

The Uno is not such a device so cannot emulate a keyboard

One needs to reprogram the 32U2 on the Uno to allow it to behave as a keypad.

Arduino used to carry this board, it likely could have been reprogrammed a similar to the 32U2 (just less memory) and used as keypad interface with software serial.
https://store.arduino.cc/usa/arduino-usb-2-serial-micro

UKHeliBob:
From : Keyboard - Arduino Reference
The Uno is not such a device so cannot emulate a keyboard

Thanks so much! its going to throw a challenge in if the board will cost 3x-4x more
Is it at all possible to take the software made for those boards listed and re-write for the UNO? Or is there a physical limitation the UNO has? It seems to me, someone who knows next to nothing about what these boards have on them, that ps/2 is just doing simple operations to drive the clock/data lines;
Is the code library(ies) for this the limitation or the board just cannot do something? I hoped to have a controller board for under $20, one solution was to take the original 8042 controllers and use an Arduino or? to generate the keypress by driving which ever lines low and letting an existing 8042 manage the rest?
Or if there are programmable logic blocks that can emulate the 8042 and the wires from the keys, but that seems like alot more work;.

If I understand you correctly, you want to emulate a PS/2 keyboard with an Arduino and a PC.

So you should read about the PS/2 Mouse/Keyboard Protocol.

Should be no problem to implement, maybe two transistors could be used to be more in spec (open collector),

Whandall:
If I understand you correctly, you want to emulate a PS/2 keyboard with an Arduino and a PC.

So you should read about the PS/2 Mouse/Keyboard Protocol.

Should be no problem to implement, maybe two transistors could be used to be more in spec (open collector),

Thank you! yes I read that one. Hoping to not have to re invent the wheel, the first reply was great, talking about software that already does this, but now Im trying to find which board(s) may work where the target price for the microcontroller is hopefully below $15. Some of the boards that will work are $70 which is too much.

rogersb:
Thank you! yes I read that one. Hoping to not have to re invent the wheel, the first reply was great,

Maybe if you want to emulate a USB keyboard,
but I thought you want to emulate a PS/2 keyboard.

Please clarify.

A possible template/solution could be the Arduino ps2dev library, or PS/2 Keyboard library for Arduino.

For a PS/2 connection you don’t need any special processor, you need two free digital port bits,
and you can even get your power (up to around 200 mA) from the PS/2 connector.

Whandall:
Maybe if you want to emulate a USB keyboard,
but I thought you want to emulate a PS/2 keyboard.

Please clarify.

A possible template/solution could be the Arduino ps2dev library, or PS/2 Keyboard library for Arduino.

For a PS/2 connection you don't need any special processor, you need two free digital port bits,
and you can even get your power (up to around 200 mA) from the PS/2 connector.

No, its an arduino or ?? microcontroller, doesnt matter which one, a TI or ST micro or? that is programmed with ?? software and has a keyboard cable that plugs into a PC computers PS/2 keyboard port. Since DOS has some requirement to see the keyboard at boot time, listen for that and otherwise be a keyboard.
The other problem is the USB side, the arduino or? connects into some usb port, windows software finds and connects so it sends keystrokes out the usb, or sorry, it sends out ascii, 41 for "A", 31 for "1" etc; or it can send anything, as long as the arduino turns that into the PS/2 format of those keyboard presses
the uC software would have a loop(s) listening for a new usb char from PC #1 and translate that into a char sent out over the PS2 keyboard side into PC#2. I think that will suffice, have to test it. the uC should be fast enough to manage that but dont know.
I need to work on the usb side, how does the arduino software deal with listening for a char(s) from usb? this project has to rely on that, also buttons on the arduino to set it up and say initialize the program.

rogersb:
I need to work on the usb side, how does the arduino software deal with listening for a char(s) from usb? this project has to rely on that, also buttons on the arduino to set it up and say initialize the program.

I disagree, the USB attachment is via USB serial emulation and comes with many/most Arduinos out of the box.
The Arduino does not need to know/do anything about USB for your task.

I disagree, the USB attachment is via USB serial emulation and comes with many/most Arduinos out of the box.
The Arduino does not need to know/do anything about USB for your task.

Great, will try to find something that can take a keypress from the pc sent out by a terminal program? and output to the LCD? and then parse the values, if its a c then clear the screen or ?

will try next time I get to use it. Didnt see the right kind of example program yet

rogersb:
Great, will try to find something that can take a keypress from the pc sent out by a terminal program? and output to the LCD? and then parse the values, if its a c then clear the screen or ?

There is a skill named programming, do you remember?

Code is rarely found exactly as needed and the quality of 'found' code is often quite low.

That the PC keyboard should be the source of the data is new information and
I have no idea what you want to display, clear, or whatever.

Whandall:
There is a skill named programming, do you remember?

Code is rarely found exactly as needed and the quality of ‘found’ code is often quite low.

That the PC keyboard should be the source of the data is new information and
I have no idea what you want to display, clear, or whatever.

Hey I dont know what your problem is, but I didnt come here to engage in some verbal fight so you better just back off now pal. How about you skip to something else and dont reply to my posts unless its about the question?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.