I am confused about some general terms. Lets say you have a battery. Does the battery produce voltage or amps, or both? Also, lets say you have a 9 volt battery. Attached to the 9 volt battery is a LED. The LED drops the voltage by 2V and consumes 20mA. How would you calculate what resistor you need? I have read that you would subtract 9 volts from the battery by the 2V that the LED drops it by. And from there you would do 7V divided by 0.02A. What I don't understand is why.
The chemical reaction in the battery or cell generates an EMF or voltage, trying to push electrons round
the external circuit - until they flow the reaction is held back. The current that flows initialliy
depends on the resistance round the circuit and internally in the cell. At low temperatures the reaction
rate may become low enough to limit the current, rather like an increase in resistance. As the chemicals
get used up the EMF will reduce a bit too, and the internal resistance may change.
Your calculation is correct - calculations about circuits are all about combining constraints, the battery
voltage is a constraint (if you assume only low currents), the LED voltage is a constraint (with the
same assumption), thus you have 7V across the resistor and thus to get 20mA the resistor ought to be
350 ohm - but 330 ohm is the nearest standard value. Since the current is limited to about 20mA by
the resistor you guarantee your assumptions are correct.
You can do more detailed calculations using the true V-I response curve of the LED and include the
battery’s internal resistance, but you don’t bother because the LED will look about the same if the
current is 10mA or 30mA.
Draw the circuit. You will have a loop. There is a law that states that the voltages around a loop sum to zero. 9 volts for the battery, -2 volts for the LED, leaves 7 (actually -7 but the sign just indicates direction of current flow) volts across the resistor. There is 0.02 amps = 20 mA through the resistor, so just use Ohms Law to calculate the resistance.
There is a similar law that states that the sum of the currents at a node (a point that joins two or more components) is zero.
Tools like Spice use these laws to write the circuit equations in matrix form to simulate a circuit.
It sounds like you want a basic college level course in electrical engineering.
Does the battery produce voltage or amps, or both?
There is a water-flow analogy...
Voltage is similar to water pressure. The pressure in your house's water pipes always there whether the water is turned-on or turned-off. The battery voltage, or voltage at your wall outlet is always there, whether current is flowing or not.
Water current flow is similar to electrical current flow.
Electrical resistance is the resistance to current flow. A small water pipe (or a valve) reduces water flow and a resistor reduces electrical current flow.
The problem with the analogy is if you cut a water pipe, water current flows out all over the place unrestricted. If you cut a wire, the opposite happens and no electrical current flows.
There is a current limit. If you try to power "something big" from your 9V battery, you'll hit the current limit of the battery and the voltage will drop. That's because Ohm's Law is a law of nature and it's always true. Of course, there is also a current limit for the power outlets in your home... If plug too much stuff into an outlet the circuit breaker blows and the voltage goes to zero.
Actually, something similar happens with water. If you have a big hole in your pipe, or if you turn-on all of the faucets in your home, too much water current flows and the pressure drops.
LED's are a bit tricky... LEDs are non-linear, which means the resistance changes with voltage. That means Ohm's Law is not very useful for the LED itself because we don't know the resistance of the LED (although we can calculate it's effective resistor under some known voltage & current conditions).
Like all diodes, at low voltage the LED has high resistance. At the "operating voltage" ("breakdown voltage" for a regular diode) the resistance suddenly drops dramatically. If you force the voltage much higher, too much current flows and the LED burns-up.
There is another set of laws called [u]Kirchhoff's Laws[/u], that describe how voltages & currents combine in series & parallel circuits.
In series circuits, the voltage divides across the series components. With a resistor and LED in series (and your 9V battery) the voltage across the LED and resistor will add up to 9V.
Another of Kirchhoff's Laws says that the current in series components is the same... The current through the resistor is the same as the current through the LED.
And, the voltages divide proportionally to the resistance. At low voltages where the LED resistance is high, most of the applied voltage will fall across the LED with less voltage across the resistor. At higher voltage where the LED resistance is lower, most of the voltage will drop across the resistor.
If we know the LED operates "normally" with 2V, we know there is 7V across the resistor. Since we know the current through the resistor is the same as the current through the LED, we can use Ohm's Law to calculate the current through the resistor (or to calculate the resistance we want).