Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interfacing Keypad with less I/O pins?

Not open for further replies.


Member level 3
Sep 18, 2008
Reaction score
Trophy points
Activity points
I want to ask that how to interface a keypad to a controller using less I/O pins. Not more than 3 I/O ?

Anybody have any idea about it then please share it with me. I would be very thankful.


one method is is to use 'matrix ' keyboard technique.

but 3 i/o pins is too small for such technique.
you will have only limited keys.

if you use a separate external keyboard decoder , then 4 i/o pins can be used for 16 keys.


I think there should be some technique. I got this circuit from by googling the web. The website is Design Idea from where i got that circuit but when i tested it on Proteus Simulator the output waveform pulse is not as they told at the website.

still confused....:!:

If the micro supports analogue inputs then you can use a single pin and a resistor network to give different voltages for each key, not recommended though. Much better way is to have an active serial keypad. If you have 2 port pins you can really use any clock+data protocol. Probably I2C is a good option, then you could use something like a PCF8574 expander chip on the keypad, this would give you a 4x4 matrix. You could even use standard serial and one port pin if you had a small micro decoder on keypad instead, pic etc.

Thanks GrandAlf....:D

Added after 5 minutes:

so you are talking about this type of Circuit......:arrow::arrow::arrow:

Thats the sort of thing, if you have a chip that supports I2C in hardware then even easier, although software bit banging is fine for the data rates that you will need. Doing it this way means you can just use the expansion chip like any other 8 bit port.


    Points: 2
    Helpful Answer Positive Rating
Thanks matbob...:!: :D

you are great man.

appreciate that. :D

Nice Tips n Tricks in this file. Help me out in future also. :D

well i took that tip and used to make it for an AVR microcontroller...

don't mind the Graphic LCD part, it's another story...

it worked, I have a more complicated firmware for the same hardware,

notice the resistors values, they must be exactly!


    Points: 2
    Helpful Answer Positive Rating
Thanks man...:!::!::!:

Appreciate your work.:!::!::!:

If you do it the analogue way, you need to make provision to handle multiple simultanious key presses, it will happen in the real world.

that's right, using a single analog input with discrete components has a tradeoff, it can only detect a single keypress... I couldn't find a resistor combination strong enough to detect many keypresses combination... of course using active components (other uc or io expander) could solve this issue.

Not open for further replies.

Part and Inventory Search

Welcome to