top of page
IMG_20170503_173438.jpg

Post

Ideas for STEM Project: How to make Arduino IR remote controller/ decoding Signals from IR Remote


Arduino IR control Circuit
Arduino IR control Circuit

Introduction


Howdy ! I hope you are having a great day.


Arduino remains a top-notch platform that proves to be valuable when it comes to delving into do-it-yourself (DIY) projects suitable for children, serving as a tool to teach kids about both electronics and programming. With an intuitive interface and an extensive array of sensors at its disposal, Arduino opens up limitless possibilities for innovative and imaginative projects. Among the many sensors that are available, the Infrared receiver and transmitter sensors are a well-known and highly useful sensor that finds its way into a variety of electronics projects.


This sensor measures the infrared signal accurately and we shall be exploring it today, sounds interesting to measure signals generated from your TV remote, right ? Let get started by learning what we need for this basic electronic project for kids.


Requirements

  • Arduino board

  • Breadboard

  • Jumper wires

  • LED

  • 220 - ohm resistor

  • IR Sensor

  • Remote


How it works


In the simplest language, the IR transmitter (remote) emits Infrared signals which are received by the infrared Receiver. These signals are in hexadecimals. They are decoded using Arduino microcontroller and the read encode is mapped out for other signal controls.


Building the circuit

If you have been attentive to the previous projects, this project is very simple to configure.

Grasp your breadboard and other components required and let me show you the steps required.

Sensor

Connect to Arduino

IR VCC

+5v of Arduino

IR GND

GND

Vout

D7

LED pin

D8

Connect Longer pin of LED through 1k Ohm or 220 Ohm resistor to the Arduino Digital pin 8. Connect the shorter pin to the GND of Arduino. To understand this Project, we have split it into two main sections:

First verify the circuit connection with the one shown below.


Schematic
Schematic

Actual Circuit


Actual circuit
Actual circuit

Find the codes from your Remote.


Use the code below, copy and paste in your Arduino IDE, Open your Serial terminal and press the remote buttons.



#include <IRremote.h>

const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup(){
  Serial.begin(9600);
  irrecv.enableIRIn();
  irrecv.blink13(true);
}

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

The code above will give you FFFFFFF most of the time when you press a button in IR transmitter. To solve this issue, use the code below:



#include "IRremote.h"

IRrecv irrecv(2);

decode_results results;

void setup()
{
   Serial.begin(9600);
   irrecv.enableIRIn();
}

void loop()
{
   readIR();
}

void readIR()
{
   if (irrecv.decode( &results ))
   {
      unsigned long IRval = results.value;
      if (IRval == 0xffffffff)
      {
         irrecv.resume();
         return;
      }
      Serial.println( results.value, HEX );
      irrecv.resume();
   }
}

You should be able to receive code like the one shown below:


how IR received Codes look like
How IR received Codes look like

Using The IR Remote to control things


We are going to switch ON and OFF an LED using infrared Remote and Arduino microcontroller .


#include <IRremote.h>

const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;
const int led1 = 8;
//const int greenPin = 9;


void setup(){
  irrecv.enableIRIn();
  irrecv.blink13(true);
  pinMode(led1, OUTPUT);
  //pinMode(greenPin, OUTPUT);
}

void loop(){
    if (irrecv.decode(&results)){

        switch(results.value){
          case 0xB5A33C754: 
          digitalWrite(led1, HIGH);
          delay(2000);
          digitalWrite(led1, LOW);
          }

//        switch(results.value){
//          case 0xFF18E7: //Keypad button "2"
//          digitalWrite(greenPin, HIGH);
//          delay(2000);
//          digitalWrite(greenPin, LOW);
//          }

        irrecv.resume(); 
    }
}

Copy and paste one of the received code from IR transmitter in the code. Whenever the signal is received the LED goes on for 2 seconds and then goes OFF.


Video /Demo



Need to explore more ?


The challenged I am giving us is to uncomment the commented part in the LED controlling code and add an LED in the schematic. This led should be in D9.


Conclusions


Congratulations ! You have successfully built an Arduino IR controller circuit with blinking LED for basic circuit. Like this post, share widely and can follow us in our social media platforms. In case you have any topics you want to suggest, leave a message in comment section. Newsletter, follow, subscribe, and like the social media If you like STEM challenges and Science activities, consider following us on Social media for the latest updates, and don't miss any STEM events. Don't forget to also subscribe to our newsletter at the bottom of our website ''www.makersgeneration.net'' for more events, tutorials, and freebies. Stay tuned for the coming online STEM activities, also in Washington DC, Maryland for your kids. It will go from coding (Python, Scratch, etc) to robotics, 3D design, making video games, and much more. So, subscribe to the newsletter to not miss a piece of it. ;-)

Subscribe to the Facebook group if you have yet registered. Content and tutorials are shared daily: Create and build STEM projects for kids We can be reached at: contact@makersgeneration.net if any questions. See you on soon.

Σχόλια