milad69_1
Posts: 3
Joined: Wed Feb 19, 2014 10:09 am

Protect GPIO

Wed Apr 30, 2014 2:32 pm

I want to protect my raspberry pi's gpio pins from high voltage and also for current limiting just like rasPio breakout pro
I have 3V3 Zener diodes and 330 Ohm resistors. the problem is that i'm new in electronics and i'm not sure that i got the idea right.

can someone help me with this problem please? is this circuit right? :D


here is what I thought it should be:
Attachments
gpio.png
gpio.png (7.4 KiB) Viewed 4729 times

User avatar
Burngate
Posts: 6182
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Protect GPIO

Wed Apr 30, 2014 4:07 pm

That seems to be approximately what the RasPiO Breakout Pro has, and, yes you have it nearly right.

If you accidentally connect the output to ground and set the pin to High, then only 10mA will flow, which the GPIO can handle.

However, if you accidentally connect the output to a voltage higher than 3v3, then what happens will depend on what that voltage is and what its source impedance is.
If it's a 5v power supply, its impedance will be very low - it will keep its output at 5v even when supplying an amp or more.
The poor little 3v3 zener will go pop, then the GPIO will try to sink that amp, and also go pop.

So move the zener to the other end of the resistor.
... the problem is that i'm new ...
can someone help me with this problem please?
Sorry, being new is something I can't help with ... but with hard work, and time, you'll eventually become old ... and then you'll wish you were young again :(

milad69_1
Posts: 3
Joined: Wed Feb 19, 2014 10:09 am

Re: Protect GPIO

Thu May 01, 2014 7:33 am

thank You!! :D
very helpful. so zener diode must be in the other end of resistor:
gpio.png
gpio.png (8.95 KiB) Viewed 4642 times
I think I got it :D

I'll do hard work but I hope I'll never be old :( It's every one's wish I think :)

Milliways
Posts: 502
Joined: Fri Apr 25, 2014 12:18 am
Location: Sydney, Australia

Re: Protect GPIO

Sat May 03, 2014 2:48 am

The Zener diode provides some protection, but is not the best (or cheapest) method.
The conventional solution is to use a clamp diode to 3.3V which limits voltage to 3.3 + 0.7V. A Schottky diode limits the voltage rise to a lower value.

User avatar
Burngate
Posts: 6182
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Protect GPIO

Sun May 04, 2014 10:28 am

Milliways wrote:The Zener diode provides some protection, but is not the best (or cheapest) method.
The conventional solution is to use a clamp diode to 3.3V which limits voltage to 3.3 + 0.7V. A Schottky diode limits the voltage rise to a lower value.
I don't want to start an arguement, but I would be interested in your reasons for saying a zener is less good than a clamp diode. ("cheapest" depends on local conditions)
Surely a zener, being a reverse-biased diode, also will clamp negative-going inputs, whereas using clamp diodes would require two - one for positive and one for negative?

boyoh
Posts: 1395
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: Protect GPIO

Sun May 04, 2014 6:29 pm

milad69_1 wrote:I want to protect my raspberry pi's gpio pins from high voltage and also for current limiting just like rasPio breakout pro
I have 3V3 Zener diodes and 330 Ohm resistors. the problem is that i'm new in electronics and i'm not sure that i got the idea right.

can someone help me with this problem please? is this circuit right? :D


here is what I thought it should be:
Wanting good protection for your Pi
I suggest you use a Opto Isolator
This will give you total isolation
Between the 3.3v GPIO pins and
Higher project voltages. You will
Get no noise feed back .
I doubt wether a zener diode
Will give you good protection from
High voltage transient feed back
Attachments
opto Is.jpg
opto Is.jpg (44.86 KiB) Viewed 4400 times
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

User avatar
Burngate
Posts: 6182
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Protect GPIO

Mon May 05, 2014 11:13 am

There are always drawbacks with any solution - nothing's perfect.

An opto-isolator is only one-way, whilst a zener-resistor can be used in either direction, as can a clamp-diode(s)-resistor combination.
It might be possible to combine two opto-isolators to make it bidirectional, but avoiding latch-up could be difficult

boyoh
Posts: 1395
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: Protect GPIO

Tue May 06, 2014 7:10 pm

Burngate wrote:There are always drawbacks with any solution - nothing's perfect.

An opto-isolator is only one-way, whilst a zener-resistor can be used in either direction, as can a clamp-diode(s)-resistor combination.
It might be possible to combine two opto-isolators to make it bidirectional, but avoiding latch-up could be difficult

" Yes " To many solutions to this project
Makes it hard to pick the right one

There is a old saying

TO MANY COOKS SPOIL THE BROTHE
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

Milliways
Posts: 502
Joined: Fri Apr 25, 2014 12:18 am
Location: Sydney, Australia

Re: Protect GPIO

Wed May 07, 2014 1:51 pm

Burngate wrote:
Milliways wrote:The Zener diode provides some protection, but is not the best (or cheapest) method.
The conventional solution is to use a clamp diode to 3.3V which limits voltage to 3.3 + 0.7V. A Schottky diode limits the voltage rise to a lower value.
I don't want to start an arguement, but I would be interested in your reasons for saying a zener is less good than a clamp diode. ("cheapest" depends on local conditions)
Surely a zener, being a reverse-biased diode, also will clamp negative-going inputs, whereas using clamp diodes would require two - one for positive and one for negative?
A Zener has some leakage (even at rated voltage) and a higher capacitance. This is admittedly mainly an issue with higher speed interfaces. There is quite a wide tolerance (±5%) which can exacerbate leakage. Ideally, if using a Zener, you should use 3.6V.

The solution was to protect against "over voltage". If negative inputs are an issue then additional protection is needed. A Zener is not the ideal solution here either as they are rather poor diodes. Neither will protect against excessively high transient voltages, but this was not the question asked either.

I maintain that the "conventional" clamp diode does an excellent over-voltage protection (which means preventing conduction or leakage to the semiconductor substrate).

The best solution is to design the circuit so that no protection is needed. Any protection circuit (clamp or Zener) which relies on conducting current will slow down the interface.

Return to “Advanced users”