![]() | ![]() | ![]() |
| | |||||||
| Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| Mabuhay, Anyone from the community who have done keypad implementation on a PIC using Analog-to-digital conversion? Any info, materials and/or a sample snippet ... Thank u. | |
| |
| | (permalink) |
| I've never actually done it, but I've seen it done a lot over the years. The technique is very simple, you feed +5V through a resistor to the A2D input, so it now reads 5V - no button pressed. You then have a series chain of resistors from this point, with switches down to ground. So when you press a switch it creates a potential divider with the upper feed resistor. By carefully selecting the resistor values you can find which key was pressed by measuring the voltage. It's usual to have one key which shorts directly to ground, so that key would read 0V, no key 5V, and all others somewhere inbetween. How many buttons are you wanting?. | |
| |
| | (permalink) | |
| Quote:
Thanx | ||
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) |
| would this work...? | |
| |
| | (permalink) |
| Where are you going to connect the pic's input to ? | |
| |
| | (permalink) | |
| Quote:
I guess this URL --> http://www.reed-electronics.com/ednm...amorim&stt=000 will give an insight that it is possible to design a keypad matrix that only use one analog port to the PIC microcontroller. Thanx for your reply and input. | ||
| |
| | (permalink) | ||
| Quote:
@rrb011270 Scanning keys using resistors an an ADC is common practive (philips even does so in some televisions) but, as you can see on the url you gave yourself, the resistors have to be placed between the switches. These 4 x 4 keypads you want to use are internally already pre-wired (in a matrix shape) wich prevents you from connecting those resistors. If you got a keypad wich allows you to connect every switch independently then there should be no problem. | |||
| |
| | (permalink) |
| Hi exo, You can read the voltage of the R8 for example. Problem with the previous circuit is that multiple keys pressed at once would not be detected. For example upper left key (A-G) would short most of the network and any other key would not be detected. Also circuit would continuously draw current. After some thinking I came up with another circuit which should be better. | |
| |
| | (permalink) |
| Yep, that should work. I'd recommend ratio for the R1-R7 values 1:2:3:4:4:8:12 For example R1=100 R2=200 R3=300 R4=400 R5=400 R6=800 R7=1200 Resistor R8 is load and for good results it should be much bigger than the other resistors if you want really linear system (the best would be to use constand current instead of fixed 5V source). I calculated things over using 10k for R8 and that looked very good. The output signal in this case is only few mV and needs to be amplified of course. Using lower value does work as well, it's just that graph is slightly bent. Values similar to R7 should be acceptable. Lower R8 also provides for larger output change. Anyway, it's an idea... use it on your own risk :lol: :lol: :lol: | |
| |
| | (permalink) | |
| Quote:
BTW, I use a discrete switch here a surface mount type and a surface mount type resistor network for my switches... With this I can select higher values of resistor in -order to have minimum current consumption. The only problem with higher resistor values is the equivalent resistance which exceeds the required impedance for the analog source... a 2.5K for PIC18Fxxxx sereis and most of the PIC16Fxxx series have 10K. The solution I use in order to meet this impedance requirement esp. I am using the PIC18F1320 I have a voltage follower and a buffer rail-to-rail OPAMP with a teraohms input and a low impedance output. With this configuration I can utilize the extra port of my PIC for access control and monitoring. BTW, I got my circuits working now... esp. ADC part... Thanx | ||
| |
| | (permalink) |
| Did it work? | |
| |
| | (permalink) | |
| Quote:
| ||
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |