remote_control_led_featured

Remote Controlled LEDs

A post after a long time !

I have done some considerable amount of work on my Arduino since I purchased it. Worked with PhotoResistors aka Light Sensors, PIR Motion Sensors, LDR Temperature Sensors etc. And I must say, it’s fun playing around with sensors.

So here’s a small and easy tutorial for controlling LEDs using IR Remote Contol.

Things Required :

  • Arduino Board
  • TSOP 1738 IR Receiver. (Purchase online)
  • Remote Control (Any TV Remote would do)
  • LEDs
  • Patch Wires

To start with, grab the TSOP 1738 IR Receiver, this works on active low principle i.e. its output remains high but becomes low on some input. The TSOP 1738 is a 3 pin device. Keeping the bulgded portion facing you, the leftmost pin is Ground, Middle pin is Vs (5 V) and the rightmost pin is Output.

TSOP 1738 Pin diagram Courtesy: Datasheetdir
TSOP 1738 Pin diagram Courtesy: Datasheetdir

To run this program you will need the IRremote.h header file. (Download Here). Once downloaded, extract the .zip file and rename it to IRremote. Now place this folder in libraries folder in your arduino directory.

Once this is done, start the Arduino IDE. Goto File->Examples->IRremote->IRrecvDemo. (Check the picture below)

IRremote Recv Demo
IRremote Recv Demo

Now burn the program to the board. Start the Serial Monitor (Crtl+Shift+M). Point the tv remote to the IR Receiver and press any button, note the corresponding values shown in the Serial Monitor.

Now moving on with the example, place the LEDs on the bread board and connect them to your arduino(Red->pin 4, Green->pin 7, Yellow-> pin 8) and to ground.

See the code below :

[code language=”c”]

#include <IRremote.h> //Include the IRremote.h file

int RECV_PIN = 2; //TSOP 1738’s Out pin
int red = 4;
int gre = 7;
int yel = 8;
IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
pinMode(red, OUTPUT);
pinMode(yel, OUTPUT);
pinMode(gre, OUTPUT);
}

void loop() {

if (irrecv.decode(&results))
{
if(results.value==2080 || results.value==32) //Compare received values from Remote
{
digitalWrite(red, HIGH);
digitalWrite(yel, LOW);
digitalWrite(gre, LOW);
}

else if(results.value==2064 || results.value==16)
{
digitalWrite(red, LOW);
digitalWrite(yel, LOW);
digitalWrite(gre, HIGH);
}

else if(results.value==2065 || results.value==17 )
{
digitalWrite(red, LOW);
digitalWrite(yel, HIGH);
digitalWrite(gre, LOW);
}
Serial.println(results.value);
irrecv.resume(); // Receive the next value
}
}

[/code]

Burn the above code and run the program. Point the remote to the receiver and press the volume(+) ,volume(-) and channel(+) keys to see the different LEDs being illuminated ! (the values are based on the remote I am using, you might receive different values from your remote)

Checkout the video below for demo  –

Voila !! You have create remote controlled LEDs !

This is one of the simplest and the easiest sketches. Hope this helped you. For any information, feel free to contact !

About Atulmaharaj

A seasoned blogger and a content marketer for close to a decade now. I write about Food, Technology, Lifestyle, Travel, and Finance related posts. Blogging brings me joy and the best part is I get to read and e-meet so many amazing bloggers! PS: I'm also the founder for Socialmaharaj.com :) Favorite Quote: "Traveling is like reading a book, one who hasn't traveled, hasn't turned a page.

Check Also

Arduino UNO

Arduino Project Ideas to implement this summer vacations

It’s that time of the year (again) when parents would be scouting for dance, music, …

Share your thoughts

This site uses Akismet to reduce spam. Learn how your comment data is processed.