Go Down

Topic: Any arguments against using internal pull-ups? (Read 1 time) previous topic - next topic

Krupski


These I believe are 10k-50k.
I use them all the time.
However in a noisy environment and with longish cables you my want to use a low external value 470=1K.


THIS exactly. I had a problem with a little controller that I built to use in a rather noisy (electrically noisy) area. Simply using "PINMODE INPUT_PULLUP" was not enough. At first I thought I had *really bad* switches that bounced a lot (and had to write some debounce code with a hideously long 100 msec timeout to make it work).

It kept bugging me that the switches couldn't be THAT bad, so I did a little test code to read the digital ports as fast as possible and record it to SRAM. Then I looked at it. Lots of noise, and doing an FFT on the noise showed (surprise) a 60 and 120 hz component (ac line noise).

Changed to using hard wired 1K (1000 ohm) pullups. No problems now at all... solid as a rock.

For what it's worth.........
Gentlemen may prefer Blondes, but Real Men prefer Redheads!

MarkT


If I could have my way they would be pull-downs because it seems more logical to me somehow that pressing a button should take it HIGH, but having said that I have no problem using INPUT_PULLUP and testing for LOW on a pin.  The convenience of not having to wire in an external resistor far outweighs other considerations.


The reason pull-ups are used is that then the switches can all wire to ground (which
is usually available everywhere as the groundplane or chassis or box in which the
equipment is mounted).  You don't need another wire to run Vcc to all your buttons.

Also several bus protocols use pull-up resistors and open-drain outputs, so there are
two reasons why pull-ups are more commonly wanted than pull-downs.
[ I won't respond to messages, use the forum please ]

PeterH

I think the biggest reason why active-low has become the preferred approach is that it avoids needing to supply power to remote switches/devices, which means there's less risk of a wiring fault/damage shorting the power to ground. When your only wires are ground, and something that is designed to be pulled down to ground, then it's pretty difficult to blow it up.
I only provide help via the forum - please do not contact me for private consultancy.

tylernt


If I could have my way they would be pull-downs because it seems more logical to me somehow that pressing a button should take it HIGH,


Code: [Select]

#define ACTIVATED LOW

if(switchpin == ACTIVATED) // see now it makes sense :)
  {
  // do stuff
  }

PeterH


Code: [Select]

if(switchpin == ACTIVATED) // see now it makes sense :)



Shouldn't that have a digitalRead() in there somewhere?
I only provide help via the forum - please do not contact me for private consultancy.

Go Up