Shop OBEX P1 Docs P2 Docs Learn Events
4x4 Keypad OBEX question — Parallax Forums

4x4 Keypad OBEX question

I have a question about Beau's 4x4 keypad reader obex. Looking through his code he talks about using a pin's capacitive to read the keypad. He does this by changing the states of all pins. First setting them to low output, then setting them to input. Then one pin at a time is made high output at a time. I'm not sure that I follow all those state changes.

My understanding is that you would set 4 pins as inputs. Use a pull up or pull down setup (I'm going to probably use a pull down setup) on those pins. Then you would set 4 pins as outputs. Then to read to keypad you would set the output pins high one at a time, at the same time reading the input pins. Is that correct and will my setup work with leads that are over 1 to 2 feet long? Is Beau's setup only to avoid using the extra pull up/down resistors?

Comments

  • Here is a driver that is more robust than Beau's. The post includes a pointer to a thread you may find interesting.
  • I believe the pins are first made outputs (and LOW) to discharge any parasitic or attached capacitance ... this creates a "known" starting point ... then they are made inputs with one pin at a time as an OUTPUT (HIGH) and the other pins are monitored for change.
  • ti85ti85 Posts: 43
    edited 2016-11-03 02:05
    Tom and Beau thank you

    Tom, I think I will try your driver. It only requires the pull down resistors? How reliable are the pin reads and do you think two feets leads will be okay?

    Beau, thank you for the explanation. That makes perfect sense
  • Requires only pulldowns. I used 1K because that was at hand. You could go down to a few hundred ohms. I found the pin reads to be 100% correct in the (limited) testing I did. I did not try longer leads, but I would be amazed if you got in trouble with two feet leads. The low resistance dissipates any noise introduced by capacitive coupling.
Sign In or Register to comment.