Hi everyone, I'm having some problems trying to interface a PS/2 keyboard to an arduino UNO.
My setup is:
Keyboard conected to PS/2 female plug, wired to Arduino UNO.
The connections are ok, I had another PS/2 keyboard in the past that worked perfectly. That keyboard is no longer available for me, so I need to use a newer one that doesn't work so perfectly. When I use the serial monitor to test it, some keystrokes respond perfect, but sometimes it doesn't respond, or respond another character. It gets somehow confused. I attached a screenshot of the serial monitor when I try to write "hello world, how are you?" several times.
So, anyone has some info on what could be wrong with the newer keyboard?
The older keyboard, the good one, was a Genius KB-06XE with PS/2 cable, I could'n find anywhere the electrical specs on this keyboard.
The newer keyboard, the bad one, is a generic ACK-595 white mini keyboard. The electrical specs are writen on it's back and it says 5V 300mA.
I suspect this might be the problem, as most keyboards run with 5V 100mA. Maybe Arduino isn't being able to deliver the needed current? And so, sometimes get the right code, sometimes wrong code, and sometimes none.
You could try to supply the power to the keyboard from an external source, say a phone charger and a lobotomized usb cable. Ensure that the grounds of the arduino and the external power supply are connected.
I've tested 2 USB keyboards that I had at home with an improvized USB-to-PS/2 conector.
First, a Logitech K120, didn't work at all, no character showed up in the serial monitor.
Then I connected a Zom ZKB-50U, it works like a charm, the serial monitor shows every keystroke perfectly.
Both are rated 5V 100mA.
I still think the minikeyboard expecting 300mA is too much for the Arduino. And the Logitech keyboard don't work due to protocol. I've read that some keyboards come with dual USB-PS/2 protocol, and some only USB protocol.
So, in order to keep on with my project, I'll need a new keyboard, the one that I have doesn't work with it.
andreschouhy:
I still think the minikeyboard expecting 300mA is too much for the Arduino.
And I repeat, an Arduino is not a power supply, suggesting that you are already doing something wrong, particularly if you are powering it via "Vin" or the "Barrel jack".
Unless there are a number of other things connected drawing significant current, if you connect it via the USB jack, either a PC or a USB "phone charger" will be capable of providing 500 mA, quite sufficient for the Arduino itself and a 300 mA - if it actually draws that much presumably because of LED backlighting - keyboard.
So now I look it up, and the ACK-595 comes in both PS/2 and USB versions so I suspect it is essentially the same in both versions. It is one of those "minis" that is configured like a laptop and pretty useless for serious PC work! No lights to speak of so just why it would draw such a ridiculous current is puzzling indeed.
No, I'm not powering the keyboard from other than the 5v lines. The wiring is correct, the other keyboard worked ok. And is using the current from my laptop via the USB port, so 500mA max. Some other electronics are connected but not being used, although they might be drawing some current.
So, no idea of how could I use this mini keyboard?
andreschouhy:
So, no idea of how could I use this mini keyboard?
Give it its own power not drawn through the Arduino. Arduino pins can use transistors to switch external power on and off, Field Effect Transistors are best for this.
5V 1A wall warts don't cost much. The non-USB types have thicker, easier to work with wires if you cut the plug end off but you can get a bare barrel jack to solder to your adapter and avoid the hack if you don't want the PS and cable permanently attached.
Spend time internet window shopping. Spend time searching the forum and net for answers. The least that will do is to improve on the questions you ask. This spoon-feed airplane is done.
I have an external power supply, the Arduino here is being used as the brain of a CV sequencer in a modular synthesizer system. With the keyboard I'm controlling that sequencer. And it worked with the other keyboard (the one that I no longer count with).
I'll give it a try with the power supply connected. But I don't think it's gonna work, because I remember I've tried to control the sequencer with this mini keyboard and didn't work.
So, I tried with the power supply connected and the behavior is exactly the same. No change at all. It could be another thing instead the needed 300mA stated in the keyboard.
I have still no idea of why this keyboard works on any computer but not on the Arduino.