In this lesson participants will use the breadboard and the Arduino to create a simple circuit that will control the output of a light with a potentiometer. By the end of this lesson participants will understand what a potentiometer is, and the difference between analog and digital input.
For each participant:
In general:
Ask the participants to review the pictures from the #ILookLikeAnEngineer twitter campaign.
Facilitate a discussion that asks the participants to reflect on what the pictures represent.
Provide students with the background information.
Discuss
Arduino is able to work with both analog input and digital input. With a digital sensor, Arduino is able to read whether it is on or off. On the other hand, Arduino is able to read how much of something there is with an analogue sensor. This is great for working with sensors that have a range of settings and not just on/off, such as sensors that measure stretching, bending, force, heat, light, etc.
There are specific pins on the Arduino board that are able to read analog input. They are located in the bottom-right part of the board, and are marked "Analog In". These pins use the "analogRead( )" function in the Arduino code, which allows them to measure not only if there is a voltage applied to them, but the amount of voltage that is applied.
Arduino defines a potentiometer as "a simple knob that provides a variable resistance, which we can read into the Arduino board as an analog value". In this specific lesson, the potentiometer will control the rate at which the LED on the Arduino board will blink.
The potentiometer we will be working with looks like this. The knob on top can be twisted left and right. The three prongs will be inserted into the breadboard, fully incorporating the potentiometer into the circuit.
This website here describes a potentiometer in more detail. Feel free to check it out, but this activity is very basic, and doesn't require the depth of understanding that the website goes into.
Insert the prongs of the potentiometer into the breaboard. It doesn't matter where the potentiometer goes, but ensure there is at least one row of empty holes next tothe side of the potentiometer that has the prongs. The wires will need to be connected into those holes to complete the circuit.
Connect the first wire from ground to one of the outer pins of the potentiometer. The ground is labeled GND on the Arduino. It will be in the row of pins on the bottom part of the board, and is labeled "POWER" on the side, found right next to the "ANALOG IN" label. There are two GND pins, and it doesn't matter which of these two you put the wire into. For the outer pins of the potentiomenter, this means one of the holes on the breadboard that is next to one of the leftmost or rightmost potentiometer prongs.
Next, place a second wire from the 5V pin to the other outer pin of the potentiometer. On the Arduino there should be a pin labeled "5V" right next to the leftmost GND.
The last wire goes from analog input 2 to the middle pin of the potentiometer. Analog input 2 is labeled "A2" and is in the row of pins labeled "ANALOG IN".
Following the directions for setting up the code on the main page:
Now you can try twisting the potentiometer. There is an LED built into the Arduino board that should be blinking. Based on the direction you twist the potentiometer, the blinking of the light will either speed up or slow down.