In short, I have programmed and wired a speed/odometer and all is working well. However, I need to save data from the components/sensors once a power button is pressed, which has led me down the road of capacitors which seem to be the solution to my problem. Reading online about capacitors has dropped me in the deep end where I would like some help to see if I am thinking right.

I have attached a clearly very crude circuit which I need someone to confirm if I have it correct. If it's important, the whole system ran on 5v, powered by a 9v battery. Is a 5v Capacitor even the right one to use, considering that most components will not be active at the point of powering down?

OLD IMAGE: https://i.sstatic.net/aXhRi.jpg NEW IMAGE: https://imgur.com/a/aHRpzE4

Just tried to download the app and it's not happening for some reason, so the link(edited) will have to do, I'm sorry.

  • Err.... no. That is wrong. Very wrong.
    – Majenko
    May 12, 2018 at 13:19
  • This will not work. You have the capacitor in series with the battery, so only an alternating voltage would reach the Arduino. The battery provides a DC voltage, which cannot pass the capacitor. Are you trying to provide power to the Arduino with the capacitor, when the battery is disconnected (so that you have some time to save your precious data)? Then the capacitor has to be in parallel to the Arduino power supply pins. Also you have to sense, if the battery is disconnected, so that the Arduino can sense this and save the data in EEPROM.
    – chrisl
    May 12, 2018 at 13:20
  • Also the capacitance of the capacitor is the important characteristic. You will have to use one with a big capacitance, to provide enough current for the Arduino and your other components.
    – chrisl
    May 12, 2018 at 13:23
  • Hmmm, hold on two secs, just gonna upload another image to confirm we are thinking alike. Thanks btw. May 12, 2018 at 13:35
  • 1
    Please don't provide links to images. Upload the images directly (using the image button above the editor).
    – Majenko
    May 12, 2018 at 13:56

1 Answer 1


Just slapping a random capacitor across your supply is not going to work. It's far more complex than that.

Yes, a capacitor is used to store a charge, but you have to manage that charge properly or you won't get much of a chance to do anything with it.

You need to:

  1. Ensure that the discharge voltage remains high enough to run the chip for long enough to save your data (Note: writing to EEPROM causes an increase in current)
  2. Isolate the capacitor from the rest of the circuit so it only powers the main chip
  3. Monitor the incoming power to know when to do the saving.

A block-diagram of your setup may look something like this:


simulate this circuit – Schematic created using CircuitLab

In that diagram R1 and R2 form a voltage divider so you can monitor the battery voltage. C1 is a big capacitor. We're talking super-cap teritory here. Rated at 9V minimum. The regulator on the Arduino is ignored. You don't want to use it. Two external regulators are now used to power your project - one direct from the battery to run the breadboard and other external components (which will lose power immediately the battery power is removed) and the other to run the main MCU and nothing else. The second regulator is isolated from the rest of the circuit by D1, and the capacitor's charge then can only go through that regulator to power the main MCU.

That regulator for the MCU should be a switching regulator (DC-DC, "buck" regulator). If you use a linear ("LDO") regulator you will waste power and your capacitor will have to be two or three times bigger than otherwise. Even better would be to have a "buck-boost" regulator that will boost the voltage up to 5V when the input voltage drops below 5V, thus giving you even more life from the capacitor.

An alternative to all this is to use the 47C16 chip (5V) or 47L16 chip (3.3V) to store your data. This is an "EERAM" chip - an EEPROM with RAM buffer and automatic saving to EEPROM at power failure. It works through I2C and needs a capacitor connected to it directly to provide the backup power while it stores the data to EEPROM.

  • Thanks Majenko. Wow, I take back my comment, lol. It's gonna take a while for me to absorb this but will be right back. May 12, 2018 at 14:50
  • One thing I will say now that you have mentioned EPROM, one of the components is an SD card where the data is being saved...I will just mull over your post though a no. May 12, 2018 at 14:54
  • @user4163554 I have just added a paragraph about using EERAM instead.
    – Majenko
    May 12, 2018 at 14:54
  • @user4163554 SD cards don't play well with capacitor backup. They are far too power hungry and slow.
    – Majenko
    May 12, 2018 at 14:55
  • Thanks Majenko, I appologise for the delay. I have rewritten my code, got rid of the SD part, now sending it to EPROM instead as mentioned by yourself. All is working good. Thanks again. May 14, 2018 at 6:43

Your Answer

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

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