Raspberry Pi 3B+ / 4B Startup Currents Examined
In this article, we talk about startup currents for the Raspberry Pi 3B+ and 4B. We are all familiar with charts like this showing the amount of current the Raspberry Pi family takes when running different tasks (thank you RasPi.TV).
This is great information, but when you are deciding what solar power system or what power supply to use for your Raspberry Pi project, you need to ask two more questions:
- What else do you have on your project that takes power? You will need to add in more power for those devices too. Be especially careful with things like Dust Sensors that take a lot of power (they have heaters or fans on board).
- What is the maximum current the system needs on startup? This is sometimes called the “inrush” current.
Question #1 is mostly simple math (or measurement if you use the SwitchDoc Labs CVSensor and add peripherals one at a time to measure it). Question#2 takes some work and calls for some SwitchDoc Labs measurements!
Measuring Dynamic Currents on the Raspberry Pi with CVSensor
In order to measure the dynamic currents during startup of the device under test, we turned to using a second handy Raspberry Pi and connected a I2C CVSensor between the power supply and the DUT (Device Under Test) which is a Raspberry Pi 4B in the picture below.
What we do is start a program running on the 3B+ that samples the current growing through the USB cable at about every 50ms, stores it in a MySQL database and then graphs the result. The software to do this is here, the Raspberry Pi DataLogger, but all options are not totally functional as it is a system being moved from Python2 to Python3. :). INA219 works though! Below is the system we used to make all of the below graphs.
Raspberry Pi 4B Startup Currents
We will start with the startup current needed for a Raspberry Pi. While the average current is about 600mA, you can see it jumps up over 1100mA during boot up. If your power supply can not supply this much current essentially instantaneously, your boot up with fail (see an example of a failed boot up later on this article). A couple of things to note about this graph. First of all, when your power supply has to provide a lot of current, the voltage will typically drop. We can see that in the voltage graph below. As long as you don’t drop below 4.75V, you should be fine. The specification for the 5V power supply is +/- 5% which means from 4.75V to 5.25V. We only went down to 4.89V so we were fine. After reading this you should now realize that 5V is never just 5V. It moves around too! This test was done with a Raspberry Pi 4B and a CanaKit 5.1V power supply @ 2.5A, recommended for the Raspberry Pi 4B.
Raspberry Pi 3B+ Startup Currents
Below we show the same power supply starting up a Raspberry Pi 3B+. Note that the average current of the Raspberry Pi 3B+ is less than the 4B (~425mA versus ~600mA) but some of the current spikes are still above 1000mA.
Running an AI (Artificial Intelligence) program on the 4B
Some of you may know we are just finishing a small Kickstarter for our MouseAir project and part of that project is using a AI technique called Machine Learning to train the Raspberry Pi to see if there is a Cat/Not Cat in the Pi Camera video. The big computational problem involved is not in running the existing model, but rather performing the millions and millions of calculations needed to train our machine with thousands of pictures to determine (fairly well) what is a Cat and what is a Not Cat (meaning everything else). Here we see the Raspberry Pi 4B just idling along and then we start the learning program (which uses all 4 cores of the Raspberry Pi 4B) and you can see the current jump up and even spike above 1400mA at times. This is why what you run on a computer can cause your system to crash or reboot. If your power supply can’t handle it, your Pi can lose its way and try to reboot.
Pi 4B and 3B+ adding an External Capacitor
We have found out the information we really wanted regarding the spikes of current during boot up. But since we have the setup and software running let us run a couple of more experiments. Let’s add a 10,000 uF capacitor across the 5V line to Ground. Make sure your Capacitor can handle above 6V. For example, https://amzn.to/2IG8Pwh will work. What is a capacitor? It stores and releases electric charge. Without getting into too much Electrical Engineering stuff, a capacitor can be looked at in the time domain (where we live) as something that stores energy and then releases it as it is required. That means that adding a capacitor to a power supply can supply energy to help the power supply put out enough current to cover those spikes.
Compare the Pi4B graph to the Pi4B graph above. It’s less spiky and smoother. Hmmm. If we look at a capacitor in the frequency domain (a scary phrase meaning looking at signals as made up of different amplitude and frequency of sine waves – real electrical engineering stuff) a capacitor configured like this one acts as a low pass filter. High frequency spikes of current get taken out of the graph. Same thing but looked at in a different manner. Turns out the math is a lot simpler in the frequency domain rather than the time domain. Electrical Engineers are nothing, if not a bit lazy.
And now the same thing run on a Raspberry Pi 3B+ boot up sequence. Note the big spike right at the beginning? That is the capacitor charging up. Why don’t we see it above? Happened between two 50msec samples. Ack! We miss things? Yes, due to the Nyquist Sampling theorem, but that is for another day.
What Happens if you use a REALLY Cheap Power Supply?
One more test of startup currents. We took a really cheap power supply (5V @ 1.0 Amp) that we ship with low power ESP8266 and ESP32 based systems and connected it up to our test system. We just used the Raspberry Pi 3B+ in this test as we knew the Pi4B would also fail. We turned it on and the Raspberry Pi never booted up. You can see it keep trying in the graph below. You can also see the power supply falling below the 4.75V specification. It fails and then tries again.
Using an External Capacitor
We hooked up the 10000uF capacitor we used earlier in this article across the 5V to Ground lines on the Raspberry Pi with the really cheap power supply. See the spike of charging the capacitor at the beginning? Note that the Raspberry Pi 3B+ now easily boots up on the real cheap power supply. The power still drops below 4.75 at times and is running pretty close to the minimum voltage even when booted up, but it still boots.. This power supply will clearly not work with the Pi 4B.
Conclusion
Startup currents for the Raspberry Pi 3B+ and 4B often set the requirement for the amount of current the power supply has to supply all the while keeping it above 4.75V.
We recommend at least a 1.5A power supply for the Pi3B+ and a 2A power supply for the Pi4B. And remember you can always add that external capacitor to clean up a marginal power supply.
In terms of our Solar Power Controllers, for the 3B+, you can use SolarMAX LiPo or SolarMax LeadAcid. The Pi 4B can use SolarMAX Lead Acid.