Michael Baycura
Created July 15, 2016

GE C-Life IR and IR+, Concept

What if all you had to do to connect your old “dumb” devices to your new “smart” ones, and control them all, was to change a light bulb?

637
GE C-Life IR and IR+, Concept

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
LED (generic)
LED (generic)
×4
940nm Infrared LED Generic
×1
Vishay TSOP4838 IR receiver
×1
LED load resistors (various 50-330 ohms)
×5
5v Power Supply generic
×1
Proto-Board from Global Specialties
×1

Software apps and online services

Bluetooth Serial Terminal, Windows 10 PC app
Arduino IDE
Arduino IDE

Story

Read more

Code

Arduino Sketch to operate demo

Arduino
/*
Arduino Sketch to turn on and off individual RGBW LEDs
as well as send and recieve IR singals. This example is for a Panasonic DVD Player.
Created by Michael Baycura
July 10th, 2016

The Arduino IR library used was created by Ken Shirriff.
http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html

the Bluetooth serial code learned from Hammad Tariq's sketch
http://www.instructables.com/id/Remotely-Control-LED-using-HC-05-Bluetooth-Arduino/
*/

#include <IRremote.h>

IRsend irsend;

int RECV_PIN = 11;
int val = 0;
IRrecv irrecv(RECV_PIN);
decode_results results;

char junk;
String inputString="";


void setup()
{
 Serial.begin(9600);
 pinMode(13, OUTPUT);
 pinMode(8, OUTPUT);
 pinMode(9, OUTPUT);
 pinMode(3, OUTPUT);  // IR LED needs to be on pin 3
 pinMode(4, OUTPUT);
 irrecv.enableIRIn(); // enable IR receiver
}

void loop()
{
  if(Serial.available()){
  while(Serial.available())
    {
      char inChar = (char)Serial.read(); //read the input
      inputString += inChar;             //make a string of the characters coming on serial
    }
    Serial.println(inputString);
    while (Serial.available() > 0)  
    { junk = Serial.read() ; }      // clear the serial buffer

     if(inputString == "rn")      //Turn on RED led
        {        
          digitalWrite(13, HIGH);
          inputString = "";  
        }
     if(inputString == "rf")    //Turn off RED led
        {   
          digitalWrite(13, LOW);
          inputString = "";      
        }
     if(inputString == "gn")    //Turn on Green LED
        {   
          digitalWrite(8, HIGH);
          inputString = "";  
        }
     if(inputString == "gf")    //Turn off Green LED
        {  
          digitalWrite(8, LOW);
          inputString = "";      
        }
     if(inputString == "bn")    //Turn on Blue LED
        {       
          digitalWrite(9, HIGH);
          inputString = "";  
        }
     if(inputString == "bf")    //Turn off Blue LED
        {   
          digitalWrite(9, LOW);
          inputString = "";      
        }
     if(inputString == "wn")    //Turn on White LED
        {    
          digitalWrite(4, HIGH);
          inputString = "";  
        }
     if(inputString == "wf")    //Turn off White LED
        {  
          digitalWrite(4, LOW);
          inputString = "";      
        }
     if(inputString == "an")    //turn on All LEDs
        {     
          digitalWrite(4, HIGH);
          digitalWrite(8, HIGH);
          digitalWrite(9, HIGH);
          digitalWrite(13, HIGH);
          inputString = "";  
        }
     if(inputString == "af")    //turn off All LEDs
        {   
          digitalWrite(4, LOW);
          digitalWrite(8, LOW);
          digitalWrite(9, LOW);
          digitalWrite(13, LOW);
          inputString = "";      
        }
     if(inputString == "ir")    //Send Power ON-Off command for Panasonic DVD player
        {       
          for (int i = 0; i < 3; i++) {
              irsend.sendPanasonic(0x4004, 0xd00bcb1);  //0xd00bcb1 is the power on-off command
            delay(40);
          }
          irrecv.enableIRIn();
          inputString = "";  
        }
     if(inputString == "on")    //Macro to turn on all lights and DVD player
        {       //turn everything on macro
          digitalWrite(13,HIGH);
          digitalWrite(8,HIGH);
          digitalWrite(9, HIGH);
          digitalWrite(4, HIGH);
          delay(2000);
          for (int i = 0; i < 3; i++) {
              irsend.sendPanasonic(0x4004, 0xd00bcb1);
            delay(40);
          }
//          Serial.println("On macro");
          irrecv.enableIRIn();
          inputString = ""; 
    { junk = Serial.read() ; }  
        }
      if(inputString.length()>2)
      {
        inputString = "";
      }
    }
// This section will execute if the IR receiver senses the Panasonic Power on-off signal
// from the hand held remote control. White light will blink twice, wait 5sec then all LEDs will turn off
     if (irrecv.decode(&results))
      {
        val = results.value;
        Serial.println(val);
        Serial.println("outside");
        if (val== -17231)
        {
          digitalWrite(4, LOW);
          delay(100);
          digitalWrite(4, HIGH);
          delay(100);
          digitalWrite(4, LOW); 
          delay(100);
          digitalWrite(4, HIGH);
          delay(100);          
          digitalWrite(4, LOW); 
          delay(100);
          digitalWrite(4, HIGH);
          delay(5000);  
          digitalWrite(13,LOW);
          digitalWrite(8,LOW);
          digitalWrite(9, LOW);
          digitalWrite(4, LOW);
        }
        irrecv.resume(); // Receive the next value
      }  
}

Credits

Michael Baycura

Michael Baycura

1 project • 1 follower
Engineer, learner, and general problem solver interested in creating solutions that enable individuals, and maximize self-determination.
Thanks to Ken Shirriff and Hammad Tariq.

Comments