Introduction: How to Emulate a TV Remote or Else With Arduino Irlib

Picture of How to Emulate a TV Remote or Else With Arduino Irlib

Introduction

Hi everyone and welcome to my first Instructable.

Today we will learn, as the title says, to emulate e TV remote or something similar that works with Infrared signals using Arduino (any model).

The problem was: How can I trasmit codes to an object if I don't know the code?

Searching on the internet I didn't find the answer to my question so I started thinking and invented this method by myself.

In this tutorial I'll show you how to do that.

P.S.:

Before we start I'm going to tell you that Ir communications are very complex and require a bit of knowledge first.

Step 1: Material

Picture of Material

You need less components than you think:

-Arduino (I used Leonardo)

-470ohm or similar resistor !ATTENTION!: resistor value may change depending on your IR LED

-IR led (I used SFH4546)

-Some Jumpers

-IR receiver (I used TSOP38238)

-Breadboard

This is what I used for this simple but essential circuit.

EDIT: If you use my same led, don't use any resistor between Arduino pin and led because it will decrease a lot the distance from you can use your remote.

If you don't use the same ir led I suggest to put a trimmer and regulate it as you want.

Step 2: Circuit and Coding

Now we take a look to the circuit.

We need to build 2 circuits:

-The first circuit needs to capture the signal from the remote control.

-The second transmits the signal we captured before.

-----------------------------------------------------------------------------------------------------------

So take arduino, breadboard, wires and receiver and lets start work!

First connect 5v and GND to your receiver (mine has in order OUT, GND, 5V)

The OUT pin needs to be connected to the Arduino pin 2. (How the circuit looks)

Once you have done that we need to connect the Anode of our led to the resistor and the Cathode to ground.

From the resistor we will connect later to the pin which is defined by the Ir library. (How the circuit looks)

-----------------------------------------------------------------------------------------------------------

The code is very simple:

First we need to install the libraries:

-The IrLib2 library for the receiving passage

You need then to open the zip file and copy the folders inside that file to your libraries folder.

-The IrRemote library for sending it

Once you have done it, open Arduino IDE and from examples menu go to the IrLib2 examples folder, then load the sketch "RawRecv.ino" on your Arduino board.

Once it's loaded on the board open the serial monitor, take the remote controller you want to emulate, aim it at the Ir receiver and press a button on it: you will see some output (raw code) on the monitor so just copy it in the clipboard.

Next passage is sending the codes we acquired.

Every single Arduino model has its own pin for the IRsend class and you cannot change it due to some restrictions by the hardware.

Here there is a table with pin setting of some Arduino boards.

This is my sketch, it sends the channel_up command to an old Samsung Tv:

#include <IRremote.h>
IRsend irsend;

#define RAW_DATA_LEN 68     //output of RawRecv
uint16_t rawData[RAW_DATA_LEN]={
  4458, 4482, 546, 1698, 550, 1690, 554, 1690, 
  546, 606, 518, 610, 526, 602, 522, 606, 
  526, 602, 522, 1694, 554, 1686, 550, 1694, 
  550, 602, 522, 606, 530, 598, 526, 602, 
  522, 606, 526, 602, 522, 1694, 554, 598, 
  522, 606, 530, 1686, 554, 602, 518, 610, 
  522, 602, 522, 1694, 554, 602, 522, 1694, 
  550, 1690, 546, 610, 526, 1690, 546, 1694, 
  554, 1690, 546, 1000};

void setup(){
}


void loop() {
  irsend.sendRaw(rawData, RAW_DATA_LEN, 38); //send raw data at 38KHz frequency
  delay(1000); //1 second delay between each signal burst
}

Pay ATTENTION: coping and pasting it on the IDE may not work, if it doesn't work you need to write every single line

Step 3: Testing and Finishing

It's time for a test now!

Point your led to the receiver in the same way you point the remote control and power up you Arduino, wait a second and you will see that the receiving device will start doing what we are telling it to do so that's it!

If something's wrong please leave a comment below.

That's the end of our Instructable. I hope it's useful for you.

Comment if you want a video of this tutorial and..........

to the next Instructable!

Comments

BrownDogGadgets (author)2017-11-19

Man, now I want to make my own TV remote.

man it's a difficult task

but if you are determined to do it maybe you can do something nice like a tft touch display that can be put instead of classic buttons

remember that's powered by batteries so keep this in mind

but i will make a tutorial for it in instructables

DIY Hacks and How Tos (author)2017-11-18

This is really cool. A simple Arduino can be the ultimate universal remote.

About This Instructable

1,090views

29favorites

License:

More by daniscubla.malignani:How to Emulate a TV Remote or Else With Arduino Irlib
Add instructable to: