Posts: 1
Joined: Tue Jun 12, 2018 5:42 am

64 key press emulation using GPIO lines

Tue Jun 12, 2018 5:54 am

I want to emulate key press of another embedded system which is having maximum of 64 keys. The other board is running on a micro controller and its having a matrix key board [configured as row (i/p) and columns(o/p)] i am looking for a solution to press these keys one by one or, multiple keys at the same time.
I thought i can connect 8 rows to 8 GPIO lines in RPI and the other 8 columns to other 8 GPIO lines of RPi. Then i will have a key table where i will map for each and every key what should be the GPIO lines to be shorted.But then after reading some of the post i think i am not doing it right and may damage my GPIO lines.
I request your help in how can i emulate the key presses using the GPIO lines in Rpi

Posts: 6384
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: 64 key press emulation using GPIO lines

Tue Jun 12, 2018 11:35 am


Your 64 keys on the other system are effectively 64 normally open switches which close when a key is pressed.

for your pi to simulate the pressing of a key you will need to close the switch on the the keyboard relative to the key you wish to simulate pressing, you cant do this directly with the gpio , you will need to have some interface between the two.

you can probably do it using 64 opto isolators with the pi driving the LED's on a matrix and the transistor mimicking the key press, but you will have to get the transistor the right way round when connecting it to the keyboard so that current can flow.
We want information… information… information no help
The use of crystal balls & mind reading are not supported

Posts: 1615
Joined: Sun Feb 17, 2013 6:51 pm

Re: 64 key press emulation using GPIO lines

Wed Jun 13, 2018 8:16 am

Your original idea of using the 8 row and 8 column lines can work but you will need to do a bit of experimentation to discover how the scanning of the keyboard matrix is being done. gives some nice material on how a keyboard matrix works

Normally scanning works by having rows driven by outputs and columns as inputs, or vice versa, so that is the first thing you have to find out.

Secondly you need to know the logic levels used. If it is 3.3V then that make it easy. If it is 5V then you need to think about level shifters.

Thirdly you need to know the sense of the scanning logic. It could be the output drives are normally low and one is pulsed high in turn during the scan, or vice versa.

Assuming rows are driven by outputs then you would connect these to 8 GPIO pins configured as inputs and 8 GPIO pins configured as outputs to the columns. This allows you to monitor which row is being driven at any moment in time. When a particular row is active then your key mapping table would tell you which column you need to drive active to simulate the keypress.

The scan rate used will determine how you need to handle the programming side. Typically it is of the order of low KHz. PIGPIO might be a useful tool to use here.

Return to “Automation, sensing and robotics”