baronobeefdip
Posts: 76
Joined: Sat Sep 27, 2014 6:20 pm
Contact: Website

Can I protect my pi from frying with resistors

Thu Nov 12, 2015 4:43 pm

I plan on supplying power to devices from an external power supply rather than relying on the onboard 5v and 3.3v power supply on the pi's board. I am wanting to protect the pi from frying from this higher supply of power, can I go about doing that with resistors to step down the current before it gets to the GND terminal on the pi's board? or is it more complicated than that. Here is a circuit in which I am assuming protects the GPIO pin from frying (although the flaw with it is that it lowers the amount of current emanating from the GPIO pin to the point where the transistor fails to saturate. I have no experience with electrical engineering so I was just wondering if this is possible.

http://i.imgur.com/rfAZVkD.png

scotty101
Posts: 3958
Joined: Fri Jun 08, 2012 6:03 pm

Re: Can I protect my pi from frying with resistors

Thu Nov 12, 2015 5:06 pm

No. It is more complicated than that*. You should use a switch mode regulator to provide a stable 5v (or 3.3v) supply to your raspberry pi.[Edit: Misunderstood your question]

You can protect GPIO pins using resistors but you should pick the resistor value based on what you are connecting to the GPIO pin.

*Very basic linear regulators use a resistor and a zener diode to provide a voltage reference, an amplifier and a suitable power transistor supplies the output voltage. More complicated switch mode supplies use more complex electronics to monitor and provide the voltage output.
Last edited by scotty101 on Wed Nov 18, 2015 12:18 pm, edited 1 time in total.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

baronobeefdip
Posts: 76
Joined: Sat Sep 27, 2014 6:20 pm
Contact: Website

Re: Can I protect my pi from frying with resistors

Thu Nov 12, 2015 5:33 pm

scotty101 wrote:No. It is more complicated than that*. You should use a switch mode regulator to provide a stable 5v (or 3.3v) supply to your raspberry pi.

You can protect GPIO pins using resistors but you should pick the resistor value based on what you are connecting to the GPIO pin.

*Very basic linear regulators use a resistor and a zener diode to provide a voltage reference, an amplifier and a suitable power transistor supplies the output voltage. More complicated switch mode supplies use more complex electronics to monitor and provide the voltage output.
What about resistor voltage divider circuits

https://www.ibiblio.org/kuphaldt/electr ... /00107.png

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: Can I protect my pi from frying with resistors

Thu Nov 12, 2015 6:01 pm

baronobeefdip wrote:What about resistor voltage divider circuits
What about Ohm's law, not to mention that Kirchhoff fella.

baronobeefdip
Posts: 76
Joined: Sat Sep 27, 2014 6:20 pm
Contact: Website

Re: Can I protect my pi from frying with resistors

Thu Nov 12, 2015 6:46 pm

stderr wrote:
baronobeefdip wrote:What about resistor voltage divider circuits
What about Ohm's law, not to mention that Kirchhoff fella.
I am aware of those laws, I was just wondering if the voltage divider circuits are going to decrease the voltages in the circuit so as to serve as a safety measure. I am aware that an electrical signal that goes through a resistor decreases the current relative to the amount of voltage that is flowing through the wire, where as from what it seems the divider circuit decreases the voltage according to the formulas represented in the picture. I might just end up performing experiments for myself and see what comes from doing so.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13099
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Can I protect my pi from frying with resistors

Thu Nov 12, 2015 6:53 pm

Wikipedia to the rescue:
https://en.wikipedia.org/wiki/Voltage_divider

You need ohms law to calculate the resistor values used to divide the input value to a GPIO value lower than 3.3V (but higher than 2.5V).

And yes, you can use resistors to protect your PI from:
  • Inputting more than 3.3V. doing so causes the GPIO logic to "latch up" which destroys them.
  • Limiting current flowing into or out of a GPIO pin to a safe value ( typically less than 3mA )
resistors cannot help against other failures like inputting negative voltages.

User avatar
rpdom
Posts: 17173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Can I protect my pi from frying with resistors

Thu Nov 12, 2015 7:02 pm

I think one of the earlier posters was thinking that you were going to power your Pi via an external supply and using resistors to limit the supply voltage.

It sounds like you just want to take a 5 volt signal and feed it into a 3.3V GPIO, in which case, as mahjongg says, a resistor voltage divider circuit will be fine.

baronobeefdip
Posts: 76
Joined: Sat Sep 27, 2014 6:20 pm
Contact: Website

Re: Can I protect my pi from frying with resistors

Thu Nov 12, 2015 7:07 pm

rpdom wrote:I think one of the earlier posters was thinking that you were going to power your Pi via an external supply and using resistors to limit the supply voltage.

It sounds like you just want to take a 5 volt signal and feed it into a 3.3V GPIO, in which case, as mahjongg says, a resistor voltage divider circuit will be fine.
Exactly, When I power a device with a larger power supply of something more than what the GND terminal of the pi can handle, and then use the GPIO pin inside of the base of a resistor (Or Triode, if I decide to do some crazy and in a way stupid experiments :lol: ) I can decrease the voltage that returns to the pi into the GND terminal. I would use the divider to drop the voltage before it gets to the GND which would protect it from frying. It has been a while since I have tackled this electrical engineering stuff and I am liking that this is giving me a small refresher and helping me design ways to protect my pi from harm.

baronobeefdip
Posts: 76
Joined: Sat Sep 27, 2014 6:20 pm
Contact: Website

Re: Can I protect my pi from frying with resistors

Thu Nov 12, 2015 7:11 pm

mahjongg wrote:Wikipedia to the rescue:
https://en.wikipedia.org/wiki/Voltage_divider

You need ohms law to calculate the resistor values used to divide the input value to a GPIO value lower than 3.3V (but higher than 2.5V).

And yes, you can use resistors to protect your PI from:
  • Inputting more than 3.3V. doing so causes the GPIO logic to "latch up" which destroys them.
  • Limiting current flowing into or out of a GPIO pin to a safe value ( typically less than 3mA )
resistors cannot help against other failures like inputting negative voltages.
This is all starting to make more sense and I am feeling more confident in tackling projects on regarding controlling large high(er-sh) voltage devices with external power supplies, I'm not going to use it to power something comparable to a super collider or something since I have no interest in doing such projects. I have brought it to my attention that dividers don't have the same features and benefits as regulators in that it can keep a constant voltage of a fixed value flowing through that part of the circuit whereas a dividers output voltage is dependent on the amount that is supplied relative to the values of the resistors. Thanks for all of the help, this is all starting to become much clearer and can't wait to see what I can tackle with this knowledge.

Also, aren't negative voltages just a current flowing in the opposite direction of which was expected?
Last edited by baronobeefdip on Thu Nov 12, 2015 7:13 pm, edited 1 time in total.

User avatar
rpdom
Posts: 17173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Can I protect my pi from frying with resistors

Thu Nov 12, 2015 7:12 pm

baronobeefdip wrote:Exactly, When I power a device with a larger power supply of something more than what the GND terminal of the pi can handle, and then use the GPIO pin inside of the base of a resistor (Or Triode, if I decide to do some crazy and in a way stupid experiments :lol: ) I can decrease the voltage that returns to the pi into the GND terminal. I would use the divider to drop the voltage before it gets to the GND which would protect it from frying. It has been a while since I have tackled this electrical engineering stuff and I am liking that this is giving me a small refresher and helping me design ways to protect my pi from harm.
No, that is completely wrong. The GND pin must be connected without any resistors, so that 0V is common on all hardware.

You only need resistors for protecting the Input GPIO pins.

Output pins would need a transistor or some other driver if they need to convert voltages.

baronobeefdip
Posts: 76
Joined: Sat Sep 27, 2014 6:20 pm
Contact: Website

Re: Can I protect my pi from frying with resistors

Thu Nov 12, 2015 7:20 pm

rpdom wrote:
baronobeefdip wrote:Exactly, When I power a device with a larger power supply of something more than what the GND terminal of the pi can handle, and then use the GPIO pin inside of the base of a resistor (Or Triode, if I decide to do some crazy and in a way stupid experiments :lol: ) I can decrease the voltage that returns to the pi into the GND terminal. I would use the divider to drop the voltage before it gets to the GND which would protect it from frying. It has been a while since I have tackled this electrical engineering stuff and I am liking that this is giving me a small refresher and helping me design ways to protect my pi from harm.
No, that is completely wrong. The GND pin must be connected without any resistors, so that 0V is common on all hardware.

You only need resistors for protecting the Input GPIO pins.

Output pins would need a transistor or some other driver if they need to convert voltages.
By input GPIO pins you mean the ones that are used as input signals? Because what I am trying to do is utilize the current that comes out of an output gpio pin in order to control a transistor while at the same time protect it from frying when the circuit completes. I have been told to place a resistor between the base and the GPIO connection to protect the PI from damage, but when I did so last time, the current dropped and the transisor wouldn't turn on. My worry here is that when the negative potential from the power supply is drawn to the base to complete the circuit after going through the collector, the GPIO pin will fry.

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

Re: Can I protect my pi from frying with resistors

Thu Nov 12, 2015 7:51 pm

Yes using separate power supply on your external circuits is a good Idea, This then lets you use buffer stages
Opto Isolators / Power transistors / voltage levelers/ Resistors/ on the Pi out/puts to control different voltage and current levels that the Pi can't supply.

A good 5v 2A well protected well filtered power supply for the RPi is needed

When using potential deviders , carful selection of the resistors must made, this depends on what the out/put is feeding into

You can't have 10ma flowing through it and expect to take 20ma off It, If the resistance you are feeding in to, is to low ,the

The out put will be devided out of existence. ( Ohms Law )
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13099
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Can I protect my pi from frying with resistors

Fri Nov 13, 2015 12:08 am

My worry here is that when the negative potential from the power supply is drawn to the base to complete the circuit after going through the collector, the GPIO pin will fry.
Either I don't understand what you are writing or it is indeed complete nonsense! I'm tempted to think the second. :mrgreen:
I would take a short course in electronics before trying to do something you clearly do not understand.
Learn the basics of the function of a common reference (called GND), the difference between voltage and current, Ohm's and Kirchhoffs laws and a number of other lesson 101 subjects first. I suggest looking up things in wikipedia, but for kirchhoff its actually much simpler than what wikipedia has to offer, the main (second ) law is better understood by going here: http://www.regentsprep.org/Regents/phys ... bkirchof2/

When you insert the wrong value resistor in series with the transistors base, perhaps the current flowing into the base (and returning through the emitter to the GND, becomes too small to fully "open" the transistor, generally a transistor used in this way acts like a current amplifier, and it commonly has an amplification of several hundred times (unless you drive the transistor into saturation, (where there is almost no voltage between emitter and collector left) then it will drop to an amplification of only maybe 50 times).

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

Re: Can I protect my pi from frying with resistors

Fri Nov 13, 2015 4:14 pm

I agree with Mahjongg , you need to learn some basic electronics before you go any further

I will start by asking how old you are, this gives us some Idea of how to speak to you with respect.

A list of things you will need for basic electronic circuit building , 0 /12v/ 3A adjustable power supply

A breadboard ,book on starter circuits to build, Leds/ resistors /diodes / transistors ( 2n2222 ) are very us full.
You will need a multimeter , a cheap one will do,

Learn Ohms Law, and how to use It.

The strength of a current (amps) is directly proportional to the Pressure ( volts ) between two points.

But is inversely proportional to It's Resistance (Ohms)

Don't use the Pi as your breadboard,, Put your Pi back in the box, until you know how to interface with it.

I'm being blunt , but building circuits is the only way to ,learn electronics . There is no Magic Formula.
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

baronobeefdip
Posts: 76
Joined: Sat Sep 27, 2014 6:20 pm
Contact: Website

Re: Can I protect my pi from frying with resistors

Fri Nov 13, 2015 7:06 pm

boyoh wrote:I agree with Mahjongg , you need to learn some basic electronics before you go any further

I will start by asking how old you are, this gives us some Idea of how to speak to you with respect.

A list of things you will need for basic electronic circuit building , 0 /12v/ 3A adjustable power supply

A breadboard ,book on starter circuits to build, Leds/ resistors /diodes / transistors ( 2n2222 ) are very us full.
You will need a multimeter , a cheap one will do,

Learn Ohms Law, and how to use It.

The strength of a current (amps) is directly proportional to the Pressure ( volts ) between two points.

But is inversely proportional to It's Resistance (Ohms)

Don't use the Pi as your breadboard,, Put your Pi back in the box, until you know how to interface with it.

I'm being blunt , but building circuits is the only way to ,learn electronics . There is no Magic Formula.
Okay then, I am doing some research of my own at the time. UC Berkley has lots of lectures posted on their youtube account, and the guy teaching the class is very entertaining so it makes it much more easier.
here is the first lecture
https://www.youtube.com/watch?v=MpBwvCq6vWM

I have several trasistors (NPN and PNP, mostly NPN by like over 100), Triodes and Pentodes, resistors of varying values, two multimeters (the second came from a friend, i didn't want to say no), some LEDs, a motor from a shark cleaner (for motor control experiments), 20 small breadboards that wer being sold for arduinos, two full sized breadboards, a breakout ribbon and circuit set for both model B and model B+, and finally some hookup wire.

The textbooks that I have been reading are Lessons in Electric Circuits and there are some open textbooks focussing on electrical engineering and circuits which I have to check out. I have some cheat sheets I made back in highschool (It's obviously been a while, I started to lose all the information once I started going more into computer science). I am also 24 years old.

Here's lessons in electric circuits, the books I have been reading since highschool but then abruptly stopped after graduating and then I had to focus on many other things. oh the process of becoming an adult really deters you from having any hobbies.
https://www.ibiblio.org/kuphaldt/electricCircuits/
Last edited by baronobeefdip on Fri Nov 13, 2015 10:01 pm, edited 1 time in total.

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Can I protect my pi from frying with resistors

Fri Nov 13, 2015 8:23 pm

You will learn a lot by watching Homofacien's video https://www.youtube.com/watch?v=9Qumu2h8FjY you won't regret using that 53 minutes.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Re: Can I protect my pi from frying with resistors

Tue Mar 08, 2016 7:59 pm

DougieLawson wrote:You will learn a lot by watching Homofacien's video https://www.youtube.com/watch?v=9Qumu2h8FjY you won't regret using that 53 minutes.
The best video tutorial I've watched by far, thanks for sharing that.
I love the lack of breadboards. The raw soldering gives far better presentation of the circuits than some fritzing png (not knocking it, just saying) and the steady flow of projects from a flickering LED to a car starter motor covers it all.
I agree it's a 'must watch' for anyone doing projects on the Pi.

Dave.
Apple say... Monkey do !!

User avatar
GTR2Fan
Posts: 1601
Joined: Sun Feb 23, 2014 9:20 pm
Location: South East UK

Re: Can I protect my pi from frying with resistors

Tue Mar 08, 2016 8:23 pm

baronobeefdip wrote:Triodes and Pentodes
You won't be able to make any use of those unless you have at least a 100V to 250V DC power supply to run them, unless they're the 'peanut' variety in which case they should work at much lower voltages. You'd also need a, usually, 6.3V supply to run the heater that's capable of delivering typically 150 to 300mA.

Biasing can be a problem and you won't be able to connect the grid directly to a GPIO pin, so you'll need to set up some kind of transistor circuit as an input stage, so you might just as well stick to solid-state throughout as there are plenty of high-voltage transistors around if you really need one.

All in all, they're a pain in the neck to work with compared to solid-state devices and the voltages involved can be lethal. I'd recommend steering well clear of putting one anywhere near either yourself or a Pi.
Pi2B Mini-PC/Media Centre: ARM=1GHz (+3), Core=500MHz, v3d=500MHz, h264=333MHz, RAM=DDR2-1200 (+6/+4/+4+schmoo). Sandisk Ultra HC-I 32GB microSD card on '50=100' OCed slot (42MB/s read) running Raspbian/KODI16, Seagate 3.5" 1.5TB HDD mass storage.

IanH
Posts: 68
Joined: Mon Dec 19, 2011 5:53 pm

Re: Can I protect my pi from frying with resistors

Wed Mar 09, 2016 9:03 am

A while back I wrote a page at http://www.elinux.org/RPi_GPIO_Interface_Circuits which gives very simple circuits for connecting inputs and outputs to a Pi's GPIO pins - this includes using a transistor to switch a bigger load on and off.

If anything's not clear, please let me know.
Cheers
Ian
https://github.com/IanHarvey

Return to “Interfacing (DSI, CSI, I2C, etc.)”