Go Down

Topic: PS2 Keyboard Emulator (Read 9 times) previous topic - next topic

yakfarmer

I'd like to use an Arduino Duemilanove as a PS2 keyboard emulator, that I can plug into a laptop. I would need to know the electrical connections, although I could gut an old PS2 keyboard as a starting point and maybe drive its internal electronics. I assume that would require generating some kind of matrix of input values, in place of the physical keyboard.

Any advice or pointers will be gratefully received.

Regards to all,
Mark
Ottawa, Ontario, Canada

TBAr

#1
Jul 18, 2009, 03:53 am Last Edit: Jul 18, 2009, 03:56 am by TBAr Reason: 1
Start with the links in the "Further readings" section of http://www.arduino.cc/playground/Main/PS2Keyboard. You will find the protocols, scan codes, and everything you need to send out of the Arduino to the laptop, if you follow those links through about one or two levels deep.

doctorwho8

[font=Times New Roman][size=12]
Hello!
We are discussing here about how to send characters (and other data) into a laptop's PS2 keyboard (& mouse) input port?

The referenced page discusses the wonders of having the Arduino communicate with a keyboard.
----
/me
[/size][/font]
Time is like sleep, it goes faster when you're not using it.

TBAr

#3
Jul 18, 2009, 04:55 am Last Edit: Jul 18, 2009, 05:15 am by TBAr Reason: 1
Quote
We are discussing here about how to send characters (and other data) into a laptop's PS2 keyboard (& mouse) input port?


Yes, the original question asked for help sending keyboard info from the Arduino to a laptop. The referenced page has a section titled "Further readings" near the bottom of the page. If you follow the links in that "Further readings" section, you will find details of the PS2 keyboard communication protocols and electrical interfaces.

(Sorry, I almost didn't read your post because of the distracting scrolling line in your signature.)

yakfarmer

Thanks TBAr that's very helpful although, to be clear, yes I am trying to emulate a keyboard, not interface with it, so it looks like I have work to do.

Main question I have next is with clock rates. The reading I have done mentioned 20 to 30 kHz, so I'm wondering how critical that is. If I drive the clock and data much slower will it still work, I wonder. I assume the clock pin mentioned in the Playground write-up is generated by the library code and not a built-in hardware feature?

I could try to reverse engineer the keyboard interface code, but I think I will start very simply from first principles. The references you pointed me to are very helpful. Thanks again.

BTW I'm a complete Arduino newbie. It's great fun!

Regards,
Mark
Ottawa, Ontario, Canada

gradbert

Ok I have uploaded to the playground a library that implements the device side of the ps/2 protocol.  I used it in a couple projects, including a sun type 5 to ps/2 interface.  Also the ps/2 port on the computer can provide plenty of power to drive the arduino

TBAr

Thanks for the contribution!

That library would be at the bottom of this page.

gradbert

Thanks for doing the link

skumlerud

Quote
Ok I have uploaded to the playground a library that implements the device side of the ps/2 protocol.  I used it in a couple projects, including a sun type 5 to ps/2 interface.  Also the ps/2 port on the computer can provide plenty of power to drive the arduino


Very interesting! I have also made such a library, and it's quite similar to yours. However, I've had some timing-issues, especially when I try to emulate both a mouse and a keyboard at the same time. Have you tried this with your library? I will definitely look into this later today, as it might solve some problems I've been struggling with for weeks.

skumlerud

#9
Jul 23, 2009, 08:35 pm Last Edit: Jul 23, 2009, 09:38 pm by skumlerud Reason: 1
Well, your library wasn't really suited for my application (my library have read- and write-buffers, and I would need to change a lot of things to manage without them) so I just replaced my own ps2read/write-routines with yours (very slightly modified). So far it's looking good :-) I'm going to test it further, and if your code did the trick you deserve a big THANK YOU :-) I've struggled with the timing for almost two months now...

gradbert

Quote

Very interesting! I have also made such a library, and it's quite similar to yours. However, I've had some timing-issues, especially when I try to emulate both a mouse and a keyboard at the same time. Have you tried this with your library? I will definitely look into this later today, as it might solve some problems I've been struggling with for weeks.


I have used it as a mouse and a  keyboard but never both at once

lerum

Does anyone have a working implementation of any arduino PS/2  keyboard emulator library? I can't seem to get the ps2dev one to work. QQ

Bontempos

Also looking for a way to cut my pc's ps2 keyboard and plug an arduino there...
Couldnt make the ps2dev.h to work.
Couldnt find ps2dev.h references or something that I could read to build my own application.
Actually Im kind of stuck...sorry.

Any help?
A simple sample to compile within arduino which will make it send a letter 'A' to PC for each second would be a nice start.

;)
Btp~

TardisX

I second that :-)

A basic overview of what's needed (hardware and software) wise would be great.

It seems an Arduino acting as a keyboard via PS/2 is easier (hardware and software wise) than doing it via USB.

pwillard

Quote

It seems an Arduino acting as a keyboard via PS/2 is easier (hardware and software wise) than doing it via USB


To sum up in a pair of words... "MUCH easier."  

The USB method requires you to essentially BIT-BANG the USB HID Emulation on the Arduino.  While some Micro controllers are now built with USB HID support... the ones we use do not.  A lot of people have used the software solution provided here --> http://www.obdev.at/products/vusb/index.html to build USB devices with AVR chips. (So it can be done)

The PS2 protocol is a simple synchronous serial connection and we already have the library code in the playground.

Go Up