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 Sender for stereo receiver

IR Sender for stereo receiver

Scheduled Pinned Locked Moved My Project
5 Posts 2 Posters 2.3k Views 3 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.
  • Dan S.D Offline
    Dan S.D Offline
    Dan S.
    Hero Member
    wrote on last edited by
    #1

    Re: [IR Switch for Luminara Candle Automation (repost with video](photos and final sketch))
    @blacey Wanted to thank you for your sketch outline for 2 IR devices. Used it as model to create my two IR devices. One to turn stereo on and off and the other to switch between two preset stations. Only difficulty was finding the discrete on and off codes for the receiver which the remote for the receiver does not have.
    Works great! Only problem I had with what you called your quick and dirty example was that the call to gw.begin did not include the incomingMessage argument. Easy fix. Overall the example was a great help.

    1 Reply Last reply
    1
    • Tore André RosanderT Offline
      Tore André RosanderT Offline
      Tore André Rosander
      wrote on last edited by
      #2

      Can you share the code?

      Dan S.D 1 Reply Last reply
      0
      • Tore André RosanderT Tore André Rosander

        Can you share the code?

        Dan S.D Offline
        Dan S.D Offline
        Dan S.
        Hero Member
        wrote on last edited by
        #3

        @Tore-André-Rosander Yes, Will be glad to. Will post it later this evening.

        1 Reply Last reply
        0
        • Dan S.D Offline
          Dan S.D Offline
          Dan S.
          Hero Member
          wrote on last edited by
          #4

          Here's the code you asked for. Turns receiver on and off and sends preset number for either of 2 stations that are on my FM HD tuner attached to the receiver. I put the hardware with the ir transmitter in the cabinet containing the receiver and tuner. Works great.

          /**
            *The code for discret on/off for my receiver could not be found in any of the online listings.
            *The code on line showed 46 and 47 for on and off respectively. Made an error in decoding from hex
            *that resulted in turning off the receiver. Thus I discovered that the on off codes for my receiver
            *are 93 and 94 respectively.
          */
            
          #include <MySensor.h>
          #include <SPI.h>
          #include <IRLib.h>
          
          #define NumChildDevices 2
          
          typedef struct IRCode {
            IRTYPES brand;
            unsigned long onIRcode;
            unsigned long offIRcode;
            unsigned int bits;
          } ir;
            
          ir childIR[NumChildDevices];
          IRsend iremitter;
          
          MySensor gw;
          MyMessage child1Msg(1, V_VAR1);
          MyMessage child2Msg(2, V_VAR2);
          
          void setup() {
            //specify node 7
            gw.begin(incomingMessage, 7);
            gw.sendSketchInfo("Radio IR", "0.1");
            
            // Initialize children devices  
            // 1. Sony Receiver: On power on, off power off
            gw.present(1, S_LIGHT);
            childIR[1] = {SONY, 0xBA0C, 0x7A0C, 15};
            
            // 2. HD Tuner: On select preset 4, off select preset 1
            gw.present(2, S_LIGHT);
            childIR[2] = {SONY, 0xC0BC8, 0xBC8, 20};
            
          }
          
          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].onIRcode : childIR[child].offIRcode, childIR[child].bits);
            //If sending to HD tuner, add "enter" code after preset code
            if (child == 2){
              //Don't send the enter command immediately after the number. Must wait a bit
              delay(500);
              iremitter.send (SONY,0xCBC8, 20);
            }
          }```
          1 Reply Last reply
          0
          • Dan S.D Offline
            Dan S.D Offline
            Dan S.
            Hero Member
            wrote on last edited by
            #5

            I should add that I use a vera scene to turn the receiver on and select a particular preset for the Hd FM tuner. I just select device off for the receiver in vera to turn everything off.

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


            18

            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