Go Down

Topic: Powering something from a I/O line? (Read 981 times) previous topic - next topic

fred256

Hello,

I'm building a wireless temperature sensor using an ATtiny85, DS18B20 temperature sensor and a 433 MHz RF transmitter (http://www.sparkfun.com/products/10534).

To conserve battery power, I'd like the transmitter to only be powered when I actually transmit data (once a minute for a short time).  The transmitter takes about 8 mA, so technically I could power it directly from a data line, but it somehow doesn't "feel" right to do this.  Should I use a transistor to turn it on, or am I overcomplicating this?

Thank you.

Nick Gammon

We had a bit of discussion about this a while back.

The outcome (as I recall) is documented here:

http://www.gammon.com.au/forum/?id=11497

See near the bottom "Powering off external devices".

A current-limiting resistor and a decoupling capacitor should be all you need.

http://www.gammon.com.au/electronics

winner10920

I've powered ds18b20s off of I/o pins simple because then I can plug it right in for an easy reading( or so I thought except the internal pullups aren't enough), I set one low, middle input and the last high, works fine without transistors,limiting resistors, or caps,
ofcourse if you have the opportunity to use them its always better to be safe then sorry

jackrae


Re  http://www.gammon.com.au/forum/?id=11497
Fabulous site Nick
Sensible talk and excellent presentation
Jack

bibre

I agree jackrae,

¡Arriba Nick!

I like how you help so, so many people, that need it. It is so clear to me that your help is invaluable.

¡Muchas gracias Nick!, Please don't ever leave this board.   :)
Billy     http://www.z-world.com/operations/gbremer/

When you've eliminated the impossible,
whatever remains, however improbable, must be

MarkT

Well looking at the article there it comments "This technique requires that the device you are powering from a digital pin does not draw more than the pin can supply (ie. 20 mA)."

But there is a 220 ohm resistor (plus the output resistance of the Arduino pins, about 40 ohms from the datasheet, ie 260 ohms).  If you try to get 20mA through that you'll lose 5.2 or your 5.0V !

If you'll accept a 0.5V loss in supply voltage you are limited to devices using 2mA or less.  An 8mA load will see only about 3 of the 5V!

If a device wants a constant supply despite load fluctuations this technique doesn't really work - its better to use an external pnp transistor or pFET than can provide a low impedance to the supply (and safely handle transients associated with charging up decoupling capacitors.  A PNP is a good choice because you can limit the transient current by setting the base resistor - thus preventing the transient from crow-barring the main supply rail.  For instance to saturate a PNP at 8mA you'd need <1mA from the output pin.  Remember to allow settling time for the switched supply.

You could also used a switched (not switching, note) regulator from Vin to drive the external component - then the Arduino supply is fully isolated from any switching transients.  You'd want one with very low quiescent current rating of course.
[ I won't respond to messages, use the forum please ]

winner10920

Id say your fine with powering it straight from an I/o pin so long as you don't short anything accidently
The ds18b20's I do it with only draw 1ma at most and I've had three on there at once, now idk how it would react with 8ma but I imagine so long as you don't get spikes of current like when it is sending/receiving you'll be fine

Nick Gammon


But there is a 220 ohm resistor (plus the output resistance of the Arduino pins, about 40 ohms from the datasheet, ie 260 ohms).  If you try to get 20mA through that you'll lose 5.2 or your 5.0V !


Good point, MarkT. There's the flaw in my argument. In my case I was describing a DS1307 clock which uses 1.5 mA when operating, so that would result in a voltage drop of 0.39V over 260 ohms at 5V. Since it can operate down to 4.5V it is just in range.

For the transmitter it looks like the transistor is a more sensible solution.
http://www.gammon.com.au/electronics

westfw

OptiLoader was originally designed to power the target AVR from an IO pin (~40ma Max, and an Atmega328 draws about 25)
It worked fine, but "stuff" kept getting added to arduino boards (auto power-switching circuit, 3V regulator, ethernet chip), and its been de-emphasized...

Nick Gammon


But there is a 220 ohm resistor (plus the output resistance of the Arduino pins, about 40 ohms from the datasheet, ie 260 ohms).  If you try to get 20mA through that you'll lose 5.2 or your 5.0V !


Something doesn't quite add up here. How can I lose 5.2V out of 5V? It's like losing three apples when I only started with two.

Say I used a 1K resistor. Then theoretically I have "lost" 1000 * 0.020 which is 20V. But that can't be right.
http://www.gammon.com.au/electronics

pwillard

Regardless of all the discussions and rationalizations, it is my opinion that is is a bad practice.

Osgeld

Quote
It's like losing three apples when I only started with two.


we call that "Hollywood" electronics
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

fred256

So it turns out I was in fact overcomplicating this: due to the simple on-off keying principle of the transmitter, it hardly uses any power when the input pin is low.  So I don't have to bother switching it off in the first place.

Go Up