To pull up or pull down..... with buttons
TJHJ
Posts: 243
So I have been pondering this issue for a while now, which is better or does it not really matter?
In the case of button switches, mainly.
Case 1.
Usually I make a button connection with 3.3v on the button side, and a 1k to ground.
So the issue I can is see is that if the pin was set as an output, potently it could sink the max current to the pin damaging the prop.
Case 2
But i see commonly it reversed with it being pulled up to vcc, and the switch pulls down to ground. The PDB board works this way, this is what got me considering it.
In case 2, it seems to me that you would excessively be sinking current all the time though the 1k resistor, not much but it would matter in battery apps ect, But it will never over current the prop pin...
So which is better? and why?
Thanks for help always.
TJ
In the case of button switches, mainly.
Case 1.
Usually I make a button connection with 3.3v on the button side, and a 1k to ground.
So the issue I can is see is that if the pin was set as an output, potently it could sink the max current to the pin damaging the prop.
3.3v | | ___ ----- | ------|-----<Prop IO PIN | > <1k > < | GND
Case 2
But i see commonly it reversed with it being pulled up to vcc, and the switch pulls down to ground. The PDB board works this way, this is what got me considering it.
In case 2, it seems to me that you would excessively be sinking current all the time though the 1k resistor, not much but it would matter in battery apps ect, But it will never over current the prop pin...
GND | | ___ ----- | ------|-----<Prop IO PIN | > <1k > < | 3.3v
So which is better? and why?
Thanks for help always.
TJ
Comments
in BOTH cases there could flow a high current if the button is CLOSED
if the button is opened, IO-pin is output and has the wrong logical stae the current is
3.3V / 1000 Ohm = 3.3 mA which is NO problem for the propeller.
1 case Pull-down: IO-PIN outpout and LOW button closed a high current will flow INTO the prop
2 case Pull-up: IO-PIN outpout and HIGH button closed a high current will flow OUT of the prop
to make it REALLY REALLY save you have to add a currentlimiting resistor like shown below
This creates a voltagedivider but the ratio between the resistors is so high that the voltage-levels ar still
far away from the threshold-point of 1.6V
The voltagedrop across the 330 ohm resistor is maximum
3.3V / (10000 + 330) * 330 = 0.105V
so
in case of pull-down the prop-pin gets 0.105V as LOW-voltage
in case of pull-up the prop-pin gets 3.3V - 0.105 = 3.195V instead of 3.3V as a high signal
but now in case of
IO-PIN set as output
the current is limited to (3.3V / 330 ohm) = 10mA which is save for the prop
best regards
Stefan
Post Edited (StefanL38) : 1/1/2009 9:17:10 AM GMT
As Stefan says, if you want to be sure, put in a series resistor, although I would use at least 1K with a 33K (10K-100K) pulldown/pullup.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439
cruising][noparse][[/noparse]url=http://www.bluemagic.biz]cruising[noparse][[/noparse]/url][/url]
This is a [noparse][[/noparse]b]bold[noparse][[/noparse]/b] test.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering