Ask MAKE is a weekly column where we answer reader questions, like yours. Write them in to mattm@makezine.comor drop us a line on Twitter. We can’t wait to tackle your conundrums!
Bjorn writes in:
I’m wondering if you could help me out with resistors. I’m a computer science guy and am very new to electronics. Most of my resistor usage in my experimentation has been because I read about situations when I should use them online and just used a specific resistor because it was recommended. Obviously this only gets me so far. How do you go about determining what level of resistance you need and when you should or need to use resistors? I didn’t know I was supposed to be hooking up LEDs to my Arduinos with resistors until I started burning out LEDs and read somewhere what type of resistor someone recommended. I know it has to do with the Arduino running at 5V and most LEDs being lower voltage, but how do you know what voltage an LED is if it’s not labeled? And more importantly (like my question above), even if you know what voltage and LED is how are you supposed to figure out what kind of resistor to use?
Sure thing! This question actually comes up quite a bit, and it’s a good thing to understand.
Putting a resistor in series with an LED limits the amount of current that can flow through it, preventing it from blowing up. It’s nice to be able to figure out an exact resistance to use, but if you aren’t too worried about your light being a bit dim, you can always just stick in a largish resistor, and you will get some light. For instance, if I am making a prototype circuit and just want an indicator light that I can control from an Arduino, I’ll grab a 220 ohm resistor and put it in series with the first LED I can find. It’s probably fine for a quickie circuit, but if you are soldering up a project that you intend to keep around, it’s probably a better idea to actually calculate the correct amount of resistance to use.
So, how do you do it? Well, for a single LED, you can use the LED circuit equation:
Unfortunately, this only helps if you know the forward voltage and current rating of your diode. So, how can one figure those out? You can make an estimate abut the forward voltage of the diode based on it’s color, because the wavelength of the color and the forward voltage are roughly inversely proportional to one another. Some typical forward voltages are: Red:1.8V, Green: 2V, Blue: 3.4V. Once you have an estimate, you can measure the forward voltage of your LED by hooking it up with the suggested resistor value, and measuring the voltage across it. Then, if you were way off, you can re-calculate the resistance with the actual voltage to get a better result.
Once you know the forward voltage drop, you can choose a current value based on how bright you want the LED to be, as long as it is lower than the current rating of the device. Unfortunately, it’s a little bit harder to figure out the current rating, because most LEDs will continue to operate at higher than the recommended amount. If they are, though, their lifetime will be much shorter, and they won’t be as efficient at producing light. If you don’t have the specifications for your LED, 20ma is probably a safe maximum.
If you don’t feel like solving all of that by hand, or have a more complicated design involving multiple LEDs, you could also use an online LED calculator. This one looks nice, because it will also tell you how to hook up multilple LEDs.
Ok, enough calculations. This is what can happen if you don’t connect the LED up properly:
Boom! Engineers sometimes call these ‘unauthorized thermal events’
Related:
ADVERTISEMENT