The_Official_Raspberry_Pi_-_Beginner’s_Book_Vol1,_2018 (1)

(singke) #1

126 THE OFFICIAL RASPBERRY PI BEGINNER'S GUIDE


actual value of the resistor. This example has a brown band, which means ‘×10^1 ’. That may look
confusing, but it’s simply scientific notation: ‘×10^1 ’ simply means ‘add one zero to the end of your
number’. If it were blue, for ×10^6 ’, it would mean ‘add six zeroes to the end of your number’.
33, from the orange bands, plus the added zero from the brown band gives us 330 – which
is the value of the resistor, measured in ohms. The final band, on the right, is the tolerance of
the resistor. This is simply how close to its rated value it is likely to be. Cheaper resistors might
have a silver band, indicating it can be 10 percent higher or lower than its rating, or no last
band at all, indicating it can be 20 percent higher or lower; the most expensive resistors have
a grey band, indicating that it will be within 0.05 percent of its rating. For hobbyist projects,
accuracy isn’t that important: any tolerance will usually work fine.
If your resistor value goes above 1000 ohms (1000 Ω), it is usually rated in kiloohms (kΩ); if
it goes above a million ohms, those are megohms (MΩ). A 2200 Ω resistor would be written as
2.2 kΩ; a 2200000 Ω resistor would be written as 2.2 MΩ.

Your first physical computing program: Hello, LED!
Just as printing ‘Hello, World’ to the screen is a fantastic first step in learning a programming
language, making an LED light up is the traditional introduction to learning physical computing.
For this project, you’ll need an LED and a 330 ohm (330 Ω) resistor, or as close to 330 Ω as you
can find, plus female-to-female (F2F) jumper wires.

CAN YOU WORK IT OUT?
What colour bands would a 100 Ω resistor have? What
colour bands would a 2.2 MΩ resistor have? If you wanted
to find the cheapest resistors, what colour tolerance band
would you look for?

RESISTANCE IS VITAL
The resistor is a vital component in this circuit: it protects the Raspberry
Pi and the LED by limiting the amount of electrical current the LED can
draw. Without it, the LED can pull too much current and burn itself – or the
Pi – out. When used like this, the resistor is known as a current-limiting
resistor. The exact value of resistor you need depends on the LED you’re
using, but 330 Ω works for most common LEDs. The higher the value, the
dimmer the LED; the lower the value, the brighter the LED.
Never connect an LED to a Raspberry Pi without a current-
limiting resistor, unless you know the LED has a built-in resistor of
appropriate value.
Free download pdf