■ BY JOE PARDUE SMILEY’S WORKSHOP
Humidity
One of the early discoveries in electricity was that
some materials have a resistance that varies with the
amount of light that falls on them. Cadmium Sulfide
(CdS) is one such material. This light dependent
resistance was used to measure light levels for
photography. Today, this and similar material are used in a
variety of applications, including turning on lights at dusk
and then turning them off again at dawn. We also see
them in sensors in entertainment devices that detect
infrared light, and are used to receive commands from
handheld remote controls. Digital cameras have millions of
light sensors to detect the red, green, and blue light falling
on each sensor picture element.
Our CdS light sensor (Figure 1) has a resistance that is
inversely proportional to the incident light. The higher the
light, the lower the resistance. We can use this by applying
what we learned in Chapters 6 and 7 about utilizing
resistors as voltage dividers.
In Lab 2 of Chapter 7, we discovered that if we
placed a potentiometer (a variable resistor) in series with a
constant resistor, we could measure the voltage change
due to the potentiometer position. When we vary the
angle of the potentiometer (thus changing its resistance),
then the current flowing into the constant resistor depends
on that current variation. This variation in current changes
the voltage across the constant resistor which we then
measure using an ADC (analog-to-digital converter) and
the analogInput() command. The light sensor works much
like the potentiometer, so it can be placed in series with a
constant resistor.
We can measure the voltage across that resistor as an
We’ve learned that computers can sense their environment and — based on what is sensed
— they can make decisions and control things. Simply stated, computers sense, decide, and
act. We learned in Chapter 4 how to sense a button press and then based on that
information, chose to act by turning an LED on or off. Your PC senses keyboard button
presses using techniques similar to what we've learned, and then makes decisions and acts.
For instance, if you are using a word processing program, the PC senses that you press the
'a' button; it then “decides” what it needs to do, and “acts” by displaying an 'a' on the
screen. While that’s a very simple example, the basic principles of sensing, deciding, and
acting represent the same sequence used by more complex computing and electronics
systems. When one of Google's autonomous cars drives itself through San Francisco — a
very complex task — it is simply sensing, deciding, and acting. This month, we will begin
expanding what we can sense with the Arduino by learning to sense light and temperature.
The Arduino Classroom
Arduino 101 — Chapter 10:
Sensing Light and Temperature
C PROGRAMMING - HARDWARE - PROJECTS
November 2014 59
■ FIGURE 1:
CdS light dependent
resistor photo.
■ FIGURE 2:
CDS sensor breadboard
and schematic symbols.