Hardware Reference
In-Depth Information
the voltage across a resistor and you know what current you want to have lowing through it,
you can calculate the resistance it has to have in Ohms by using Ohm's law in the form of
Resistance equals Voltage over Current, or
R = E / I
E is the voltage in volts, and I is the current in amps. So if you want to have 20mA lowing
through the LED, which means 20mA lowing through the resistor as well because these two
components are in series, which means the same current lows through both of them, you
plug those igures into the formula to get the following:
R = 1.8 / 0.02 = 90 Ohms (also stated as 90R )
Unfortunately, you can't get a 90R resistor because you can get only certain standard values,
but the value closest to 90R is 91R, so you can use that. If you plug that value back into
Ohm's law, you will see that your actual current is
I = E / R = 1.8 / 91 = 19.78mA (which is almost spot on)
So let's see what happens if the forward voltage drop changes slightly. How will that afect
the current? You can plug some diferent values into the equation, as shown in the graph in
Figure 8-3. You can see that the current through the LED doesn't vary dramatically with
small changes in forward voltage like it does when you drive the LED with a ixed voltage.
he resistor has acted to minimise variations and stabilise the operating current.
To allow the PiFace board to control an LED, all you need to do is to connect the resistor not to
ground but to the PiFace's output. hese outputs are what is known current sinks; that is, they
allow current to low through them to ground, or not, depending on the logic level set by the
Raspberry Pi. his means that you can turn the LED on or of by setting the output high or low.
When you set the PiFace output high, that makes the current sink through the output bufers
and thus allows current to low through the LED, thus allowing the LED to emit light. What
you are going to do for this project is not to have one resistor to sink the current through but to
have two. If you arrange the currents the resistors provide carefully, you can get three diferent
brightness levels from one LED. his means having one resistor supply twice the current of the
other to give a current of one unit, or two units or three units of current, where three units of
current is less than or equal to the maximum working current.
In practice, the eye has a nonlinear response to brightness, so although you might increase
the current in equal steps and the light output from the LED changes in equal steps, we do
not perceive it as being in equal steps. In fact, the brighter something gets, the less a ixed
step in brightness appears to make it change; this is a logarithmic law.
Search WWH ::




Custom Search