Data Sheet

26 : circuit 1c
NEW
COMPONENTS
PHOTORESISTORS are light-
sensitive, variable resistors. As
more light shines on the sensor’s
head, the resistance between its
two terminals decreases. They’re
an easy-to-use component in
projects that require ambient-
light sensing.
NEW CONCEPTS
ANALOG TO DIGITAL CONVERSION:
In order to have the RedBoard sense analog
signals, we must first pass them through
an Analog to Digital Converter (or ADC).
The six analog inputs (A0–A5) covered
in the last circuit all use an ADC. These
pins sample the analog signal and create
a digital signal for the microcontroller to
interpret. The resolution of this signal is
based on the resolution of the ADC. In the
case of the RedBoard, that resolution is 10-
bit. With a 10-bit ADC, we get 2 ^ 10 = 1024
possible values, which is why the analog
signal can vary between 0 and 1023.
VOLTAGE DIVIDERS CONTINUED:
Since the RedBoard can’t directly interpret
resistance (rather, it reads voltage), we
need to use a voltage divider to use our
photoresistor, a part that doesn’t output
voltage. The resistance of the photoresistor
changes as it gets darker or lighter. That
changes or “divides” the voltage going
through the divider circuit. That divided
voltage is then read in on the analog to
digital converter of the analog input.
The voltage divider equation:
assumes that you know three values of
the above circuit: the input voltage (V
in
),
and both resistor values (R
1
and R
2
). If R1
is a constant value (the resistor) and R2
fluctuates (the photoresistor), the amount
of voltage measured on the Vout pin will
also fluctuate.
Circuit 1C:
Photoresistor
In circuit 1B, you got to use a
potentiometer, which varies resistance
based on the twisting of a knob. In this
circuit, you’ll be using a photoresistor,
which changes resistance based on how
much light the sensor receives. Using this
sensor you can make a simple night-light
that turns on when the room gets dark
and turns off when it is bright.
YOU
NEED
10k
100k
330
10k
100k
330
LED PHOTORESISTOR  RESISTOR K RESISTOR JUMPER WIRES
V
out
=V
in
R
2
R
1
+R
2
SIK v4 Book Oct 13.indb 26 10/18/17 9:59 AM