How can I know which resistor to use in my circuit
sheonbanks
Posts: 10
One of the first assignments in the book is to create a circuit. The circuit has 1 LED(Green) and a 470(Ohm) resistor. Why was this resistor chosen? When using the potentiometer connected to the LED a 220(Ohm) resistor was used. How will I know which resistor I need when I want to create a circuit of my own?
Sheon
Sheon
Comments
It's E = I x R where E is the voltage in Volts, I is the current in Amperes, and R is the resistance in Ohms.
If you look on the datasheet for a typical red LED, the (mostly) constant voltage drop across it is 1.7V and they will produce usable
light with currents from 5 to 20mA. Usually over 20mA they will begin to overheat. Some very efficient LEDs will give usable light
at currents below 5mA. If you're using a transistor or some logic circuit to turn this LED on and off, the switch will probably drop
another 0.3V. Check the datasheet for the device for the Vsat (saturation voltage drop) or the Voh (logic high voltage output).
So, if you're using a 5V logic supply, that gives 5V - 1.7V - 0.3V = 3V to drop across the resistor. If you're using a 470 Ohm
resistor, that's 3V = I x 470. That gives I = 3/470 or approximately 6mA. If you use a 220 Ohm resistor, you get I = 3 / 220
or roughly 15mA. Either resistor will cause the LED to light. You can check the specific LED's datasheet for the amount of light
given the current.
The same kind of calculation is used for other LEDs and other supply voltages. Given a specific current value, you can solve Ohm's
Law for the resistor value you need.
(1) the current limit of the LED (you want this to be less than 20mA)
(2) the current limit of a single pin of the BASIC Stamp (happens to be about 20mA too)
(3) accumulated current limit of the BASIC Stamp (the sum of all current used for a given set of 8 ports should be less than 40mA) - this is usually why the resistor is so "high" and the current is much smaller than 20mA.
470-ohm resistor ends up being a good compromise in most cases due to Mike's calculations above. You have to be more careful about your calculations though if you intend to drive more than 5 or 6 LED's out of a group of 8 ports.