Arduino Uno R4 WiFi LESSON 2 SUPPLEMENTAL: Calculating Current Limiting Resistor for LED

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys Paul mcar with toptechboy do.com and I've got a very quick lesson for you this is a supplemental lesson to lesson number two and the reason I'm doing the supplemental lesson when I was reading the comments after a lot of you guys watched lesson number two there was a little bit of confusion and I wanted to provide clarification what was the confusion over the confusion was over how to properly choose a current limiting resistor your LED circuit to make sure that nothing is damaged when you turn it on okay now I will say what I showed in lesson number two was correct we got to the correct answer a th000 ohm resistor in series with the LED that will make sure everything is safe but as people were looking at it they did not perfectly understand what I was doing and then some people were arguing for a different approach and then some people were arguing for an approach that was actually wrong okay so I want everyone to more perfectly understand how I got to the th000 ohms okay so let's start by saying what is the purpose of a current limiting resistor the purpose of the current limiting resistor is to ensure that you do not draw a current which will damage either your LED or damage your Arduino and in particular we don't want to damage the Arduino now the Arduino R3 it could drive a lot more current from those uh digital pins and so we typically used a 330 Ohm resistor and that was well within the tolerance of where you would never be worried about burning out your uh Arduino on the R3 now this is the thing about the R4 they dro the current Drive capability of the digital pins on the R4 down to 8 milliamps so what could happen if we try to draw more than 8 milliamps we could burn out our Arduino so we've got to make sure when we're hooking circuits up that we don't try to draw more than 8 milliamps otherwise we would damage the circuit okay so let me show you our circuit and let's talk about this particular topic in a little bit more detail okay so from last week what I was showing you was I was showing you that this is the voltage supply for the sake of that lesson that was a digital pin on the Arduino and then you come over and you go to your diode you go to your light emitting diode and then we put a current limiting resistor okay and then what the question was what value should that resistance be okay what value should that resistance be in order to ensure that you never drop you never try to pull more than 8 milliamps okay what else do we know we know that this was 5 volts that is coming off of the digital pins on the Arduino and then what we know is we know that the maximum current the IM Max that we want to try to draw is 8 milliamps okay now what I did was said okay let's just put in resistance and we say V is equal to I * R and then I said let's just assume that all the voltage drops across the resistor and so then what we could say is well that the resistance let's divide both sides by I the resistance would be the voltage divided by the I Max okay what did I do I divided both sides of the equation by I and now I have R is equal to V divided by IMAX so then I say R is equal to V we know what that is 5 volts and then IM Max is 8 milliamps and then we change milliamps to amps and so that's 5 / 08 because we're changing milliamps to amps and then when I put that in the calculator when I put that in the calculator what I get is 5 / 008 and then I get 625 ohms so if that resistance is 625 ohms then there is no way that I could draw more than 8 milliamps but then what people were saying is they said wait wait wait wait you've got a voltage drop across the diode okay and then therefore you're you're not going to have five volts against across the resistor you're going to have something less than 5 volts and therefore you would do the calculation and you would get a much lower resistance okay you would get a much lower resistance because some of the voltage is dropping across the diode now there's parts of that that are true but there's parts of that that then lead you to getting a very dangerous value for the resistor so what is true is the voltage as you go around your circuit the voltage the 5 volts has to be dropped across all the different components in the uh in the loop so you add the voltage drop of each of the components that is in the loop and it will add up to your Source voltage and so what do I know I know that the voltage source which for us is 5 volts is going to be equal to the voltage drop across the diode plus the voltage drop across the resistor okay that makes sense and so you know if I have 5 volts dropping across the resistor I have Zer volts across the diode if I have three volts across the diode then I have two volts across the resistor okay that part is true and then what people were saying is well you know you can have twv drop across the diode and so really there would be three volts across the uh across the resistor and so what they're saying is is that is is that if you got a voltage drop of two across the diode then actually you're going to have three remaining to drop across the resistor and therefore the resistance would be the voltage drop across the resistor divided by the I Max and then that is going to be 3 ided .008 and then they're going to get let's try that they're going to get 3 / ah 3 / 0 8 and then they're going to calculate a 375 Ohm resistor and you know let's push things a little bit what's the one closest to that would be 330 ohms okay and that is what they are saying all right but now let's think about it let's think about it can you say that you sometimes get a 2vt drop across a diode yes you can but what you have to see is the current voltage characteristics of a diode are not linear they are exponential meaning a very very small change in the voltage on the diode can cause a very very large change in the current through the diode because it's an exponential and so if you were saying well if I just put the diode in there and I put it at 1.8 volts then then I would have or yeah I put it at 1.3 volts I would be drawing 6 milliamps and I would need a current limiting resistor because I could just run it at that voltage and everything's going to be okay well what's the problem what if you aren't right at 1.6 volts but you have a little noise or a little error and you're a little bit more than that and you get a huge increase in current then you have possibly either damaged your diode or you have damaged your uh damaged your Arduino so let's look at a typical current voltage let's look at a typical current voltage uh curve of a LED of a red LED what do you see it's exponential it doesn't change very fast at first and then it just is Off to the Races and and changes very very quickly well what do you notice if you're doing your circuit analysis and let's say ah let's plug in two volts for the diode and you're saying okay we're going to plug in two 2 Volts for the diode well if you have a 2v drop across the diode what current is that diode going to be drawing it is going to be drawing 45 milliamps what if you design your circuit to draw 45 milliamps what is going to happen you are going to burn out your Arduino or at least burn that pin out and you could say well let's come down here and let's just let's just do this circuit okay let's do this circuit I'm going to put plus minus and then I'm going to come over I'm going to put a diode in my LED and then I'm going to go like this okay no current limiting resistor and I'm going to run at 1.7 volts and then at 1.7 volts I am right at 8 milliamps and everything's going to be okay all right but what happens if your circuit heats up a little bit or cools down a little bit and this curve shifts a little bit just a tiny shift and very quickly you're up here at 20 milliamps okay very quickly you are up here at 20 milliamps and then what have you done you have damaged your uh you have damaged your uh uh Arduino now you don't want to damage the LED and you don't want to damage the Arduino so when you're doing this you've got to see well which one is more sensitive you know I don't if if the LED is more sensitive I'll design around its current handling capability or if the supply is more sensitive I will Design around that you want to design around whichever one has the lower the lower current handling capability okay well most LEDs can certainly take more than 8 milliamps so for the purpose of these lessons what are we worried about we don't don't want to burn out our Arduino okay well if uh if 2 volts is not the right thing what voltage do I put in for the diode this is what you have to do you have to say those diodes I don't know what they're going to do I don't know what they're going to do what I know is I don't want to burn out my Arduino so I want what 8 million amps Max Max no I better get out of your way because this is important 8 milliamps Max no matter what okay no matter what I want 8 milliamps Max no matter what well you see I don't know what the voltage drop across the diode is going to be because it could be down here at 1.65 or it could be up here at 1.85 and those little bitty changes in voltage have massive changes in current what else can happen an LED over time now it's very unusual for the component to fail but what if the LED failed over time and what if it became a short no voltage drop across it now it's probably been burned out for some reason something caused it to be burned out but when it's burned out if it fails as a short what do you not want to happen you don't want to then go and burn your Arduino out so how do we do how do we do a circuit like this okay how do we do a circuit like this okay I'm not trying to do a circuit analysis I'm trying to do a circuit design where I design for the worst case and under the worst case I don't want my Arduino to burn out so how would I choose my resistor okay I'm going to come here I'm going to have my LED and then I'm going to come over to my resistor and then what am I going to assume I'm going to assume what is the worst thing that could happen the worst thing that could happen is this led shorts itself out for whatever reason the LED becomes a short if that led becomes a short then all the voltage is going to drop across the resistor and in that case the voltage drop across the resistor is 5 Vols that's the worst case under the worst case what do I want to make make sure that I'm not drawing more than 8 milliamps and so in that case what would it be V across the resistor is equal to the I times the resistance resistance is equal to V or the voltage across the resistor divided by I which is equal to 5 divided by what do we want never more than .008 and then what do we get we get 5 / 008 and the right value of the resistor would be the right value of that resistor would be 625 ohms okay now there is not a 625 ohm resistance well what if we went down to 330 well if I used a 330 Ohm resistor and if the voltage was shorted across the diode what would I have I would have all five volts so I would have current right we've got V is equal to I * r i is equal to V / R and I've still got 5 volts and then what if I used 300 and 30 Ohm resistor and then what if that diode had shorted out then what I would have is 5 / 330 is equal to 15 milliamps that's 2x what is safe 2x what is safe what is likely to happen there you're very likely that you could burn your LED out well you say well I don't think the diode's going to I don't think the diode's going to short out yeah but you see look at this this curve over here where are you operating that diode is just a device waiting to draw huge amounts of current right what is the safe thing is let's just put zero volts across the diode okay and then let's calculate all the voltage drop across the resistor and that way no matter what this diode does there's no way that I am going to burn out my Arduino does that make sense well what if you said okay Let's uh let's come in and let's put this value that value would be pretty safe so let's let's design around that value well in that case you would say let's say that's 1.5 1.5 volts well if 1.5 volts is dropping across the diode then what would we have we would have 3.5 volts dropping across the resistor and then we divide that by 0.008 milliamps and what would we get we would get uh 3.5 ided .008 and then that's going to be 437 ohms well if our typical resistors are coming as 220 ohms 330 ohms or 1,000 ohms okay if they're coming like this still if we wanted 437 we still have to round to the 1,000 because if we went down to 330 ohms it would still then be possible to draw more than 8 milliamps from the Arduino man I hope this isn't confusing you more but what I want you to see is I don't want you to burn out the Arduino so what is the safe thing to do the safe thing to do is just say I'm going to assume there's no voltage drop across the diode all the voltage drop is across the resistor and in that case for 8 milliamps and 5 volts I need a 625 Ohm resistor and if your box had a 625 Ohm resistor I would still advise you to put a little margin in right put a little margin in because what if your resistor isn't exactly the value that you thought maybe if instead of 625 maybe we go 675 to be safe but really you don't have that level of Fidelity in your resistors and so I got a 330 I got a th I'm going to use a thand okay and if I use a th I'm not going to burn it out now if you go back to the Arduino R3 the safe number is probably 330 ohms okay use 330 you're going to be safe all right so does that make sense what I'm saying and that way if different Dows behave a little bit different differently or the different color diode behaves a little differently if you use a th000 ohms you won't burn out your Arduino okay and that's what I want you to do so hopefully I haven't just bored you and hopefully I haven't confused you and what I would like is I would like feedback from you guys whether these supplemental lessons that I go in and put in in the middle after I see where there's confusion is that helpful or is it not helpful like did I just annoy you with this lesson or did I not annoy you okay man the other thing that kept coming up is in the discussion there seemed to be an argument about the difference between building the circuit like this okay where the current limiting resistor was on the downside of the diode or building it like this okay and in that discussion I saw some really bad physics about oh well uh in this case in this case the diode is seeing the five volts and in this case the diode is not seeing the five volts no no no no no no no no it's the voltage drop okay and the voltage drop across this resistor is exactly the same if you put it here or if you put it here and if the voltage drop across that resistor is exactly the same regardless of which side you put it on then the voltage drop across the diode is going to be exactly the same and the current is going to be exactly the same so in both of these circuits the voltage drop across the diodes are identical the voltage drop across the resistors are identical and the current through the circuit is identical and so how do I decide which one of these to use well just on my breadboard what's more convenient sometimes it's easier to put the resistor on the downside because then you can connect the voltage to the long lead of the LED easier sometimes it's easier to put it on the other side you can sort of put it on either side okay now the one exception to that would be when you are working with an RGB LED right the RGB LED looks like this okay and you have the four leads right off the RGB LED they all come down here like this and then they come down and this is that long leg down here and then you have the r leg the G leg and the B leg like this the r the G and the b in this case you have to put the resistor on this side because otherwise you would be sharing a resistor between the channels and you can't do that because then you would be getting cross Channel kind of like cross Channel communication which wouldn't be good the brightness that you set the red LED would control how bright the green one was or you Chang the green brightness and it also changes the red brightness so when you are doing an RGB LED you have to put the current liming resistors on that side you don't have a choice okay but still what value should they be they should be 1,000 ohms and if they're a th000 ohms then not any one of your digital pins would be drawing more than 8 milliamps okay guys I really need feedback from you on this because normally I just keep going but I was just seeing that the way I'd explain things in lesson number two some people were getting confused and so I hope this clears it up but man give me feedback quit the supplemental lessons or when there seems to be confusion give us a little bit more information okay guys I hope you enjoyed this lesson uh this was just a quick one and we'll get back now to to our normal normal program uh schedule and lesson number three will be next week as normal I will talk to you Paul mcar with toptechboy do.com I'll talk to you guys later
Info
Channel: Paul McWhorter
Views: 6,920
Rating: undefined out of 5
Keywords: STEM, LiveStream, TopTechBoy
Id: _kpiHFGB_ys
Channel Id: undefined
Length: 23min 13sec (1393 seconds)
Published: Fri Feb 02 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.