15
\$\begingroup\$

I want to install an Arduino Uno in a car, powered by a consumer 12V->5V car voltage regulator plugged into the lighter socket. The socket is switched, i.e, there's no power when the motor's off. When I turn off the engine I'd like to keep the Uno powered for extra ~3 secs. Can I use a capacitor in parallel to the Uno to get the extra 3 secs of power once the motor's off? How would i determine the capacitance? Should the cap be placed before the volt. regulator (i.e. directly on car's 12V) or after volt. regulation (on the regulated 5V)? Would I need some diodes to go with it? I don't want to put the Uno on the car's unswitched circuit, because it seems wasteful to run the Uno 24/7 off the battery just so it can be used for extra 3 secs when the motor's off. Thanks.

\$\endgroup\$
3
  • \$\begingroup\$ The car's 12V is more like 13.4-14V when running. Keep that in mind. \$\endgroup\$
    – Shamtam
    Jun 9, 2012 at 5:39
  • \$\begingroup\$ Probably way more than you need but just in case you have other items pulling a current too... lindelectronics.com/cgi-bin/store/shop.cgi/!ORDERID!/other/x/… \$\endgroup\$ Jun 12, 2012 at 18:26
  • \$\begingroup\$ You can send the Uno in low power mode, with basically no current consumption, then wake it up automatically as soon as the "accessories" power line has enough votlage on it (use a voltage divider with resistors). This way you can simply detect power off (no more signal on the accessories) and turn off the Uno with a timer, after you finish doing what you wanted to do. \$\endgroup\$
    – FarO
    Feb 2, 2016 at 10:44

3 Answers 3

13
\$\begingroup\$

Don't use the 12V\$\rightarrow\$5V regulator, the Arduino needs at least 7V in. Use the battery's 12V directly instead.

The capacitor's value will depend on the Arduino's power consumption. The Arduino webpage doesn't say what the Uno consumes, so you can't say right away what capacitor value it needs. In any case it's not designed for low power. I checked the datasheet for the voltage regulator, and that alone already uses 6mA. On the schematic I can see two microntrollers: an ATMega16U2 running at 16MHz, and an AtMega328P, also at 16MHz. The former may consume up to 21mA, the latter says 9mA at 8MHz, so it's safe to say 18mA at 16MHz. We already have 45mA, let's round it to 50mA for the other components.

If a capacitor is discharged at a constant current, then

\$ \Delta V = \dfrac{I \cdot t}{C} \$

You start at 12V, and the Arduino needs a minimum of 7V, so \$\Delta V\$ = 5V, I was 50mA and t = 3s. Then

\$ C = \dfrac{I \cdot t}{\Delta V} = \dfrac{50mA \cdot 3s}{5V} = 30 000\mu F \$

That's the minimum, I would pick a 47 000\$\mu\$F/25V capacitor. Add detection for power off, so that you can switch off all unnecessary outputs which also may consume current, a relay for instance.

If you want to know exact what the power consumption is, add a 1\$\Omega\$ resistor in series with the power supply and measure the voltage drop. A 50mV drop means 50mA consumption.

Also add a TVS (Transient Voltage Suppressor) at the Arduino's power input; a car's 12V is extremely dirty.

Add the diode clabacchio mentions. A series resistor of 10\$\Omega\$/5W will charge the capacitor in 1.5s when applying power.

\$\endgroup\$
0
4
\$\begingroup\$

An alternative to using a capacitor is to connect to the permanent supply but to use a timer to power down or disconnect after a suitable delay.

The circuit can be arranged to repower the Arduino via the switched circuit when power is next switched on.

Current drain when off can be essentially zero.

When power is switched on supply to the Arduino can be from switched or permanent supply as required.


As Clabacchio notes, if a capacitor is used, the holdup time =

t = C x V / I or
C = t x I / V

where t = holdup time. V = allowed drop in Volts and C = capacitance in Farads.

eg for 3 seconds, 50 mA, 5 Volt allow droop

C = t x I / V = 3 x 0.05 / 5 = 0.03F = 30 mF = 30,000 uF.

\$\endgroup\$
2
  • \$\begingroup\$ Ah yes, thanks. The 3 got lost in the woods. \$\endgroup\$
    – Russell McMahon
    Jun 8, 2012 at 10:43
  • \$\begingroup\$ Yes, permanent supply + low power mode + switched power sense = the right way to do this. \$\endgroup\$
    – Joel B
    Jun 8, 2012 at 13:53
3
\$\begingroup\$

You can use a capacitor, but you need quite a big one depending on how much your Arduino consumes. 3 seconds at - let's say - 25 mA is 75 mC (Q=I*t), that at 12 V are stored in a 6.25 mF capacitor.

$$\left( C = \dfrac{Q}{V} \right) $$

The problem is that the voltage will decrease linearly if you drain a constant current, and below a certain voltage your Arduino will turn off. If you put the capacitor before the voltage regulator it will store more charge for the same capacity value, and - more important - the regulator will allow a wider voltage range, so you'll be able to use better the capacitor.

Since the Arduino accepts 7-12 V supply, you have a 5 V range to have the capacitor discharge. Again, 75 mC over 5 V means 15 mF, so with a 20 mF capacitor you should be able to keep it alive.

Note: I don't know what your Arduino should do, so the power that it will consume; size your capacitor accordingly.

About how to connect it, I'd suggest a resistor and a diode in the lighter socket side, to prevent too fast charge of the capacitor and to avoid its discharge towards the lighter socket.

So, summarizing, if I is the average current absorbed by your Arduino, 7-12 V is its supply voltage range, the minimum capacitor size you need will be approximately:

$$ C = \frac{Q}{\Delta V} = \frac{I \cdot t}{\Delta V} = \frac{I \cdot 3s}{12V-7V} = \frac{3s}{5V}I $$

\$\endgroup\$
8
  • \$\begingroup\$ Thanks. I see a 5mF cap from Radio Shack for $7: radioshack.com/product/…. The Uno would activate a tiny (3.7g) servo, with no load on it. Not sure how much current a tiny servo with no load adds. Any suggestions for the resistor value/wattage? \$\endgroup\$
    – MrSparkly
    Jun 8, 2012 at 10:13
  • \$\begingroup\$ @user73921 - 5mF is not enough. I calculated the minimum in my answer, based on the most power-hungry components on the Arduino. See my answer for the details. \$\endgroup\$
    – stevenvh
    Jun 8, 2012 at 10:44
  • \$\begingroup\$ @user73921: I'd bet that's a 5uF part - sometimes the "micro" gets abbreviated to 'm' despite the fact that's the abbreviation for "milli"! See the datasheet here: sourceresearch.com/nte/nte-pdf.cfm?pdfpage=cfc.pdf \$\endgroup\$ Jun 8, 2012 at 10:52
  • \$\begingroup\$ @stevenvh: note that 5 mA is an arbitrary value, because I didn't know the needs, and consider that you can also user power saving modes if you don't need it all the time \$\endgroup\$
    – clabacchio
    Jun 8, 2012 at 11:00
  • \$\begingroup\$ @clabacchio - Product summary says \$\mu\$F. (Radio Shack really sucks.) Anyway, that's a 250V capacitor, that's not what he wants. \$\endgroup\$
    – stevenvh
    Jun 8, 2012 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.