Wednesday, 28 November 2012

Raspberry Pi GPIO Header - protection

The mouse is here. Gave up on looking on the web for programming help and ordered a book on the Raspberry Pi. While waiting for this to come thought I'd look at the GPIO bus.

The GPIO bus allows the Raspberry Pi to control external electronics and handle various inputs. As well as 17 Input and Output pins, it also provides a 3.3V and 5V supply. Looking on the web, found this site which has a lot of useful information on the GPIO bus and explained it very simply.

http://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/


One concern seemed to be that these pins are not protected in any way. the pins go stright from the GPIO header into the pins of the IC without any type of protection. In my experience, and GPIO bus where it is controlling external electronics various voltages can be connected by accident and cause permanent damage to the IC. For example an input that goes well over the expected voltage can result in an input pin being pulled high, say well above the supply voltage. Reverse connection of voltage are also a possibility. 

It is quite easy to protect against overvoltage and reverse voltage by using a zener diode and normal diode per pin that is being used.

Overvoltage - connect a zener diode between the pin being used and GND (one of pin 9,14,17 etc). The cathode (the end with the line on it) is connected to the pin and the other end to GND. The zener rating needs to be 3.3 V.  If a voltage higher than this is connected to the pin, the zener will clamp the voltage to close to 3.3 V and protect an overvoltage on the pin.

Reverse voltage - Connect a diode between the input and GND with the cathode (the end with the line) connected to the pin. If the voltage on the pin is +ve then the diode has no effect. If the voltage on the pin goes below GND then the diode conducts and keeps this voltage from going below GND by too much.

Suitable Zener from Farnell Components -  

FAIRCHILD SEMICONDUCTOR - 1N5226B - DIODE, ZENER, 3.3V, 0.5W, DO35

Suitable Diode (use of a schottky diode as this will provide better protection)

 VISHAY SEMICONDUCTOR - BAT86 SB00018/D8 - SCHOTTKY RECTIFIER 200A 

It's also a good idea to use a resistor to limit any damaging currents that may flow due to a reverse or over voltage.


Here is a diagram of the protection recommended. Please remember - this can only provide increased protection, You still need to take care when you connect the Raspberry Pi GPIO to external circuits.


 




1 comment:

  1. Hi Mistertee! I resolved put this protection on gpio rpi 2B, only diode zener and resistor, and was good solution, but these days after install rda5807 module happen issue the port 0x60 is detected and 0x10,0x11 not! If I connect before a protection i.e. sda and scl without protection all address are detecteds!
    any idea? Thanks JDavis

    ReplyDelete