Pages: [1]   Go Down
Author Topic: Powering something from a I/O line?  (Read 914 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 484
Posts: 18764
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged


Offline Offline
Edison Member
*
Karma: 5
Posts: 1730
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

SW Scotland
Offline Offline
Edison Member
*
Karma: 17
Posts: 1389
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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

Monterrey, N.L. México
Offline Offline
Full Member
***
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.   smiley
Logged

Billy     http://www.z-world.com/operations/gbremer/

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

0
Offline Offline
Shannon Member
****
Karma: 206
Posts: 12164
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Edison Member
*
Karma: 5
Posts: 1730
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 484
Posts: 18764
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 132
Posts: 6747
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 484
Posts: 18764
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Cumming, GA
Offline Offline
Edison Member
*
Karma: 20
Posts: 1655
Ultimate DIY: Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

SE USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

we call that "Hollywood" electronics
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: