Objective: To get my USB keyboard to interface with an Arduino Uno board.

Constraints: I can't afford a USB host shield for now for Arduino. Currently available is a keyboard with PS/2 connector. That example is available here. However, it is silly going for such a keyboard, or, buy a USB to PS/2 converter at the moment.

Challenge: USB has VCC, GND, RX/TX. (Rx/Tx also labelled D+/D- respectively). The parallel port connector has the following:

enter image description here

Where will the D- pin go?

  • 1
    USB doesn't have RX/TX. – Ignacio Vazquez-Abrams Jul 29 '18 at 7:50
  • 2
    Is there a reason that you think an USB keyboard would work with a PS2 library? These are not the same but two very different means of communication. When wanting to interface an USB slave, you simply have (!) to implement some kind of an USB master. Thats how USB works. – chrisl Jul 29 '18 at 8:01
  • @chrisl Many USB keyboards can also work as PS/2 keyboards. Plug them into one of those green USB to PS/2 converters and it becomes a PS/2 keyboard. There's no electronics in those converters, it's just a plug. It's down to the keyboard to recognise it's plugged into PS/2 not USB and change its behaviour. Not all keyboards can do it, but certainly most older ones can. I doubt wireless ones would work. – Majenko Jul 29 '18 at 10:18
  • @IgnacioVazquez-Abrams I thought the green/white wires correspond to TX/RX respectively... – deostroll Jul 29 '18 at 14:14
  • @chrisl heard keyboard MCUs do support both protocols...so I have to discover for myself what is the case with my keyboard... :( – deostroll Jul 29 '18 at 14:15

Many USB keyboards (certainly older ones, though almost certainly not wireless ones) are also PS/2 keyboards. The wiring of the cable is all that differs, and the chip in the keyboard changes its behaviour depending on how it's wired.

A simple USB to PS/2 adaptor is merely a USB socket and PS/2 plug wired together in a certain way:

enter image description here

So that's:

  • 5V to 5V
  • D- to Data
  • D+ to Clock
  • GND to GND

It may work with your keyboard, or it may not. All you can do is try it and see.

Not the answer you're looking for? Browse other questions tagged or ask your own question.