## How to calculate resistors...

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

### Re: How to calculate resistors...

You have just been given very good advice by “ hippy “ nobody
Could have give you any better advice, Just don’t be to critical
With your cancelations, If I had been very critical in the past
The project would have never got off the design stage, If it worked
Within its limits that was all i wanted. The rule of the thumb is a very good example, especially with capacitors

Regards BoyOh
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

Posts: 89
Joined: Fri Feb 22, 2019 5:43 pm
Location: Eastern - USA

### Re: How to calculate resistors...

hippy wrote:
Sun Apr 21, 2019 1:13 pm
Sat Apr 20, 2019 11:42 am
There are lots of ideas of things I'd like to make - but I have to fix my electronics concepts and move forward and deeper from there.
Not necessarily. You have already proven that a 1K resistor for your LED is bright enough and draws an insignificant current from whatever is driving that, so you don't have to worry about the actual theory and principles behind it any more. You know that 1K is probably a good starting point for any LED no matter what it's connected to.

You only have to go back to fist principles if it isn't, and even then you know there's a lot of leeway for resistor adjustment before problems will occur, so you only need to do that when you are getting down to lower resistance values.

So you already have a rule of thumb; "use a 1K with a LED". And a lot of electronics is like that and a lot of people get by just fine with only rules of thumb, only cursory understandings of the theory and principles.

Other rules of thumb are, "Pull-up or Pull-down, 10K, maybe 4K7 or 1K". "Decoupling capacitor, 100nF", "In-line current limiting resistor for over-voltage inputs, don't do that with a Pi, use a voltage divider or an opto".

Most people doing digital electronics can get away with just using rules of thumb so long as they can recognise where the rules of thumb may not apply. An in-depth knowledge isn't absolutely necessary.
I see your point. Yeah - I mean to calculate everything to the nth degree would mean you are at the level of electrical/computer engineer. I don't think I'll go that far - but I still have to get my basics corrected. Rule of thumb approaches definitely has its place. I mean - just like this - I tried to resolve some design aproach ideas, basic concepts, and worked out more detail on this one LED/resitor pair - but in my project I'm putting in 6 LEDs relating to one part of my design. Another part of my design uses another 5 LEDS - but I was told to use 220Ω resistors with them - but after learning this, I will replace those with larger resistors as well. My main power hungry components are the 8 channel relay, the DHT22s and the ULN2803 and Adafruit 757 that theyr're running through. My approach so far has been like computer building - get a big enough power supply, then add cards to the motherboard to get the hardware functionality I need - but this needs a bit more knowledge of these basic components. The computer cards have been designed to meet the specs of the slot type they use - we don't have quite the same level of simplicity here - so I think knowing the basics is more important - even if it's only enough to know that you need more help - what you said
"When money ceases to be the tool by which men deal with one another, then men become the tools of men. Blood, whips and guns–or dollars. Take your choice–there is no other..."
- Ayn Rand - Atlas Shrugged

hippy
Posts: 8239
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

### Re: How to calculate resistors...

Tue Apr 23, 2019 4:31 pm
Another part of my design uses another 5 LEDS - but I was told to use 220Ω resistors with them
And do you know why ? Because that's their rule of thumb. And how so ... ?

5V through 220R through a LED with a Vforward of 0.5V keeps current to 20mA -

V = IR, I = V/R = (5-0.5)/220 = 20mA

So put any LED into the circuit and you won't blow it up, because most LED Iforward ratings are 20mA. And, if it's safe for 5V it's safe for 3V3 where the current will be lower, and it'll also be safe for a LED with a Vforward greater than 0.5V because that likewise reduces the current.

In the olden days one needed 20mA to get a decent brightness but as LED's got more efficient the current needed fell and the recommended R crept up, 330R isn't uncommon to see as the recommended value.

It used to be 20mA, then 15mA, then 10mA, then 3mA, and reality these days is a lot less is often bright enough. Though some people do seem to like having LED's which are 'as bright as lasers' will still pump maximum Iforward through them even though they don't have to.

The 220R or 330R is a value which will be safe while lighting the LED. Not a value which is best. Those handle most cases of worst case scenario.

What the 220R rule of thumb however fails to take into account is that any GPIO driving the LED might not be able to handle the 20mA which will be taken by the LED+R.

Though by good fortune it mostly still holds true when 3V3 is used, or Vforward is greater than 0.5V, where the current actually delivered won't likely exceed what the GPIO can handle.

"220R" is a rule of thumb for 5V/20mA which hasn't been updated for more modern times.

Posts: 89
Joined: Fri Feb 22, 2019 5:43 pm
Location: Eastern - USA

### Re: How to calculate resistors...

That makes sense - and now I understand that much better than at the beginning of this thread.

I would have been in trouble had I stayed with that rule of thumb on my project - running LEDs at 20mA - plus all the other components in terms of the RPi. I mean - the LEDs would have been safe but the RPi would have been VERY overloaded. I'm actually surprised that I didn't already have problems. I already had 5 LEDs with 220Ω resistors - so 100mA - plus the other components. Maybe because of the 3A PSU I'm using (vs the 2.5A)? I knew I was putting a lot on the RPi early on so I got the larger PSU to help.

So on that note - if too much stuff is put on the RPi - like this where I was using 100+mA - can that damage the RPi - or will it just not be able to give them enough power and then they will just not work properly? I can see using too small of resistors being an issue - the closer the resistance goes towards zero - the closer it is to a short - which is bad. But too much resistance and/or "wanted" power draw?
"When money ceases to be the tool by which men deal with one another, then men become the tools of men. Blood, whips and guns–or dollars. Take your choice–there is no other..."
- Ayn Rand - Atlas Shrugged

hippy
Posts: 8239
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

### Re: How to calculate resistors...

Wed Apr 24, 2019 12:21 pm
So on that note - if too much stuff is put on the RPi - like this where I was using 100+mA - can that damage the RPi - or will it just not be able to give them enough power and then they will just not work properly?
You'll have to check the official figures are correctly stated, but as I recall it; the official statement from the Foundation is that anything above 16mA per pin or 50mA in total may damage the Pi.

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

### Re: How to calculate resistors...

Wed Apr 24, 2019 12:21 pm
That makes sense - and now I understand that much better than at the beginning of this thread.

I would have been in trouble had I stayed with that rule of thumb on my project - running LEDs at 20mA - plus all the other components in terms of the RPi. I mean - the LEDs would have been safe but the RPi would have been VERY overloaded. I'm actually surprised that I didn't already have problems. I already had 5 LEDs with 220Ω resistors - so 100mA - plus the other components. Maybe because of the 3A PSU I'm using (vs the 2.5A)? I knew I was putting a lot on the RPi early on so I got the larger PSU to help.

So on that note - if too much stuff is put on the RPi - like this where I was using 100+mA - can that damage the RPi - or will it just not be able to give them enough power and then they will just not work properly? I can see using too small of resistors being an issue - the closer the resistance goes towards zero - the closer it is to a short - which is bad. But too much resistance and/or "wanted" power draw?

Sometimes you have got to be blunt with some people
First get to know the current handling capability of the Pi
If your project current is greater than the Pi can supply, use the
Pi to switch buffer stages (Transistors / Opto Isolators / Relays
Using a higher current power supply. Stick to tried and tested
Calculations for your components, Remember sometimes you
Can have two identical circuit boards that will give different
readings when tested, but still in tolerance and still work,

Regards BoyOh
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

Posts: 89
Joined: Fri Feb 22, 2019 5:43 pm
Location: Eastern - USA

### Re: How to calculate resistors...

drgeoff wrote:
Sat Apr 20, 2019 8:11 am
Fri Apr 19, 2019 1:15 pm
So, if the voltage on the positive side of the LED in this case is now 2.54V after the voltage drop from the 1kΩ resistor, and we know the current is 0.74mA - then R of the LED is R = 2.54V / 0.74mA = 3432Ω.
That line of thought has the potential to lead you astray. The "resistance" ot the LED is not a constant 3432 ohms. It depends on the current passing through it. The graph of curent versus voltage is not a straight line.
Yeah - understand - if I use a higher/lower resistor - that would change the current to the LED which would cause it to change its resistance in turn. It's almost like it's a variable resistor. The 3432Ω calculation here is only for this very specific configuration instance. Thanks for the heads up!
"When money ceases to be the tool by which men deal with one another, then men become the tools of men. Blood, whips and guns–or dollars. Take your choice–there is no other..."
- Ayn Rand - Atlas Shrugged

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

### Re: How to calculate resistors...

Thu Apr 25, 2019 11:54 am
Yeah - understand - if I use a higher/lower resistor - that would change the current to the LED which would cause it to change its resistance in turn. It's almost like it's a variable resistor. The 3432Ω calculation here is only for this very specific configuration instance. Thanks for the heads up!
Different types of component have different attributes.

A Resistor has a fixed value of resistance, but the current and voltage across it can vary according to Ohms Law. An LED has a fixed value for voltage, the current and it's effective resistance will change.

Fortunately, as others have said, in Digital electronics you can get away with rule-of-thumb a lot of the time. In Analogue electronics (Amplifiers, Radio circuits, Power supplies, etc) it is a lot more important that you use the exact value of component required.

Posts: 89
Joined: Fri Feb 22, 2019 5:43 pm
Location: Eastern - USA

### Re: How to calculate resistors...

hippy wrote:
Wed Apr 24, 2019 2:49 pm
Wed Apr 24, 2019 12:21 pm
So on that note - if too much stuff is put on the RPi - like this where I was using 100+mA - can that damage the RPi - or will it just not be able to give them enough power and then they will just not work properly?
You'll have to check the official figures are correctly stated, but as I recall it; the official statement from the Foundation is that anything above 16mA per pin or 50mA in total may damage the Pi.
So I wonder - If these specs are correct - I suppose that to RPi has 50mA available to the GPIOs - which means that all 50mA COULD be pulled across a single or couple of GPIOs - exceeding their 16mA rating - and thus potentially damaging them? But what if using say 10mA across 10 GPIOs- none of them would individually be exceeded and should not damage the GPIOs - but would this (100mA) damage something else in the RPi or would that case be what I asked earlier - where the RPi would just not have enough power to do this, so the components would fail to work . I guess I'm looking at this like a battery - if you connect a device that needs too much power from the battery - it just won't work right - or at all - but nothing is damaged. Is this the case with the RPi as well - or being more sophisticated and many more levels of stuff involved this actually can lead to damaging it? I don't want to test it by doing it - either by accident or on purpose.

I also realized - I don't have 100mA being pulled right now on my RPi - I have one of my 220Ω resistors in place with a green LED on my breadboard being using as an indicator of when any of my DHT22s are being polled and another LED that is at the end of a cable with a 220Ω resistor along with a DHT22. I will have this pattern for each DHT22 so I will have an indicator at each DHT22 showing that it is being polled. So, in the end, I will have 4 of these DHT22s with an LED paired with it plus the one at the RPi/PCB - thus the 100mA that WOULD have been pulled if they were all wired up - but 3 of them are not wired yet. So with the small draws I have with everything else - I think it's fine - but it would not have been had I wired them all up. But now I know better and I'll replace the 220Ω resistors with 1kΩ and all should be good.
"When money ceases to be the tool by which men deal with one another, then men become the tools of men. Blood, whips and guns–or dollars. Take your choice–there is no other..."
- Ayn Rand - Atlas Shrugged

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

### Re: How to calculate resistors...

The specs are 16mA MAXIMUM per pin, and 50mA MAXIMUM for all pins combined. Don't exceed either limit.

NGC6543
Posts: 81
Joined: Thu Feb 28, 2019 7:30 pm
Location: Lancashire, UK

### Re: How to calculate resistors...

Thu Apr 25, 2019 12:18 pm
...but would this (100mA) damage something else in the RPi or would that case be what I asked earlier - where the RPi would just not have enough power to do this...
Think of it this way:

All the available current has to be supplied through something, for all the GPIO pins. I've no idea what the exact internal structure of the chip is, but I can imagine a single conductor carrying the supply voltage, being chained along all the output transistors on the GPIOs. So, that thin conductor will eventually get the sum of all the currents going through each GPIO, at one end of it. Current=friction=heat=melt if it gets too much.

The individual GPIOs have driver transistors which must pass their individual currents. Those transistors are tiny and have their own limits.

Now, with regards to whether something will be damaged, or it just won't supply enough 'power' like a battery... it will be damaged. The internal resistance is most unlikely to limit the current enough to prevent damage.

What prevents a battery from supplying enough power (assuming the voltage is right but the battery is too small, like a AAA when you need a D) is its internal resistance. The internal resistance drops some of the voltage across itself when current is drawn. The smaller the cell (assuming the same type of chemistry/construction) the higher the internal resistance. The more current drawn, or the higher the internal resistance, the more voltage is dropped (Ohm's law works here, mostly). That has the knock-on effect that the thing being powered doesn't get the full voltage (it gets the remains after the internal drop) and so cannot get enough voltage or current if it asks too much of the cell.

Thus, the battery self-limits its power. That's why cheap LED button torches get away with no resistor. The tiny cell's own resistance drops enough voltage from the few mA that the LED draws. But put the same LED on a much bigger cell with a lower internal resistance, and it can draw more current with less voltage drop internally and might well get too much and go pop.

Hope that helps

Posts: 89
Joined: Fri Feb 22, 2019 5:43 pm
Location: Eastern - USA

### Re: How to calculate resistors...

NGC6543 wrote:
Thu Apr 25, 2019 2:34 pm
Thu Apr 25, 2019 12:18 pm
...but would this (100mA) damage something else in the RPi or would that case be what I asked earlier - where the RPi would just not have enough power to do this...
Think of it this way:

All the available current has to be supplied through something, for all the GPIO pins. I've no idea what the exact internal structure of the chip is, but I can imagine a single conductor carrying the supply voltage, being chained along all the output transistors on the GPIOs. So, that thin conductor will eventually get the sum of all the currents going through each GPIO, at one end of it. Current=friction=heat=melt if it gets too much.

The individual GPIOs have driver transistors which must pass their individual currents. Those transistors are tiny and have their own limits.

Now, with regards to whether something will be damaged, or it just won't supply enough 'power' like a battery... it will be damaged. The internal resistance is most unlikely to limit the current enough to prevent damage.

What prevents a battery from supplying enough power (assuming the voltage is right but the battery is too small, like a AAA when you need a D) is its internal resistance. The internal resistance drops some of the voltage across itself when current is drawn. The smaller the cell (assuming the same type of chemistry/construction) the higher the internal resistance. The more current drawn, or the higher the internal resistance, the more voltage is dropped (Ohm's law works here, mostly). That has the knock-on effect that the thing being powered doesn't get the full voltage (it gets the remains after the internal drop) and so cannot get enough voltage or current if it asks too much of the cell.

Thus, the battery self-limits its power. That's why cheap LED button torches get away with no resistor. The tiny cell's own resistance drops enough voltage from the few mA that the LED draws. But put the same LED on a much bigger cell with a lower internal resistance, and it can draw more current with less voltage drop internally and might well get too much and go pop.

Hope that helps
Yes! That's more what I was trying to get. Thank you for the deeper answer! I actually didn't understand that before about batteries.

So, if there were more safeguards in place on the GPIOs and in the deeper areas of the RPi - might could limit the power draw being asked of it without damage - but as designed it is not - and will allow too much current to pass through the GPIOs as well as some other bottleneck(s) somewhere deeper causing it to go 'pop' on the GPIOs and/or the deeper areas. Ok.

Is there anywhere on the RPi that you can use a multimeter to test what the overall load is on it so you can check that outside of tracking it on each GPIO and tallying - especially just to make sure that reality matches the expected results? That would be useful for learned and verifying as well as protecting the RPi.
"When money ceases to be the tool by which men deal with one another, then men become the tools of men. Blood, whips and guns–or dollars. Take your choice–there is no other..."
- Ayn Rand - Atlas Shrugged

hippy
Posts: 8239
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

### Re: How to calculate resistors...

Thu Apr 25, 2019 12:18 pm
I suppose that to RPi has 50mA available to the GPIOs - which means that all 50mA COULD be pulled across a single or couple of GPIOs - exceeding their 16mA rating - and thus potentially damaging them?
Correct; anything above 16mA through any single pin can damage the pi.
Thu Apr 25, 2019 12:18 pm
But what if using say 10mA across 10 GPIOs- none of them would individually be exceeded and should not damage the GPIOs
Correct again. 10mA spread across 10 pins means none of them are having more than 16mA drawn through them so that's okay, and the total isn't more than 50mA so also okay.
Thu Apr 25, 2019 12:18 pm
but would this (100mA) damage something else in the RPi
Assuming the Pi GPIO could deliver 100mA, whether it worked or not, damaged other things or not, that would come down to what other components it passes through, is drawn from. If it came through a 50mA max rated regulator it could damage that, if it came from a 50mA max rated PSU it could damage that, if it passed through a 50mA fuse it would probably blow that.

If everything in the chain from power supply to where you draw current from allows 100mA or more it will all be fine.

It is a case of which is the weakest link in the chain, not exceeding its rating. Much like 20mA may be okay through the LED but not okay from a GPIO pin with a 16mA rating. That's the weakest link, the next weakest link is the 50mA combined.
Thu Apr 25, 2019 12:18 pm
I will have 4 of these DHT22s with an LED paired with it plus the one at the RPi/PCB
With 1K's you'll be fine.

If you had used a pair of 220R+LED per line, each would draw about 4mA, so 8mA in total from the GPIO pin. That's below the 16mA limit so it's fine.

If you had four of those, all lit at the same time you'd still be drawing less than 16mA through each GPIO pin, but drawing 4x8mA, 32mA, in total. Again that's below the 50mA total so you'd be fine.

If you had ten of those, all lit, the individual pin currents would again be fine, but your total would be 10x8mA, 80mA, which would exceed the combined limit.

But you could have that because that's only the case when all are lit simultaneously. If you only light one at a time the current drawn will be 4mA per pin, and it's only 4mA combined because the others aren't lit, aren't drawing anything.

hippy
Posts: 8239
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

### Re: How to calculate resistors...

Maybe think of it as a chain of non-replaceable fuses, things which will be permanently destroyed if their current rating is exceeded -

Code: Select all

``````
PSU         Polyfuse         SoC
.---------.              .-----------------.
|         |              |                 |
| --O==O--|--> >--O==O---|--O==O--.--O==O--|-->
|  1000mA |      2000mA  |  50mA  |        |
`---------'              |        }--O==O--|-->
|        :        |
|        :        |        ___
|        `--O==O--|--> >--|___|--O==O--.
-O==O- = Fuse           |           16mA  |         R    20mA  |
`-----------------'                   _|_ 0V
``````

Posts: 89
Joined: Fri Feb 22, 2019 5:43 pm
Location: Eastern - USA

### Re: How to calculate resistors...

hippy wrote:
Thu Apr 25, 2019 3:29 pm
Maybe think of it as a chain of non-replaceable fuses, things which will be permanently destroyed if their current rating is exceeded -

Code: Select all

``````
PSU         Polyfuse         SoC
.---------.              .-----------------.
|         |              |                 |
| --O==O--|--> >--O==O---|--O==O--.--O==O--|-->
|  1000mA |      2000mA  |  50mA  |        |
`---------'              |        }--O==O--|-->
|        :        |
|        :        |        ___
|        `--O==O--|--> >--|___|--O==O--.
-O==O- = Fuse           |           16mA  |         R    20mA  |
`-----------------'                   _|_ 0V
``````
Thanks hippy! I like your text based schematics - do you do those on the fly or do you have a program that creates those for you?

I think I'll be good on my project with all of this info. Again too - I have been power concerned from the beginning so I've focused on trying to limit power use at any one time. Right now, I have 4 - DHT22 with a paired resistor/LED (only 1 DHT22/resistor/LED being polled/lit at a time), 1 resistor/LED on the PCB (to be) for any DHT22 polling indicator (would be on simultaneously with any of the DHT22/resistor/LEDs), 5 resistor/LEDs that will be used to select the operating mode (only one ever lit at a time - but one will always be lit), one resistor/LED to indicate when mode is being changed (so stays on once the mode button is pressed, but goes off then the "accept" button is pressed) which means it overlaps the others, and up to 4 relays that are on simultaneously - including overlap with the other stuff.

But, the DHT22s and the relay coils are being powered by the 5V side with the polling signals and relay trigger pins going through 3.3v to level converters. The DHT22s are going through an Adafruit 757 to 5V (since they are using digital data), and the relay signals are going through the UNL2803 to up the voltage to 5V on the other side. The 8-channel relay does have small LEDs on them as well - for each relay - but again this is being powered off the 5V side at that point.

I still have to update my KiCAD schematic to add in the 2 buttons and the 6 mode related LEDs. Once I do that I could upload an image of the schematic. But, like I said - I am making an effort to limit what is on simultaneously via the code to reduce power draws/spikes. I have considered (as someone else had suggested it in another thread earlier) the use an additional PSU to power the 5V side to lower the overall draw on the RPI - especially when kicking the relay coils - but I'm really trying to avoid that as I really don't want to deal with a partially powered system in the event of psu failure. One thing I have done via code is that only one relay coil is ever activated at the same time - I have a 1 second delay between any relay being turned on or off. So, I could have 4 of them on at any one time - but it will have turned on one, waited 1 second, turned on another, waited 1 second, turned on another, etc... To reduce the spike of turning on/off 4 of them at exact same time.

That actually does brings up another question. Is the 50mA maximum only related to the GPIOs, or the whole 3.3v bus (inlcuding the GPIOs and the 3.3V pins - like pins 1 and 17), or does that also include the 5V pins (2 and 4)? Or, does the 5V side have it's own max mA? Do the power pins (pins 1, 17, 2, and 4 have the same 16mA max ratings? Or are they different per pin? And to that point and my project - if I us a higher amp PSU say 3A vs the 2.5A standard for the 3B+, and from my understanding that the parts will draw what they need - can I split the leads coming from the psu into two pairs - one that powers the RPI and one that powers the 5V components (the relay coils and DHT22s)? I could easily add in a set of pins on my PCB to connect the 5V psu leads and remove the traces from the RPI 5V pins.

And one more monkey wrench here - I was considering using a small RPi cooling fan just to make sure everything is staying cool - how would that factor in? Better to put it on the 5V side - especially with the double lead PSU idea - and use a resistor to reduce its amp draw like maybe a resistor with a voltage drop to 3.3V? Other? This will eventually be mounted in a cabinet that has 3200 cubic feet per minute air flow moving through it at room temperature - but it will be on a side wall - not quite in the direct air flow path.
"When money ceases to be the tool by which men deal with one another, then men become the tools of men. Blood, whips and guns–or dollars. Take your choice–there is no other..."
- Ayn Rand - Atlas Shrugged

Burngate
Posts: 6347
Joined: Thu Sep 29, 2011 4:34 pm
Contact: Website

### Re: How to calculate resistors...

Thu Apr 25, 2019 5:09 pm
... Is the 50mA maximum only related to the GPIOs, or the whole 3.3v bus (inlcuding the GPIOs and the 3.3V pins - like pins 1 and 17), or does that also include the 5V pins (2 and 4)?
That 50mA is only for the GPIOs themselves.

The 3.3v on the header - pins 1 & 17 - comes directly from the regulator, so nothing in the SoC has any bearing on what they can supply.
Rather, taking too much from those pins limits what's available for the SoC from the budget the regulator has.

The 5v on the header - pins 2 & 4 - is similar, in that the only limit is what the psu can supply (through the polyfuse) after the board and any USB devices have had what they want.
... And to that point and my project - if I use a higher amp PSU say 3A vs the 2.5A standard for the 3B+, and from my understanding that the parts will draw what they need - can I split the leads coming from the psu into two pairs - one that powers the RPI and one that powers the 5V components (the relay coils and DHT22s)?
That would work.
The polyfuse will temporarily curl up its toes if you try to take too much through it, but taking current from your psu before it reaches the Pi wouldn't affect the Pi.

I've been following this thread since its inception, but not joined in, partly because lots of other clever people have said what I was going to say more succinctly.
However, it's about time someone pointed out something about the 16mA GPIO limit, that is bound to muddy the waters but needs saying
https://matt.ucc.asn.au/mirror/electron ... ntrol2.pdf
"What does the current value mean?
The current value specifies the maximum current under which the pad will still meet the
specification.
It is not: The current that the pad will deliver.
It is not: A current limit so the pad will not blow up.
The pad output is a voltage source.
 If set high the pad will try to drive the output to the rail voltage
which on the Raspberry-Pi is 3V3 (3.3 Volts).
 If set low the pad will try to drive the output to ground (0 Volts).
As the text says: the pad will try to drive the output high or low. If it succeeds depends on
what is connected. If the pas is shorted to ground it will not be able to drive high. In fact it
will try to deliver as much current as it can and the current is only limited to what the internal
resistance is.
If you drive the pad high and it is shorted to ground in due time it will blow up!
The same holds true if you connect it to 3V3 and drive it low.
Now I come back to the definition above:
The current value specifies the maximum current under which the pad will still meet the
specification."

hippy
Posts: 8239
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

### Re: How to calculate resistors...

Thu Apr 25, 2019 5:09 pm
Thanks hippy! I like your text based schematics - do you do those on the fly or do you have a program that creates those for you?
All hand-drawn on-the-fly. My original motivation was it was the only option for text-only forums. I have been doing them for years so have honed my skill a little and can knock them out quite quickly. They are not always perfect but usually good enough to convey their intended meaning. Hopefully most are worth 500 words

hippy
Posts: 8239
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

### Re: How to calculate resistors...

Thu Apr 25, 2019 5:09 pm
can I split the leads coming from the psu into two pairs - one that powers the RPI and one that powers the 5V components (the relay coils and DHT22s)?
You can and that will often be recommended / better rather than drawing 5V through the Pi itself.

You can also put a 5V to 3V3 regulator on that 'around the Pi' 5V line to have 3V3 for external circuitry rather than drawing 3V3 through the Pi if that's needed. And that's probably more recommended these days with the introduction of the MxL7704 PMIC for the latest Pi 3A+'s and 3B+'s.

Posts: 89
Joined: Fri Feb 22, 2019 5:43 pm
Location: Eastern - USA

### Re: How to calculate resistors...

hippy wrote:
Thu Apr 25, 2019 7:52 pm