Yes there was always a resistor. Thank you for the lesson.
Yes there was always a resistor. Thank you for the lesson.
The PIC outputs 5V, the forward voltage of the LED is 1.5V at 10mA. So you need to drop 3.5V across the resistor when 10mA flows thru it.
R=U/I or 3.5V/0.01A=350Ohm. For a LED this is not at all critical, a 220Ohm resistor will work and so will a 680Ohm resistor.It may be helpful to try what HenrikOlsson suggested. Put a volt meter at the LED Anode (the + side, assuming the resistor is placed on the LED's "+" side) with a low value resistor (referencing the math provided by Henrik, try 220 Ohms) and see what the actual voltage is. Then replace the resistor with one a bit higher in value and retest the voltage. Repeat with an even larger resistor. You'll see that the voltage at the LED Anode doesn't change much as you swap out different resistors. HOWEVER, the CURRENT flowing through the circuit DOES change. (Ohm's Law stuff.) This will eventually affect how bright the LED appears to your human eye.I thought the resistor only provided current limiting? Maybe you've explained but I don't get how it drops the voltage. I've used voltage dividers using 2 resistors, etc.
Most 8-bit PICs have 25ma ratings on the individual pins (some are as low as 10 ma, some as high as 50; you didn't mention the PIC part you're playing with). Therefore, driving an LED is perfectly safe, so long as you include the 'current limiting' resistor.
Thanks Mike. I'm using the 16F1823.
Take a look at charlieplexing if you'd like to see LED indicators taken to the extreme. Not saying this applies to your question, but it will give you some insight into how cleverly these simple rules can be applied.
Bookmarks