Previously, I made a small IR signal receiver. Which receives the NEC signals from IR remote of TV/ PS/ AC or mp3 and display the decoded data on the screen. But this time I am going to make a universal remote so that we can clone our remote codes. The same technique is also used in some smart phones that comes with IR on top. But through this remote we can copy the signals of different devices which reduce the number of remote controls.

This device is an IR transmitter having a long indoor range of 50 meters. This is only an educational tutorial and you are not allowed to tease someone with this smart gadget. You need to know some basics of Hexadecimal and digital number system before understanding the code. My friend made a superb device to get the hexadecimal number out of digital. That is basically a calculator or you can do that by any online calculators available on web.

And finally, we will design a PCB of our universal IR remote control. Which is easy to program and give you a better interface. I am using JLCPCB PCB prototype service for a long time. And honestly speaking, JLCPCB is the most affordable PCB prototype and PCB assembly till now. You can get the boards just in $2 for 5pcs and PCB assembly is starting from $8.

Working idea:

The program is fully dependent on the libraries used in the project. And the code is so designed, it will take input as digital which can be converted into HEX while decoding. IR remote work on a carrier frequency of 38khz which can be generated using PWM pin of Arduino. Data is modulated over 38khz carrier which is demodulated by the receiver end TSOP sensor. To know more about IR receiver, follow this link. Now digital keys are programmed with different data structures, which can be edited and changed as per needs.

Components required:

1) Arduino NANO

2) IR transmitter LED

3) Tactile buttons

4) Battery

5) Custom PCB from JLCPCB

Circuit diagram:

Arduino Digital Pin 3 is used to transmit the data over an internally generated 38khz carrier frequency. There are 12 more digital pins and they can be used to send 12 different data without any external components.

No need of any pull-down resistor with tactile switches the code itself do the job. If you are using a linear power supply or Traced PCB then add a small electrolytic capacitor of 100uf to the power line. which helps to reduce the noise. Whole the system can be powered using 5v @1amp charger or a 3.7v li-po battery.

PCB designs:

These PCBs are made using JLCPCB PCB prototype service. I designed the shield so that after mounting all the components we just have to plug the microcontroller in. I made the schematics in EasyEDA and then generated the Gerber files. If you want to use the same designs as mine then get them from here. The battery terminals for the power supply are given on back panel. Sign-up now to JLCPCB and get free coupons of $54.

Code:

When the pin is pulled down by pressing tactile switch, then it will send an interrupt to MCU and send the respective data to output pin of the Arduino. By default it is PWM pin 3.

#include <IRremote.h>

IRsend irsend;

void setup()
{
  Serial.begin(9600);
  pinMode(5,INPUT_PULLUP); // button 1
  pinMode(6,INPUT_PULLUP); // button 2
  pinMode(7,INPUT_PULLUP); // button 3
  pinMode(8,INPUT_PULLUP); // button 4
  // add more number of lines in code utilise more pins
}

void loop() {
  
    if (digitalRead(5) == LOW){
      irsend.sendNEC(0x34895725, 32);  // change these unique code to yours but in decimal 
      delay(30);
      } 

  else if (digitalRead(6) == LOW){
      irsend.sendNEC(0x56874159, 32);
      delay(30);
      } 

  else if (digitalRead(7) == LOW){
      irsend.sendNEC(0x15467823, 32); 
      delay(30);
      } 
      
  else if (digitalRead(8) == LOW){
      irsend.sendNEC(0x25467823, 32);
      delay(30);
      } 
  else{
      Serial.println("Nothing to send");
      delay(30);
      } 

   delay(100);
  
    }

Libraries used:

Here I am using 2.2.3 version of IR remote library. The code is very well working with this bigger versions has...

Read more »