Offline
Newbie
Karma: 0
Posts: 9
|
 |
« on: April 06, 2012, 11:20:58 pm » |
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
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13896
Lua rocks!
|
 |
« Reply #1 on: April 06, 2012, 11:28:03 pm » |
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=11497See near the bottom "Powering off external devices". A current-limiting resistor and a decoupling capacitor should be all you need.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 3
Posts: 1712
|
 |
« Reply #2 on: April 06, 2012, 11:43:35 pm » |
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
Edison Member
Karma: 6
Posts: 1053
Arduino rocks
|
 |
« Reply #3 on: April 07, 2012, 02:46:17 am » |
Re http://www.gammon.com.au/forum/?id=11497Fabulous site Nick Sensible talk and excellent presentation Jack
|
|
|
|
|
Logged
|
|
|
|
|
Monterrey, N.L. México
Offline
Full Member
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
|
 |
« Reply #4 on: April 07, 2012, 03:26:02 am » |
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. 
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Tesla Member
Karma: 71
Posts: 6623
Arduino rocks
|
 |
« Reply #5 on: April 07, 2012, 08:38:40 am » |
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
|
|
|
|
|
Offline
Edison Member
Karma: 3
Posts: 1712
|
 |
« Reply #6 on: April 07, 2012, 12:09:26 pm » |
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
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13896
Lua rocks!
|
 |
« Reply #7 on: April 07, 2012, 04:01:58 pm » |
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
Faraday Member
Karma: 78
Posts: 5454
Strongly opinionated, but not official!
|
 |
« Reply #8 on: April 07, 2012, 04:39:05 pm » |
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
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13896
Lua rocks!
|
 |
« Reply #9 on: April 07, 2012, 05:01:52 pm » |
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
Edison Member
Karma: 12
Posts: 1389
Ultimate DIY: Arduino
|
 |
« Reply #10 on: April 07, 2012, 07:19:04 pm » |
Regardless of all the discussions and rationalizations, it is my opinion that is is a bad practice.
|
|
|
|
|
Logged
|
|
|
|
|
SE USA
Offline
Faraday Member
Karma: 33
Posts: 3623
@ssh0le
|
 |
« Reply #11 on: April 07, 2012, 07:29:31 pm » |
It's like losing three apples when I only started with two. we call that "Hollywood" electronics
|
|
|
|
|
Logged
|
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
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 9
|
 |
« Reply #12 on: April 08, 2012, 02:51:17 pm » |
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
|
|
|
|
|
|