Since I in different occasions had this question about how to simulate a keypress on an existing keyboard, I decided to post the answer to all. Original Question from andre@compufire.com: "using pic to control a vcr" >Hi to all engineers in this list. -snip- >I decided to drive them >from switches like pressing buttons. switches are connected together >in multiplexed method that means each switch when you press it >doesn't ground the only access i have is switches. my question is >to press a button electronically should i use optoisolater or can I use >electronic analog switch like 4066. any recommendations ? > >Andre thank you very much.> >========================================== >= http://www.compufire.com = >= mailto:andre@compufire.com = >= mailto:mcu-engineering@compufire.com = >= Andre Abelian: Engine Electronics, Inc.= >= Tel 909-589-5485 Fax 909-598-5695 = >========================================== Cheapest (i belive) is to use a transistor resistor and a diode for each button. What a coincidence: I actually today built a remote controlled PC keyboard (15 buttons) with this technology: The keyboard controller scans the keyboard by asserting one row at a time ti GND, others to Vdd. The horizontal lines it pulls high. For each button to be emulated I connected a NPN transistor«s emitter to the key«s scan row, and the collector via a diode to horizontal line. (diode kathode to collector) I drive the transistor with logic level from IR decoder via a 100 kohm R. >what is the idea of using a diode in each switch? If, when this transistor«s emitter scan line is high, and another key sharing the same feedback line as the transistor«s collector is pressed, it will sink the collector voltage. If you are then holding the base high the transistor will lead current from emitter (now positive) to collector. As the keys here have some high resistnace (rubber-type) the transistor will win and the keystroke not detected. Anyway, in my application it would not matter, since only one transistor or switch is activated at the same time, but I want to make it reliable, since I will sell it. (For controlling engine test equipment when sitting in car.) Also beware that when your input to the transistor is high, the NPN transistor will most of the time have a negative Vbe. Almost any transistor can take -5V, but I don«t know about -Vcb, (which we will have if we don't use diode) /Morgan Morgan Olsson, MORGANS REGLERTEKNIK, Sweden, ph: +46 (0)414 70741; fax 70331 -