Trybotics Logo

Remote Control Countdown Timer Via Arduino

DESCRIPTION

Here's a simple guide on how to create your own count down timer. The purpose of this guide is to get familiar with IR receiver, LCD, active buzzer, potentiometer and LED. This design uses the Arduino UNO R3 board, but any of the Arduino boards with at least 7 digital i/o pins and 1 analog pin would be fine. This timer that you are going to build will count down the time you input in seconds. Once the time reaches 0, the LED lights up and buzzer will sound off. It continues to react until reset by remote or manually resetting the Arduino.

Description:

Arduino Uno (1)

Breadboard (1)

LCD 1602 Module (1)

IR Receiver Module (1)

Remote (1)

Active Buzzer (1)

LED(1)

10k Potentiometer (2)

Jumper wires

Description:

In order to program the remote to do a particular task, first we must obtain each button's hexadecimal code. The IR receiver has 3 pins, VCC, GND, and SIGNAL pin. Connect GND to the GND pin of Arduino, VCC to 5V, and SIGNAL to pin 5 of Arduino.

Next, We need to install the IRremote Arduino library.

download from https://github.com/z3t0/Arduino-IRremote by Ken Shirriff. Once you have it downloaded, go ahead and extract into the Arduino library folder. Now we are ready to load the coding.

#include <IRremote.h>
int RECV_PIN = 5;
IRrecv irrecv(RECV_PIN);
decode_results results;
{
  Serial.begin(9600);
  irrecv.enableIRIn(); 
}

void loop()
{
  if (irrecv.decode(&results))
    {
     Serial.println(results.value, HEX);
     delay(100);
     irrecv.resume(); 
    }
}

Description:

After you load the code into Arduino, open the Serial Monitor and monitor the values by pressing each button of the remote. Notice how there are few hexadecimals in red that are abnormal. Those abnormal values are caused by interference, therefore you need to press each button couple of times until a consistent value. Then record each value to it's corresponding button.

Description:

First connect the 5V output from Arduino to the positive rail of breadboard and ground to negative rail.

Connect the LCD as follow:

LCD VSS (pin 1), RW (pin 5), K (pin 16), to negative rail.

LCD VDD(pin 2), A (pin 15) to postive rail.

LCD VO (pin 3) to the output pin of potentiometer.

LCD RS (pin 4) to digital pin 10 of Arduino

LCD E (pin 6) to digital pin 9 of Arduino

LCD D4, D5, D6, D7 to digital pin 5, 4, 3, 2, respectively

connect signal pin of IR receiver to digital pin 0

connect analog pin A5 to VCC pin of another potentiometer.

connect the output of the potentiometer to the positive side of active buzzer and LED.

-purpose of this potentiometer is to reduce LED brightness or mute buzzer

connect the remaining GND pins to negative rail and VCC pins to postive rail.

Description:

#include <LiquidCrystal.h>
#include<IRremote.h>
int RECV_PIN = 0;
IRrecv irrecv(RECV_PIN);
decode_results results;
LiquidCrystal lcd(10, 9, 5, 4, 3, 2);
void setup() {
  lcd.begin(16, 2);
  lcd.write("Enter Time:");
  lcd.setCursor(9, 2);
  lcd.write("seconds");
  lcd.setCursor(0, 1); lcd.blink();
  irrecv.enableIRIn();
  Serial.begin(9600);
}
String x = "";
int y = 0;
void loop()
{
  if (irrecv.decode(&results))
  {
    switch (results.value)
    {
      case 0xFFA25D:      analogWrite(A5, 0); lcd.clear(); lcd.print("Enter Time:"); lcd.setCursor(9, 2); lcd.write("seconds"); x = ""; lcd.setCursor(0, 1); lcd.blink(); break; //PWR
      case 0xFF02FD:
        y = x.toInt();
        for (int i = y; i >= 0; i--) {
          if (i == 0) {
            analogWrite(A5, 255);
            lcd.clear();
            lcd.noCursor();
            lcd.print("TIME's UP");
            break;
          }
          lcd.noCursor();
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print("Remaining Time:");
          lcd.setCursor(0, 1);
          lcd.print(i, DEC);
          lcd.setCursor(9, 2);
          lcd.print("seconds");
          delay(999);
        }     break;            //PLAY/PAUSE

      case 0xFF6897:           x = x + "0"; lcd.setCursor(0, 1); lcd.print(x); break;       //0
      case 0xFF30CF:           x = x + "1"; lcd.setCursor(0, 1); lcd.print(x); break;       //1
      case 0xFF18E7:           x = x + "2"; lcd.setCursor(0, 1); lcd.print(x); break;       //2
      case 0xFF7A85:           x = x + "3"; lcd.setCursor(0, 1); lcd.print(x); break;       //3
      case 0xFF10EF:           x = x + "4"; lcd.setCursor(0, 1); lcd.print(x); break;       //4
      case 0xFF38C7:           x = x + "5"; lcd.setCursor(0, 1); lcd.print(x); break;       //5
      case 0xFF5AA5:           x = x + "6"; lcd.setCursor(0, 1); lcd.print(x); break;       //6
      case 0xFF42BD:           x = x + "7"; lcd.setCursor(0, 1); lcd.print(x); break;       //7
      case 0xFF4AB5:           x = x + "8"; lcd.setCursor(0, 1); lcd.print(x); break;       //8
      case 0xFF52AD:           x = x + "9"; lcd.setCursor(0, 1); lcd.print(x); break;       //9
    }
    irrecv.resume();
  }
}

Description:

Before loading the code into your Arduino board, you first have to modify the code to be able to receive and decode your own remote input signal. This can be done simply changing the hexadecimals in each of the Switching cases. Case 1 is for resetting the LCD when time is up or inputted wrong time. Case 2 is for starting the timer. Case 3-12 is for inputting numbers. Each of these cases can be assigned to any button of your preference. You can also modify code to turn on/off display or turn it into a stopwatch instead, and so much more!


YOU MIGHT ALSO LIKE