Arduino Blink Challenge
Arduino Blink Challenge
tryengineering.org/teacher/arduino-blink-challenge
This lesson explores how computer and software engineers work to solve the challenges
of a society, such as providing systems for turning lights on and off automatically.
Students work in teams to set up and program an Arduino board to “blink” (i.e. turn a
light on and off at a 5 second on and 2 second off interval).
Age Levels: 14 – 18
1/22
Materials & Preparation
Build Materials (For each team)
Required Materials
Testing Materials
Use the programmed Arduino board and LED bulbs for testing. See the “Testing
Materials and Process” Section for a Step-by-Step Arduino Setup Tutorial.
2/22
Testing Materials & Process
Source: golubovy/bigstock.com
Materials
Use the programmed Arduino board and LED bulbs for testing
Process
This tutorial explains how to connect your Arduino board to the computer and upload
your first sketch. This is provided and available online by Arduino at
http://arduino.cc/en/Guide/HomePage. These instructions apply to the Windows
environment, but Arduino works on Mac OS X and Linux and the website provides step-
by-step instructions for all operating systems.
1. Get an Arduino Board and USB Cable: In this tutorial, we assume you’re using
an Arduino Uno, Arduino Duemilanove, Nano, or Diecimila. If you have another
board, visit http://arduino.cc/en/Guide/HomePage and read the corresponding
page for that product in the getting started guide. You also need a standard USB
cable (A plug to B plug): the kind you would connect to a USB printer, for example.
(For the Arduino Nano, you’ll need an A to Mini-B cable instead.) (Note:
TryEngineering.org recommends purchasing kits via Amazon or other retailers
which are already bundled with breadboards, lights, cable, or other parts you might
use down the road as you explore more advanced Arduino challenges.)
2. Download the Arduino Environment: Get the latest version from the download
page. When the download finishes, unzip the downloaded file. Make sure to
preserve the folder structure. Double-click the folder to open it. There should be a
few files and subfolders inside.
3/22
3. Connect the Board: The Arduino Uno, Mega, Duemilanove and Arduino Nano
automatically draw power from either the USB connection to the computer or an
external power supply. If you’re using an Arduino Diecimila, you’ll need to make
sure that the board is configured to draw power from the USB connection. The
power source is selected with a jumper, a small piece of plastic that fits onto two of
the three pins between the USB and power jacks. Check that it’s on the two pins
closest to the USB port. Connect the Arduino board to your computer using the
USB cable. The green power LED (labeled PWR) should go on.
4. Install the Drivers: Installing drivers for the Arduino Uno with Windows7, Vista, or
XP: Plug in your board and wait for Windows to begin its driver installation
process. After a few moments, the process will fail, despite its best efforts. Click on
the Start Menu, and open up the Control Panel. While in the Control Panel,
navigate to System and Security. Next, click on System. Once the System window
is up, open the Device Manager. Look under Ports (COM & LPT). You should see
an open port named “Arduino UNO (COMxx).” Right click on the “Arduino UNO
(COmxx)” port and choose the “Update Driver Software” option. Next, choose the
“Browse my computer for Driver software” option. Finally, navigate to and select
the Uno’s driver file, named “ArduinoUNO.inf”, located in the “Drivers” folder of the
Arduino Software download (not the “FTDI USB Drivers” sub-directory). If your
software does not allow you to select a specific file, just select the “Drivers” folder
and Windows will finish up the driver installation from there. When you connect the
board, Windows should initiate the driver installation process (if you haven’t used
the computer with an Arduino board before).
5. Launch the Arduino Application: Double-click the Arduino application.
6. Open the Blink Example: Open the LED blink example sketch: File > Examples >
1.Basics > Blink.
7. Select Your Board: You’ll need to select the entry in the Tools > Board menu that
corresponds to the type of Arduino you are using.
8. Select Your Serial Port: Select the serial device of the Arduino board from the
Tools | Serial Port menu. This is likely to be COM3 or higher (COM1 and COM2
are usually reserved for hardware serial ports). To find out, you can disconnect
your Arduino board and re-open the menu; the entry that disappears should be the
Arduino board. Reconnect the board and select that serial port.
9. Upload the Program: Now, simply click the “Upload” button in the environment
which may look like an arrow pointing to the right. Wait a few seconds – you should
see the RX and TX LEDs on the board flashing. If the upload is successful, the
message “Done uploading.” will appear in the status bar. A few seconds after the
upload finishes, you should see the pin 13 (L) LED on the board start to blink (in
orange). If it does, congratulations! You’ve gotten Arduino up-and-running. Note:
Some content and images on this page are derived from Arduino.cc via their
Arduino getting started guide (http://arduino.cc/en/Guide/HomePage) The text of
the Arduino getting started guide is licensed under a Creative Commons
Attribution-ShareAlike 3.0 License. Code samples in the guide are released into
the public domain.
4/22
Engineering Design Challenge
Design Challenge
You are part of a team of engineers given the challenge of using Arduino to make a light
blink on for 5 seconds and off for 2. The instructions and code on the Student
Worksheets will help you see how to program the Arduino to blink for one second on and
one second off.
Criteria
Light must turn on and off at a 5 second on and 2 seconds off interval.
Constraints
5/22
Activity Instructions & Procedures
1. Break class into teams of 2.
2. Hand out the Arduino Blink Challenge worksheet, as well as some sheets of paper
for sketching designs.
3. Discuss the topics in the Background Concepts Section. Consider asking the
students how stoplights are timed to change for traffic.
4. Review the Engineering Design Process, Design Challenge, Criteria, Constraints
and Materials.
5. Provide each team with their materials.
6. Explain that students must set up their Arduino Board and program it to “blink.”
The LED light must turn on and off at a 5 second on and 2 seconds off interval.
7. Instruct students to set up their Arduino Boards. Use the Step-by-Step Arduino
Setup Tutorial under the “Testing Materials and Process” Section.
8. Teams program their Arduino Boards
9. Teams test their Arduino Boards by demonstrating turning the light on and off at a
5 second on and 2 seconds off interval.
10. As a class, discuss the student reflection questions
11. For more content on the topic, see the “Digging Deeper” section.
Extension Idea
Require students to make the Arduino blink in the pattern of S-O-S…or have them select
three other activities (run a fan, make a stoplight, etc.).
1. What challenges did you have, if any, to programming the Arduino to blink on and
off at 1 second intervals? How did you resolve any challenges you encountered?
2. Were you able to adjust the code to change the intervals to 5 seconds on and 2
seconds off?
3. Do you think that this activity was more rewarding to do as a team, or would you
have preferred to work alone on it? Why?
4. What do you think about the Arduino? Was it a good way for you and your team to
explore basic computer programming?
5. How complicated or different do you think code would be to provide instructions to
a cell phone to play a particular ringtone?
6. Do you think that stop lights use computer programming to provide a pattern for
lights changing at intersections? How do you think stoplights were coordinated
prior to computer technology?
Time Modification
6/22
The lesson can be done in as little as 1 class period for older students. However, to help
students from feeling rushed and to ensure student success (especially for younger
students), split the lesson into two periods giving students more time to brainstorm, test
ideas and finalize their design. Conduct the testing and debrief in the next class period.
7/22
Background Concepts
Advanced Arduino Applications?
The following are some sample ideas so you can see how versatile your new computing
skills are!
Control Sensors
Try controlling an external sensor with your Arduino. You can sample air for pollution,
identify how bright an area is, set up a flood alarm with a water sensor, or attach a
motion detector. Or, consider using the Arduino to control sensors that measure
electromagnetic Fields, sample air for humidity levels, take the temperature, identify if a
gas is present in the air, or gather data from an anemometer that measures wind speed.
You can even attach a barcode scanner (which simulates a keyboard) or a keyboard to
the Arduino.
Your arduino can be set up to manage a camera system, and control photography
settings. This can be done with most equipment, including Nikon, Canon, Sony, Minolta,
Olympus and Pentax cameras. You can even attach a barcode scanner (which simulates
a keyboard) or a keyboard to the Arduino.
Arduino is a great tool for controlling motors and robotics. Try connecting DC motors or
stepper motors. You can control a highly accurate stepper motor using a potentiometer
with an Arduino.
8/22
Community of Developers
There is a growing community of Arduino application developers who share code, ideas,
and example. Additional documentation has been created by the Arduino community on
the publicly-editable playground wiki at http://playground.arduino.cc.
What is Arduino?
Computer Programming
The Arduino development environment or software contains a text editor for writing
code, a message area, a text console, a toolbar with buttons for common functions, and
a series of menus. It connects to the Arduino hardware to upload programs and
communicate with them. Software written using Arduino is called a “sketch.” These
sketches are written in the text editor. Sketches are saved with the file extension .ino.
There are features for cutting/pasting and for searching/replacing text. The message
area gives feedback while saving and exporting and also displays errors. The console
displays text output by the Arduino environment including complete error messages and
other information. The bottom right hand corner of the window displays the current board
and serial port.
Note: Some content and images on this page are derived from Arduino.cc via their
recommended Arduino getting started guide (http://arduino.cc/en/Guide/HomePage).
The text of the Arduino getting started guide is licensed under a Creative Commons
Attribution-ShareAlike 3.0 License. Code samples in the guide are released into the
public domain.
9/22
Vocabulary
Arduino: An open-source physical computing platform based on a simple
microcontroller board, and a development environment for writing software for the
board.
Computer Programming (often shortened to programming or coding): The process
of designing, writing, testing, debugging, and maintaining source code of computer
programs.
Constraints: Limitations with material, time, size of team, etc.
Criteria: Conditions that the design must satisfy like its overall size, etc.
Engineers: Inventors and problem-solvers of the world. Twenty-five major
specialties are recognized in engineering (see infographic).
Engineering Design Process: Process engineers use to solve problems.
Engineering Habits of Mind (EHM): Six unique ways that engineers think.
Iteration: Test & redesign is one iteration. Repeat (multiple iterations).
Prototype: A working model of the solution to be tested.
Dig Deeper
Internet Connections
Arduino
Recommended Reading
Writing Activity
Write an essay or a paragraph that identifies three major products or systems that have
been overwhelmingly impacted by computer programming.
10/22
Curriculum Alignment
Alignment to Curriculum Frameworks
Note: Lesson plans in this series are aligned to one or more of the following sets of
standards:
11/22
CONTENT STANDARD G: History and Nature of Science
Energy
4-PS3-4. Apply scientific ideas to design, test, and refine a device that converts
energy from one form to another.
12/22
Engineering Design
Engineering Design
MS-ETS1-1 Define the criteria and constraints of a design problem with sufficient
precision to ensure a successful solution, taking into account relevant scientific
principles and potential impacts on people and the natural environment that may
limit possible solutions.
Computational Thinking:
13. Understand the notion of hierarchy and abstraction in computing including high
level languages, translation, instruction set, and logic circuits.
Collaboration:
13/22
5. Implement problem solutions using a programming language, including: looping
behavior, conditional statements, logic, expressions, variables, and functions.
8. Demonstrate dispositions amenable to open ended problem solving and
programming (e.g., comfort with complexity, persistence, brainstorming,
adaptability, patience, propensity to tinker, creativity, accepting challenge).
9. Collect and analyze data that is output from multiple runs of a computer
program.
Computational Thinking:
Collaboration:
Collaboration:
14/22
Standard 3: Students will develop an understanding of the relationships among
technologies and the connections between technology and other fields of study.
Design
Standard 11: Students will develop abilities to apply the design process.
Standard 12: Students will develop abilities to use and maintain technological
products and systems.
Standard 13: Students will develop abilities to assess the impact of products and
systems.
Standard 17: Students will develop an understanding of and be able to select and
use information and communication technologies.
15/22
Related Engineering Fields and Degrees
There are many different types of engineering fields that involve designing products and
processes. Here are just some of the related engineering fields.
Electrical Engineering
Computer Engineering
Software Engineering
16/22
Download the Engineering Fields Infographic: How will YOU change the world?
17/22
Student Worksheet
Engineering Teamwork and Planning
You are part of a team of engineers given the challenge of using Arduino to make a light
blink on for 5 seconds and off for 2. The instructions and code below will help you see
how to program the Arduino to blink for one second on and one second off.
Research Phase
Read the materials provided to you by your teacher. If you have access to the internet
ahead of the activity, explore the Arduino website and become familiar with the logic of
the programming code.
To build the circuit, attach a 220-ohm resistor to pin 13. Then attach the long leg of an
LED (the positive leg, called the anode) to the resistor. Attach the short leg (the negative
leg, called the cathode) to ground. Then plug your Arduino board into your computer,
start the Arduino program, and enter the code below. Note: Most Arduino boards already
have an LED attached to pin 13 on the board itself. If you run this example with no
hardware attached, you should see that LED blink.
You may also set up your blinking light using a breadboard as in the image above. In
this case, you’ll use the connectors to link the Arduino to the breadboard and make a
complete circuit by having another connector going back to Arduino. You would need to
include a separate light on the breadboard too. You can do this lesson either way…with
or without the breadboard — it just depends on what materials you have provided to you
and if your team wishes to gain some experience on the breadboard.
Note: Some content and images on this page are derived from Arduino.cc via their
Arduino getting started guide (http://arduino.cc/en/Guide/HomePage)
Schematic
This illustration or schematic shows how the circuit for the light works in the Arduino.
18/22
Code
In the program below, the first thing you do is to initialize pin 13 as an output pin with the
line
pinMode(13, OUTPUT);
In the main loop, you turn the LED on with the line:
digitalWrite(13, HIGH);
This supplies 5 volts to pin 13. That creates a voltage difference across the pins of the
LED, and lights it up. Then you turn it off with the line:
digitalWrite(13, LOW);
That takes pin 13 back to 0 volts, and turns the LED off. In between the on and the off,
you want enough time for a person to see the change, so the delay() commands tell the
Arduino to do nothing for 1000 milliseconds, or one second. When you use the delay()
command, nothing else happens for that amount of time.
19/22
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Reflection
1) What challenges did you have, if any, to programming the Arduino to blink on and off
at 1 second intervals? How did you resolve any challenges you encountered?
2) Were you able to adjust the code to change the intervals to 5 seconds on and 2
seconds off?
20/22
3) Do you think that this activity was more rewarding to do as a team, or would you have
preferred to work alone on it? Why?
4) What do you think about the Arduino? Was it a good way for you and your team to
explore basic computer programming?
6) Do you think that stoplights use computer programming to provide a pattern for lights
changing at intersections? How do you think stoplights were coordinated prior to
computer technology?
21/22
© Copyright 2020 IEEE – All rights reserved. Use of this website signifies your agreement
to the IEEE Terms and Conditions. A not-for-profit organization, IEEE is the world’s
largest technical professional organization dedicated to advancing technology for the
benefit of humanity.
22/22