Audio and Visual Timer

by akanderson240 in Circuits > Arduino

2160 Views, 11 Favorites, 0 Comments

Audio and Visual Timer

PXL_20220521_030128432.jpg
Audio and Visual Timer

Do you need a way to quickly and easily set a timer for short intervals?

This audio and visual timer has you covered! All you need to do to set your timer is turn the potentiometer knob and push the button.

One LED = 5 seconds

Two LEDs = 10 seconds

Three LEDs = 20 seconds

Four LEDs = 30 seconds

At the end of the timer, the Piezo will beep, and you can set another timer!


This project is great for timing quick tasks, and the delays can be adjusted to accommodate for longer or shorter tasks!


I was motivated to create this project because I have been teaching multiplication fact fluency in my classroom, and I've been using sand timers to help students time themselves as they solve multiplication facts. I noticed that many of them would spend too much time looking at the sand timer, and not enough time looking at their math, or spend the whole time working on their math, and not notice when the timer ended. I wanted to create a variable length timer that had a visual element as well as an audio element.


This project would be good for an intermediate Arduino project. The circuitry can be fickle, but

Supplies

PXL_20220521_013147078.jpg

Arduino Uno

Breadboard

Piezo

Potentiometer

LEDs (4)

Resistors (1 k ohm) (5)

Push button

Jumper wires (16, various sizes)

Arrange Input and Output Components on Breadboad

PXL_20220521_013505522.jpg

Insert Piezo, LEDs, potentiometer, and pushbutton as shown and described.

  1. Place the Piezo in the breadboard, inserting pins into rail e, rows 26 and 30.
  2. Place the LEDs in the breadboard as shown, 1 row apart from each other in rail e. (LED 1, cathode (short end) row 22, anode (long end) row 21; LED 2, cathode in row 19, the anode in row 18; LED 3, cathode in row 16, the anode in row 15; LED 4, cathode in row 13, the anode in row 12).
  3. Place the potentiometer in the breadboard with pins in rows 8, 9, and 10. My potentiometer has the outer pins in rail e and the inner pin in rail f.
  4. Place the pushbutton in the breadboard with pins in rows 3 and 5, rails e and f.

Add Resistors

PXL_20220521_015230161.jpg

Insert resistors as shown and described.

  1. Insert resistor pins in (h,5) and (h,6)
  2. Insert resistor pins in (a,22) and negative rail.
  3. Insert resistor pins in (a,19) and negative rail.
  4. Insert resistor pins in (a,16) and negative rail.
  5. Insert resistor pins in (a,13) and negative rail.

Wire LEDs

PXL_20220521_020905381.jpg

Wire LEDs

Connect LEDs to pins on Arduino Uno. The wire connects the anode side of the LED to the pin.

  1. Connect a jumper wire from (a,12) to Arduino digital pin 7.
  2. Connect a jumper wire from (a, 15) to Arduino digital pin 6.
  3. Connect a jumper wire from (a, 18) to Arduino digital pin 5.
  4. Connect a jumper wire from (a, 21) to Arduino digital pin 4





Wire Piezo

PXL_20220521_021305395.jpg

Wire Piezo

Connect Piezo to power and to Arduino Uno. You may need to lift the Piezo out of the breadboard in order to access slots for wiring.

  1. Connect a jumper wire from (a, 26) to Arduino digital pin 8.
  2. Connect a jumper wire from (a, 30) to the negative rail.


Wire Potentiometer

PXL_20220521_021921038.jpg

Wire Potentiometer

Connect the potentiometer to power and to Arduino Uno.

  1. Connect a jumper wire from (c, 8) to the positive rail.
  2. Connect a jumper wire from (a, 10) to the negative rail.
  3. Connect a jumper wire from (a,9) to Arduino Analog In Pin A0.


Wire Pushbutton

PXL_20220521_022403901.jpg

Wire Pushbutton

Connect the pushbutton to power and to the Arduino Uno.

  1. Connect a jumper wire from (h,3) to the positive rail.
  2. Connect a jumper wire from (i, 6) to the negative rail.
  3. Connect a jumper wire from (i, 4) to Arduino digital pin 3.


Connect to Electricity Ground and Current

PXL_20220521_022932473.jpg

Wire the Electricity

Create the circuitry for electricity to flow throughout the circuit.

  1. Connect a jumper wire from 5v on Arduino Uno to the positive rail on the breadboard.
  2. Connect a jumper wire from GND (ground) on Arduino Uno to the negative rail on the breadboard.
  3. Connect a jumper wire from the positive rail on the breadboard to the opposite positive rail on the breadboard.
  4. Connect a jumper wire from the negative rail on the breadboard to the opposite negative rail on the breadboard.


Connect Arduino to Computer

PXL_20220521_023600030.jpg

Connect your Arduino to your computer via USB cable.

Load Sketch to Arduino

PXL_20220521_030128432.jpg

To access the sketch, follow the link below, or view the sketch below.

https://create.arduino.cc/editor/akanderson240/2776056d-5702-4af8-8736-0c89a360ae28/preview


const int buzzer=8;

int sensorValue=0;

int buttonState=0;

void setup()

{pinMode(A0, INPUT);

 pinMode(3, INPUT);

 pinMode(8, OUTPUT);

 pinMode(7, OUTPUT);

 pinMode(6, OUTPUT);

 pinMode(5, OUTPUT);

 pinMode(4, OUTPUT);

}


void loop()

{sensorValue = analogRead(A0);

 buttonState = digitalRead(3);

 if (buttonState == HIGH) //button is pushed

 {

  if(sensorValue >= 0 && sensorValue < 250){

  digitalWrite(7, HIGH);

  digitalWrite(6, LOW);

  digitalWrite(5, LOW);

  digitalWrite(4, LOW);

  delay (5000); // 5 second timer

  tone(buzzer, 1000);

  delay (1000);

  noTone(buzzer);}

 else if (sensorValue >= 250 && sensorValue < 500){

  digitalWrite(7, HIGH);

  digitalWrite(6, HIGH);

  digitalWrite(5, LOW);

  digitalWrite(4, LOW);

  delay (10000); // 10 second timer

  tone(buzzer, 1000);

  delay (1000);

  noTone(buzzer);}

 else if (sensorValue >= 500 && sensorValue < 750){

  digitalWrite(7, HIGH);

  digitalWrite(6, HIGH);

  digitalWrite(5, HIGH);

  digitalWrite(4, LOW);

  delay (20000); // 20 second timer

  tone(buzzer, 1000);

  delay (1000);

  noTone(buzzer);}

 else if (sensorValue >=750) {

  digitalWrite(7, HIGH);

  digitalWrite(6, HIGH);

  digitalWrite(5, HIGH);

  digitalWrite(4, HIGH);

  delay (30000); // 30 second timer

  tone(buzzer, 1000);

  delay (1000);

  noTone(buzzer);}

}

}


  

Test Your Timer