Arduino Essentials
Electrical EngineeringComputing Systems

Arduino Essentials

Grades 5–12
5 hr 13 min
22 steps
Groups of 5
NC CTEHS. Energy

Standards Alignment

NC CTE

Engineering Explorations I (8450) 36 weeks

  • EE.7.39: Demonstrate knowledge of appropriate personal safety procedures.
  • EE.9.50: Present information pertaining to an engineering achievement.
  • EE.7.40: Comply with safety rules in laboratory activities.
  • EE.12.65: Define an engineering design process.
  • EE.12.66: Define an engineering design problem.
  • EE.12.69: Generate multiple solutions to the design problem.
  • EE.12.70: Visually communicate the solutions to a design problem.
  • EE.12.73: Create a model or prototype for the chosen solution.
  • EE.12.75: Test the solution to the design problem.
  • EE.3.20: Demonstrate professionalism.
  • EE.12.76: Evaluate the test results.
  • EE.12.79: Document the final project report.

Showing 12 of 25 standards.

Lesson Steps

1

👋 Welcome to Arduino Essentials

5 min

Welcome to Arduino Essentials! Together we will be learning about hardware design, engineering, and programming by constructing various microcontroller projects!

Check out this video to see what the Arduino microcontroller can do!

 

 

You will need a Betabox Workbench to complete these projects as well as a device with a USB port.

 

 

When you're ready to begin, go to the next page!

Teaching tips

Welcome to Arduino Essentials! This project will introduce students to microcontrollers and how they can be used to control different sensors and components! Students will be able to control LED and sound output as well as receive input from potentiometers and light sensors.

Here you will find the resources you'd need to teach this in your classroom.

Get your accompanying hands-on kit ready!

2

✔️ Standards and Objectives!

5 min

Mississippi College and Career Readiness Standards for Science

 

MS CCRSS

 

  • FSL.3A - Students will apply science and engineering practices and skills to scientific investigations.
  • PHS.9 - Students will explore basic principles of magnetism and electricity (e.g., static electricity, current electricity, and circuits).
  • PHY.5 - Students will investigate the key components of electricity and magnetism.

 


 

 

Alabama Digital Literacy and Computer Science Standards

 

  • 7.5: Solve a complex problem using computational thinking.
  • 7.6: Create and organize algorithms in order to automate a process efficiently.
  • 7.8: Formulate a narrative for each step of a process and its intended result, given pseudocode or code.
  • 7.22: Compare data storage structures.
3

🧰 How to Use the Workbench!

10 min

How to Remove the Workbench Top

 

 

 

How to Attach the Clicks to the Workbench

 

Teaching tips

Visit the Product Page on myBetaBox!

 

Instruct students to navigate through the content on the page below.

Direct students to watch the videos explaining how to remove the workbench top and how to attach the clicks to the workbench.

Once students have watched the videos, have each student demonstrate how to remove the top and how to successfully attach the clicks. Students will need to be able to attach and detach their clicks at the beginning and end of each session.

4

🔌 About the Components!

15 min

Breadboards

 

 


 

Resistors

 

 

 


 

Jumper Wires

 

 


 

LEDs

 

Teaching tips

Educator Classbox

 

Your Educator Classbox includes:

 

  • 4x Workbenches each containing…
  • 1x Arduino
  • 1x Breadboard
  • 1x Arduino USB Cable
  • 3x Each Color LED (15x total)
  • 3x Buzzers
  • 3x IR Sensors
  • 3x Photoresistors
  • 3x Potentiometers
  • 6x Push Button Switches
  • 10x 470 Ohm Resistors
  • 3x each of 1k, 10k, 100k, 220k, and 1m Ohm Resistors
  • Various 10cm and 20cm Jumper Wires
  • Envelope of Diagram Handouts

 


 

Additional Requirements

 

In addition to the items we’ve provided, you will need the following materials to complete your lessons:

 

  • Computers with USB port
  • Internet access

 


 

About the Components

 

Direct students to watch the videos explaining the different components in their workbench. There are a few components that are not discussed here but they will be used in later parts of this project.

To test student knowledge, it is helpful to call out a component and have them select it from the workbench and hold it up. This is especially helpful when teaching them to identify different resistors.

Remind students to keep their bench organized so that they can return everything to the correct compartment at the end of the session.

Vocabulary

  • Arduino - A microcontroller which is a small computer on a single metal-oxide-semiconductor integrated circuit chip.
  • Breadboard - A prototyping tool that allows someone to quickly wire together a circuit.
  • Resistors - Conductors with ceramic pieces that allows someone to change the amount of current going into other components.
  • Ohms - The measurement of the amount of resistance.
  • Jumper Wires - Conductive wire used to plug into the breadboard to create pathways for electricity.
  • LED - A light emitting diode.
  • Diode - Electricity can only travel one way.
  • Anode - The positive and long side of a diode.
  • Cathode - The negative and short side of a diode.
5

🖥️ Using the Software!

10 min

About the Arduino Editor

 

 


 

How to Use the Arduino Web IDE

 

 


 

How to Install the Create Agent

 

 

Windows

 

 

 

Mac

 

 

 

Chromebook

 

Teaching tips

Whitelisting URLs

 

You will be accessing our online project with your students. Whitelist these domains by your IT department:

 

  • vimeo.com
  • templetons.com
  • arduino.cc

 


 

Software

 

For early lessons, we advise you to use the web editor. The website allows for 200s of compile time per day. This should be fine for most uses but at a certain point you may notice that students need access to more time. To get around this, you can download the Arduino Create.

You will be downloading the following software and using the following applications. Please verify that your student devices have software downloading permissions enabled before you begin. You may choose to pre-download them before you begin your lesson or to do it together as a class. NOTE: If you are using a Chromebook you will have to use the web editor exclusively.

 

Windows

 

To install the Arduino IDE on a Windows computer follow the steps below:

 

  1. Navigate to this link.
  2. You will need to click where it says Windows and your computer will download the installer.
  3. Once the installer is downloaded, run it and follow the steps.
  4. Now you should have everything you need to get started.

 

Mac

 

To install the Arduino IDE on a Mac computer follow the steps below:

 

  1. Navigate to this link.
  2. You will need to click where it says Mac and your computer will download ta zip file.
  3. Once the zip file is downloaded, unzip it and place the resulting Application in your Applications folder.
  4. Now you should have everything you need to get started.

 


 

Using the Software

 

Direct students to watch the videos explaining the software we will be using to flash our code to the Arduino.

Once students have watched the videos, they should be able to set up their Arduino Create accounts, download the Create Agent, and successfully flash code to their Arduino.

Note: You may setup accounts for them prior to the lesson and download the Create Agent. If you do this then students can skip these videos.

 

Vocabulary

 

  • IDE - Integrated Development Environment
  • Sketch - Arduino specific name for a program.
6

⚠️ Safety!

3 min

Protecting the Arduino

 

Teaching tips

Safety

 

Direct students to watch the video explaining how to safely use the Arduino to avoid causing any complications.

Once students have completed the video, have them demonstrate safely plugging in and unplugging the Arduino from the computer.

7

🧰 Our Very First Project!

10 min

For the first time, we are introducing a program to control what the Arduino does! It is one of the simplest possible programs, but it showcases many of the features of the programming environment, the language and the Arduino itself.

This project also has the simplest possible hardware configuration; there is nothing to wire, and no breadboard is needed.  We will only need the Arduino itself, connected to your computer by the USB cable.

This project makes use of the Arduino's onboard LED, which is highlighted in the Fritzing diagram for this project. While there are four LEDs total on the Arduino, this is the one  you can control by code when you program your Arduino.

The program will blink the onboard LED of the Arduino at one-second intervals:  one second on, one second off, repeatedly, for as long as the Arduino has power.

You can also practice your coding skills a bit by changing the length of either the ON time or the OFF time, or both. We will show you how to do that in the Arduino Web Editor.

 

How to Complete the First Project

 

Teaching tips

Introduction to Breadboarding with Microcontrollers

 

Direct students to read the information and watch the video. This project requires no wiring and will introduce students to the Arduino Create website and how to use it. Students can play around with the code to see different results quickly.

Students should be able to demonstrate the light blinking on their Arduino board and demonstrate knowledge of how to flash the board with their code.

8

🧰 Project 1A: Constant LED!

15 min

This Project is an Example of...

 

POWER INDICATOR LIGHTS
When you plug in a device, like your phone, to an outlet, a light will appear to show you that it’s connected to power!

 

 

This is the first of several practice projects to get you comfortable working with the Arduino and building breadboard projects.

In your first Arduino project, we will not be using any code for the project. We'll just be using the Arduino to supply power to a light-emitting diode, or LED. When the Arduino is plugged into a computer or battery, it can function as a power supply, and that's how we are going to use it here.

When this project is correctly wired up, the LED on the breadboard will light up and stay lit as long as your Arduino is plugged into your computer via the USB cable.

This is a very simple project, but it will let you practice inserting components correctly into a breadboard and safely/properly connecting a breadboard to an Arduino to draw power from the power pins on the Arduino.

 


 

Required Components

 

 

470Ω RESISTOR (1)

 

 

 

LED, ANY COLOR (1)

 

 

 

JUMPER WIRE, BLACK (1)

 

 

 

 

JUMPER WIRE, RED (1)

 

 

 

JUMPER WIRE, ANY COLOR (1)

 


 

Opening the Fritzing Diagram

 

 

 

Fritzing Diagram

 


 

Wiring Tips for Your First Project

 

  • SAFETY: Do NOT apply power to your Arduino until you are finished wiring.
  • When inserting small wires into the breadboard sockets, grasp the wires gently but firmly as close as possible to the end so they don't fold up or bend as you insert them into the socket.
  • Push them straight down into the socket until you feel them bottom out in the socket.
  • Breadboard sockets need to make good electrical contact with the wire, but that sometimes makes it more difficult to get the wire to go in.
  • SUGGESTION: Practice with the jumper wires first. They have stronger leads than the LEDs and resistors. If a particular socket on the breadboard is fighting your efforts, try a different socket in the same row or column (that is, one that follows the same logical path).

 


 

Breadboarding the Project

 

 

 

Testing It Out!

 

 

 


 

Troubleshooting

 

 

  • LED
    Flip the LED so the longer lead (leg) is closer to the resistor.

 

  • RESISTOR

    Double check you are using the correct resistor (470 Ω) and that the pins are pushed into the breadboard. Too much resistance won't allow enough electricity to power up the bulb! See the Required Components section for a description.

 

  • JUMPER WIRES
    Make sure your wires are in the correct pins on the Arudino and the breadboard. Look at the Fritzing Diagram to check!

 

  • BREADBOARD NODES
    Are your wires, resistor, and LED in the correct holes on the breadboard? Look at the Fritzing Diagram to double check!

 

  • ARDUINO
    Is your Arduino plugged into your computer with the USB cable?

 

Teaching tips

Project 1A: Constant LED

 

Direct students to read the information and watch the videos. This project requires our first use of the breadboard and wires. Make sure students are comfortable reading Fritzing diagrams and plugging wires into the Arduino and breadboard.

Note: Students should pay close attention to the Wiring Tips to avoid any potential issues that may arise.

After completing this project, students should be able to trace the path of electricity and describe the difference between an anode and a diode.

9

🧰 Project 1B: Pushbutton LED!

20 min

This Project is an Example of...

 

LASER POINTERS
Next time you're playing 'chase the laser' with your kitten, notice how the light comes on when the button is pressed down and disappears when it's released!

 


 

Required Components

 

 

470Ω RESISTOR (1)

 

 

 

PUSH BUTTON SWITCH (1)

 

 

 

LED, ANY COLOR (1)

 

 

 

JUMPER WIRE, BLACK (1)

 

 

 

 

JUMPER WIRE, RED (1)

 

 

 

JUMPER WIRE, ANY COLOR (1)

 


 

 

Add Sketch to Editor

 

Click Me to Add This Code to Your Sketchbook!

 

 


 

Opening the Fritzing Diagram

 

 

 

Fritzing Diagram

 

 


 

 

Breadboarding the Project

 

Teaching tips

Project 1B: Pushbutton LED

 

Direct students to read the information and watch the videos. This project will introduce a new component called a pushbutton. Students should be comfortable undoing their wiring and rewiring to create a new project.

After completing this project, students should be able to trace the path of electricity and describe what the pushbutton is doing in the circuit.

10

🧰 Project 2A: Blinking LED on Breadboard!

20 min

This Project is an Example of...

 

EMERGENCY INDICATORS
Hard to ignore a blinking light, right? Construction zones, first-responder vehicles, and emergency exits use blinking lights to draw people's attention to them.

 

 

In this project we are going to build the the 'Hello World' blinking light project again, but this time with an LED on a breadboard.

 


 

Required Components

 

 

470Ω RESISTOR (1)

 

 

 

LED, ANY COLOR (1)

 

 

 

JUMPER WIRE, BLACK (1)

 

 

 

 

JUMPER WIRE, ANY COLOR (1)

 


 

 

Add Sketch to Editor

 

Download the Sketch

 

 


 

Fritzing Diagram

 

 

Now that you've wired up a few projects, try to build this one just by looking at the diagram above.

 


 

Building Tips

 

  • Wire this project according to the Fritzing diagram for Project 2A.
  • IMPORTANT: Make sure to plug the long leg of the LED next to the resistor, and the short leg of the LED into the ground power column that the black jumper wire is connected to.
  • Make sure to use Digital Pin 10 for the color jumper wire to the LED.
  • Double-check your connections before powering up.
  • UPLOAD AND SAVE the correct/current sketch to your Arduino from the Web Editor.

 

Expand Your Learning

 

  • Change the blink rate of the LED by trying different numbers for the variables onTime and offTime in the program, Lines 20 and 21.
  • What happens to the blink rate when the numbers get higher? Lower?
  • What happens if the numbers are not the same?

 


 

Troubleshooting

 

 

  • LED
    Make sure the long lead is nearest the resistor. You can try swapping out another LED, too.

 

  • RESISTOR

    Make sure you are using the 470Ω resistor. Too strong of a resistor will prevent enough electricity to power the LED!

 

  • BREADBOARD NODES
    Check for continuity across each connection. Do your wires and pins match the holes on the Fritzing Diagram?

 

  • ARDUINO
    Make sure your Arduino is plugged into your computer with the USB cable.

 

  • ARDUINO IDE
    Check that you have clicked the verify and upload buttons  in the IDE software to properly upload (flash) the code to the Arduino. Also make sure you have selected the correct port for your Arduino.

 

  • SKETCH

    Click the Download the Sketch button to work on this current project's sketch in the Arduino IDE program.

 

Teaching tips

Project 2A: Blinking LED

 

Direct students to read the information below. This project will not have any video to accompany it so make sure students are comfortable loading a Sketch and reading a Fritzing diagram on their own.

Students should be able to demonstrate how to read a Fritzing diagram and change code in the sketch to get different results.

11

🧰 Project 2B: Pulse-Width Modulation (PWM) Dimmer!

15 min

This Project is an Example of...

 

ANTI-COLLISION LIGHTS ON AIRCRAFTS
Also known as Beacon lights, these pulsing lights are required on every aircraft to improve its visibility to others and to warn other pilots.

 

 

In this project we are going to make an LED on a breadboard fade on and off repeatedly using pulse width modulation (PWM).

 

  • The Arduino can control wave patterns that allow it to decrease the amount of voltage that a component "thinks" it is receiving. This acts like a dimmer switch.
  • The LED in this project will dim gradually and then come back up to full brightness as if someone were turning a dimmer switch up and down again and again.
  • This is a powerful tool that lets the Arduino "throttle" power to many components with no mechanical components at all. This capability is entirely electronic.

 


 

Required Components

 

 

470Ω RESISTOR (1)

 

 

 

LED, ANY COLOR (1)

 

 

 

JUMPER WIRE, BLACK (1)

 

 

 

 

JUMPER WIRE, ANY COLOR (1)

 


 

 

Add Sketch to Editor

 

Download the Sketch

 

 


 

Fritzing Diagram

 

 

Now that you've wired up a few projects, try to build this one just by looking at the diagram above. Just an FYI though, it is the same as the last project!

 


 

Building Tips

 

  • Wire this project according to the Fritzing diagram for Project 2B.
  • NOTE that this is exactly the same build as Project 2A! You don't need to change any hardware; just load the new sketch for Project 2B to the Arduino. If Project 2A was working, 2B should immediately work as well.
  • IMPORTANT: Make sure to plug the long leg of the LED next to the resistor, and the short leg of the LED into the ground power column that the black jumper wire is connected to.
  • Make sure to use Digital Pin 10 for the color jumper wire to the LED.
  • Double-check your connections before powering up.
  • UPLOAD AND SAVE the correct/current sketch to your Arduino from the Web Editor.

 

Expand Your Learning

 

 

  • Research pulse width modulation (PWM) on the Internet to get a better understanding of how this process works.
  • Identify other components besides LEDs that can be throttled using PWM.

 


 

Troubleshooting

 

 

  • LED
    Make sure the long lead of the LED is closest to the resistor. You can also swap out another bulb.

 

  • RESISTOR

    Make sure you are using the 470Ω resistor. Too strong of a resistor will prevent enough electricity to power the LED!

 

  • BREADBOARD NODES
    Check for continuity across each connection. Do your wires and pins match the holes on the Fritzing Diagram?

 

  • ARDUINO
    Make sure your Arduino is plugged into your computer with the USB cable.

 

  • ARDUINO IDE
    Check that you have clicked the verify and upload buttons  in the IDE software to properly upload (flash) the code to the Arduino. Also make sure you have selected the correct port for your Arduino.

 

  • SKETCH

    Click the Download the Sketch button to work on this current project's sketch in the Arduino IDE program.

 

Teaching tips

Project 2B: Pulse-Width Modulation (PWM) Dimmer

 

Direct students to read the information below. Once again, there is no video for this project so make sure that students read the instructions carefully before beginning their wiring.

Students should be becoming comfortable with reading the diagrams, wiring the Arduino and breadboard, and editing the code.

12

🧰 Project 2C: Pushbutton Switch Actuated LED!

20 min

This Project is an Example of...

 

ELEVATOR BUTTONS
Going up? When you push a the button to call an elevator, it sends a signal to a microcontroller that directs the car to the level where the button was pressed!

 

 

In this project we are going to turn an LED on a breadboard on and off by using a pushbutton switch on the breadboard. The switch does not directly control the LED; instead, the switch sends a signal to the Arduino which then turns the power on or off directly to the LED.

It may seem unnecessarily complicated to use a switch to tell a computer to turn a light on or off. Why not just directly connect the switch to the light?

While that may be true for this exercise, in many real-life situations the manually actuated switch can be replaced by some other automated signal. The ability for the Arduino to intercept that signal and then initiate some other action is an important component of many types of industrial or commercial automation projects.

 


 

Required Components

 

 

470Ω RESISTOR (1)

 

 

 

10KΩ RESISTOR (1)

 

 

 

PUSH BUTTON SWITCH (1)

 

 

 

LED, ANY COLOR (1)

 

 

 

JUMPER WIRE, BLACK (1)

 

 

 

 

JUMPER WIRE, RED (1)

 

 

 

JUMPER WIRES, ANY COLOR (4)

 


 

 

Add Sketch to Editor

 

Download the Sketch

 

 


 

Fritzing Diagram

 

 

Now that you've wired up a few projects, try to build this one just by looking at the diagram above.

 


 

Building Tips

 

  • Wire this project according to the Fritzing diagram for Project 2C.
  • This is a more complicated build than the previous two projects; take your time and make sure all the breadboard connections are in the right places.
  • Pay close attention to where the prongs on the switch go; it helps to write down the row number of these prongs so you can place their matching jumper wires correctly.
  • IMPORTANT: Make sure to plug the long leg of the LED next to the resistor, and the short leg of the LED into the ground power column that the black jumper wire is connected to.
  • Make sure to use Digital Pin 10 for the color jumper wire to the LED.
  • Double-check your connections before powering up.
  • UPLOAD AND SAVE the correct/current sketch to your Arduino from the Web Editor.

 

Expand Your Learning

 

  • List other inputs besides a manual pushbutton switch that you might want the Arduino to respond to.
  • How could you use this concept to automate something in your life that you now do manually?

 


 

Troubleshooting

 

 

  • LED
    Make sure the long lead is nearest the resistor. You can try swapping out another LED, too.

 

  • RESISTORS

    Check to make sure you are using the 470Ω and 10KΩ resistors!

 

  • JUMPER WIRES

    Are you using all six (6) jumper wires?

 

  • BREADBOARD NODES
    Are your wires, button, resistors, and LED in the correct holes on the breadboard? Look at the Fritzing Diagram to double check!

 

  • ARDUINO
    Is your Arduino plugged into your computer with the USB cable?

 

  • ARDUINO IDE
    Check that you have clicked the verify and upload buttons  in the IDE software to properly upload (flash) the code to the Arduino. Also make sure you have selected the correct port for your Arduino.

 

  • SKETCH

    Click the Download the Sketch button to work on this current project's sketch in the Arduino IDE program.

 

Teaching tips

Project 2C: Pushbutton Switch Actuated LED

 

Direct students to read the information below. Once again, there is no video for this project so make sure that students read the instructions carefully before beginning their wiring.

At this point, students should be fairly confident at working with the components they have been introduced to so far. Students should also understand why it is important to have the Arduino in control of the LED instead of the the button in control of the LED.

13

🧰 Project 2D: LED Fade with Photoresistor!

20 min

This Project is an Example of...

 

AUTOMATIC NIGHT LIGHTS
Say goodbye to midnight scaries! Automated night lights use photoresistors, which detect the amount of light, to activate once it becomes dark.

 

 

This seems much like the last project, and is similar in some ways. But this project uses a more complicated switching mechanism called a light-dependent resistor (LDR), also called a photoresistor.

The LDR changes its resistance based on how much light is hitting it at any given moment. We can use the Arduino to monitor how the resistance varies and map that resistance to a scale.

By setting "trip points" in the Arduino at certain points, we can tell the Arduino to turn something on or off based on how much light is hitting the LDR at any given moment.

 


 

Required Components

 

 

470Ω RESISTOR (1)

 

 

 

10KΩ RESISTOR (1)

 

 

 

LED, ANY COLOR (1)

 

 

 

PHOTORESISTOR (1)

 

 

 

JUMPER WIRE, BLACK (1)

 

 

 

 

JUMPER WIRE, RED (1)

 

 

 

JUMPER WIRES, ANY COLOR (3)

 


 

 

Add Sketch to Editor

 

Download the Sketch

 

 


 

Fritzing Diagram

 

 

Now that you've wired up a few projects, try to build this one just by looking at the diagram above.

 


 

Building Tips

 

  • Wire this project according to the Fritzing diagram for Project 2D.
  • This is a more complicated build than the previous two projects; take your time and make sure all the breadboard connections are in the right places.
  • Route the jumper wires away from the LDR so it has a clear view of the light above it.
  • IMPORTANT: Make sure to plug the long leg of the LED next to the resistor, and the short leg of the LED into the ground power column that the black jumper wire is connected to.
  • Make sure to use Digital Pin 10 for the color jumper wire to the LED.
  • Double-check your connections before powering up.
  • UPLOAD AND SAVE the correct/current sketch to your Arduino from the Web Editor.

 

Expand Your Learning

 

  • Think about how you could use a sensor that does something when the area around it gets either brighter or darker.
  • Experiment with holding your hand or a piece of paper over the LDR to see how sensitive it is.
  • Try changing how much ambient light is in the room around the LDR. How does this change how it reacts to being covered? Does it behave differently at night than it does during the day?

 


 

Troubleshooting

 

 

  • LED
    Make sure the long lead is nearest the resistor. You can try swapping out another LED, too.

 

  • RESISTORS

    Check to make sure you are using the 470Ω and 10KΩ resistors!

 

  • JUMPER WIRES

    Are you using all five (5) jumper wires?

 

  • BREADBOARD NODES
    Are your wires, photoresistor, resistors, and LED in the correct holes on the breadboard? Look at the Fritzing Diagram to double check!

 

  • ARDUINO
    Is your Arduino plugged into your computer with the USB cable?

 

  • ARDUINO IDE
    Check that you have clicked the verify and upload buttons  in the IDE software to properly upload (flash) the code to the Arduino. Also make sure you have selected the correct port for your Arduino.

 

  • SKETCH

    Click the Download the Sketch button to work on this current project's sketch in the Arduino IDE program.

 

Teaching tips

Project 2D: LED Fade with Photoresistor

 

Direct students to read the information below. This project will introduce a new component that students have not used yet called a photoresistor. Make sure that students can locate and identify this component before beginning the wiring.

Students should now understand how different inputs can be used to change the output that the LED is giving us and what a photoresistor actually does.

14

🧰 Project 3A: Serial Monitor with Potentiometer!

15 min

This Project is an Example of...

 

VOLUME KNOBS
If you’ve ever turned a dial to adjust the volume of your favorite song, you probably used a potentiometer to send a signal to a microcontroller to then change the audio output of a speaker! See what the microcontroller receives in the serial monitor.

 

 

 

For this project we introduce a widely used component in electronics projects: the potentiometer.  It is often called a "pot" for short by people who build electronics.

A dimmer switch to dim the lights found in many homes is an example of a potentiometer.  A dimmer switch varies the amount of resistance it presents to electricity when you turn a dial, knob or screw on the potentiometer. More resistance lets less electric current through and the lights get dimmer; less resistance lets more current through and the lights get brighter.

By turning a dial all the way to the left (counter-clockwise) you increase the resistance in the potentiometer; all the way to the right (clockwise) decreases the resistance.

This project will read the resistance of a potentiometer several times a second and display the amount of resistance in a special window in the Arduino Web Editor.

 

 

What you will learn:

 

 

  • You will learn how to set up and wire a potentiometer for use with an Arduino. Potentiometers have an amazing array of uses in electronics and electrical projects. We will build a few projects that use potentiometers in this course.
  • You will also learn about the Serial Monitor in the Arduino Web Editor. The Serial Monitor is a powerful tool that lets us communicate with the Arduino. It is particularly useful because it can show us the values that the Arduino is getting from sensors or sending out to actuators that it is connected to.
  • In the code, you will see a function that interprets the current setting of the potentiometer to a number within a range between 0 and 1023. This number can be used to make decisions based on what the pot is currently set to.
  • In our program, the resistance of the pot is shown on the left after the word ANALOG.
  • The program then used the resistance value of the pot to set a voltage between 0V and 5V, which is displayed on the same line after the word VOLTAGE.

 

 


 

Required Components

 

 

POTENTIOMETER (1)

 

 

 

JUMPER WIRE, BLACK (1)

 

 

 

 

JUMPER WIRE, RED (1)

 

 

 

JUMPER WIRES, ANY COLOR (1)

 


 

 

Add Sketch to Editor

 

Download the Sketch

 

 


 

Fritzing Diagram

 

 

Now that you've wired up a few projects, try to build this one just by looking at the diagram above.

 


 

Building Tips

 

  • Wire this project according to the Fritzing diagram for Project 3A.
  • This is an easy project to wire up; we'll use it as a basis for more complicated, interesting projects to come.
  • IMPORTANT: Make sure to plug the long color jumper wire to the CENTER lead of the potentiometer.
  • The other end of the color jumper wire goes to Analog Pin A0 on the Arduino.
  • Double-check your connections before powering up, especially the power connections.
  • UPLOAD AND SAVE the correct/current sketch to your Arduino from the Web Editor.
  • SOMETHING NEW: Turn on your Serial Monitor when you start this project. On the left-side menu (under EDITOR), click the fourth menu option from the top that says MONITOR.

 

This will open a long vertical window that will show you feedback from the Arduino.

 

Expand Your Learning

 

Experiment with the potentiometer by turning the dial up and down.

 

  • Leave it low for a while and see what happens.
  • Leave it high for a while; now what happens.
  • Turn the potentiometer slowly; what happens to the values you are seeing on the Serial Monitor?
  • What is the lowest number it reads? What is the highest number?
  • Does the lowest number come when you turn the dial down/left/CCW?
  • Think of some ways you could use this potentiometer. Where do you see potentiometers in real life?

 


 

Troubleshooting

 

 

  • POTENTIOMETER
    Make sure the colored wire (yellow in the diagram) is connected to the MIDDLE pin of the potentiometer on the breadboard (see Fritzing Diagram).

 

  • JUMPER WIRES

    Are you using all three (3) jumper wires?

 

  • BREADBOARD NODES

    Are your wires and potentiometer legs in the correct holes on the breadboard? Look at the Fritzing Diagram to double check!

 

  • ARDUINO
    Is your Arduino plugged into your computer with the USB cable?

 

  • ARDUINO IDE
    Check that you have clicked the verify and upload buttons  in the IDE software to properly upload (flash) the code to the Arduino. Also make sure you have selected the correct port for your Arduino.

 

  • SKETCH

    Click the Download the Sketch button to work on this current project's sketch in the Arduino IDE program.

 

  • POTENTIOMETER IS BACKWARDS

    If your potentiometer reads backwards (clockwise turns it down), you have reversed the power leads.

    1. Unplug your Arduino from your computer to remove the power supply.
    2. Swap the positions of the red and black jumper wires on the potentiometer.
    3. Plug your Arduino back in and try again.

 

  • NOT GETTING A READING AT ALL
    1. Confirm that your jumper wires are in the correct rows to match the pins on the potentiometer.
    2. Make sure that the color jumper wire is connected to the MIDDLE pin of the potentiometer.

     

  • SERIAL MONITOR IS NOT RESPONDING
    1. Make sure your Arduino is plugged in to the USB port on your computer.
    2. Check that your Serial Monitor is set to 9600 BAUD in the window at the top of the Serial Monitor.
    3. Refresh your Arduino Web Editor page and try again.

Teaching tips

Project 3A: Serial Monitor with Potentiometer

 

Direct students to read the information below. This project will be introducing a new component that students have not used before called the potentiometer. Make sure that students can locate and identify this component before they start wiring.

Students should understand how a potentiometer works to change values and how the serial monitor can be used to monitor the changes made by the potentiometer.

15

🧰 Project 3B: Arduino Flash Rate Controlled by Potentiometer!

20 min

WARNING
This project contains flashing lights which may not be suitable for people with photosensitive epilepsy.

 

This Project is an Example of...

 

STROBE LIGHTS
Stroboscopes produce a continuous series of short, flashing lights and have uses that from range from studying the behavior of heavy rotating machinery and photographing fast-moving objects.

 

 

NOTE!
This project uses the same Fritzing diagram as Project 3A but uses a different code.

 

 

Now that we have introduced the concept and function of the potentiometer, let's put it to use and control something in real life.

As you recall, the Arduino has an onboard LED that is connected to Digital Pin 13. We controlled it using a program in Project 1D.

Let's use this LED as an output device controlled by our potentiometer. We don't have to change any wiring whatsoever from our last project; we just need to send a new program to our Arduino--that is, reflash the Arduino.

When we do, you will be able to control the rate at which the onboard LED flashes using the potentiometer.

 

 

What you will learn:

 

 

  • Using the wiring exactly as we set it up for the last project, you will see a simple but effective demonstration of how to use a potentiometer in real life.
  • This is also a good demonstration of taking advantage of the easy-to-use onboard LED to get feedback for different projects. It's fast and easy—no wiring needed.
  • Like before, turning the pot all the way down/left/CCW will make the time interval for the flashing very short, so the light blinks faster and faster. Turning the pot up/right/CW will make the interval much longer (making the light blink slower).

 

 


 

Required Components

 

 

POTENTIOMETER (1)

 

 

 

JUMPER WIRE, BLACK (1)

 

 

 

 

JUMPER WIRE, RED (1)

 

 

 

JUMPER WIRES, ANY COLOR (1)

 


 

 

Add Sketch to Editor

 

Download the Sketch

 

 


 

Fritzing Diagram

 

 

 


 

Building Tips

 

 

  • You don't need to make any wiring changes from the previous project (Project 3A), so if you just did that one, don't change anything.
  • If you are coming at this project fresh, wire it according to the diagram for Project 3B.
  • IMPORTANT: Make sure to plug the long color jumper wire to the CENTER lead of the potentiometer.
  • The other end of the color jumper wire goes to Analog Pin A0 on the Arduino.
  • Double-check your connections before powering up, especially the power connections.
  • UPLOAD AND SAVE the correct/current sketch to your Arduino from the Web Editor.
  • NOTE: This project does not use the Serial Monitor, so if that's not working, it's because this program doesn't include that functionality.

 

 

Expand Your Learning

 

 

Experiment with the potentiometer by turning the dial up and down.

 

  1. Leave it low for a while and see what happens.
  2. Leave it high for a while; now what happens.

 

Think of other things you could control with the potentiometer.

 


 

Troubleshooting

 

 

  • POTENTIOMETER
    Make sure the colored wire (yellow in the diagram) is connected to the MIDDLE pin of the potentiometer on the breadboard (see Fritzing Diagram).

 

  • JUMPER WIRES

    Are you using all three (3) jumper wires?

 

  • BREADBOARD NODES

    Are your wires and potentiometer legs in the correct holes on the breadboard? Look at the Fritzing Diagram to double check!

 

  • ARDUINO
    Is your Arduino plugged into your computer with the USB cable?

 

  • ARDUINO IDE
    Check that you have clicked the verify and upload buttons  in the IDE software to properly upload (flash) the code to the Arduino. Also make sure you have selected the correct port for your Arduino.

 

  • SKETCH

    Click the Download the Sketch button to work on this current project's sketch in the Arduino IDE program.

 

  • POTENTIOMETER IS MOVING BACKWARDS

    If your potentiometer reads backwards (clockwise turns it down), you have reversed the power leads.

    1. Unplug your Arduino from your computer to remove the power supply.
    2. Swap the positions of the red and black jumper wires on the potentiometer.
    3. Plug your Arduino back in and try again.

 

  • NOTHING HAPPENS WHEN I TURN THE POTENTIOMETER
    1. Confirm that your jumper wires are in the correct rows to match the pins on the potentiometer.
    2. Make sure that the color jumper is connected to the MIDDLE pin of the potentiometer.
    3. Check to be sure that you uploaded (flashed) the correct/current sketch to your Arduino. Reflash this sketch and try again.

     

Teaching tips

Project 3B: Arduino Flash Rate Controlled by Potentiometer

 

Direct students to read the information below. This project will introduce the idea that just because the Fritzing diagram looks the same between two projects does not mean that the circuit will do the same thing.

Students should understand the role that the code plays in the process of creating a working Arduino circuit.

16

🧰 Project 3C: LED Fade with Potentiometer!

20 min

This Project is an Example of...

 

DIMMER SWITCHES
Adjust your room’s light intensity to your heart’s delight!

 

 

 

Let's use the potentiometer to control a different behavior of an LED.  We'll use an LED on the breadboard and control its brightness with the potentiometer, just like the dimmer switch on the wall in your home.

 

 

What you will learn:

 

 

This project uses an important concept called pulse width modulation, or PWM, to control the brightness of the LED.

PWM creates a wave pattern in the current being sent to the LED. To create the wave pattern, the Arduino turns the power going to the LED on and off very quickly, many times a second.

 

  • If the wave is OFF more than it is ON, the LED acts as if the voltage coming to it is lower and gives off less light.
  • If the wave is ON more than it is OFF, the LED acts as if the voltage is higher and burns brighter.

 

PWM is a very important concept in electronics. Microcontrollers like Arduino do a great job of giving us a way to manage PWM to control a wide variety of components, including lights, motors, and heaters.

 

 


 

Required Components

 

 

470Ω RESISTOR (1)

 

 

 

LED, ANY COLOR (1)

 

 

 

POTENTIOMETER (1)

 

 

 

JUMPER WIRE, BLACK (1)

 

 

 

 

JUMPER WIRE, RED (1)

 

 

 

JUMPER WIRES, ANY COLOR (4)

 


 

 

Add Sketch to Editor

 

Download the Sketch

 

 


 

Fritzing Diagram

 

 

 


 

Building Tips

 

 

  • Wire this project according to the Fritzing diagram for Project 3C.
  • This is one of the more complicated builds; take your time and make sure that all the connections go to the right places.
  • IMPORTANT: Make sure to plug the long color jumper wire to the CENTER lead of the potentiometer.
  • The other end of the color jumper wire goes to Analog Pin A0 on the Arduino.
  • Double-check your connections before powering up, especially the power connections.
  • UPLOAD AND SAVE the correct/current sketch to your Arduino from the Web Editor.

 

 

Expand Your Learning

 

 

Experiment with the potentiometer by turning the dial up and down.

 

  1. Leave it low for a while and see what happens.
  2. Leave it high for a while; now what happens.

 

Think of other things you could control with the potentiometer by using PWM.

 


 

Troubleshooting

 

 

  • POTENTIOMETER
    1. Confirm that your jumper wires are in the correct rows to match the pins on the potentiometer.
    2. Make sure that the color jumper is connected to the MIDDLE pin of the potentiometer.
    3. Check to be sure that you uploaded (flashed) the correct/current sketch to your Arduino. Reflash this sketch and try again.

 

  • LED

    Make sure the long lead is nearest the resistor. You can try swapping out another LED, too.

 

  • RESISTORS

    Check to make sure you are using the 470Ω resistor. Too strong of a resistor may prevent enough electricity to power the LED.

 

  • JUMPER WIRES

    Are you using all six (6) jumper wires?

 

  • BREADBOARD NODES

    Are your wires, resistor, potentiometer and LED in the correct holes on the breadboard? Look at the Fritzing Diagram to double check!

 

  • ARDUINO
    Is your Arduino plugged into your computer with the USB cable?

 

  • ARDUINO IDE
    Check that you have clicked the verify and upload buttons  in the IDE software to properly upload (flash) the code to the Arduino. Also make sure you have selected the correct port for your Arduino.

 

  • SKETCH

    Click the Download the Sketch button to work on this current project's sketch in the Arduino IDE program.

 

  • POTENTIOMETER IS MOVING BACKWARDS

    If your potentiometer reads backwards (clockwise turns it down), you have reversed the power leads.

    1. UNPLUG YOUR ARDUINO FROM YOUR LAPTOP TO TAKE POWER OFF.
    2. AT THE POTENTIOMETER, swap the positions of the red and black jumper wires.
    3. Plug your Arduino back in and try again.

 

Teaching tips

Project 3C: LED Fade with Potentiometer

 

Direct students to read the information below. This project will reinforce the ideas of pulse width modulation and Arduino input/output that were discussed in previous lessons.

Students should have a better understanding of what PWM is and how the Arduino can process input to change the output of the LED.

17

🧰 Project 3D: Potentiometer Bar Graph!

30 min

This Project is an Example of...

 

LCD DISPLAYS
LCD bar graphs are used to show the level of a certain something, such as a progress bar for a battery charger or settings on a sound mixer for a DJ!

 

 

 

Let's use the potentiometer to control a number of LEDs. We'll read the value of the pot and turn on more LEDs as the value of the pot goes higher.

Since we're putting these LEDs in a row, we call this type of project a "bar graph," and you can use it to display rising values in a number of different projects.

 

 

What you will learn:

 

Unlike Pulse-Width Modulation (PWM), this project uses what can be called a "stair step" approach.  When the value of the pot hits predefined intervals, we turn on one more LED.

This is a bit different than PWM, which was varying in a continuous manner. Here, although the values of the pot vary continuously, we chop that input up and we only tell the Arduino to change its output when one of the predefined intervals is met.

 

 


 

Required Components

 

 

470Ω RESISTORS (9)

 

 

 

LED (9)

 

 

 

POTENTIOMETER (1)

 

 

 

JUMPER WIRE, BLACK (1)

 

 

 

 

JUMPER WIRE, RED (1)

 

 

 

JUMPER WIRES, ANY COLOR (12)

 


 

 

Add Sketch to Editor

 

Download the Sketch

 

 


 

Fritzing Diagram

 

 

 


 

Building Tips

 

 

  • Wire this project according to the Fritzing diagram for Project 3D.
  • This is the most complicated project you have built so far!
  • Because there are so many components on the breadboard, and because they are so close together, spacing is critical, so look closely at the Fritzing diagram and follow the layout carefully.
  • Leave one or two rows between each resistor/LED combination.
  • Start at the top and work your way down, being careful not to disturb the previously built components when putting in new ones.
  • Be especially careful with the orientation (placement of the long and short legs) of all those LEDs. If they are backwards, it is more difficult to change later when there are so many installed close together.
  • IMPORTANT: Make sure to plug the long color jumper wire to the CENTER lead of the potentiometer.
  • The other end of the color jumper wire goes to Analog Pin A0 on the Arduino.
  • Double-check your connections before powering up, especially the power connections.
  • UPLOAD AND SAVE the correct/current sketch to your Arduino from the Web Editor.

 

 

Expand Your Learning

 

 

Experiment with the potentiometer by turning the dial up and down.

 

  1. Do all of your LEDs light up?
  2. Do they all turn off when you turn the pot completely off/left/CCW?
  3. Do they all turn on when you turn the pot completely on/right/CW?

 

Think of other things you could use the bar graph technique for. What else could you control a bar graph with, besides a potentiometer?

 


 

Troubleshooting

 

 

  • LED

    Make sure the long lead is nearest the resistor. You can try swapping out another LED, too.

 

  • RESISTORS

    Check to make sure you are using the 470Ω resistors!

 

  • JUMPER WIRES

    Are you using all fourteen (14) jumper wires? Make sure the yellow wire in the diagram is connected to the MIDDLE pin of the potentiometer.

 

  • BREADBOARD NODES

    Are your wires, potentiometer, resistors, and LEDs in the correct holes on the breadboard? Look at the Fritzing Diagram to double check!

 

  • ARDUINO
    Is your Arduino plugged into your computer with the USB cable?

 

  • ARDUINO IDE
    Check that you have clicked the verify and upload buttons  in the IDE software to properly upload (flash) the code to the Arduino. Also make sure you have selected the correct port for your Arduino.

 

  • SKETCH

    Click the Download the Sketch button to work on this current project's sketch in the Arduino IDE program.

 

  • POTENTIOMETER IS MOVING BACKWARDS

    If your potentiometer reads backwards (clockwise turns it down), you have reversed the power leads.

    1. UNPLUG YOUR ARDUINO FROM YOUR LAPTOP TO TAKE POWER OFF.
    2. AT THE POTENTIOMETER, swap the positions of the red and black jumper wires.
    3. Plug your Arduino back in and try again.

 

  • POTENTIOMETER DOESN'T TURN ON LEDS

    If you are not getting a response from the LEDs at all (that is, if you turn the pot and nothing happens):

    1. Confirm that your jumper wires are in the correct rows to match the pins on the potentiometer.
    2. Make sure that the color jumper is connected to the MIDDLE pin of the potentiometer.
    3. Check to be sure that you uploaded (flashed) the correct/current sketch to your Arduino. Reflash this sketch and try again.

 

Teaching tips

Project 3D: Potentiometer Bar Graph

 

Direct students to read the information below.. This project will challenge students to carefully read a Fritzing diagram and properly wire the circuit.

Students will learn the importance of following the diagram as closely as possible.

18

🧰 Project 4A: Buzzer!

15 min

This Project is an Example of...

 

SPEAKERS
Speakers are used from everything from alert systems, music broadcasts, cell phones, alarm clocks…and more! What piece of equipment could benefit from having a speaker?

 

 

 

For this project series, we introduce a cool new component called a "piezo-electric passive buzzer," which is a complicated name for a very small speaker that you can control with your Arduino.

This first project is easy to build--just the speaker and two wires to connect it to your Arduino. In fact, this same build will work for projects 4B, 4C, and 4D.

The program that you flash to your Arduino is the only difference between these projects. These four programs all demonstrate different things you can do with sound on an Arduino, and how to control the speaker.

This first project is a simple 7-note melody that you will recognize right away.

 

 

What you will learn:

 

 

  • You will see how to connect a speaker to an Arduino. Because it's easy, it makes it great addition to many other projects that could benefit from adding sound.
  • By examining the code in this program, you'll get start to understand how sound is generated with an Arduino.
  • This is the first time we have used a library in any program we have run. A library adds functionality that could be used in many different programs, so the creator of the library will write it one time and make it available to anyone who wants to use it. Then a user can "check the code out" (like a library) and use it without having to write it from scratch.

 

 

The library in our program is called into action on Line 23 of the program: #include "pitches.h"

If you click on the tab for this project called pitches.h, you will see the code for the library. It defines all the notes that you would find on a piano (and a few extra ones). That way, when you want to play a melody, you just "check out" the notes you want from the library called "pitches.h," and you're ready to go!

Here's a sample line from the pitches.h library, which defines one note: #define NOTE_B0  31

The first word (#define) just tells the computer what to do.

The second word (NOTE_B0) is the name of the note that you will call in the program when you want the Arduino to play that note.

The third word (31) isn't a word at all--it's a number, of course. That is the audio frequency of NOTE_B0, which is what the speaker will play when you sent it that note.

 

 

Notice what else the program allows you to control: the space between the notes. Musicians call these spaces “rests”. Our little melody includes one rest. Can you pick out the rest in the program below?

NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4

 

 

There is one more difference with this program: it only plays the melody once, and then stops. This is because the code for the melody was not put into the LOOP part of the program, but in the SETUP portion of the program.

To play the melody again, you either have to reflash your Arduino, which is pretty tedious, OR you can simply reboot the Arduino. Find the button at the corner of the Arduino next to where you plug in the USB cable. The reset button on the Elegoo-brand Arduino is red. (Other brands of Arduino use different colors; some are labelled RESET.)

Simply push that button and the Arduino will reboot, which runs the program it is currently flashed with. And hear your melody again.

 

 


 

Required Components

 

 

BUZZER (1)

 

 

 
JUMPER WIRE, BLACK (1)

 

 

 

 

JUMPER WIRE, ANY COLOR (1)

 


 

 

Add Sketch to Editor

 

Download the Sketch

 

 


 

 

Fritzing Diagram

 

 


 

 

Building Tips

 

  • Wire this project according to the Fritzing diagram for Projects 4AD.
  • This is a relatively simple project, BUT THERE IS ONE IMPORTANT TRICK!

 

Because the pins on the speaker do not perfectly line up with the sockets in the breadboard, the speaker will break if you force it. (Sadly, this is reality. Not all electronic components are designed to interface with each other. Unfortunately, our speaker pins are not spaced exactly like the socket spacing on a standard breadboard. So, we have to adapt to that.)

 

FIRST, use your fingers to bend the pins inward (toward each other) just slightly out of parallel. This will help them align better with the breadboard. Notice the plus (+) sign on the top of the speaker. The pin on that side is Pin 1.

 

SECOND, align Pin 1 of the speaker with a socket in the breadboard, but don't push it in yet. Align Pin 2 of the speaker with a socket in the same COLUMN as the first pin. Then you will swivel the speaker by one row or column.

Here are examples: if Column A on the breadboard is furthest from the Arduino, put Pin 1 in Column A, Row 16. (Orange.) Align Pin 2 of the speaker with Column A as well, NEAR Rows 14 or 18--but don't push it in. It won't go into Column A without breaking the speaker.

 

THIRD, turn the speaker slightly by one row or column, so that Pin 2 is aligned with Column B, Row 14 or Row 18 (Blue). Alternatively, you can align Pin 2 with Column C, Row 15 or Row 17 (Green).

If you play chess, you will recognize these patterns as moves the knight can make.

 

 

 

FOURTH, now gently push the speaker down so that the pins seat all the way into the breadboard. When done correctly, Pin 1 will be in Column A, Row 16 and Pin 2 will be either in Column B, Rows 14 or 18 or in Column C, Rows 15 or 17.

Pay careful attention to exactly which column and row Pins 1 and 2 are in. You may even want to write it down. Once the speaker is pushed in, the pins are hidden.

 

FINALLY, insert the long color jumper wire into the same row that the plus sign on the speaker is close to (marked here with a “C”). Insert the long black jumper into the row the other speaker pin is in (marked with an “X”). Connect the black jumper to the Arduino GND, and the color jumper to Digital Pin 8.

The goal is to connect Digital Pin 8 on the Arduino to the pin with the plus sign on the speaker. The black jumper (from GND on the Arduino) connects to the other (unmarked) pin on the speaker.

As always, Double-check your connections before powering up. UPLOAD AND SAVE the correct/current sketch to your Arduino from the Web Editor.

 


 

Expand Your Learning

 

 

  • Experiment with the RESET button; after the melody plays once, reboot the Arduino by pressing and releasing the RESET button (the red button on the Arduino).
  • What do you think you could do with the program code to make the melody play continuously?
  • What do you think the variable named NOTEDURATION does in this program?

 

 


 

 

Troubleshooting

 

 

  • BREADBOARD NODES

    Are your wires and speaker in the correct holes on the breadboard? Look at the Fritzing Diagram to double check!

 

  • ARDUINO
    Is your Arduino plugged into your computer with the USB cable? Make sure the black jumper wire is lugged into one of the GND pins and that the color jumper wire is plugged into Digital Pin 8.

 

  • ARDUINO IDE
    Check that you have clicked the verify and upload buttons  in the IDE software to properly upload (flash) the code to the Arduino. Also make sure you have selected the correct port for your Arduino.

 

  • SKETCH

    Click the Download the Sketch button to work on this current project's sketch in the Arduino IDE program.

 

  • NO SOUND FROM SPEAKER

    Confirm that your jumper wires are in the correct rows to match the pins on the speaker. Pull the speaker up gently and note which rows the pins are in, and then carefully put it back in exactly the same place.

 

 

Teaching tips

Project 4A: Buzzer

 

Direct students to read the information below. This project will be introducing another new component called the piezo-electric passive buzzer. Make sure that students can locate and identify this component before they begin wiring.

Students will be reintroduced to the importance of code in this project and how the buzzer can be used to create different sounds.

19

🎶 Remixing (Adding New Songs) for your Buzzer!

10 min

Try to add some more songs!

Check out the github below. Find a song that you like, and paste in the code to your Editor.

 

 

Songs Github

20

🧰 Project 4B: Theremin aka The Annoyer 9000!

20 min

This Project is an Example of...

 

PROXIMITY SENSORS ON CARS
Most cars today have an alert sound, as if to say “you’re too close!”, when they are approaching another vehicle.

 

 

 

In this project we are going to build the most annoying thing one could imagine... THE THEREMIN!

By using a photoresistor to detect ever-so-slight changes in light when we move our hands, our microcontroller will change the pitch and volume of the speaker output to create different notes!

A person playing an actual theremin will move one hand to change the frequency of a note and the other hand to alter the amplitude (volume). Check out this video from SciShow to learn more!

 

 

 


 

Required Components

 

 

10KΩ RESISTOR (1)

 

 

 

PHOTORESISTOR (1)

 

 

 

BUZZER (1)

 

 

 

JUMPER WIRE, BLACK (1)

 

 

 

JUMPER WIRE, RED (1)

 

 

 

JUMPER WIRES, ANY COLOR (4)

 


 

 

Add Sketch to Editor

 

Download the Sketch

 

 


 

Fritzing Diagram

 

 

 


 

Teaching tips

Project 4B: Theremin

 

Direct students to read the information below. This project will bring back the photoresistor component to allow students to control the frequency of the buzzer by moving their hand.

Students will be using all they have learned so far to create the circuit and experiment with the sounds the theremin can make.

21

🧰 Project 5A: IR Sensor!

10 min

This Project is an Example of...

 

MOTION DETECTORS
Technologies like security cameras, lights, and camera traps use infrared (IR) sensors to react to movement.

 

In this project, you will learn about a versatile, exciting sensor that can detect the presence of an object up to a certain distance in front of the sensor. This is a simple project in terms of both the code and the wiring to complete it.

But even though it only requires a few wires and one sensor, the sensor in this project is a very powerful tool for helping your Arduino interact with things in its immediate environment. In a way, you are teaching your Arduino to "see" the world around it.

 

 

What you will learn: 

 

 

We will wire up and experiment with an infrared sensor that can "see" an object from a short to a medium distance in front of it. When it detects an object, it lights up the onboard LED of your Arduino.

We are also using the Serial Monitor in this project, like we did in some previous projects. When the sensor detects an object, it will tell you that it has a "hit" on the Serial Monitor; otherwise, it says that it detects a "miss."

The sensor for this project is designed to detect whether an object is (or is not) present in front of the sensor. Because of that, this sensor is widely used for obstacle avoidance.

You will be using an infrared (IR) sensor, but there are several different types of IR sensors, so let's talk about how this one works.

Looking at the sensor, you will see two "bulbs" soldered to the front end of the sensor. These "bulbs" are actually a transmitter and a receiver.

The clear "bulb" is the emitter which sends the IR signal out; the dark "bulb" is the receiver which listens for a signal to come back.

When an object within the range of the sensor is hit by the emitted signal, the object reflects that signal back towards the sensor and the receiver detects this. The sensor knows that something is in front of it and sends a digital signal back through the "Out" pin to the Arduino.

Because this IR sensor shoots out a signal and waits for a response (the reflected signal), it is known as an "active" IR sensor. Other types of IR sensors just look for heat emitted by some object in the environment around them; these don't emit their own signals, and are called "passive" IR sensors.

You can adjust the range of your sensor by turning the potentiometer in the little blue box on the sensor body. The range for this sensor is between 2 and 30 centimeters (cm), or between approximately 3/4 inch and 12 inches.

 


 

Required Components

 

 

IR SENSOR (1)

 

 

 

JUMPER WIRE, BLACK (1)

 

 

 

 

JUMPER WIRE, RED (1)

 

 

 

JUMPER WIRE, ANY COLOR (3)

 


 

 

Add Sketch to Editor

 

Download the Sketch

 

 


 

 

 

Fritzing Diagram

 

 

When you have wired up your project, it's time to find out how good your Arduino's vision is!

 

  1. Before starting, open up the Serial Monitor in the Arduino IDE so you can watch the sensor's responses as you run the program.
  2. When everything is ready, run your program and place your hand a good distance away from the sensor--about 2 feet--directly in a line straight out from the two bulbs.
  3. The onboard LED on your Arduino should NOT be lit up yet. The Serial Monitor should say "The IR Sensor detects a MISS."
  4. Slowly bring your hand down towards the IR sensor until the LED on your Arduino lights up and the Serial Monitor says "The IR Sensor detects a HIT." Your Arduino has "seen" your hand!
  5. Note the distance from your hand to the bulbs; it should be somewhere between very close (less than one inch) and pretty far (one foot).
  6. Experiment with this distance to see if it is consistent by repeating this experiment.

 

 


 

 

Building Tips

 

 

  • Wire this project according to the Fritzing diagram for Project 5A.
  • Double-check your connections before powering up.
  • UPLOAD AND SAVE the correct/current sketch to your Arduino from the Web Editor.

 

 

Expand Your Learning

 

 

  • Try using a light-color or white sheet of paper instead of your hand to set off the sensor. Is the distance the same as with your hand? If it's different, is it more or less than your hand?
  • Try using a dark-color sheet of paper. How is that different from your hand, and from the light-color paper? Which one is the sensor most sensitive to? Least sensitive?
  • Why do you think the color of the object makes a difference?
  • Think of three different ways you could use this sensor in different projects.
  • Think of different ways to use this sensor in a real-life setting, like a factory or workplace.
  • Can you think of any devices you use every day that might have a sensor like this in them?

 


 

Troubleshooting

 

 

  • JUMPER WIRES

    Are you using all five (5) jumper wires?

 

  • BREADBOARD NODES

    Are your wires and IR sensor in the correct holes on the breadboard? Look at the Fritzing Diagram to double check!

 

  • ARDUINO
    Is your Arduino plugged into your computer with the USB cable?

 

  • ARDUINO IDE
    Check that you have clicked the verify and upload buttons  in the IDE software to properly upload (flash) the code to the Arduino. Also make sure you have selected the correct port for your Arduino.

 

  • SKETCH

    Click the Download the Sketch button to work on this current project's sketch in the Arduino IDE program.

 

  • IF THE LED ON YOUR ARDUINO NEVER LIGHTS UP AND THE SERIAL MONITOR NEVER SAYS THAT IT DETECTS A HIT

     

    1. Confirm that your jumper wires are in the correct rows to match the pins on the sensor as shown on the Fritzing diagram.
    2. Adjust your jumper wires in the breadboard if they are not in the correct rows. Pay special attention to the POWER and GROUND wires where they plug into the sensor.
    3. Check to be sure that you uploaded (flashed) the correct/current sketch to your Arduino. Reflash this sketch and try again.
    4. Check to see if the POWER LED on your sensor is lit up. (See the Active_IR_Sensor_Diagram in the project pages for its location).

 

  • If the POWER LED is NOT lit up, you are not getting power to the sensor:

     

    1. Check that your Arduino is plugged in and running.
    2. Double-check your red jumper and black jumper to make sure they are plugged into the proper pins on the Arduino, and that they are going to the right rows on the breadboard to connect to the sensor. 
    3. Continue checking and adjusting until the POWER LED comes on. Repeat the experiment? Does it work now? Cool!

     

     

  • If the POWER LED is lit, check to see if the OBSTACLE LED on your sensor comes on when you move your hand down.

    1. If the OBSTACLE LED lights up but the onboard LED on the Arduino does not (and the Serial Monitor always says MISS), then there is something wrong with your output wire between the sensor and the Arduino. Confirm that your short color jumper wire is plugged into Digital Pin 2 on the Arduino and retest. Also double-check that it is going to the correct pin on the sensor.
    2. If the OBSTACLE LED never lights up but the POWER LED is ON, either the sensor distance needs to be adjusted, or the sensor is broken. Try adjusting the distance by turning the blue potentiometer and retest. Do this multiple times. If it still doesn't work, try a different sensor.
22

🎉 More Projects and Resources to Build on Your Own!

5 min

 

 

Nice work! You've completed the Arduino Essentials project! We've covered a ton about Arduino and congrats to you for finishing it...

...but the fun doesn't have to end here! There is so much more that you can create with Arduino. Think of Arduino as a platform for your own creativity.

If you are interested in continuing to learn, here are a few resources to help!

 


 

Reading Material

 

 


 

Additional Hardware

 

Want to keep building? Check out these websites to search for new hardware you can add to your workbench!

 


 

Replacement Parts

 

Did one of your components break? Need a replacement Click mount for your workbench? Email Betabox at hello@betaboxlearning.com and we will help!

 


 

More Betabox Projects

 

Check out the Browse page to see what else Betabox has to offer!

Materials

  • Circuit Components Box — 5 per group
  • ELEGOO UNO — 5 per group
  • Phase Dock Workbench — 5 per group

Related Supply Kit

Arduino Workbench

All the hands-on materials you need for this lesson, delivered to your classroom.

Ready to bring this lesson to your classroom?

Sign up to save this lesson, order supplies, and track student progress.