cancel
Showing results for 
Search instead for 
Did you mean: 

Emulating a matrix keypad with a stm32 microcontroller

Ondrej Popp
Associate III

Good morning Stm32 community,

I am designing a ​matrix keypad emulator to control a musical keyboard. I need a 16x16 keypad for the music keys and a 8x8 keypad for the control buttons.

The idea is to swap the existing keypads connected to the existing processor with the keypad emulator (because I do not have access to the existing firmware and a programming environment) and do the matrix scanning and control of the keypad emulator with an additional stm32 microcontroller, which I can program myself.

​Now, you can build such a keypad emulator with either discrete components, such as analog switches, diodes and shift registers with will cost me around 100 Euro's for the components only or... you can use a microcontroller for that, which would be much cheaper and flexible. The following blog I found says it all I guess,

https://www.eevblog.com/forum/beginners/simulate-a-matrix-keypad-with-a-microcontroller/

Using a micro controller to emulate a keypad directly is a bit tricky because you need to be fast enough to be within the wait time of the original firmware when a scan line is activated, or, what just came to me this morning, I could maybe do a "Master Slave FF like approach" and anticipate for the next scan line going high and already put the code word for the next scan line ready in the current scan line cycle, after... a sufficient delay to be past the wait time of the original firmware but I can control that delay myself, which I think could work reliably.

I​ just wanted to ask whether anyone has experience with this, and would like to share his or hers ideas on this.

Thanks.​

1 ACCEPTED SOLUTION

Accepted Solutions

If you dont know nothing about timing parameters of master microcontroller you can consider using simple parallel RAM. It is low cost and fast enough, and separation address and data bus can be simply done by some buffers (your emulation microcontroller have to write and external device want to read). Another "reasonably cheap and fast enought" can be CPLD... If reading is too fast, you can have very limited chances with microcontroller ...

View solution in original post

7 REPLIES 7

If you dont know nothing about timing parameters of master microcontroller you can consider using simple parallel RAM. It is low cost and fast enough, and separation address and data bus can be simply done by some buffers (your emulation microcontroller have to write and external device want to read). Another "reasonably cheap and fast enought" can be CPLD... If reading is too fast, you can have very limited chances with microcontroller ...

Ondrej Popp
Associate III

Tx! =) I didn't know about the RAM solution. I'll definitely consider it may the microcontroller be too slow...​

Ondrej Popp
Associate III

Hello mdudka9,

I just wanted to thank you again for your answer and to wish you a belated merry Christmas and a happy new year!

In the meantime, I have had more than enough time to think about this, so now I will not only definitely consider it, but definitely do it like you suggested. I even found great memories with a 16 bits wide address bus and really cheap for around ​one Euro or so.

So thanks again and a merry Christmas and a happy new year!​

You're welcome.

Say then how exatly did you solved that.

Have a Merry Christmas.

I don't have any details, because I have not started building it​ yet...

Just wanted to say thanks for the tip.​

I see, I wanted to write that you can share the finished solution when it will be done. There will certainly be some interesting obstacles along the way.

Yes I will remember to share it here.

And for now I wish you again a belated merry Christmas and a happy new year!​