Make a Smart Light Sensor

Version 1


    Created by Charles Alba, on September 10, 2015; last modified by Tom Seaman on September 10, 2015


    Unit Summary

    Smart appliances are becoming more common every day.  But how do they work?  In this hands-on unit, students learn how to build a device that can sense the level of ambient light and take a pre-determined action based on the amount of light it measures.  For example, the device may turn off the lights if there is sufficient ambient light present, and turn the lights back on when the room gets dark, thus saving energy.  Students learn about photoresistors – or light-dependent resistors – and build the smart device using a photoresistor, an Intel® Galileo Gen 2 board, and a computer program they can manipulate.  They are challenged to make changes to the program to modify the device’s behavior.  The design can be adapted to offer utility in any number of science projects.  No prior experience with Galileo or programming is required.


    At a Glance

    • Grade: 6-8, 9-12
    • Subjects:  Science, technology & engineering
    • Topics:  Computers, electronics, light (science)
    • Higher-order thinking skills:  Analysis, experimental Inquiry
    • Key Learnings:  Coding, making, design thinking, types and uses of electronic components
    • Content type:  Unit plan
    • Time needed:  45-60 minutes
    • Prerequisites:  No prior knowledge or experience is necessary to complete the activities.
    • License:  Creative Commons Attribution-ShareAlike (CC BY SA).  Read about the license and what you can do with this material here.


    Learning Outcomes

    • Students should gain hands-on experience with of coding and computer hardware.
    • Students should acquire confidence that they can make their own tools.
    • Students should get a glimpse of the type of work engineers and computer scientists do.


    Things You Need

    We suggest students work in groups of 2-4.  This list represents the

    • The Intel® Galileo Gen 2 board
    • The Galileo’s power cable
    • A USB cable (standard USB at one end, micro-USB at the other end)
    • A Grove Starter Kit Plus – Intel IoT Edition for Intel Galileo Gen 2 and Edison
      • See figure 1 below for the list of items we’ll be using from the kit
    • A PC (with the Galileo IDE)



    Standards Alignment

    This unit is aligned to Common Core National and Next Generation Science Standards.

    • Engineering Design:  define design problem, generate solutions, carry out tests and analyze resulting data
      • 3-5-ETS1-1, 3-5-ETS1-2, 3-5-ETS1-3
      • MS-ETS1-1, MS-ETS1-2, MS-ETS1-3, MS-ETS1-4
    • ELA/Literacy:  conduct short research projects, build knowledge through investigation
      • W.5.7
      • WHST.6-8..7


    Inquiry Process

    The unit encourages students to engage in scientific inquiry.  Students will be challenged to figure out how the sketch (computer program) works and interacts with the input (sensor) and output (LED).  They must figure out how the program works to be able to change the device’s behavior.  If things don’t work out right, they must investigate why not and try another approach.


    Assessment Processes

    An opening discussion about prior exposure to computers, electronics, and programming can be helpful in pacing the activity and grouping students who can provide leadership.  Short wrap-up discussions after completing the unit is helpful to assess progress and revisit key learnings.


    Instructional Procedures

    Introduce the Key Concepts

    Introduce the concept of a photoresistor, also known as a light-dependent resistor, how it works and its applications.  Introduce the light-emitting diode (LED) and how it works and its applications.  You may choose to use the attached teacher’s presentation for this, or use your own materials.  Explain that in this activity, we’ll be using a photoresistor to sense the degree of illumination, and an LED to simulate a lamp that we wish to turn on or off depending on the need for more light – in other words, depending on the amount of ambient lighting in the room.


    To build our smart appliance, we need some smarts.  Introduce the Intel® Galileo board.  Explain to students that Galileo is a computer, but unlike a PC, it has no keyboard.  This computer is designed to allow a wide assortment of things to be connected to it.  For example, you might connect some type of device to sense input.  This might be a microphone to sense sound.  It might be a button to sense a human decision, or a device that can sense motion or the temperature in the room.  You can also connect other types of devices to allow the computer to output something.  This might be something to display information from the computer, or provide a sound from the computer.  It could be a simple light that the computer turns on and off based on something it’s doing, or a signal that tells a motor when to run or turn off.


    With so many options for connecting different combinations of inputs and outputs, and instructing the computer how to think and act, the possibilities for creating cool things are truly endless.


    Instruct students to unpack the Grove Starter Kit Plus - Intel IoT Edition for Intel Galileo Gen 2 and Edison.  Allow the students to explore the kit and identify its pieces.  Have them use the diagram in figure 1 to set aside the pieces they will need from the kit for the activity.


    Explain that in the following activity, they’ll be connecting a light sensor and an LED to the Galileo board via the shield and cables.  They’ll build the light sensor and will then have to change the design by way of modifying the computer program.


    Set-up for the Activity

    Note about set-up:  You may elect to allow the students to connect up their Galileo boards, or you may elect to perform this set-up yourself prior to the start of class. The set-up involves connecting the Galileo to the PCs the students will be using, as well as pre-loading the Arduino (Galileo Gen 2 version) IDE onto the PCs.


    If the students will be performing the set-up themselves, add 15-20 minutes to the amount of time required for the unit.  In addition, make sure the students are responsible and take care to follow the instructions below very carefully as performing the steps in the wrong order can result in permanent damage to the Galileo board.


    Step-by-step instructions for connecting Galileo are found here:


    Within the step-by-step instructions, when prompted to choose a development environment, choose Arduino.  Have the students proceed all the way through the getting started exercise to the point where they blink the LED on the Galileo board. This affirms the set-up was done correctly.  If they cannot blink the LED, have them start over and/or seek your help.


    Make the Light Sensor


    Now that the Galileo board is connected to the computer and the computer running the Arduino IDE, the students are ready to build the light sensor circuit.  Share with the class the photo in figure 2 of the teacher’s presentation, illustrating the correct set-up.   Explain that to simulate the lights of the whole house or room, we will be using a single LED, or more precisely the LED module, in the Grove kit.


    Walk students through the steps as follow: >

    1. Identify the shield, light sensor module, LED module, green LED, and cables in the Grove Kit.>
    2. Carefully attach the shield to the Galileo Gen 2 board as shown in figure 2.
    3. Using the cables, connect the light sensor module to the shield at A0.
    4. Attach the green LED to the LED module, and then using the cables connect the LED module to the shield at D3.
    5. Turn on the shield using its switch.
    6. Open the Arduino IDE software.
    7. Upload the sketch K11_1.ino from Github, here:
    8. To simulate the changing of brightness, you may opt to cover the sensor with your finger.>


    Challenge #1

    The Intel Galileo board detects the voltage drop being emitted by the module.  This voltage changes with respect to the ambient brightness.  Galileo then uses this data to change the voltage being applied to the LED via PWM (pulse width modulation), thus making the LED shine brighter or duller.


    Using this information, replace the line





    What do you notice is different now in execution? Try reading the comments in the code as well.


    Challenge #2

    A computer screen needs to be brighter in bright ambient light, and can be dimmed when the ambient light is lower.  What could you change in the set-up and/or code to adapt the project to make a “smart computer screen” that automatically dims when the ambient light decreases, and brightens when the ambient light is brighter?


    Conclude the Unit

    Lead the class in a discussion about the unit.  Several directions are possible:  What did we learn?  What are some other applications you can think for marrying the Intel® Galileo board with a photoresistor?  Can you think of any interesting ideas for innovative smart devices for the home?  What kinds of careers are available to people who enjoy this kind of activities?


    Differential Instruction

    Resource Student

    • Allow more time as needed.
    • Skip the challenge sections and focus on building the sensor and discussing how it works.

    Gifted Student

    • Give students additional challenges that force them to go deeper into modifying the sketch.
    • Have students integrate the smart light sensor into a broader science project.
    • Have students learn the Arduino programming language and try writing their own sketches to interact with she sensor input.

    English Language Learner

    • Pair the student with a peer in groups
    • Allow more time on the visuals in the presentations
    • Provide the student with Internet access and relevant sites in the student’s first language beforehand


    Additional Resources

    For an introduction to the benefits of teaching making and coding, and tips for bringing hands-on activities to your classroom, see Gary Stager’s paper, “Guide to Creating and Inventing with Technology in the Classroom.”

    Students use Intel® Galileo to build a smart sensor that can take action based on the amount of ambient light it senses.  No prior experience with Galileo or programming required.