Introduction: Infrared-RF 433-Bluetooth Arduino Remote

Having seen several tutorials on home automation, I thought it would be cool to take on an all in one remote control box that contained infrared protocols to turn on the tv, rf 433 protocols to control lighting and other household electronics and transmit and receive Bluetooth commands. Most importantly do it on the cheap. I use a web interface to send BT signals from a RPI (this is out of the scope of this tutorial but pretty cool stuff).   I hope you enjoy and maybe spark more ideas. Before we start I have to give several others credit as none of this is original, many thanks folks.
IR Tutorial/Library
Ken Shirriff
Bluetooth and Arduino
Mohannad Rawashdeh
RF Tutorials/Library
Suat Özgür
Ray Wang

Step 1:

Materials used in this project and source

Arduino UNO R3 board with DIP ATmega328P,

Arduino Wireless Bluetooth Transceiver Module Slave 4Pin Serial + DuPont Cable,

Infrared Receiver,

Infrared LED, Old remote

433M receiver module 433MHZ Superregeneration Wireless Transmitter Module,

Jumper Wires, Amazon

Etekcity® 5 Pack Wireless Control Electrical Outlet Switch Socket with 1 Remote,

Sanyo TV with IR Remote, Already

Step 2:

I am not going to devote to much time to this I found that Ken Shirriff’s
Has done an excellent job of demonstrating the codes receive process, after you follow his physical and virtual setup loading the IRrecvDump sketch.
Next open Arduinos IDE serial monitor
Point your IR remote to the IR Receiver on the Arduino, press each button from top left to working your way down. It may not need to be said but keep track of your remote button pushes
OUTPUT I GOT LOOKED LIKE THIS “Decoded NEC: 1CE348B7 (32 bits)”
In the serial monitor you will begin to see values appear, once completing with the remote buttons copy these values into a text editor, notepad would be fine,  Using the text editor note each code and save for later, I did this:

Step 3:

Learn the RF remote codes
To learn the codes I used Suat Özgür’s library , (I could not get the library to send the learned codes)
Save and add the following link to your Arduino IDE
Following the steps provided with one modification, instead of using ReceiveDemo I used  RecieveDemo_Advanced
Following the instructions I received the following on the serial monitor:
Decimal: 1922051 (24Bit) Binary: 0001110101010100000000110 Tri-State: 0F1FFFF00001 PulseLength: 162 microseconds Protocol: 1
Raw data: 5036,120,524,116,528,116,524,444,204,440,200,444,200,120,528,440,216,128,592,532,252,152,688,608,288,172,792,708,376,228,1276,436,2580,1224,524,124,524,120,528,116,524,124,528,116,528,440,200,444,200,
I saved the binary from each button push in a text editor
1. 000111010101010000000011
2. 000111010101010000001100
3. 000111010101010000110000
4. 000111010101010011000000
5. 000111010101011100000000

Step 4:

Now that the codes have been captured we can begin physically building the Arduino: 
Connect your ir led to the GND and #3 Pins
Connect the rf transmitter data pin to pin 10 on the Arduino
Connect the rf transmitter GND pin to GND pin on the Arduino
Connect the rf transmitter VCC pin to 5V pin on the Arduino (It needs the voltage more than the BT)
Bluetooth can only be connected after the sketch is uploaded

Step 5:

Now to load the sketch but before loading, I analyzed each rf code and noticed that each had the same leading 14 digit signature and 10 digit command after I will break the command into two parts (later testing revealed that by manipulating the last ten digits I could control multiple sockets at one time ex 0000110011 toggles socket one and socket three, 1111111111 toggles all the sockets)
The code below is modified from Ray Wang’s original rf sketch

My Example Sketch

//Use the irremote library
#include <IRremote.h>
IRsend irsend;
// Buffer to store incoming commands from serial port/bluetooth
String inData;
//defines the pin that will send the rf data
int sendPin = 10;
//defines how long to hold a rf burst
#define DELAYSHORT 160
#define DELAYLONG  500

static void ookPulse(int on, int off) {
  digitalWrite(sendPin, HIGH);
  digitalWrite(sendPin, LOW);
static void pt2262Send(uint14_t signature, uint10_t command) {
  byte i, k;
  // send 14 times
  for(k=0;k<14;k++) {
    // send signature first
    for(i=0;i<14;i++) {
      if((signature>>(13-i)) & 0x1) {
        ookPulse(DELAYLONG, DELAYSHORT);
      } else {
        ookPulse(DELAYSHORT, DELAYLONG);
    for(i=0;i<10;i++) {
      if((command>>(9-i)) & 0x1) {
        ookPulse(DELAYLONG, DELAYSHORT);
      } else {
        ookPulse(DELAYSHORT, DELAYLONG);
    // end with a '0'
    // short delay
void setup() {
pinMode(sendPin, OUTPUT); 
void loop() {
    while (Serial.available() > 0)
        char recieved =;
        inData += recieved;

        // Process message when K character is recieved
        if (recieved == 'K')
            Serial.print("Arduino Received: ");
if (inData == "TVINPUTK") { irsend.sendNEC(0x1CE3C837, 32); delay(100); }
if (inData == "TVPOWERK") { irsend.sendNEC(0x1CE348B7, 32); delay(100); }
if (inData == "TVINFOK") { irsend.sendNEC(0x1CE330CF, 32); delay(100); }
if (inData == "TVPIXSHAPEK") { irsend.sendNEC(0x1CE3EA15, 32); delay(100); }
if (inData == "TVAUDIOK") { irsend.sendNEC(0x1CE358A7, 32); delay(100); }
if (inData == "TVRESETK") { irsend.sendNEC(0x1CE338C7, 32); delay(100); }
if (inData == "TVCAPTIONK") { irsend.sendNEC(0x1CE38877, 32); delay(100); }
if (inData == "TVSLEEPK") { irsend.sendNEC(0x1CE3B04F, 32); delay(100); }
if (inData == "TVONEK") { irsend.sendNEC(0x1CE3807F, 32); delay(100); }
if (inData == "TVTWOK") { irsend.sendNEC(0x1CE340BF, 32); delay(100); }
if (inData == "TVTHREEK") { irsend.sendNEC(0x1CE3C03F, 32); delay(100); }
if (inData == "TVFOURK") { irsend.sendNEC(0x1CE320DF, 32); delay(100); }
if (inData == "TVFIVEK") { irsend.sendNEC(0x1CE3A05F, 32); delay(100); }
if (inData == "TVSIXK") { irsend.sendNEC(0x1CE3609F, 32); delay(100); }
if (inData == "TVSEVENK") { irsend.sendNEC(0x1CE3E01F, 32); delay(100); }
if (inData == "TVEIGHTK") { irsend.sendNEC(0x1CE310EF, 32); delay(100); }
if (inData == "TVNINEK") { irsend.sendNEC(0x1CE3906F, 32); delay(100); }
if (inData == "TVCHLUPK") { irsend.sendNEC(0x1CE350AF, 32); delay(100); }
if (inData == "TVCHLDWNK") { irsend.sendNEC(0x1CE3D02F, 32); delay(100); }
if (inData == "TVZEROK") { irsend.sendNEC(0x1CE300FF, 32); delay(100); }
if (inData == "TVVOLUPK") { irsend.sendNEC(0x1CE3708F, 32); delay(100); }
if (inData == "TVVOLDWNK") { irsend.sendNEC(0x1CE3F00F, 32); delay(100); }
if (inData == "TVRECALLK") { irsend.sendNEC(0x1CE39867, 32); delay(100); }
if (inData == "TVMUTEK") { irsend.sendNEC(0x1CE318E7, 32); delay(100); }
if (inData == "LIGHTONEK") { pt2262Send(0b00011101010101, 0b0000000011); delay(100); }
if (inData == "LIGHTTWOK") { pt2262Send(0b00011101010101, 0b0000001100); delay(100); }
if (inData == "LIGHTTHREEK") { pt2262Send(0b00011101010101, 0b0000110000); delay(100); }
if (inData == "LIGHTFOURK") { pt2262Send(0b00011101010101, 0b0011000000); delay(100); }  
if (inData == "LIGHTFIVEK") { pt2262Send(0b00011101010101, 0b1100000000); delay(100); }
if (inData == "LIGHTALLK") { pt2262Send(0b00011101010101, 0b1111111111); delay(100); }
if (inData == "LIGHTLRK") { pt2262Send(0b00011101010101, 0b0000001111); delay(100); }
if (inData == "LIGHTPANICK") { for (int i = 2; i < 50; i++) {
    pt2262Send(0b00011101010101, 0b0000000011); delay(500);
    pt2262Send(0b00011101010101, 0b0000000011); delay(100);
    pt2262Send(0b00011101010101, 0b0000001100); delay(500);
    pt2262Send(0b00011101010101, 0b0000001100); delay(100);
    pt2262Send(0b00011101010101, 0b0000110000); delay(500);
    pt2262Send(0b00011101010101, 0b0000110000); delay(100);
    pt2262Send(0b00011101010101, 0b0011000000); delay(500);
    pt2262Send(0b00011101010101, 0b0011000000); delay(100);} }

if (inData == "TVMEDIAK") { irsend.sendNEC(0x1CE300FF, 32); delay(500);
                            irsend.sendNEC(0x1CE340BF, 32); delay(500);
                            irsend.sendNEC(0x1CE3D02F, 32); delay(500);
                            irsend.sendNEC(0x1CE3D02F, 32); delay(500);

            // You can put some if and else here to process the message just like that:

            if(inData == "+++K"){ // DON'T forget to add "\n" at the end of the string.
              Serial.println("OK. Press h for help.");
inData = ""; // Clear received buffer

Step 6:

To test I opened the serial monitor and typed in one of the command words above (no newline) if the code uploaded correctly you should see “Arduino Received:” along with the word. If everything went really well an action should have happened in your physical world as well.

Step 7:

On success unplug the serial cable and power to connect the Bluetooth module
Connect the Bluetooth modules RX pin to the Arduino TX pin
Connect the Bluetooth modules TX pin to the Arduino RX pin
Connect the Bluetooth modules VCC pin to the Arduino 3V pin
Connect the Bluetooth modules GND pin to the Arduino GND pin
Plug Arduino back in and start sending bluetooth commands to the device via your phone or computer

Microcontroller Contest

Participated in the
Microcontroller Contest