input from keypad and microcontroller

Hi all,๐Ÿ˜

can you guys help me with: how to input a value from a keypad (say a keypad having 4 numbers; 1,2,3 and 4) into a microcontroller and the latter reads the number entered?

e.g. i want the microcontroller to know that my system must shutdown when the bump sensor reads '2', i.e it hits something twice. So when i pressed the key '2', the microcontroller gets the value '2' and will compare it with the bump count. But i don't know how to do it.๐Ÿ˜•

i am thinking of using 4 different switches, each defining numbers 1 to 4. but this would occupy 4 ports.. so guys can this be done using ONLY ONE PORT? ๐Ÿ˜’

please reply soon.

regards,
Satanas

Replies

  • reachrkata
    reachrkata
    Sure can. You can do it with a single ADC port.

    Connect the ADC port to the supply via a 47k pull-up (say).
    Next, connect different pull-downs to the same port through the 4 keys.
    For example, Connect the ADC port to GND via a 1K and Key 1.
    Again connect the ADC port to GND via a 2K and Key 2.... and so on.

    When no key is pressed, the ADC detects Vcc. When Key 1 is pressed, the ADC detects the voltage due to potential divide of 47k and 1k.
    ..... and so on.

    -Karthik.
  • satanas
    satanas
    Hi Karthik,

    thanks for the tip.. i will try it right away..

    cheerz.

    regards.
    satanas
  • satanas
    satanas
    Hi,

    i tried it but things are not working.. can you provide me with the circuit please-resistors values? the supply is 5V and am sure i did something wrong.. so please help me.. i have limited time. i would be very grateful to you guys..

    regards,
    satanas
  • reachrkata
    reachrkata
    Perhaps this clarifies everything -

    [โ€‹IMG]
    -Karthik
    ๐Ÿ˜
  • Ashraf HZ
    Ashraf HZ
    In all honesty, I never thought of that kind of approach before ๐Ÿ˜›
  • reachrkata
    reachrkata
    No sweat Ash !! i too learnt it only in my company !!!

    -Karthik
    ๐Ÿ˜

You are reading an archived discussion.

Related Posts

Hi cean's, I recently installed Ubuntu 9.10 & it's working fine on my pc. I am able to install softwares from "software center" present in it by searching required software...
We all use mobile phones in everyday life, but very few of us know the exact working of the principle on which these cellphones work. I need a very simple...
SAE NORTHERN INDIA SUMMIT,IGIT its going to b held on 6 march organised by IGIT-SAE club ,invites ur projects (mech engnn),send abstracts 2 sae.igit@gmail.com prize 10k
I need to know how a digital camera works with simple explaination.
Make your very own Pendrive a Portable RAM (virtual)๐Ÿ˜ Just Follow these steps :- 1. Insert the Pen Drive (1GB atleast) in the USB port, i suggest you use 4GB....