Home > Uncategorized > Raspberry Pi SD Card Power off Corruption and Solution

Raspberry Pi SD Card Power off Corruption and Solution

December 1st, 2017

All versions Raspberry Pi including the latest Raspberry Pi 3 and the Pi Zero W expect to be shut down gracefully, with a shutdown command something like

sudo shutdown now

This however does not always happen. We often pull the Power Chord or the cable may accidentally wiggle loosing the power connection momentarily. This results is SD Card Corruption. The more disastrous result is loosing your programs that you may have been working on for few weeks. This blog is about how to prevent this to happen using hardware method.

The Schematics shows the idea used to make this happen

The +5V Power is given to the Fuse F1. The Diode D1 is a Schotty Diode ( Part Number MBR230LSFT1G) that gives a 0.3V dropped as measured. The 4.7V Power is supplied to the Raspberry Pi Circuit through the 40 Pin Connector. The circuit will work at 4.7V as we have verified it, but if you have USB Devices this scheme may not work.

The Key element is the Super Cap C1, which is nominally a 5F Super Cap rated at 5.5V.

The Key equations that govern this circuit are as follows

1. The Fully charged voltage on the Capacitor is = 5V - Vd = 4.7V
2. The Processor works until the voltage drops until about 3.8V. The is delta V is 0.9V
2. The Current taken by Raspberry Pi 3 in steady state after boot was measured at 300mA
3. The Capacitor formula gives Q = CV

One we disconnect the power chord the Voltage at the resistor divider R1 and R2 drops from 2.5V to 0V. This goes to GPIO6 ( or any other GPIO that you may select). The processor can detect this and issues the shutdown command. Let us assume that the processor needs 10 seconds to completely finish the shutdown process. The total charge required is

Q = ix t = 300mA x 10s = 3 Coulomb

The Capacitor Value required is C = Q/V
or C = 3/.9
or C = 3.33 Farad

A Capacitor value of 5 Farad is adequate for this purpose.

Few Concerns

1. The 4.7 Volt is not an acceptable value and drop of 0.3V Across the Diode is not desirable. A FET based circuit is

The Circuit taken courtesy Electro-Tech .

With this circuit in place the Voltage drop will be only of the order of 0.07V. This is something we need to test.

2. The Capacitor may take high sudden inrush current, and therefore a small resistor in series with Diode may be worth considering.

3. The Capacitor should have low ESR. A typical capacitor tested to make the system work had ESR of 100 milli Ohm.

A typical implementation will consist of an Add on Board with 40 Pin Connector. A USB Micro connector can be installed in the Add on Board and and power may be supplied from the USB Micro connector on the Add ON Board in place of from that the Raspberry Pi Board.

Update 12/3/2017

It turns out that in place of the P-Channel MOSFET and the related circuits as a Diode, we could also possibly try Load Switch using Micrel MIC94040YFL-TR Part.

Notice the Internal Pull Down on the Enable Pin. When there is no power, the Enable Pin will be pulled down. There still be a resistor divider with the Enable Pin at the center point of the Voltage divider.


  1. No comments yet.
  1. No trackbacks yet.