Arduino Forum

Using Arduino => General Electronics => Topic started by: Wokstation on Feb 10, 2016, 12:37 pm

Title: Toggle switch/pulled-up pin extremely basic Q
Post by: Wokstation on Feb 10, 2016, 12:37 pm
This is an embarressingly simple question, but I thought I'd ask rather than remain in the dark...

I'd like to connect a basic flick-switch to an arduino, using the internal pullup to prevent floating.  It's to act as a mode switch for a lamp, so will be in either state for long periods, hence the question:

Is there any problem leaving a pulled-up pin with a high input for long periods? Overheating? Weird electronic-y things of which I'm unaware?

Or am I just pondering needlessly and it's totally fine and a standard thing to do?
Title: Re: Toggle switch/pulled-up pin extremely basic Q
Post by: codlink on Feb 10, 2016, 01:00 pm
Is there any problem leaving a pulled-up pin with a high input for long periods? Overheating? Weird electronic-y things of which I'm unaware
As long as the voltage and current are within limits, should last forever.
Title: Re: Toggle switch/pulled-up pin extremely basic Q
Post by: JimboZA on Feb 10, 2016, 01:18 pm
As long as the voltage and current are within limits, should last forever.
But with an internal pullup, which is what OP's getting at, we have no control over that. Have to assume that the power rating of the resistor is sufficient and that the (little) heat doesn't do any harm.
Title: Re: Toggle switch/pulled-up pin extremely basic Q
Post by: Wokstation on Feb 10, 2016, 01:33 pm
If it makes it more reliable, I can go the external pullup route instead (in which case, reccomendations on which value resistor to use would be extremely welcome).

The specific board in question is actually a clone - a Nano one, which I believe has 22k pullup resistors, but I'm not sure.

Many thanks for the help!
Title: Re: Toggle switch/pulled-up pin extremely basic Q
Post by: JimboZA on Feb 10, 2016, 01:46 pm
Unless someone tells you a horror story from their experience, I'd say you're ok tbh
Title: Re: Toggle switch/pulled-up pin extremely basic Q
Post by: JimboZA on Feb 10, 2016, 01:49 pm
P = V2/R = 25/22000 ~ 1mW.... no problem at all I'm sure.
Title: Re: Toggle switch/pulled-up pin extremely basic Q
Post by: Paul__B on Feb 10, 2016, 01:56 pm
Is there any problem leaving a pulled-up pin with a high input for long periods? Overheating? Weird electronic-y things of which I'm unaware?
Absolutely none.  It is specifically designed to do this, just like any other aspect of the microcontroller.

Or am I just pondering needlessly and it's totally fine and a standard thing to do?
To reiterate.  It is the standard thing to do.
Title: Re: Toggle switch/pulled-up pin extremely basic Q
Post by: Wokstation on Feb 10, 2016, 01:57 pm
Brilliant, thank you very much! Time to dig out the maths exercise book! (I use the grid to represent pin holes on perfboard ;) )
Title: Re: Toggle switch/pulled-up pin extremely basic Q
Post by: dlloyd on Feb 10, 2016, 02:16 pm
If the switch is close to the input pin, internal pullup should be OK. However, note that some switches specify a minimum DC switching current to operate reliably (could be 1mA). In this case, a lower value external pullup resistor is required.

If the switch has longer wires and/or located close to the lamp, then a lower value external pullup resistor is required to make a stronger signal and reduce noise pickup through the cables. If the lamp is AC, filtering or debouncing of the signal might be required.

Title: Re: Toggle switch/pulled-up pin extremely basic Q
Post by: raschemmel on Feb 10, 2016, 06:09 pm
Quote
P = V2/R = 25/22000 ~ 1mW.... no problem at all I'm sure.
Internal pullups are 50k. :

P = V2/R = 25/50000 = 0.0005 W = 500uW.... no problem at all I'm sure.
Title: Re: Toggle switch/pulled-up pin extremely basic Q
Post by: MarkT on Feb 10, 2016, 06:59 pm
Internal pullups are not actually resistors, they are actually FETs that behave like resistors,
you can rely on the value being between 20k and 50k, you cannot rely on them being
very linear (but why would you care).

For externally mounted hardware this is too weak a pullup - use 5k...1k sort of range
(a few milliamps).