Go Down

### Topic: Does holding pin to ground (button) uses more current? (Read 2864 times)previous topic - next topic

#### bratan

##### Jan 28, 2015, 08:58 pm
I'm using a normally open switch on ATmega pin that's pulled high via internal resistor (INPUT_PULLUP). Is there more current used when button kept pressed, vs. when it's released?
I'm making a mailbox notifier where ATMega328p is sleeping most of the time, unless there's interrupt generated on pin where button switch is connected (i.e. when mailbox is opened). Switch is always pressed (i'm planning to use reed switch, and I only can find NO type) when mailbox is closed. Since everything is powered by coin cell, power usage is important, thus the question.
Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, etc.

#1
##### Jan 28, 2015, 09:08 pm
A little - 1uA max when open, and up to 5V/20K = 250uA when closed, but could  be as low as 5V/50K = 100uA.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### bratan

#2
##### Jan 28, 2015, 09:12 pm
A little - 1uA max when open, and up to 5V/20K = 250uA when closed, but could  be as low as 5V/50K = 100uA.
Thanks CrossRoads! So with 3V/20K it's still 150uA, that's too much   I guess I either need to find NC reed switch or just use physically micro-switch.
Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, etc.

#### Paul__B

#3
##### Jan 28, 2015, 10:25 pm
Actually, it's simple.

Just offset the reed switch so that as you open the mailbox, the magnet passes the reed switch, but does not activate it when fully closed.

#4
##### Jan 28, 2015, 10:30 pm

Or, just turn off the pull-up while the switch is closed.  (Requires polling to know when the switch is opened.)

#### bratan

#5
##### Jan 28, 2015, 10:36 pm
Actually, it's simple.

Just offset the reed switch so that as you open the mailbox, the magnet passes the reed switch, but does not activate it when fully closed.

Hmm great idea!  So if I add magnet to extension arm, it will move inside mailbox past sensor, is that what you mean?
Or, just turn off the pull-up while the switch is closed.  (Requires polling to know when the switch is opened.)

Yeah polling is an option, that was originally the idea (to use hall sensor and poll it), but it wastes too much power. If I use hardware interrupt to wake up microprocessor, power usage is so low that single 3V coin cell should be able to work for about a year or more without replacing...
Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, etc.

#### bratan

#6
##### Jan 29, 2015, 02:38 am
Just wanted to share, I found this video where guy shows how to "modify" reed switch from NO to NC with 2 magnets
Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, etc.

#### dlloyd

#7
##### Jan 29, 2015, 04:07 amLast Edit: Jan 29, 2015, 05:25 am by dlloyd
Configure the pin using INPUT (high impedance).

Pulled low at input, this will draw just 5µA when the reed switch is closed:

Pulled high at input, still 5µA current when the reed switch is closed:

Or ... use a NC reed switch and use INPUT_PULLUP. When when the mailbox door is closed, the switch is open (signal at pin is high, no current draw). When the door is opened, a falling pulse is created and can be detected using an interrupt. Overall, not much current draw to speak of. Could add a 100Ω resistor in series with the capacitor to limit the max current current through the reed switch.

Or ... if the mailbox door is only opened momentarily, then this will draw no steady-state current to speak of while the door is closed (use INPUT_PULLUP with NC reed switch):

#### bratan

#8
##### Jan 29, 2015, 07:39 pmLast Edit: Jan 29, 2015, 08:12 pm by bratan
Fantastic!!! I couldn't find any small NC reed switches, but using very high impedance resistor with NO switch is great idea!  I think I'm gonna go this route, since getting magnet past sensor is a little difficult mechanically...

EDIT: Just found this education article on Sparkfun about pull-up resistor values. So 1 M resistor might be too big for ATmega to register key-press?
Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, etc.

#### Paul__B

#9
##### Jan 29, 2015, 10:02 pmLast Edit: Jan 29, 2015, 10:04 pm by Paul__B Reason: Always more ...
Hmm great idea!  So if I add magnet to extension arm, it will move inside mailbox past sensor, is that what you mean?
That is what I meant.

However, using a second magnet on the other side of the reed switch, oriented in opposition to "bias" the reed switch off whilst the moving magnet is close - and bias it on when the moving magnet moves away - is a great idea too and probably is the more practical.

#### dlloyd

#10
##### Jan 30, 2015, 01:45 am
Quote
EDIT: Just found this education article on Sparkfun about pull-up resistor values. So 1 M resistor might be too big for ATmega to register key-press?
Note that the input impedance of a pin configured as INPUT will be very high (approx 100MΩ). http://arduino.cc/en/Tutorial/DigitalPins

With 1MΩ pullup resistor, I would use a capacitor in parallel to eliminate influence of noise (also acts as hardware debouncing). Give it a test.
With 1MΩ and 0.1µF  the response will be 0.1 sec Time Constant Calculator

#### kdub

#11
##### Jun 13, 2018, 04:29 am
I know this is a super old thread, but maybe someone will find it via Google and this will help. I am sort of pursuing this same goal, using a reed switch to wake up a pro mini.

I found a magnetic switch that has both NO and NC contacts. They are made by Sentrol and several other Home Automation / Alarm brands. They are sold as SPDT magnetic contacts. The part number for mine is 1076C. Hope this helps someone!!!
Disclaimer: My robots will one day eat Skynet.

#### ChrisTenone

#12
##### Jun 16, 2018, 03:40 am
I know this is a super old thread, but maybe someone will find it via Google and this will help. I am sort of pursuing this same goal, using a reed switch to wake up a pro mini.

I found a magnetic switch that has both NO and NC contacts. They are made by Sentrol and several other Home Automation / Alarm brands. They are sold as SPDT magnetic contacts. The part number for mine is 1076C. Hope this helps someone!!!
I use this tiny little switch that I get from Fry's. It's got two leads on one side, one is NO and the other NC. Just clip off the one you don't want.
Atmosphere carries combustion vapors to places where they will do good instead of harm - Mike Faraday's 'History of a Candle': https://www.youtube.com/watch?v=6W0MHZ4jb4A

Whoops

Go Up