2
\$\begingroup\$

I'm trying to make a simple ups for a raspberry pi dash cam. The goal is to provide power to the pi for about 10 seconds after the car has stopped running. When the power supply turns off, the gpio pin will read low and the pi will begin to shutdown, using the capacitor for power. I haven't decided on R3 or D1 yet, they will be determined by what the 5v supply can output.

Will the circuit below work for this purpose?

circuit

\$\endgroup\$
5
  • \$\begingroup\$ Do you know how much your current your Pi draws? And do you know if your Pi will happily operate at 5V-Vdiode? Oh, and why do you think you need R3? \$\endgroup\$ – uint128_t Jun 15 '16 at 0:13
  • \$\begingroup\$ The pi can run down to about 3.3v officially I believe. Providing you aren't using any picky usb devices. But yes I have tested it with a diode and it runs just fine. R3 would be a ~2-5ohm current limiting resistor. The super capacitor I have has an ESR of only 80mOhm so I thought I may need to limit the current depending on the 5v car supply I end up using. edit: also, the pi draws about 140ma under load \$\endgroup\$ – rujoesmith Jun 15 '16 at 0:19
  • 1
    \$\begingroup\$ This wonderful answer would suggest you can run it down to ~3.8V (without USB, HDMI, Ethernet) before you have boot/stability issues. If you bypass the regulator, then 3.3V is doable. 5Ω for R3 is probably a bit much (too much voltage drop), you're right: a current-limiting resistor is probably a good idea. \$\endgroup\$ – uint128_t Jun 15 '16 at 0:25
  • \$\begingroup\$ Thanks for sharing that, I think I should be ok bypassing the regulator. One more question if you have the time. Do you think a resistor is necessary in parallel with the capacitor? I have heard its better to discharge the capacitors when not in use rather than leave them for long periods of time. \$\endgroup\$ – rujoesmith Jun 15 '16 at 0:38
  • \$\begingroup\$ Sure, a (large) resistor in parallel with the cap would probably be appropriate. At this voltage, an energized cap isn't a huge issue (and the Pi will probably discharge it anyway), but it's good practice. Maybe 1k or a bit less, I suppose. \$\endgroup\$ – uint128_t Jun 15 '16 at 0:40
3
\$\begingroup\$

The relevant formula for this sort of circuit is below:

$$C_{min} = \frac{t_{HOLD}\cdot I_{OUT}}{\Delta V}$$

In your case, neglecting the voltage drop of the current-limiting resistor, and assuming you can run down to 3.3V, this becomes

$$C_{min} = \frac{10\text{ s}\cdot I_{OUT}}{5\text{V} - V_{diode} - 3.3\text{V}}$$

Ballpark numbers:

Use a Schottky diode, and you'll maybe have 300 mV for the diode drop. Let's say the Pi draws 0.4A.

With these numbers, the equation above gives 2.9F. So your capacitor is close, but might not be quite enough.

A 12V battery, charger, and buck converter might be a better way to do this. You'd at least be able to avoid the giant capacitor.

\$\endgroup\$
4
  • \$\begingroup\$ I think the 2.5F should be enough. The most ive ever measured the pi zero at while recording is 140mA at 5v. Thank you for those ideas though, i hadnt really taken all the voltage drops into account and I will definitely end up getting schottky now. Also, here is the cap I was planning on using, surprisingly it isn't all that big digikey.com/product-search/en?mpart=PHV-5R4V255-R&v=283 \$\endgroup\$ – rujoesmith Jun 15 '16 at 0:52
  • 1
    \$\begingroup\$ Sounds like you've got things planned out pretty well. Good luck! \$\endgroup\$ – uint128_t Jun 15 '16 at 1:05
  • 1
    \$\begingroup\$ There is another important consideration - can the capacitor sustain the required output current? supercaps tend to have very high ESR and frequently can't deliver more than about 100mA depending on size. Those that can will be physically larger. \$\endgroup\$ – Tom Carpenter Jun 15 '16 at 16:21
  • 2
    \$\begingroup\$ @TomCarpenter Yup, thanks for pointing that out. OP has stated his capacitor has an ESR of 80 mΩ, so I think he'll be alright. \$\endgroup\$ – uint128_t Jun 15 '16 at 16:23
1
\$\begingroup\$

The best solution I think in this case is to avoid a supercap altogether and instead draw directly from the car battery. You can easily get a direct lead to the battery from the car radio, or in a pinch run a wire from the fuse box. Use the switched power to start a timer and shutdown 10 seconds later. When the switched power comes on assert power to the board.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Drawing from the car battery has its own problems, in that the 12V signal and ground can be extremely noisy and spiky. However, proper filtering that can handle such issues is within the realm of reason. \$\endgroup\$ – nanofarad Jun 15 '16 at 16:27
0
\$\begingroup\$

In this circuit, the large capacitor will start at ~4.7V (5V minus V-D1, here I assume 0.3V but be careful if you have a generic 0.7V diode, and also beware of the voltage divider effect of R3) and decay from there, so it will be a game between the 4.7V sagging down and when the RPI browns out. If this was a production design, then you are spending way too much on the huge capacitor. Also, if the capacitor is fully discharged, then be aware of the inrush current that will occur when it is first powered up. With such a huge capacitor, D1 and R3 will see a ton of amperage for a bit of time.

So if you make D1 and R3 big enough (in terms of wattage), and the brown-out level for the RPI is well below 4.7V, and R3 isn't too high of impedance, then it will work. But I wouldn't do this in a production product.

It would be more efficient to connect your 12->5V converter to the battery (use a fuse). That way, the RPI isn't racing against time. You could put in a hold-up circuit so that when the RPI detects the car is off, it can do its tasks and then flip an output that turns off its own power, thereby conserving your car battery. No worries about brown-out behavior, minimal inrush current, no rush against time for the RPI, minimal drain on battery, and much cheaper in component cost.

\$\endgroup\$
1
  • \$\begingroup\$ Not production, just a hobby. Thanks for the alternative ideas though, that is probably a better idea. \$\endgroup\$ – rujoesmith Jun 22 '16 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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