Monday, 22 July 2013

Power Supply Protection for Raspberry-Pi

Defining the Problem, Again

The power rails of the Raspberry-Pi are bought out on the GPIO header as well as the IO pins.  This is both a blessing and a curse.

The advantage of this is that you have 5V and 3V3 rails available to power your circuitry that you are hooking up to your GPIO pins, but again, as the Raspberry-Pi doesn't have any protection circuitry you run the risk of killing your Raspberry-Pi through:

  • Short Circuiting the Rail
  • Reverse Biasing the Rail
  • Over-Volting the Rail



5V RAIL

The Raspberry-Pi needs to be supplied with a 5V rail, and this is derived from it's micro-usb input.  Typically this is supplied via a regulated 5V power supply and it's up and running.  

There isn't any definition as to what current you can draw from the 5V supply via the GPIO pin, and it's understandable as to why the makers of the Raspberry-Pi could not define it - it all depends on how big a supply you use to connect to your Raspberry-Pi.  The pic below shows how the 5V rail is defined in the Raspberry-Pi schematics.


Raspberry-Pi 5V Supply

There is some protection there - a 5V Transzorb and a 1.1 amp polyswitch.

The way this combination protects the Raspberry-Pi is that if you accidentally reverse bias the input, or apply more than 5V to the input - Overvolt -, the Transzorb will conduct drawing a large current through the polyswitch, causing the polywitch to go to a high impedance, and block power flowing into the rest of the raspberry pi.  

But if you inject the wrong voltage into the 5V GPIO pin, the polyswitch is no longer there to protect you, and you can kill your board.  So my initial thoughts are to add a polyswitch and a zener diode on my board to protect the pin from the end user.

3V3 RAIL

Raspberry-Pi 3V3 Rail Schematic

The 3V3 rail on the Raspberry-Pi is generated via a linear regulator (On-Semi NCP1117) hanging off the 5V rail.

There's some mixed news with the selection of this regulator by the Raspberry-Pi team.

If you look at page 9 of the datasheet On-Semi define how the regulator behaves if the output is short circuited, or over-volted. Long story short, there are internal protection diodes that protect the regulator, but there are some instances where a short circuit can kill it.

Current Draw

From the Raspbery-Pi schematics, you can see that the 5Vinout is limited by a 1.1A polyswitch, and the requirement is for a supply that can deliver 700mA minimum.  This leaves 400mA before the polyswitch beings to limit current.

From this, I took a punt and decided that my board should limit current through the GPIO pins to around 100mA, so I chose to use 100mA polyswitches.

As I've mentioned before, you can get twice the rated current drawn through the polyswitches before they finally trip, which gives a worse case current draw of 400mA (200mA on the 5V and 200mA on the 3V3 rails) through the GPIO pins, which consumes the rest of the 400mA budget.  

Your USB peripherals aren't going to be happy when you draw all their power away...

My Solution

I've decided to protect the 5V and 3V3 rails in the same way as the Raspberry-Pi guys did with their input.  Truth be told I'd derived my idea *before* looking at the Raspberry-Pi schematics so I'm pretty happy with the similarities. You know, bright minds think alike... or is it fools never differ?

I'd come up with my solution when you consider how other options are unsuitable:

  • Series diode has too high a voltage drop, especially on the 3V3 rail
  • Series diode doesn't protect from short circuit 
  • Series resistors will limit power to external circuits
Note that to sink the current from a 100mA polyswitch (factoring the need to sink twice the rated current) a little SOT-23 package Zener isn't going to cut it.

I've chosen the BZV90  series in 3V3 and 5V1 variants.
Rated at 1.5W, the devices will be able to survive the 660mw (for the 3.3 Zener) and 1020mW (for the 5V1 Zener) fault currents the zeners need to dissipate.  A touch more onerous than the SOD-23's I can use on the IO pins!

More Testing!


Test Board Ready

Using the same setup as last time, I applied a test voltage at the output, and logged the current draw and voltage that will be generated at the 5V and 3V3 pins on the GPIO header.

A summary of the test results can be found here.

5V1 Results

The IV curve of the 5V protection is shown below.

As expected, as the input voltage rises, the output voltage of the Zener increases but with in input current as high as 200mA, the output voltage doesn't exceed 5.4V.  WIN!

If you plot Vin vs Vout you get the curve shown below.


As the input voltage climbs, the zener conducts more current and the polyswitch beings to limit current.  When the maximum of 200mA is reached the polyswitch starts to increase it's impedance and the output voltage falls.  However, unliek a glass fuse that blows and open circuits, the polyswitch is quite happy delivering many milliamps into the zener.  

 3V3 Results

 For the 3V3 protection circuit I obtained a similar result as shown in the following pics.
However, while I was happy with the results given by the 5V1 circuit, the 3V3 zener is pretty disappointing.  The maximum Vout I obtain is nearly 4.3V, or nearly a full volt more than the 3V3 requirement (a 30% error!).  With the 5V1 circuit the maximum output was almost 5.5V (approx 8% error).

What was disappointing was that the BZV90 series doesn't show any IV curves for their parts so this testing was pretty important.  And yes, I checked my results against a second 3V3 zener and got the same results, so I doubt it's an issue with a rogue part....

What Now?

Although not happy with the upper voltage limit on the 3V3 circuit, I do have a few options.

Do Nothing

From the schematics and the datasheet for the NCP1117, the rise in the 3V3 rail won't kill the Rasberry-Pi power supply, so I could run with the board as is..

What annoys me the most is that Broadcom will not release a full datasheet (partial here) for the BCM2835 used in the Raspberry-Pi so I cannot check what the maximum tolerance is on the 3V3 rail.  So no, Do Nothing is not going to work here, I need to err on the side of safety.

Change Current Limit

I could chose a polyswitch that limits current to a point where the 3V3 zener's voltage doesn't rise above my 10% limit, but that's only 30mA or so, and I don't know if you can get polyswitches that small.  Some testing is required here.

Change Zener

I could use a different family of zeners, where the IV curve of the 3V3 part better matches my requirements, which are (through waving hands in the air and plucking a magic number) plus 10% (3.63V). One possible candidate is the BZV49 series (1W, 3V3 and 5V1 available) so the next step is to grab some and test.

Until then...

2 comments:

  1. Isn't transistor current limiter better suited for 3.3V? More parts, but fast ...
    http://www.radio-electronics.com/info/circuits/diode_current_limiter/power_supply_current_limiter.php

    ReplyDelete
  2. Hi Rastislav

    Thanks for the suggestion. However, the losses through the pass transistor (0.7V) soon knock your rail down (3.3 - 0.7 = 2.6V) to the point that your 3V3 circuit won't function.

    Simon

    ReplyDelete