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).

  • Learn about engineering design and redesign.
  • Learn about circuits, computers, and software coding.
  • Learn how engineering can help solve society’s challenges.
  • Learn about teamwork and problem solving.

Age Levels: 14 – 18

Build Materials (For each team)

Source: VanVoorhis

Required Materials

  • Arduino Starter kit (may be purchased individually or as a starter kit)
    • Arduino Uno
    • 3′ USB Cable
    • Solderless breadboard
    • 65 jumper wires
    • Breadboard holder
  • Arduino Starter kit purchased via amazon.com or https://www.arduino.cc
  • Connectors
  • LED bulbs
  • Fan
  • Insulators
  • Breadboard (optional)

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.

Source: golubovy/bigstock.com

Materials

  • Use the programmed Arduino board and LED bulbs for testing

Process

Step-by-Step Arduino Setup Tutorial (for Windows)

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. 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.

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

Use only the materials provided.

  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.).

Student Reflection (engineering notebook)

  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

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.

Divide into teams
Review the challenge and criteria constraints
Brainstorm possible solutions (sketch while you brainstorm!)
Choose best solution and build a prototype
Test then redesign until solution is optimized
Reflect as a team and debrief as a class

Advanced Arduino Applications? 

Source: Kuzmik/bigstock.com

Beyond Flashing Lights

If you have completed the Arduino Blink Challenge, there are many other applications for using an Arduino board that you can try on your own, as a team, in the classroom, or on your own time. You can also find advanced tutorials at http://arduino.cc/en/Tutorial/HomePage to show you how to read a switch, read a potentiometer, use a pushbutton to control an LED, play tones on multiple speakers, make an LED bar graph, send a text string, or even output the values from a barometric pressure sensor as a web page.

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.

Visual and Audio Applications

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.

Motors and Robotics

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.

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?  

Open Source Computing

Arduino is an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board. Arduino can be used to develop interactive objects, taking inputs from a variety of switches or sensors, and controlling a variety of lights, motors, and other physical outputs. Arduino projects can be simple – – such as turning on and off a light — or very complex. The boards can be assembled by hand or purchased preassembled; the open-source software can be downloaded for free. The Arduino software runs on Windows, Macintosh OSX, and Linux operating systems.

Computer Programming

Computer programming (often shortened to programming or coding) is the process of designing, writing, testing, debugging, and maintaining source code of computer programs. The code can be written in many different programming languages. Programming is basically a set of instructions that a computer or other device uses to perform a task — it might be turning on a light, opening a door, or writing a document.

Arduino Development Environment

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.

Internet Connections

Recommended Reading

  • Beginning Programming (ISBN: 978-0672337000)
  • Hello World! Computer Programming for Kids and Other Beginners (ISBN: 978- 1617290923)
  • Programming Arduino Getting Started with Sketches (ISBN: 978-1259641633)

Writing Activity

Write an essay or a paragraph that identifies three major products or systems that have been overwhelmingly impacted by computer programming.

Alignment to Curriculum Frameworks

Note: Lesson plans in this series are aligned to one or more of the following sets of standards:  

National Science Education Standards Grades 5-8 (ages 10-14)

CONTENT STANDARD A: Science as Inquiry

As a result of activities, all students should develop

  • Abilities necessary to do scientific inquiry 

CONTENT STANDARD B: Physical Science

As a result of their activities, all students should develop an understanding of

  • Properties and changes of properties in matter 
  • Transfer of Energy

CONTENT STANDARD E: Science and Technology

As a result of activities in grades 5-8, all students should develop

  • Abilities of technological design 
  • Understandings about science and technology

CONTENT STANDARD F: Science in Personal and Social Perspectives

As a result of activities, all students should develop understanding of

  • Risks and benefits 
  • Science and technology in society 

CONTENT STANDARD G: History and Nature of Science

As a result of activities, all students should develop understanding of

  • Science as a human endeavor 
  • History of science 

National Science Education Standards Grades 9-12 (ages 14-18)

CONTENT STANDARD A: Science as Inquiry

As a result of activities, all students should develop

  • Abilities necessary to do scientific inquiry 

CONTENT STANDARD B: Physical Science 

As a result of their activities, all students should develop understanding of

  • Interactions of energy and matter 

CONTENT STANDARD E: Science and Technology

As a result of activities, all students should develop

  • Abilities of technological design 
  • Understandings about science and technology 

CONTENT STANDARD F: Science in Personal and Social Perspectives

As a result of activities, all students should develop understanding of

  • Science and technology in local, national, and global challenges 

National Science Education Standards Grades 9-12 (ages 14-18)

CONTENT STANDARD G: History and Nature of Science

As a result of activities, all students should develop understanding of

  • Science as a human endeavor 
  • Historical perspectives 

Next Generation Science Standards Grades 3-5 (Ages 8-11)

Energy

Students who demonstrate understanding can:

  • 4-PS3-4. Apply scientific ideas to design, test, and refine a device that converts energy from one form to another.

Engineering Design 

Students who demonstrate understanding can:

  • 3-5-ETS1-1.Define a simple design problem reflecting a need or a want that includes specified criteria for success and constraints on materials, time, or cost.
  • 3-5-ETS1-2.Generate and compare multiple possible solutions to a problem based on how well each is likely to meet the criteria and constraints of the problem.
  • 3-5-ETS1-3.Plan and carry out fair tests in which variables are controlled and failure points are considered to identify aspects of a model or prototype that can be improved.

Next Generation Science Standards Grades 6-8 (Ages 11-14)

Engineering Design 

Students who demonstrate understanding can:

  • 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.

CSTA K-12 Computer Science Standards Grades 6-9 (ages 11-15)

Computational Thinking: 

  • 13. Understand the notion of hierarchy and abstraction in computing including high level languages, translation, instruction set, and logic circuits.

Collaboration: 

  • 1. Apply productivity/multimedia tools and peripherals to group collaboration and support learning throughout the curriculum.
  • 3. Collaborate with peers, experts, and others using collaborative practices such as pair programming, working in project teams, and participating in group active learning activities.
  • 4. Exhibit dispositions necessary for collaboration: providing useful feedback, integrating feedback, understanding and accepting multiple perspectives, socialization.

CSTA K-12 Computer Science Standards Grades 6-9 (ages 11-15)

Computing Practice & Programming: 

  • 1. Select appropriate tools and technology resources to accomplish a variety of tasks and solve problems.
  • 2. Use a variety of multimedia tools and peripherals to support personal productivity and learning throughout the curriculum.
  • 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.

Computers & Communications Devices: 

  • 1. Recognize that computers are devices that execute programs.
  • 3. Demonstrate an understanding of the relationship between hardware and software.

CSTA K-12 Computer Science Standards Grades 9-10 (ages 14-16)

Computational Thinking: 

  • 2. Describe a software development process used to solve software problems (e.g., design, coding, testing, verification).

Collaboration: 

  • 1. Work in a team to design and develop a software artifact.
  • 4. Identify how collaboration influences the design and development of software products.

Computing Practice & Programming: 

  • 3. Use various debugging and testing methods to ensure program correctness (e.g., test cases, unit testing, white box, black box, integration testing)
  • 4. Apply analysis, design, and implementation techniques to solve problems (e.g., use one or more software lifecycle models).
  • 8. Explain the program execution process.

Computers & Communications Devices: 

  • 4. Compare various forms of input and output.

CSTA K-12 Computer Science Standards Grades 10-12 (ages 16-18)

Collaboration: 

  • 3. Evaluate programs written by others for readability and usability.

Standards for Technological Literacy – All Ages

The Nature of Technology

  • Standard 3: Students will develop an understanding of the relationships among technologies and the connections between technology and other fields of study.

Technology and Society

  • Standard 4: Students will develop an understanding of the cultural, social, economic, and political effects of technology.
  • Standard 6: Students will develop an understanding of the role of society in the development and use of technology.
  • Standard 7: Students will develop an understanding of the influence of technology on history.

Design

  • Standard 8: Students will develop an understanding of the attributes of design.
  • Standard 9: Students will develop an understanding of engineering design.
  • Standard 10: Students will develop an understanding of the role of troubleshooting, research and development, invention and innovation, and experimentation in problem solving.

Abilities for a Technological World

  • 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.

The Designed World

  • Standard 17: Students will develop an understanding of and be able to select and use information and communication technologies.

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.

Building the Circuit

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.

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.

/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

Reflection

Complete the reflection questions below:

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 stoplights use computer programming to provide a pattern for lights changing at intersections? How do you think stoplights were coordinated prior to computer technology?

 

 

 

Lesson Plan Translation