This document provides instructions for students to create Arduino projects using LEDs and other components. It includes how to build a pushbutton-controlled LED, LED light dimmer using a potentiometer, LED bar graph controlled by a potentiometer, and a disco strobe light with adjustable flash speed. The goals are for students to learn how to construct simple Arduino circuits and write code to control outputs like LEDs based on inputs from components like buttons and potentiometers.
This document provides instructions for students to create Arduino projects using LEDs and other components. It includes how to build a pushbutton-controlled LED, LED light dimmer using a potentiometer, LED bar graph controlled by a potentiometer, and a disco strobe light with adjustable flash speed. The goals are for students to learn how to construct simple Arduino circuits and write code to control outputs like LEDs based on inputs from components like buttons and potentiometers.
This document provides instructions for students to create Arduino projects using LEDs and other components. It includes how to build a pushbutton-controlled LED, LED light dimmer using a potentiometer, LED bar graph controlled by a potentiometer, and a disco strobe light with adjustable flash speed. The goals are for students to learn how to construct simple Arduino circuits and write code to control outputs like LEDs based on inputs from components like buttons and potentiometers.
Light Dimmer SUBTOPIC 1 Pushbutton- Controlled LED and Light Dimmer
At the end of the presentation, the students should be able to:
Discuss how create a simple Arduino project using LED and other arduino electrical components. Create a pushbutton-controlled LED and Ligh Dimmer arduino project. In this project, you’ll add a pushbutton switch to an LED circuit to control when the LED is lit. •Arduino board • Breadboard • Jumper wires • LED • Momentary tactile four-pin pushbutton • 10k-ohm resistor • 220-ohm resistor 1. Place your pushbutton in a breadboard, as shown in figure. 2. Connect pin A to one leg of a 10k-ohm resistor, and connect that same resistor leg to Arduino pin 2. Connect the other resistor leg to the GND rail, and connect the GND rail to the Arduino’s GND. Connect pin B on the switch to the +5V rail, and connect this rail to +5V on the Arduino. 3. Add the LED to your breadboard, connecting the longer, positive leg to Arduino pin 13 via a 220-ohm resistor and the shorter leg to GND. 4. Confirm that your setup matches the circuit diagram shown in figure, and then upload the code in “The Sketch” on the next page. In this sketch, you assign a pin for the pushbutton and set it as INPUT, and a pin for the LED and set it as OUTPUT. The code tells the Arduino to turn the LED on as long as the button is being pressed (completing the circuit), and to keep the LED off when the button is not being pressed. When the button is released, the circuit breaks and the LED will turn off again. In this project, you’ll create a dimmer switch by adding a potentiometer to control the brightness of an LED. •Arduino board • Breadboard • Jumper wires • LED • 50k-ohm potentiometer • 470-ohm resistor 1. Insert the potentiometer into your breadboard and connect the center pin to the Arduino’s A0 pin. Connect one of the outer pins to the +5V rail of the breadboard and the other outer pin to GND on the breadboard (it doesn’t actually matter which way around the outer potentiometer pins are connected; these instructions just reflect the diagrams in this project), as shown in figure. 2. Insert the LED into the breadboard. Attach the positive leg (the longer leg) to pin 9 of the Arduino via the 470-ohm resistor, and the negative leg to GND, as shown in figure. 3. Upload the code in “The Sketch” below.
4. Turn the potentiometer to control the brightness of the LED.
This project has many potential uses: you can cluster
a number of LEDs together to create an adjustable flashlight, a night-light, a display case light, or anything else that uses dimming lights. This sketch works by setting pin A0 as your potentiometer and pin 9 as an OUTPUT to power the LED. You then run a loop that continually reads the value from the potentiometer and sends that value as voltage to the LED. The voltage value is between 0–5 volts, and the brightness of the LED will vary accordingly. THANK YOU FOR LISTENING! References Fitzgerald, S., & Shiloh, M. (2013). Arduino Projects Book. Arduino.
Banzi, M. (2011). Getting Started with Arduino (2nd ed.).
O'Reilly.
Monk, S. (2011). Programming Arduino: Getting Started
with Sketches (1st ed.). McGraw-Hill Education. ACTIVITY MODULE 1 (LED) TOPIC 2: Bar Graph and Disco Strobe Light SUBTOPIC 1 Bar Graph and Disco Strobe Light
At the end of the presentation, the students should be able to:
Discuss how create a simple Arduino project using LED and other arduino electrical components. Create a Bar Graph and Disco Strobe Light arduino project. In this project, you’ll combine what you’ve learned in the previous LED projects to create an LED bar graph that you can control with a potentiometer. •Arduino board • Breadboard • Jumper wires • 9 LEDs • 50k-ohm potentiometer • (9) 220-ohm resistor 1. Insert the LEDs into the breadboard with their shorter, negative legs in the GND rail. Connect this rail to Arduino GND using a jumper wire. 2. Insert a 220-ohm resistor for each LED into the breadboard, with one resistor leg connected to the positive LED leg. 3. Connect the other legs of the resistors to digital pins 2–10 in sequence, as shown in figure. It’s important that the resistors bridge the break in the breadboard as shown. 4. Place the potentiometer in the breadboard and connect the center pin to Arduino A0. Connect the right outer pin to +5V and the left potentiometer pin to GND.
5. Upload the code in “The Sketch” below.
The sketch first reads the input from the potentiometer. It maps the input value to the output range, in this case nine LEDs. Then it sets up a for loop over the outputs. If the output number of the LED in the series is lower than the mapped input range, the LED turns on; if not, it turns off. See? Simple! If you turn the potentiometer to the right, the LEDs light up in sequence. Turn it to the left, and they turn off in sequence. In this project, you'll apply the skills you learned in the previous project to make a strobe light with adjustable speed settings. •Arduino board • Breadboard • Jumper wires • 2 blue LEDs • 2 red LEDs • 50k-ohm potentiometer • (4) 220-ohm resistor 1. Place your LEDs into the breadboard with the short, negative legs in the GND rail, and then connect this rail to Arduino GND 2. Insert the resistors into the board, connecting them to the longer, positive legs of the LEDs. Use jumper wires to connect the two red LEDs together and the two blue LEDs together via the resistors, as shown in Figure; this allows the LEDs of the same color to be controlled by a single pin. 3. Connect the red LEDs to Arduino pin 12 and the blue LEDs to Arduino pin 11. 4. Place the potentiometer in the breadboard and connect the center pin to Arduino A0, the left pin to GND, and the right pin to +5V. 5. Confirm that your setup matches that of figure, and then upload the code in “The Sketch” on the next page . The sketch works by setting the analog signal from the potentiometer to the Arduino as an input and the pins connected to the LEDs as outputs. The Arduino reads the analog input from the potentiometer and uses this value as the delay value—the amount of time that passes before the LEDs change state (either on or off). This means that the LEDs are on and off for the duration of the potentiometer value, so changing this value alters the speed of the flashing. The sketch cycles through the LEDs to produce a strobe effect. THANK YOU FOR LISTENING! References Fitzgerald, S., & Shiloh, M. (2013). Arduino Projects Book. Arduino.
Banzi, M. (2011). Getting Started with Arduino (2nd ed.).
O'Reilly.
Monk, S. (2011). Programming Arduino: Getting Started