Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. IR Switch for Luminara Candle Automation (repost with video, photos and final sketch)

IR Switch for Luminara Candle Automation (repost with video, photos and final sketch)

Scheduled Pinned Locked Moved My Project
ir blasterir code
29 Posts 9 Posters 20.6k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • blaceyB Offline
    blaceyB Offline
    blacey
    Admin
    wrote on last edited by
    #6

    They use two C-size batteries so they last a very long time. With them on the automation system, I expect them to last at least a year because my wife won't leave them running 24/7 anymore ;) In fact, they may last even longer because the candles will be on less per day as we approach summer because the trigger is tied to sunset... My wife has had the candles just under six months without automation and is still on her first set of batteries.

    1 Reply Last reply
    0
    • petewillP Offline
      petewillP Offline
      petewill
      Admin
      wrote on last edited by
      #7

      @blacey awesome, thanks!

      My "How To" home automation video channel: https://www.youtube.com/channel/UCq_Evyh5PQALx4m4CQuxqkA

      1 Reply Last reply
      0
      • korttomaK Offline
        korttomaK Offline
        korttoma
        Hero Member
        wrote on last edited by
        #8

        anyone know if you can buy these in europe?

        • Tomas
        B 1 Reply Last reply
        0
        • korttomaK korttoma

          anyone know if you can buy these in europe?

          B Offline
          B Offline
          betonishard
          wrote on last edited by betonishard
          #9

          @korttoma just bought these yesterday on ebay:

          http://www.ebay.com/itm/Remote-Control-Electronic-LED-Candle-Romantic-Gift-3pcs-LED-Wax-Candles-DX-/251766554387?pt=LH_DefaultDomain_0&hash=item3a9e74bf13

          I have no idea if this is something useful

          Worth a try for 8 dollar?

          1 Reply Last reply
          0
          • korttomaK Offline
            korttomaK Offline
            korttoma
            Hero Member
            wrote on last edited by
            #10

            I just received a couple of these:

            http://www.ebay.com/itm/301578035483?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

            Looks like they are the same candles as Luminara but cheaper, time to build the IR Blaster and find out if I can use the sketch @blacey provided straight of.

            • Tomas
            1 Reply Last reply
            0
            • korttomaK Offline
              korttomaK Offline
              korttoma
              Hero Member
              wrote on last edited by
              #11

              @blacey would you mind sharing how you connected the IR-Transmitters to the arduino? Is this what the Transistor is for?

              • Tomas
              blaceyB 1 Reply Last reply
              0
              • korttomaK korttoma

                @blacey would you mind sharing how you connected the IR-Transmitters to the arduino? Is this what the Transistor is for?

                blaceyB Offline
                blaceyB Offline
                blacey
                Admin
                wrote on last edited by blacey
                #12

                @korttoma, yes the transistor is used to drive the IR LEDs. It is a standard NPN transistor (NTE123AP) capable of delivering 600mA of current through the collector.

                The transistor base lead is connected to the Arduino PWM pin 3 per IRLib, the transistor emitter lead is connected to GND and the transistor collector lead is connected to the IR LED emitters wired in parallel (cathode). It is best practice to place a forward current limiting resistor between IR LEDs anode and VCC but the IRLib drives the LEDs for such short intervals, that you can avoid adding the forward current limiting resistors as I mentioned in the video.

                1 Reply Last reply
                0
                • korttomaK Offline
                  korttomaK Offline
                  korttoma
                  Hero Member
                  wrote on last edited by
                  #13

                  Thanks @blacey for the clarification. I sort of overlooked the fact that there was a video, sorry. My consirns was about the current limiting resistor but if you say the IR LEDs can take it I believe you. Thanks again for this project ;)

                  • Tomas
                  1 Reply Last reply
                  0
                  • blaceyB Offline
                    blaceyB Offline
                    blacey
                    Admin
                    wrote on last edited by
                    #14

                    @korttoma - sorry you missed the video ;) I have it on my to-do list to draw a proper schematic for the IR blaster board and the actuator but I just haven't had time yet. I would like to post one in this thread to make it easier for people to build their own IR actuator. Maybe you will get there first ;)

                    jeylitesJ 1 Reply Last reply
                    0
                    • blaceyB blacey

                      @korttoma - sorry you missed the video ;) I have it on my to-do list to draw a proper schematic for the IR blaster board and the actuator but I just haven't had time yet. I would like to post one in this thread to make it easier for people to build their own IR actuator. Maybe you will get there first ;)

                      jeylitesJ Offline
                      jeylitesJ Offline
                      jeylites
                      wrote on last edited by
                      #15

                      @blacey what program are you using to capture the IR codes from the remote ?

                      blaceyB 1 Reply Last reply
                      0
                      • jeylitesJ jeylites

                        @blacey what program are you using to capture the IR codes from the remote ?

                        blaceyB Offline
                        blaceyB Offline
                        blacey
                        Admin
                        wrote on last edited by
                        #16

                        @jeylites I used the IRSensor sketch in the MySensors examples.

                        jeylitesJ 1 Reply Last reply
                        0
                        • blaceyB blacey

                          @jeylites I used the IRSensor sketch in the MySensors examples.

                          jeylitesJ Offline
                          jeylitesJ Offline
                          jeylites
                          wrote on last edited by
                          #17

                          @blacey Nice. I'm using IR Recorder from the library. I asked because you had a fancy setup in the video :) Very neat setup!

                          1 Reply Last reply
                          0
                          • jeylitesJ Offline
                            jeylitesJ Offline
                            jeylites
                            wrote on last edited by jeylites
                            #18

                            Hello @blacey , I got a question... If I'm going to add another IR into the sketch, how do I go about doing this? So two independent sensors into one. This is what I have done so far. Correct me if I'm wrong. Should I be changing something in IRsend irsend ....?

                            And is your IR LED connected to Pin 1 or Pin3?

                            /***
                             * Binary IR Switch sketch that controls Luminara Candles
                             *
                             * Sketch inspired by, and a derivative work of, Hek's IR Sensor example sketch
                             */
                            
                            #include <MySensor.h>
                            #include <SPI.h>
                            #include <IRLib.h>
                            
                            int RECV_PIN =  8;
                            #define CHILD1  3 // Arduino Pin 3
                            #define CHILD2  4 // Arduino Pin 4
                            
                            
                            MySensor gw;
                            MyMessage switchMsg1(CHILD1, V_VAR1);
                            MyMessage switchMsg2(CHILD2, V_VAR1);
                            
                            // IR LED must be connexted to Arduino PWM pin 3
                            IRsend irsend;                    
                            #define switchOnIRcode  0x00ff629d  // Luminara On  IR code
                            #define switchOffIRcode 0x00ffa857  // Luminara Off IR code
                            
                            void setup()  
                            {  
                              gw.begin(incomingMessage);
                            
                              // Send the sketch version information to the gateway and Controller
                              gw.sendSketchInfo("IR Switch", "1.0");
                            
                              // Register a sensors to gw. Use binary light for test purposes.
                              gw.present(CHILD1, S_LIGHT);
                              gw.present(CHILD2, S_LIGHT);
                              
                              // Sync switch state to gateway state upon reset / power-up
                              gw.request(CHILD1, V_LIGHT);
                              gw.request(CHILD2, V_LIGHT);
                            }
                            
                            void loop() 
                            {
                              gw.process();
                            }
                            
                            void incomingMessage(const MyMessage &message) {
                              
                              // We only expect one type of message from controller. But we better check anyway.
                              if (message.type==V_LIGHT) {
                                 int incomingRelayStatus = message.getInt();
                                 
                                 // Emit the IR ON/OFF code
                                 irsend.send(NEC, (incomingRelayStatus == 1 ? switchOnIRcode : switchOffIRcode), 32);
                                 
                                 // Sync gateway of the light switch state
                                 gw.send(switchMsg1.set(incomingRelayStatus));
                                 gw.send(switchMsg2.set(incomingRelayStatus));
                              }
                            }
                            
                            
                            blaceyB 1 Reply Last reply
                            0
                            • jeylitesJ jeylites

                              Hello @blacey , I got a question... If I'm going to add another IR into the sketch, how do I go about doing this? So two independent sensors into one. This is what I have done so far. Correct me if I'm wrong. Should I be changing something in IRsend irsend ....?

                              And is your IR LED connected to Pin 1 or Pin3?

                              /***
                               * Binary IR Switch sketch that controls Luminara Candles
                               *
                               * Sketch inspired by, and a derivative work of, Hek's IR Sensor example sketch
                               */
                              
                              #include <MySensor.h>
                              #include <SPI.h>
                              #include <IRLib.h>
                              
                              int RECV_PIN =  8;
                              #define CHILD1  3 // Arduino Pin 3
                              #define CHILD2  4 // Arduino Pin 4
                              
                              
                              MySensor gw;
                              MyMessage switchMsg1(CHILD1, V_VAR1);
                              MyMessage switchMsg2(CHILD2, V_VAR1);
                              
                              // IR LED must be connexted to Arduino PWM pin 3
                              IRsend irsend;                    
                              #define switchOnIRcode  0x00ff629d  // Luminara On  IR code
                              #define switchOffIRcode 0x00ffa857  // Luminara Off IR code
                              
                              void setup()  
                              {  
                                gw.begin(incomingMessage);
                              
                                // Send the sketch version information to the gateway and Controller
                                gw.sendSketchInfo("IR Switch", "1.0");
                              
                                // Register a sensors to gw. Use binary light for test purposes.
                                gw.present(CHILD1, S_LIGHT);
                                gw.present(CHILD2, S_LIGHT);
                                
                                // Sync switch state to gateway state upon reset / power-up
                                gw.request(CHILD1, V_LIGHT);
                                gw.request(CHILD2, V_LIGHT);
                              }
                              
                              void loop() 
                              {
                                gw.process();
                              }
                              
                              void incomingMessage(const MyMessage &message) {
                                
                                // We only expect one type of message from controller. But we better check anyway.
                                if (message.type==V_LIGHT) {
                                   int incomingRelayStatus = message.getInt();
                                   
                                   // Emit the IR ON/OFF code
                                   irsend.send(NEC, (incomingRelayStatus == 1 ? switchOnIRcode : switchOffIRcode), 32);
                                   
                                   // Sync gateway of the light switch state
                                   gw.send(switchMsg1.set(incomingRelayStatus));
                                   gw.send(switchMsg2.set(incomingRelayStatus));
                                }
                              }
                              
                              
                              blaceyB Offline
                              blaceyB Offline
                              blacey
                              Admin
                              wrote on last edited by
                              #19

                              @jeylites My IR LEDs are connected to Pin 3 because that is what IR Lib requires. Your sketch looks close but you will need to define separate switchOnIRcode and switchOffIRcode codes for your respective lights. Then in the incomingMessage loop, send the appropriate code based upon the child ID. If you plan to have a large number of child IDs, I would create an array indexed by child ID to hold the on/off IR codes and then simply invoke ir.send() passing the onOffCode[childID] to it. Does that make sense?

                              Also, I just started another thread for an official IR Blaster board that you might want to review. I plan to provide multiple device support out of the box...

                              1 Reply Last reply
                              0
                              • jeylitesJ Offline
                                jeylitesJ Offline
                                jeylites
                                wrote on last edited by
                                #20

                                @blacey I think I get what you're saying on #define but don't know how to associate child id with ir code. Do you have a sample or something ?

                                IR blaster - you working on looks great. Next project is to use that to control my AV system.

                                Thank you!

                                blaceyB 1 Reply Last reply
                                0
                                • jeylitesJ jeylites

                                  @blacey I think I get what you're saying on #define but don't know how to associate child id with ir code. Do you have a sample or something ?

                                  IR blaster - you working on looks great. Next project is to use that to control my AV system.

                                  Thank you!

                                  blaceyB Offline
                                  blaceyB Offline
                                  blacey
                                  Admin
                                  wrote on last edited by
                                  #21

                                  @jeylites Here is a quick and dirty example for two switch IR devices... Hope this helps you get started. I will give multi-device more thoughts/elegance for the final IR Blaster.

                                  #include <MySensor.h>
                                  #include <SPI.h>
                                  #include <IRLib.h>
                                  
                                  #define NumChildDevices 2
                                  
                                  typedef struct IRCode {
                                    IRTYPES brand;
                                    unsigned long on;
                                    unsigned long off;
                                    unsigned int bits;
                                  } ir;
                                    
                                  ir childIR[NumChildDevices];
                                  IRsend iremitter;
                                  
                                  MySensor gw;
                                  MyMessage child1Msg(1, V_VAR1);
                                  MyMessage child2Msg(2, V_VAR2);
                                  
                                  void setup() {
                                    
                                    gw.begin();
                                    gw.sendSketchInfo("Multi IR", "0.1");
                                    
                                    // Initialize children devices  
                                    // 1. Candles (Switch)
                                    gw.present(1, S_LIGHT);
                                    childIR[1] = {NEC, 0x00ff629d, 0x00ffa857, 32};
                                    
                                    // 2. TV
                                    gw.present(2, S_LIGHT);
                                    childIR[2] = {SONY, 0x0062ff8d, 0x00aff578, 32};
                                    
                                  }
                                  
                                  void loop() {
                                    gw.process();
                                  }
                                  
                                  void incomingMessage(const MyMessage &message) {
                                    
                                    //Determine the child device
                                    uint8_t child = message.sensor;
                                    
                                    //Get the relay status for the child device
                                    int incomingRelayStatus = message.getInt();
                                    
                                    //Emit the appropriate IR code to the child device
                                    iremitter.send( childIR[child].brand, incomingRelayStatus == 1 ? childIR[child].on : childIR[child].off, childIR[child].bits);
                                  }
                                  
                                  1 Reply Last reply
                                  0
                                  • jeylitesJ Offline
                                    jeylitesJ Offline
                                    jeylites
                                    wrote on last edited by
                                    #22

                                    @blacey Thank you sir! Will test it out over the weekend.

                                    1 Reply Last reply
                                    0
                                    • korttomaK Offline
                                      korttomaK Offline
                                      korttoma
                                      Hero Member
                                      wrote on last edited by
                                      #23

                                      I just wanted to confirm that the cheep ebay Luminara "style" candles does work with blaceys sketch "out of the box".

                                      • Tomas
                                      1 Reply Last reply
                                      0
                                      • tbowmoT Offline
                                        tbowmoT Offline
                                        tbowmo
                                        Admin
                                        wrote on last edited by
                                        #24

                                        @korttoma

                                        do you have a link to some of the cheap ones on ebay?

                                        hekH 1 Reply Last reply
                                        0
                                        • tbowmoT tbowmo

                                          @korttoma

                                          do you have a link to some of the cheap ones on ebay?

                                          hekH Offline
                                          hekH Offline
                                          hek
                                          Admin
                                          wrote on last edited by hek
                                          #25

                                          @tbowmo

                                          Scroll up half a page ;)

                                          Edit: Opps.. sold out..

                                          Here is another one:
                                          http://www.ebay.com/itm/Luminara-Style-7-inch-LED-Ivory-Wax-Flameless-Pillar-Candle-with-Remote-control-/301644690382?pt=LH_DefaultDomain_3&hash=item463b6cb3ce

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          10

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular