Simple Button Keypad – Microcontroller
Simple method for creating a custom button keypad that doesn’t require separate hardware. Just your microcontroller buttons a few resistors.
What we have here is 9 buttons and 6 signal lines (3 inputs, 3 outputs). The basic setup is in a grid pattern where the three input lines come down as columns (PIN0, PIN1, and PIN2), and the three output lines come across as rows (PIN3, PIN4, and PIN5).
Each button is a momentary ON button, normally open. So what will happen is when we press the button it will make a connection between that button’s input and output, other wise there is no connection.
The key here is in the software.
What the software is going to do is sweep between the inputs and outputs, for every combination very fast. I will outline the steps for 1 input, and then it simply repeats the same steps for each other input.
For input on PIN0
— PIN0, 1, 2 defined as outputs
— PIN3, 4, 5 defines as inputs
1. Set PIN0, PIN1, AND PIN2 to LOW
2. Set PIN0 to HIGH
3. Check if PIN3 is HIGH or LOW, IF HIGH go to function SW1
4. Check if PIN4 is HIGH or LOW, IF HIGH go to function SW4
5. Check if PIN5 is HIGH or LOW, IF HIGH go to function SW7
6. Set PIN0 to LOW
This will then repeat with the only differences being which input pin is set to HIGH, and the names of the SW functions its going to.
For more detail: Simple Button Keypad – Microcontroller
EasyEDA: Ideas for Circuit Design, Innovation for Electronics Access
Free Circuit Design: Schematic – Simulation – PCB Layout – Gerber Viewer
Cheapest PCB Prototype: Only $2 for 10pcs 10×10cm PCBs, 24 hours Quick Turn, DHL Delivery in 3 Days
Current Project / Post can also be found using:
- simple keypad and lcd interfacing in pic16 microcontroller