Keypad help (floating voltages)

Status
Not open for further replies.

willsor

New Member
Hey everyone... I am building a keypad lock for a project using a PIC and one of those passive keypa with 8 pins,4 input 4 output. Each of the pins corresponds to a row of numbers on the 4 by 4 keypad, and the 4 output pins correspond to the numbers in that row..so putting a 1 into input pin 1 will make the 4 output pins correspond to 1,4,7,dot. Putting a 1 into input pin 2 now makes 4 output pins correspond to 2,5,8,0 etc... this then goes into the pic and that advances the programme etc.
The problem is, the keypad keeps advancing the program without you pressing a key, the voltage into the pic floats around 1-2.5v which I can't get rid of. I have tried putting it through a 4050 non inverting buffer but then the output of the buffer just floats too... it should be giving out a solid 0v or 5v,not 2.5v

Can anyone suggest what to do?
Sorry if it is hard to understand... believe me, its harder to explain
Thanks
 
Last edited:
hi and welcome.
Whats the PIC type, are you using the internal weak pull ups.??
 
Hi, thanks for the swift reply.. apologies for that last post.. it was from my mobile and it didn't have much detail!

I am using a PICAXE28X.
I'm not sure what you mean by the weak internal pull ups, the keypad is all inside a plastic housing, so I can't get to it, but I'm pretty sure it's just a PCB.

I don't know the PIC has any internal pull ups, but if it does, I guess i'm using them
 
Last edited:
hi,
I dont use the Picaxe.
But on the PIC's I use they have internal 'weak' pull up resistors.

On the pins of the Picaxe that are used as inputs from the keypad, you need to have on each of the 4 pins a resistor from the pin to the +5V supply. The value of the resistors can be from approx 3.3K thru 10K, these will stop the pins from 'floating'.

If the output pins of the Picaxe to keypad are 'selected' high, you may have to connect the resistors as pulldown.

Post your Pixaxe program..
 
Last edited:
The pins are not in anyway connected to the 5v rail though, I'm not sure how to add that in, the only power the keypad recieves are the 5v signals from the PIC

EDIT EDIT: do you want a picture of the flowsheet, or the BASIC?
 
Last edited:
hi,
This is a typical app for a pad.

Is your program selecting the Rows or Cols as outputs, also is the selected Row/Column high or low.???

Code would do
 

Attachments

  • AAesp01.gif
    6.9 KB · Views: 264

My keypad looks sort of like that one..

This is my circuit diagram
**broken link removed**

I made this table to help with explaining this keypad..
Basically read it like: when pin 5 has a 1, pin 1 will output 5v when key 1 is pressed... etc..
1 indicates high, blank indicates low.
**broken link removed**
 
Last edited:
hi,
The way I read your post, is that each column is pulled High in turn while the other Cols are low, and the Row pins tested for a high. [ if key pressed]

So that means you need pull down resistors on the Row inputs, say 2K2 or 4k7 resistor on each Row input pin to 0V.

So when no key pressed all Row pins are low.
A key press on a Col thats high will put a high on the correct Row pin.
 
Last edited:
Hi Eric
sounds good, will I still need the 4050 buffer chip?
Also I never really understood pull down resistors, if they can pull 1.5Vish down to 0, will a 5v signal be pulled down to 3V, or anything like that?
Thanks for taking the time to help me here


EDIT: do you mean this sort of setup? (red arrows just included to help clarity)
**broken link removed**
Note the significantly less amount of effort put into this diagram for no reason at all
 
Last edited:
if it helps, I just think of pull(up/down) as resistors that fill.or drain(pulldown) the energy on that pin,
 
hi,
Without pullup or pulldown resistors on Inputs that can be left 'unconnected' to an external source, the inputs are 'floating'.

This means the inputs can assume any state ie : '0' or '1'.
By placing your hand or objects, wiring etc, close to the pins, there can be sufficient induced voltage, to make the high impedance [CMOS]
inputs at a an indeterminate state.
So when your program reads the input pins it could be either '0' or '1'.
By connecting pulldown resistors the unconnected input pin will be held close to 0v, so the program will 'see' a '0' state.

For a Column that has been set to 5V by the program, will, if a key on that Column is closed, then Row pin will be pulled to +5V, which the program detects as a '1'.

Note: In some cases depending upon the sense the Column is set active, it could be that the unselected Cols are all high and the selected Col is pulled low.
In that case the Rows would have pullup resistors, so when a key is pressed the Row pin is pulled Low.

EDIT:
On many of the 'larger' PIC's on PORTB, there is an option in the configuration part of the program to enable 'weak' INTERNAL pullup resistors [IIRC about 50k.?].
So if pullups are needed the weak pullups are used.
 
Last edited:
I think I understand it now, the pull ups worked by the way, the outputs now sit nicely at 0 or 5v, not in between
Thanks very much for helping me so quickly
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…