View Full Version : propeller to pc keyboard input ?

kelvin james
10-27-2006, 12:58 AM
Would the possibility exsist to use the serial keyboard input for a propeller to work as an output? The basic idea is to use the propeller as an automated keyboard controller for a pc running a program. The key commands would be preprogrammed in the prop, and commands would be sent at certain intervals related to the key commands of the pc software.
I figured if this could be done, it would ideal to run usb related hardware for a minimal cost. Don't like the size aspect, but you can't have everything. I don't know about the pc boot factor either, getting the pc to recognize the prop as a keyboard?


Mike Green
10-27-2006, 01:12 AM
Electrically there's no problem doing this (assuming you're talking about a PS/2 keyboard). The problem is that you'd have to write the program that would simulate a keyboard. It shouldn't be a difficult program to write, but, if you don't have the experience, I wouldn't recommend it.

If you're talking about creating a substitute USB keyboard, that's harder, both from an electrical standpoint and from a programming standpoint. Most published examples these days use some kind of USB interface chip (like the MAX3421E from Maxim/Dallas) which handles most of the timing and other niceties of low level USB. On top of this, you'd have to write a program that would pretend to be a HID class device and send "reports" containing keypress information. Most operating systems will recognize a generic keyboard device as the system keyboard.

Loopy Byteloose
10-27-2006, 01:24 AM
From a hardware standpoint, I think the pullup resistors would never know the difference.

The biggest problem is that the keyboard interface is asymentrical. IN one direction it is 11 bits and in the other it is 12 bits. Then there is how the clock is controlled. The keyboard operates as the master by providing the clock pulse with the Propeller as a slave. You would have to reverse that role too.

My impression is that someone might want to setup some kind of keyboard logger by doing this. This type of device can often be used to steal passwords and snoop around in other people's affairs. Personally, I don't care to support such efforts.

Since you mention USB, I suspect you are unaware that USB keyboards are more complex and entirely different from their forerunners. The Propeller doesn't directly support USB and the question of USB keyboards is an entirely different and very complex approach.

A more valid application would be a keyboard switch that would allow you to enter data selectively to two PCs from one keyboard with a keyboard sequence having the ablilty to tell the device where the output should go.

Hardware switches require that the keyboard be powered down as the 'hot switching' really can damage both the keyboard and the PCs involve. I bought one and threw it away as it was just waiting to cause serious damage.

I suspect the Prop can do it, but you would have to get completely down to the assembly languge programing.

"If you want more fiber, eat the package.и Not enough?и Eat the manual."ииииииии

ииииииииииииииииииии Tropical regards,иииии G. Herzog [и黃鶴 ]иin Taiwan

Graham Stabler
10-27-2006, 04:30 AM
At the moment I am looking at writing a keyboard encoder so I can take any matrix keypad and turn it into a PS/2 keyboard. See my thread:


I don't know what the time frame will be on this project, its a bit slow going at the moment.

Anyway the first step will probably be to get one cog of the propeller to pretend to be a keyboard while another cog has the keyboard object running in it. This will let me test out the comms. As Kramer has said the comms is a little different for keyboard and host but a lot of the keyboard object assembly will be usable after some modifications.

This first step to my encoder could be used to get the propeller to type on your PC screen or something.

When you talk about USB are you just saying use the propeller to pretend to be a PS/2 keyboard to control the USB device that is running on the PC?


kelvin james
10-27-2006, 01:25 PM
Mike, Kramer and Graham, thanks for the response. The idea just came to me, and i should have put some more thought into explaining it.
Grahams' assumption is correct, the idea is to control a pc with a usb device running on it. Grahams' obviously already way ahead of me, it sounds like what is being worked on is exactly what i was thinking. Since most pc software can be run through keyboard commands, i thought the prop could act as a controller for the software. The basic operation would have the prop monitoring a sensor or whatever, and when a condition is met, a control keyboard command would be sent to the pc to activate an operation of the usb device. I was hoping it would be as simple as making a cable from the demo board to the pc from the keyboard connection, then figuring out the serial operation on the clock/ data lines. But i am not knowledgable on the pc side of how a keyboard communicates, so i just wanted to see the possibilities. Actually, the idea of being able to do text overlay to the pc monitor would be interesting too. Just think, a pc actually being a " slave or peripheral " to a propeller, things get more interesting as time goes on. This obviously is not a very practical idea, but there may be some applications that it could be used for.