Looking for an expelation for strange behavior of tact switch.
AndrejaKo
Posts: 24
Hi!
I don't know where to post this, so I decided to put it in general. Feel free to move!
So I got some tact switches and I've set them up in a simple circuit for the Propeller Demo Board. Basically I've got a 10 kΩ resistor going from the VDD to VSS and the switch going from the resistor to a Propeller pin. The Propeller is programmed to turn an LED on when the switch is pressed.
Now comes the strange part: When I touch the metallic body of the switch with my finger, the LED turns on! I'm 100% sure that I'm not actually applying any force at the plastic switch, just touching the body.
Why would that happen?
I don't know where to post this, so I decided to put it in general. Feel free to move!
So I got some tact switches and I've set them up in a simple circuit for the Propeller Demo Board. Basically I've got a 10 kΩ resistor going from the VDD to VSS and the switch going from the resistor to a Propeller pin. The Propeller is programmed to turn an LED on when the switch is pressed.
Now comes the strange part: When I touch the metallic body of the switch with my finger, the LED turns on! I'm 100% sure that I'm not actually applying any force at the plastic switch, just touching the body.
Why would that happen?
Comments
It sounds to me like your finger is injecting electrical 'noise': could you kindly post the exact code you are using, together with further details of the hardware.
There are easy circuit recipes that will enable you to make the hardware stable, then 'debounce' the switch in software sucessfully. Just give us a few more clues to work on ...
Regards,
T o n y
The proper input circuit for a switch would have a 10K resistor from Vdd to the Propeller I/O pin and the switch from the Propeller I/O pin to Vss. You can also connect it the opposite way with the 10K resistor from Vss to the Propeller I/O pin and the switch from the Propeller I/O pin to Vdd.
Anyway, put your resistor in the right spot and it should stop doing this.
pull down on the left, pull up version on the right.
R= 10k to 470k, if battery operated curcuit and switch stays closed for longer lenghts use 100-470k.
Think of it as water:
when the switch is open, the line will eventually fill up (pull up version) a larger resistor and it takes longer.
When switch is closed the water in the line connected to the prop empty's out fast,
much faster than the water coming in through the resistor. so now you get your zero state.
http://vimeo.com/1133329
I can't believe I made such a beginner's mistake and did not notice it until now.
I fixed the pushbutton circuit and did some debouncing too, so it works fine now.