I've got a reasonable enough grip on the use of the watchdog timer and sleep mode.
My current project is also going to use a shift register and some SN754410, but only for a few milliseconds every few hours. What's the most reasonable way to secure power to these during down time? A MOSFET feeding the VCC pin? Mechanical relay?
I'm not finding any obvious examples of power saving beyond the controller itself.
Assuming I am reading the datasheet correctly, the current consumption with the two drivers disabled is... ICC1 = 25mA; IOZ(off) = 500µA; ICC2 = 5nA ...about 26mA. Too much?
I would think that would be worth trying to conserve, no?
Here are more details. The project is an irrigation controller. The power source is just two AA batteries, supplemented with a solar panel, and a cheap 5v boost from EBay. The valves are triggered by a 20 millisecond pulse, reversing the polarity closes them. That's what I'm using the h-bridges for. The shift register is just to reduce my pin consumption, as I will have hygrometers and an LCD in the works as well.
Even on hot dry days, opening and closing all four valves twice, that doesn't add up to a full second of use of those three ICs. Shouldn't I try to secure power to them altogether? Or am I being overly stingy?
Well, keeping it under 20mA is preferable but I've got a few projects where a peripheral is powered directly from a digitalWrite(, HIGH) 26mA should be no problem so long as you're not exceeding the total output current with all your pins added together.
I would think that would be worth trying to conserve, no?
It is your application. The people on this forum can provide guidance but only you can definitively answer that question.
ChuckJaxFL:
If the other ICs draw a total of less than 40mA, is there a reason I can drive them from one of my IO pins?
Maybe. The pin driver is not ideal; it essentially has a resistance. The voltage supplied to the other device will be less than VCC. Some devices will tolerate the lower voltage some will not.
However, the datasheet is quite clear. 40mA may damage a pin. Try to keep the current at or below 20mA.
Shouldn't I try to secure power to them altogether?
You have to. If you power the valves but not the SN754410 you will very likely damage the SN754410.
Even though you know what you're talking about, I think it's important to make things clear for other people: "absolute maximum ratings" means that drawing that amount of current or more WILL damage the pin. Even though it might not, one has to understand "will" and not "may" for reliable design.
No, the MOSFET is the correct solution. When the MOSFET is conducting, its on resistance can be milliohms. Milliamps applied to milliohms means your voltage drop will be nanovolts. A relay also has a "contact resistance" which is likely to be more than the MOSFET plus you also have to wait for the relay contacts to move - the MOSFET is much faster.
If you're just powering a digital chip like a shift register and you know that the output current won't exceed the maximum absolute ratings then I would not worry about the voltage drop. If you're powering any analog device, like a DAC, then the voltage may be important.
Sacha22:
I think it's important to make things clear for other people: "absolute maximum ratings" means that drawing that amount of current or more WILL damage the pin.
I am paraphrasing what is provided by Atmel (highlight added)...
*NOTICE: Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent damage to the device. This is a stress rating only and functional operation of the device at these or other conditions beyond those indicated in the operational sections of this specification is not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability.
ChuckJaxFL:
And this would also be true if I use pretty much anything other than a relay, correct?
A relay with superconducting contacts? Yes. However, I doubt you need such a thing.
The difference is the order of magnitude in voltage drop. You can easily find a relay or MOSFET that will have a drop so small as to be insignificant. The drop from an AVR I/O pin is several orders of magnitude more which makes it a concern.
Any transistor or MOSFET would suffer some drop?
Correct. Again, what is important is the amount. Relay / MOSFET can be very small; typically insignificant. A bipolar transistor drops about 0.7 volts.
[ A BJT does not drop 0.7V in saturation. In fact you can get some that drop less then 50mV, although
0.25V is more common. 0.7V is the base-emitter voltage. ]
The main reason not to use Arduino pins as switched power is you can't add decoupling capacitors to the
switched power rails without totally exceeding the Arduino pin maximum ratings - decoupling caps can
draw high currents on power up. It would be a rare situation where the load didn't require decoupling.
Ideally you want to switch power with a soft switching device, so such decoupling capacitor charging
isn't too rapid. A p-channel logic-level MOSFET with a 10k gate resistor will do nicely - the high gate
resistor value slows down the switch on (which is OK for single events, not good if doing PWM).