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. Announcements
  3. 💬 Infrared Sender and Receiver

💬 Infrared Sender and Receiver

Scheduled Pinned Locked Moved Announcements
45 Posts 26 Posters 15.0k Views 26 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.
  • Talat KeleşT Talat Keleş

    @Reza

    That node is simply IR to gateway (or vice versa) transfering medium. It doesn't learn just decodes or emits IR signals. This node is mostly dumb.

    To make it learn something like z-wave ir extender,

    Manually: Just manually decode and note down required codes then use them. Easy solution for known and used commands like on/off, vol +/-, numbers etc.

    • hard code it on node, however program space is tight. eeprom may be required.
    • hard code it on controller, easy for logic operations and automation needs.

    Automatic:

    • Write the code to learn and save it to eeprom. It requires some coding, at the end it might be a device like somehow z-wave ir extender. Howeer controller should know and send some kind of message to select right IR code. I didn't work on this solution yet.
    R Offline
    R Offline
    Reza
    wrote on last edited by
    #6

    @Talat-Keleş
    I am confused . i just want know if i want control my TV ( each switch for example on , off , vol + , vol - , number etc) with a domoticz and a IR sensor (mysensors) how i do it ?

    Talat KeleşT 1 Reply Last reply
    0
    • R Reza

      @Talat-Keleş
      I am confused . i just want know if i want control my TV ( each switch for example on , off , vol + , vol - , number etc) with a domoticz and a IR sensor (mysensors) how i do it ?

      Talat KeleşT Offline
      Talat KeleşT Offline
      Talat Keleş
      wrote on last edited by Talat Keleş
      #7

      @Reza

      Below is node sketch (v1.5.4) and openhab sitemap&items for simple control. More advanced control needs rules/scripts to make it more automation like.

      Set up the circuit, load below code or example code given and open serial monitor. Press buttons on IR remote and read hex values on serial. Note down values for buttons you need. (i.e. power off 0x184C, power on 0x104C, chanel up 0x1860 etc, RC5 protocol) If below sketch is uploaded to node, then adapt domoticz to send needed IR codes like i did in sitemaps part or use automation rules to send required commands to node to tv.

      Simple button based TV Control with OH

      Here is my node sketch:

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik EKblad
       * Version 1.1 - V_IR_SEND / _RECEIVE 16.08.2016 Any hex command received over NRF is send with IR led
       * Version 1.2 - Don't send repeting codes - 19.08.2016 T. Keles
       * Version 1.3 - Repeating code blocking correction - 01.09.2016 T.Keles
       * 
       * DESCRIPTION
       * This sketch decodes IR remote and send to gateway.
       * Rules can interpret this or simpleused to find out button codes.
       * Controller sends string code values as V_IR_Send and incoming message is emitted by IR led.
       * An IR LED must be connected to Arduino PWM pin 3.
       * An optional ir receiver can be connected to PWM pin 8. 
       * All receied ir signals will be sent to gateway device stored in V_IR_RECEIVE
       *  http://www.mysensors.org/build/ir
       */
      
      #include <MySensor.h>
      #include <SPI.h>
      #include <IRLib.h>
      
      int RECV_PIN = 8;
      
      #define CHILD_1  3  // childId
      
      IRsend irsend;
      IRrecv irrecv(RECV_PIN);
      IRdecode decoder;
      unsigned int Buffer[RAWBUF];
      unsigned long prevMillis=0;
      MySensor gw;
      MyMessage msg(CHILD_1, V_IR_RECEIVE); //send decoded ir code
      
      void setup()  
      {  
        irrecv.enableIRIn(); // Start the ir receiver
        decoder.UseExtnBuf(Buffer);
        gw.begin(incomingMessage,2);
      
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("IR Remote", "1.3");
      
        // Register a sensors to gw. Use binary light for test purposes.
        gw.present(CHILD_1, S_IR);
      }
      
      
      void loop() 
      {
        gw.process();
        if (irrecv.GetResults(&decoder)) {
          unsigned long curMillis=millis();
          irrecv.resume(); 
          decoder.decode();
          decoder.DumpResults(); // dumresults print values to serial monitor
          
          if(curMillis-prevMillis>900){ // if last IR received less than 900ms pass it, otherwise send it to GW
          							  //This value is experimental and added to bypass rapidly repeating codes 
            prevMillis=curMillis;
            if(!(decoder.value==0 || decoder.value==0xffffff)){ // if value is valid
              char buffer[10];
              sprintf(buffer, "%08lX", decoder.value); //format it to 8byte Uppercase Hex format
              gw.send(msg.set(buffer));  // Send ir result to gw
            }
            
          }
        }
      }
      
      void incomingMessage(const MyMessage &message) {
      char ircode[11] = {0};  // in case your code takes the form of 0xE0E0FF0F
      //incoming ir code is string, however IRSend need unsigned long Below codes do the work 
         if (message.type == V_IR_SEND) {
            String hexstring = message.getString();
            hexstring.toCharArray(ircode, sizeof(ircode));
            // get the code as an unsigned long
            unsigned long code = strtoul(ircode, NULL, 0);
            if(code==0 || code ==0xFFFFFFFF) {} //if code is not valid, do nothing        
            irsend.send(RC5,code,13); // blast incoming hex code to IR device 
          }
          // Start receiving ir again...
          irrecv.enableIRIn(); 
      }
      

      In openhab .items file:

      String TV_power "TV" <television> (gHomeMedia) {mysensors="2;3;V_IR_SEND"}
      String TV_channel "Channel" <television> (gHomeMedia) {mysensors="2;3;V_IR_SEND"}
      String TV_volume "Volume" <television> (gHomeMedia) {mysensors="2;3;V_IR_SEND"}
      String IR_Receive "IR Code [%s]" <television> (gHomeMedia) {mysensors="2;3;V_IR_RECEIVE"}
      

      In openhab sitemap:

      Frame label="TV Control" {
      	Switch item=TV_power label="TV Power" mappings=[0x184C=OFF, 0x104C=ON]
      	Switch item=TV_channel label="Channel" mappings=[0x1860=UP, 0x1061=DOWN] visibility=[TV_power==0x104C]
      	Switch item=TV_volume label="Volume" mappings=[0x1850="V+", 0x1051="V-"] visibility=[TV_power==0x104C]
      	Text item=IR_Receive
      
      R 1 Reply Last reply
      2
      • Talat KeleşT Talat Keleş

        @Reza

        Below is node sketch (v1.5.4) and openhab sitemap&items for simple control. More advanced control needs rules/scripts to make it more automation like.

        Set up the circuit, load below code or example code given and open serial monitor. Press buttons on IR remote and read hex values on serial. Note down values for buttons you need. (i.e. power off 0x184C, power on 0x104C, chanel up 0x1860 etc, RC5 protocol) If below sketch is uploaded to node, then adapt domoticz to send needed IR codes like i did in sitemaps part or use automation rules to send required commands to node to tv.

        Simple button based TV Control with OH

        Here is my node sketch:

        /**
         * The MySensors Arduino library handles the wireless radio link and protocol
         * between your home built sensors/actuators and HA controller of choice.
         * The sensors forms a self healing radio network with optional repeaters. Each
         * repeater and gateway builds a routing tables in EEPROM which keeps track of the
         * network topology allowing messages to be routed to nodes.
         *
         * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
         * Copyright (C) 2013-2015 Sensnology AB
         * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
         *
         * Documentation: http://www.mysensors.org
         * Support Forum: http://forum.mysensors.org
         *
         * This program is free software; you can redistribute it and/or
         * modify it under the terms of the GNU General Public License
         * version 2 as published by the Free Software Foundation.
         *
         *******************************
         *
         * REVISION HISTORY
         * Version 1.0 - Henrik EKblad
         * Version 1.1 - V_IR_SEND / _RECEIVE 16.08.2016 Any hex command received over NRF is send with IR led
         * Version 1.2 - Don't send repeting codes - 19.08.2016 T. Keles
         * Version 1.3 - Repeating code blocking correction - 01.09.2016 T.Keles
         * 
         * DESCRIPTION
         * This sketch decodes IR remote and send to gateway.
         * Rules can interpret this or simpleused to find out button codes.
         * Controller sends string code values as V_IR_Send and incoming message is emitted by IR led.
         * An IR LED must be connected to Arduino PWM pin 3.
         * An optional ir receiver can be connected to PWM pin 8. 
         * All receied ir signals will be sent to gateway device stored in V_IR_RECEIVE
         *  http://www.mysensors.org/build/ir
         */
        
        #include <MySensor.h>
        #include <SPI.h>
        #include <IRLib.h>
        
        int RECV_PIN = 8;
        
        #define CHILD_1  3  // childId
        
        IRsend irsend;
        IRrecv irrecv(RECV_PIN);
        IRdecode decoder;
        unsigned int Buffer[RAWBUF];
        unsigned long prevMillis=0;
        MySensor gw;
        MyMessage msg(CHILD_1, V_IR_RECEIVE); //send decoded ir code
        
        void setup()  
        {  
          irrecv.enableIRIn(); // Start the ir receiver
          decoder.UseExtnBuf(Buffer);
          gw.begin(incomingMessage,2);
        
          // Send the sketch version information to the gateway and Controller
          gw.sendSketchInfo("IR Remote", "1.3");
        
          // Register a sensors to gw. Use binary light for test purposes.
          gw.present(CHILD_1, S_IR);
        }
        
        
        void loop() 
        {
          gw.process();
          if (irrecv.GetResults(&decoder)) {
            unsigned long curMillis=millis();
            irrecv.resume(); 
            decoder.decode();
            decoder.DumpResults(); // dumresults print values to serial monitor
            
            if(curMillis-prevMillis>900){ // if last IR received less than 900ms pass it, otherwise send it to GW
            							  //This value is experimental and added to bypass rapidly repeating codes 
              prevMillis=curMillis;
              if(!(decoder.value==0 || decoder.value==0xffffff)){ // if value is valid
                char buffer[10];
                sprintf(buffer, "%08lX", decoder.value); //format it to 8byte Uppercase Hex format
                gw.send(msg.set(buffer));  // Send ir result to gw
              }
              
            }
          }
        }
        
        void incomingMessage(const MyMessage &message) {
        char ircode[11] = {0};  // in case your code takes the form of 0xE0E0FF0F
        //incoming ir code is string, however IRSend need unsigned long Below codes do the work 
           if (message.type == V_IR_SEND) {
              String hexstring = message.getString();
              hexstring.toCharArray(ircode, sizeof(ircode));
              // get the code as an unsigned long
              unsigned long code = strtoul(ircode, NULL, 0);
              if(code==0 || code ==0xFFFFFFFF) {} //if code is not valid, do nothing        
              irsend.send(RC5,code,13); // blast incoming hex code to IR device 
            }
            // Start receiving ir again...
            irrecv.enableIRIn(); 
        }
        

        In openhab .items file:

        String TV_power "TV" <television> (gHomeMedia) {mysensors="2;3;V_IR_SEND"}
        String TV_channel "Channel" <television> (gHomeMedia) {mysensors="2;3;V_IR_SEND"}
        String TV_volume "Volume" <television> (gHomeMedia) {mysensors="2;3;V_IR_SEND"}
        String IR_Receive "IR Code [%s]" <television> (gHomeMedia) {mysensors="2;3;V_IR_RECEIVE"}
        

        In openhab sitemap:

        Frame label="TV Control" {
        	Switch item=TV_power label="TV Power" mappings=[0x184C=OFF, 0x104C=ON]
        	Switch item=TV_channel label="Channel" mappings=[0x1860=UP, 0x1061=DOWN] visibility=[TV_power==0x104C]
        	Switch item=TV_volume label="Volume" mappings=[0x1850="V+", 0x1051="V-"] visibility=[TV_power==0x104C]
        	Text item=IR_Receive
        
        R Offline
        R Offline
        Reza
        wrote on last edited by
        #8

        @Talat-Keleş
        thank you my friend

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Reza
          wrote on last edited by Reza
          #9
          This post is deleted!
          1 Reply Last reply
          0
          • TON RIJNAARDT Offline
            TON RIJNAARDT Offline
            TON RIJNAARD
            wrote on last edited by
            #10

            is it possible to use with domoticz?

            1 Reply Last reply
            0
            • R Offline
              R Offline
              Reza
              wrote on last edited by
              #11

              this module ( ir transmitter ) is weak in transmit . for more than 2 or 3 meter distance dont work . also for less than 1 meter we must direct connection exactly.
              i think this is related to power or noise or problem of module ?!
              can you guidance me ?

              C 1 Reply Last reply
              0
              • R Offline
                R Offline
                Reza
                wrote on last edited by
                #12

                domoticz doesn't support this ?! i test this and i see domoticz wont detect this node

                zhangzcZ 1 Reply Last reply
                0
                • R Reza

                  domoticz doesn't support this ?! i test this and i see domoticz wont detect this node

                  zhangzcZ Offline
                  zhangzcZ Offline
                  zhangzc
                  wrote on last edited by
                  #13

                  Hi @Reza ,
                  Did you solve this problem?

                  R 1 Reply Last reply
                  0
                  • zhangzcZ zhangzc

                    Hi @Reza ,
                    Did you solve this problem?

                    R Offline
                    R Offline
                    Reza
                    wrote on last edited by
                    #14

                    @zhangzc

                    hi , no . i can not use this device with domoticz

                    1 Reply Last reply
                    0
                    • R Reza

                      this module ( ir transmitter ) is weak in transmit . for more than 2 or 3 meter distance dont work . also for less than 1 meter we must direct connection exactly.
                      i think this is related to power or noise or problem of module ?!
                      can you guidance me ?

                      C Offline
                      C Offline
                      chuckconnors
                      wrote on last edited by
                      #15

                      @Reza said:

                      this module ( ir transmitter ) is weak in transmit . for more than 2 or 3 meter distance dont work . also for less than 1 meter we must direct connection exactly.
                      i think this is related to power or noise or problem of module ?!
                      can you guidance me ?

                      I'm thinking of building this but am concerned about limited range. I'd like it to work 10ft/3m. Can someone confirm that this does not work at these distances? If so, is there a way to increase the range?

                      1 Reply Last reply
                      0
                      • W Offline
                        W Offline
                        Wackid
                        wrote on last edited by
                        #16

                        So how can is set this node in learnmode?? V_IR_RECORD in the Serial of Arduino?
                        How do i store codes in the Eprom. SO i can use them in Domoticz

                        W 1 Reply Last reply
                        0
                        • W Wackid

                          So how can is set this node in learnmode?? V_IR_RECORD in the Serial of Arduino?
                          How do i store codes in the Eprom. SO i can use them in Domoticz

                          W Offline
                          W Offline
                          Wackid
                          wrote on last edited by
                          #17

                          @Wackid

                          I know how to read out the IR signals. And to put it in the sketch manually. But I really like to make use of the record function.
                          Where and how do I make the node to set it in learn function.

                          1 Reply Last reply
                          0
                          • tianaT Offline
                            tianaT Offline
                            tiana
                            wrote on last edited by
                            #18

                            I send command from remote control arduino read this command (i can see this in serial monitor) but this commands are not sending to gateway, my radio is working the sensor connect to gateway and controller. I use example Sketch given up in this page without changing anything.
                            Any idea whats wrong in my setup?

                            1 Reply Last reply
                            0
                            • W Offline
                              W Offline
                              Wackid
                              wrote on last edited by
                              #19
                              This post is deleted!
                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                Mihai
                                wrote on last edited by
                                #20

                                I use this IR transmitter toward my LG Tv and it works at a distance of ~3.5 m, but IR LED must be well pointed to the Tv, otherwise it doesn't work.

                                1 Reply Last reply
                                0
                                • Talat KeleşT Talat Keleş

                                  @Reza said:

                                  is this a learning mode module ?
                                  how use this module for learn my ir codes ?

                                  This node decodes IR remote codes, print protocol and hex value to serial monitor and send it to gateway. Then controller can do logic on that to do some stuff.
                                  The sample code also receive on/off command from controller and emits IR signal depending on it.

                                  I use this node to turn on/off sony sound system (15bit sony protocol) and benq projector (NEC protocol) together beside htpc(via wol). Openhab rule send 8byte IR codes as V_IR_Send to node and node emits the required IR codes.

                                  ramoncarranzaR Offline
                                  ramoncarranzaR Offline
                                  ramoncarranza
                                  wrote on last edited by
                                  #21

                                  @Talat-Keleş
                                  Hi, I am having an issue compiling the sketch and was wondering if you had any input or could help me out, This is what I get back when I try to compile;
                                  0_1483733093476_upload-fba9c55f-1a02-4b17-b7ff-bc75aadb47d1

                                  Talat KeleşT P 2 Replies Last reply
                                  0
                                  • ramoncarranzaR ramoncarranza

                                    @Talat-Keleş
                                    Hi, I am having an issue compiling the sketch and was wondering if you had any input or could help me out, This is what I get back when I try to compile;
                                    0_1483733093476_upload-fba9c55f-1a02-4b17-b7ff-bc75aadb47d1

                                    Talat KeleşT Offline
                                    Talat KeleşT Offline
                                    Talat Keleş
                                    wrote on last edited by Talat Keleş
                                    #22

                                    @ramoncarranza
                                    Compiler complains about not understanding decode_type_t. It should be defined in .h file or maybe you defined it in sketch but there is a problem definetly.
                                    Can you post whole sketch and IR library and error message if any other so we can check and test.

                                    By the way, I installed IRremote.h (v2.1.0) via library manager, and default sketch compiled without error on IDE 1.6.5 win7 and IDE 1.6.10 linux mint 17.

                                    1 Reply Last reply
                                    0
                                    • tmn103T Offline
                                      tmn103T Offline
                                      tmn103
                                      wrote on last edited by
                                      #23

                                      Re: 💬 Infrared Sender and Receiver

                                      How do you enter the raw IR codes, i.e. those that aren't covered in the sketch? I have one through the receiver in the format - 23784 1800 -800 950 -1700 1800 -850 900 -850 950 -1700 1800 -850 900 -850 900 -850 950 -800 950 -850 900

                                      1 Reply Last reply
                                      0
                                      • ramoncarranzaR ramoncarranza

                                        @Talat-Keleş
                                        Hi, I am having an issue compiling the sketch and was wondering if you had any input or could help me out, This is what I get back when I try to compile;
                                        0_1483733093476_upload-fba9c55f-1a02-4b17-b7ff-bc75aadb47d1

                                        P Offline
                                        P Offline
                                        pete1450
                                        wrote on last edited by
                                        #24

                                        @ramoncarranza When I went and looked where the library manager installed the IRremote lib(for me C:\Users\User\Documents\Arduino\libraries), it had given it an odd name like arduino_294267. I renamed it to IRremote and the issue went away.

                                        1 Reply Last reply
                                        0
                                        • H Offline
                                          H Offline
                                          hashem25
                                          wrote on last edited by
                                          #25

                                          I am confused i see the decode in my com monitor and i see the ir node in my domoticz but there is no data???

                                          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.0k

                                          Posts


                                          Copyright 2019 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