Go Down

Topic: Does keypad library require diodes? (Read 1 time) previous topic - next topic

MD5003

Does the keypad library (http://playground.arduino.cc//Code/Keypad) require diodes on the switches?
Quote
You won't need external resistors or diodes because the library uses the internal pullup resistors and additonally ensures that all unused column pins are high-impedance.

I see why I wont need external resistors, but does the "no diodes" apply only on pre-manufactured kaypads?
I am planning to make my own matrix for input switches and now the question is if all the diodes are required or not:

CrossRoads

Diodes are not required.
What the library basically does is have all the column lines high.
It then brings 1 low, and reads the row pins. If a low is seen, it knows the active column, and now the row, so it knows whic button was pressed.
Then on to the next column...
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

MD5003

Thanks for your reply, but my question is: What happens if 3 buttons in a rectanble are pressed?
Normally the arduino would report 4 buttons then if I don't use any diodes?!
Or does this library go around this problem somehow?
Hope you do understand what I mean ;)

CrossRoads

I don't have a keypad set up at the moment. It likely just reports the first one it reads. Try it & see. 
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

mstanley


Or does this library go around this problem somehow?

Sadly, not yet.  As soon as they improve quantum computers I should be able to nail it. ;)

To be clear, you are correct.  The problem you are talking about is called ghosting.  http://en.wikipedia.org/wiki/Rollover_%28key%29.  The default settings for the library allows 10 keys to be pressed at the same time but you will need diodes if you need to avoid ghosting.

Go Up