Arduino Double Button IR Remote Control

Introduction

This article delves into the creation of an Arduino Double Button IR Remote Control LED illumination. Utilizing an Arduino Nano, a TSOP4838 IR receiver, three 5mm LEDs (Red, Green, and Blue), and essential resistors, this guide navigates the process of setting up an interactive system allowing users to manipulate LED lighting via an IR remote control. The provided code snippet orchestrates the interplay between the Arduino Nano, IR receiver, and LEDs. By deciphering and implementing the code, enthusiasts can create a dynamic, remotely operated LED system, expanding their understanding of Arduino-based remote control functionalities.

Hardware Required

Components#Buy From Amazon
Arduino Nano1Buy Now
TSOP4838 IC1Buy Now
LED 5mm (Red, Green, Blue)3Buy Link
Resistors 1K1Buy Link
9v DC Adapter (Optional)1Buy Link
Jumper WiresFewBuy Link
Breadboard1Buy Link

Pinout of TSOP4838 IC

TSOP4838-IR-Receiver-Pinout

Pinout Configuration

Pin NameDescription
VCCThe Vcc pin powers the module, typically with +5V
GNDPower Supply Ground
OUTOutput Pin

Circuit Connections

The connections must be established correctly for the circuit to function as intended. Here’s a suggested configuration:

  • Arduino Nano Pin 3: Connect to the signal pin of the TSOP4838 IR receiver.
  • LED Red (Pin 6), LED Green (Pin 7), LED Blue (Pin 8): Connected to digital pins on the Arduino through 1KΩ resistors.
  • Jumper wires: Used to establish connections between the Arduino, IR receiver, resistors, and LEDs.
  • Power: Ensure the Arduino is powered using an appropriate power source.

Circuit Diagram

The following circuit shows you the connection of the Arduino Double Button IR Remote Control Please make the connection carefully

Arduino-Double-Button-IR-Remote-Control-circuit

Installing Arduino IDE Software

First, you will require to Download the updated version of Arduino IDE Software and Install it on your PC or laptop. if you Learn How to install the Arduino step-by-step guide then click on how to install Arduino Button given Blow

Installing Libraries

Now when you are Ready to upload the code, to the Arduino Board you will need first to add the Following Libraries in Arduino, If you Learn How to add the library in the Arduino step-by-step guide click on how to install the library Button given Blow

Code

//For more Projects: www.arduinocircuit.com

#include <IRremote.h>
int RECV_PIN = 3;
const int ledPin1 = 6;
const int ledPin2 = 7;
const int ledPin3 = 8;
IRrecv irrecv(RECV_PIN);
decode_results results;
int buttonPushCounter = 0;
void setup()
{
Serial.begin(9600);
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
irrecv.enableIRIn(); // Start the receiver
}
unsigned long last = millis();
void loop() {

if (irrecv.decode(&results)) {

if (results.value == 0xEF1001FE) { //code from your IR remote
if ((millis() – last > 150)&&(buttonPushCounter <3)) {
buttonPushCounter++;

Serial.println(“on”);
Serial.print(“number of button pushes: “);
Serial.println(buttonPushCounter);
}
last = millis();
}
if (results.value == 0xEF1055AA) { //code from your IR remote
if ((millis() – last > 150)&&(buttonPushCounter >0)){
buttonPushCounter–;
Serial.println(“on”);
Serial.print(“number of button pushes: “);
Serial.println(buttonPushCounter);
}
last = millis();
}
irrecv.resume(); // Receive the next value
}
if (buttonPushCounter % 4 == 0) {
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, LOW);

}
if (buttonPushCounter % 4 == 1) {
digitalWrite(ledPin1, HIGH);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, LOW);
}
if (buttonPushCounter % 4 == 2) {
digitalWrite(ledPin1, HIGH);
digitalWrite(ledPin2, HIGH);
digitalWrite(ledPin3, LOW);
}
if (buttonPushCounter % 4 == 3) {
digitalWrite(ledPin1, HIGH);
digitalWrite(ledPin2, HIGH);
digitalWrite(ledPin3, HIGH);
}

}

Applications

  • Home Automation: Effortlessly control the lighting in various rooms using a single remote control.
  • Energy Savings: Turn off bulbs remotely to save energy when not needed.
  • Convenience: Control multiple lights from a distance, perfect for bedrooms, living rooms, or hallways.
  • Home Theater Setup: Use the IR remote to create a comfortable ambiance for movie nights.
  • Accessibility: Provide easy light control for individuals with mobility challenges.

Leave a Comment


error: