You can turn on the TV at ANY TIME.

We can turn ON and Turn Off the Tv remotely using IR and IoT technology. We can send the IR code it may ON or OFF etc. to the gateway, then gateway sends it to the client device via the server.
By Jehoon song
Hardware Components
IR receiver & transceiver sensor
X 1
Software Apps and online services
mbed compiler


IoT era.

Many things can be controlled remotely. Bluetooth or WiFi is used to these. But I am making is too difficult and expensive. I can more easily access the IR remote module in the surrounding.

So, I decided to use the Infrared remote.

IR Gateway!



Step 1: Parts for making it


1. Remote controller.

I use the remote controller a feature of the smartphone

2. IR Receiver

Arduino + Ethernet Shield + IR Recive Sensor (It contained in Total Sensor Board)

3. IR Transceiver

WIZwiki W7500(mbed platform) + IR Transceive Sensor(It connected with Seeed studio’s interface board)


Step 2: Flow


You can turn on the TV at everywhere.

1. Press the power button on the remote control.

2. Arduino + IR receiver reads the IR value. (ex, 0x20 0xDF 0x10 0xEF)

3. Arduino + ethernet shield is transmitted to the server in a specified format.

(NEC, 0010 0000 1101 1111 0001 0000 1110 1111)

4. WIZwiki-W7500 TCP server receives a fixed format.

(NEC, 0010 0000 1101 1111 0001 0000 1110 1111)

5. Binary Format Conversion

0000 0100 1111 1011 0000 1000 1111 0111

6. And it transmits the IR data. Because Bits are stored in reverse order.

Final HEX values: 0x04 0xFB 0x08 0xF7


Step 3: Can my TV get the same value via direct and indirect path?



I tested that my TV can receive the same values from different paths.

So, I used Arduino + IR receiving a sensor. Then uploaded demo firmware (IRrecvDemo – Arduino example source code) author: Ken Shirriff’s IRremote library(

I tested that IRrcvDemo program has received the same.

1. Direct path.

When I used my IR remote controller, IRrcvDemo program received 0x20 0xDF 0x10 0xEF when Power button pressed.

2. Indirect path.

When I used the IR library in mbed(…

I sent 0x20 0xDF 0x10 0xEF, IRrcvDemo program received 0x04 0xFB 0x08 0xF7..

In both cases, IRrcvDemo program received a different value.

I fell into chaos.

So, I had checked Binary code.

0x20 0xDF 0x10 0xEF ==> 0010 0000 1101 1111 0001 0000 1110 1111

0x04 0xFB 0x08 0xF7 ==> 0000 0100 1111 1011 0000 1000 1111 0111

!!! An array of bits had been opposed.

So, I tried to make bits to inverse in mbed & Transceiver

Step 4: When TCP Client sent specific Packet to TCP SERVER & IR TRANSCEIVER


I sent the specific Packet like “NEC,00100000110111110001000011101111”.(Protocol,Bit string)

W7500(TCP SERVER&IR TRANSCEIVER) can receive the right packet and send the reversed IR code.

So, IRrcvDemo program received the right data that I want.



Step 5: When I use the IR Remote controller


How to send specific Packet that I want.

I want to send a specific packet like “NEC,00100000110111110001000011101111” when I pressed the Power button on my remote controller.

When I Press the power button on my remote controller, Arduino+Ethernet Shield+IR receiver can receive the data like “0x20 0xDF 0x10 0xEF”.

So, I had to change to the specific format. (NEC,00100000110111110001000011101111)

Then that packet sends to the TCP Server.

Step 6: Finally, When I press the Power, Could my TV be received correctly?


When I press the power,

TCP Server can receive the right packet(NEC,00100000110111110001000011101111)

AND send the reverse packet(0x04 0xFB 0x08 0xF7)


My RECEIVER(IRrcvDemo program) can receive the same data as a Direct path.

Step 7: Result.


WOW, my TV received same data in two cases.

Receiver side Source code included in this article.

And IR transceiver side Source code included in mbed repository.





//Sending ir codes over ethernet
//This sketch accept IR from an IR sensor connected to Pin 6 and sends over IP
// parts of the code for storing ir in to buffer is from  Ken Shirriff's ir recorder
//                       THIS ONE PICKS IR FROM A REMOTE
#include <IRremote.h>
#include <SPI.h>
#include <Ethernet.h>

int RECV_PIN = 6;
IRrecv irrecv(RECV_PIN);
decode_results results;
// Network settings 
byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //MAC
byte gateway[] = { 192,168,29,1 };// Gateway
byte ip[] = { 192,168,29,190 };  //ip if dhcp fails 
// IP of the Target arduino with ir emitter
IPAddress server(192,168,29,150);  
EthernetClient client;

char rawCodes[RAWBUF]; // The durations if raw
int codeLen; // The length of the code
//Get the infrared codes from remote

void storeCode(decode_results *results) {
//  NEC,00100000110111110001000011101111\n
  int count = results->rawlen;
  int j = 0;
  Serial.println("Received code");
  codeLen = results->rawlen - 1;
    for (int i = 3; i <= codeLen; i++) {
      if (i % 2) {
      else {
        // Space
         if(results->rawbuf[i] > 25)
             rawCodes[j++] = '1';
             rawCodes[j++] ='0';
    codeLen = j;

void setup()
  // For debug
  irrecv.enableIRIn(); // Start the receiver
  // Start ethernet
  Ethernet.begin(mac, ip, gateway);

//sending the raw IR code over the ether net

void sendIR(decode_results *results)
    char tmp[50] = {'\0'};
    int n=0;
    // Send over HTTP
    if (client.connect(server, 5000))
       if (results->decode_type == UNKNOWN) {
         n = strlen("UNKNOWN,");
      else if (results->decode_type == NEC) {
        n = strlen("NEC,");
      else if (results->decode_type == SONY) {
        n = strlen("SONY,");
      for (int i = n; i < codeLen+n; i++) {
        tmp[i] = rawCodes[i-n];

void loop()
  if (irrecv.decode(&results))
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value


Original Source:


major source code


Please Login to comment
Notify of