Hello YouTubers, here is the guy with the Swiss accent.
In video #131 I pimped my Raspi by protecting it from an unforeseen shutoff without proper
“Linux” shutdown.
But then, I had a battery pack as a backup.
Today I want to reach the same goal, but cheaper.
I want to use Super Capacitors instead.
This principle can also be used for Pi Zeros.
Just to recap: We want to create a signal for a GPIO of a running Raspi as soon as the
supply voltage is interrupted to trigger a software which immediately starts a controlled
shutdown.
And we need some sort of “energy source” for a few seconds, until this shutdown is
finished.
Last time, we used a “battery fuel gauge” to create a signal for “low energy level”.
I will use the same principle also for today’s build.
In the meanwhile, a viewer pointed me to the KA75XXX series of “voltage detectors”.
They detect low voltage, for example the KA75450 detects 4.5 volt.
These parts could also be used instead of our bar display.
But I do not have one of those on hand for the moment.
So, we have to use what we have.
If you remember: The bar gauge is for 3.7 volt batteries, but our Raspi run on 5 volt
USB.
So, we have to use a trick: I connect two diodes in series to the display.
Each of them “destroy” about 0.5 volts.
If we connect our low-voltage-level signal to the output for the second bar, everything
works fine and we get a signal at about 4.8 volts.
Now, we just have to build our small PCB with the NPN transistor and we are good to go.
Next, we need a short-term storage device for 5 volt.
Last time, I used a battery.
This time, I want to use super capacitors for this purpose.
But why super capacitors?
If we compare them with batteries, we see some big differences.
For example, they are much bigger and much more expensive for the same capacity.
And you can charge and discharge them very, very fast.
Which is not needed for a Raspberry drawing 1 Ampere maximum.
So, at the first glance, they do not really fit our purpose.
But they have a big advantage compared to the batteries: You cannot overcharge a capacitor.
At a constant voltage level, the charging current becomes zero after a while.
So, we do not need a charging device.
And you can discharge capacitors to zero volt without any problems.
So, we also do not need any protection against deep discharge.
We just need bare capacitors.
Most super capacitors are only made for 2.7 volts.
So, we need two in series to store the 5 volts needed for our Raspberry.
Even if we take the maximum specifications for USB, which is about 5.2 volt, we are still
below the 5.4 volt of two super caps in series.
We will later on decide, which capacity the capacitors need.
So, we connect the two super caps in series and connect this directly to the 5v supply
pins of the pin header of the Raspi.
Like that, we do not need an additional micro USB cable.
In addition, we connect wires with Dupont headers to 3.3 v and GPIO 18 as in video #131
and the hardware is ready.
If we power the Raspi now, we see, that it draws quite some current.
This is, because the super caps have to be charged first.
The voltage increases slowly, as expected.
Above about 3 volts, the Raspi starts to boot and after a while, we reach the full 5v of
the USB cable and the current is now normal for the Raspi Zero.
So, we reached the steady state and, as foreseen, the capacitor is not charged anymore.
Now we have to apply the same software magic as last time: Copy our small python program
and a laucher.sh file to our Raspi, create a directory for the log file, and create an
entry in crontab for the automatic start at boot.
You find all commands and files on my new blog page under video #131.
Now, we can test the device: I remove the power, and really, the voltage starts to sink
quite fast.
Suddenly, the Raspi starts to shut down and switches off.
We see that, because the voltage decreases a little slower, if the Raspi is off.
So, we achieved our goal, a safe shutdown.
And we still have some leeway, because complete shutdown is at a voltage around 4 volts.
So, we have to answer the last question: Which size of capacitors do we need?
My Pi Zero works fine with these two 10 Farad capacitors.
For the Raspberry Pi 3 I suggest to use slightly bigger capacitors, for example 15 or 20 Farad.
Of course, we could also use bigger super caps like these with a capacity of 500 Farad.
This is not a good idea because they need a very long time till they reach the 3 volt,
and the USB cable can get pretty hot during this process.
It is even possible, that your USB charger is overloaded.
So, 15 or 20 Farad are a good compromise.
And from now on, your data on your Raspberries is safe.
One last thing concerning overloading of the super caps: Because we use them in series,
it could happen, that one is charged more than the other and would be charged above
its maximum voltage.
Under normal circumstances, this should not happen, because we are still below the maximum
voltage of 5.4 volts and because both are completely discharged after a few hours without
USB current.
Just make sure, that you start with both completely discharged.
Because I was not able to use the device for a long time, I would be interested in your
experience with super caps.
So, summarized: • We wanted to protect our data on the Raspberries
through a proper shutdown even if we lose power
• For that, we looked at the differences of Super Caps vs. batteries.
Batteries seem to be much better • The charging curve of a super cap is similar
to a normal capacitor.
This is, why it stops loading if a constant voltage is applied
• This makes these capacitors ideal for short-term power storage, because we do not
need charging or protection circuitry • We used the same “loss of power indicator”
from video #131 using a cheap “battery fuel gauge” and an NPN transistor and
• We installed the Python script also from video #131 and made it start automatically.
• At the end, we have a small and cheap device which works fine for our purpose
I hope, this video was useful or at least interesting for you.
Bye.