Control keyboard IC with Arduino using transistor?

Hello,

I am busy trying to control a keyboard IC with my Arduino Mega. I simply have to connect 2 pins of the IC to generate a key press. I thought of to do this with a transistor but I feel uncertain how to wire this. My first thought was to connect one IC pin to the C, one IC pin to the E and the digital out of the Arduino to the B pin of the transistor. I have no idea if this works so I ask some advise before I blow up my Arduino :slight_smile:

The reason I am trying to control a Keyboard IC is to control the inputs of a game with my Arduino. Since I couldn't find any info to do this with pure software communication I am trying this approach. Or does anyone know if this is possible with Arduino + Processor?

Regards, Edwin

While in theory you could get something like that to work (although, I wouldn't try that exact circuit you are suggesting - that would probably cause problems); have you thought about other options?

  1. Set up the Arduino as a USB host (you have to build a shield or something with an extra USB connector), and emulate the keyboard HID device (this wouldn't be easy - and may not even be possible within the limits of the Arduino, but if you look up OrdDuino, you can see someone who did it for serial-port joystick-like devices).

  2. Do you have a PS/2 keyboard port on your computer? If you do, there have been several projects done for other microcontrollers (Basic Stamp, PIC, etc) that emulated a PS/2 keyboard - this might be a good option.

  3. Use the Arduino to fire solenoids which hit the keys; ok - I'm not serious on this one, but it would be an interesting project nonetheless! :slight_smile:

Without knowing some specifics of the keyboard controller chipset in question, it would be difficult to know how to properly create a transistor-based switch for the key matrix, but it definitely could be done. Maybe you should let us know what kind of keyboard IC is being looked at (are you looking at a bare IC from a distributor - or are you going to hack an existing keyboard?).

Also, on the transistor in your example, you would want a resistor between the base and the Arduino pin (about 1K); this controls current thru the transistor - without it, you might either burn out the Arduino, the transistor, or both.

Good luck!

You can probably get away with that approach (except you'll need a resistor in the base circuit. Check the Playground examples), but you'll need to know which of the keyboard IC pins is being pulled in which direction to scan the keyboard, and you have to make sure you have a good common ground for the keyboard and the Arduino.

A simpler, and safer, approach is to wire the contacts of a relay in parallel with the keyboard switch. Then you don't need to worry about figuring out how the keyboard scanner works, wiring up a ground, or having the transistor work erratically when the Arduino isn't connected. Or about the small, but real, chance that the scanner works in a way that prevents using the transistor.

Thanks for the advise on how to do this. I was looking into the relay option until I came across the discussion in this forum: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1266246354 which is about Gobetwino. It runs on Windows and reads Arduino commands and sends it to a specified program, also keystrokes :smiley:

I thought I'd share