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. General Discussion
  3. IR remote controle

IR remote controle

Scheduled Pinned Locked Moved General Discussion
5 Posts 3 Posters 1.4k 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.
  • DickD Offline
    DickD Offline
    Dick
    wrote on last edited by
    #1

    I found a nice project using an IR remote controle, it is designed for Arduino but I have no idea how to convert the code to MySensors. Who can help? ```

    /*Code belongs to this video https://www.youtube.com/watch?v=wqZwQnh6ZtQ
    writen by Moz for YouTube changel logmaker360.
    13-04-2016

    code works on a car mp3 remote controller
    */

    #include <IRremote.h>
    int RECV_PIN = 6;
    int BLUE_LED = 13;
    int RED_LED = 12;

    IRrecv irrecv(RECV_PIN);
    decode_results results;

    void setup() {
    // initialize the digital pin as an output.
    pinMode(RECV_PIN, INPUT);
    pinMode(BLUE_LED, OUTPUT);
    pinMode(RED_LED, OUTPUT);
    irrecv.enableIRIn(); // Start the receiver
    Serial.begin(9600);
    }
    void loop() {
    int i=0;
    if (irrecv.decode(&results)) {

    translateIR();
    unknownRemoter();

     irrecv.resume(); // Receive the next value
    

    }
    }

    void translateIR() // takes action based on IR code received describing Car MP3 IR codes
    {

    switch(results.value){
    case 0xFFA25D:
    Serial.println(" CH- ");
    break;
    case 0xFF629D:
    Serial.println(" CH ");
    break;
    case 0xFFE21D:
    Serial.println(" CH+ ");
    break;
    case 0xFF22DD:
    Serial.println(" blue LED off ");
    digitalWrite(13,LOW);
    break;
    case 0xFF02FD:
    Serial.println(" blue LED on ");
    digitalWrite(13, HIGH);
    break;
    case 0xFFC23D:
    Serial.println(" PLAY/PAUSE ");
    break;
    case 0xFFE01F:
    Serial.println(" VOL- ");
    break;
    case 0xFFA857:
    Serial.println(" VOL+ ");
    break;
    case 0xFF906F:
    Serial.println(" EQ ");
    break;
    case 0xFF6897:
    Serial.println(" 0 ");
    break;
    case 0xFF9867:
    Serial.println(" 100+ ");
    break;
    case 0xFFB04F:
    Serial.println(" 200+ ");
    break;
    case 0xFF30CF:
    Serial.println(" 1 ");
    break;

    case 0xFF18E7:
    Serial.println(" 2 ");
    break;

    case 0xFF7A85:
    Serial.println(" 3 ");
    break;

    case 0xFF10EF:
    Serial.println(" 4 ");
    break;

    case 0xFF38C7:
    Serial.println(" 5 ");
    break;

    case 0xFF5AA5:
    Serial.println(" 6 ");
    break;

    case 0xFF42BD:
    Serial.println(" 7 ");
    break;

    case 0xFF4AB5:
    Serial.println(" 8 ");
    break;

    case 0xFF52AD:
    Serial.println(" 9 ");
    break;

    default:
    Serial.print(" unknown button ");
    Serial.println(results.value, HEX);

    }

    delay(500);

    }

    void unknownRemoter(){ //this function is from an old remoter see video.
    long RED_LED_OFF = 0xFF40BF;
    long RED_LED_ON = 0xFF906F;
    long LAST_BUTTON = 0xFFD02F;

    if (results.value == RED_LED_OFF){
    Serial.println ("Red led off");
    digitalWrite(12,LOW);
    }
    else if (results.value == RED_LED_ON )
    {
    Serial.println ("Red led on");
    digitalWrite(12,HIGH);
    }
    else if (results.value == LAST_BUTTON )
    {
    Serial.println ("CAMERA IMAGE button");
    }else{
    Serial.print(" still an unknown button ");
    Serial.println(results.value, HEX);
    }
    }

    gohanG 1 Reply Last reply
    0
    • DickD Dick

      I found a nice project using an IR remote controle, it is designed for Arduino but I have no idea how to convert the code to MySensors. Who can help? ```

      /*Code belongs to this video https://www.youtube.com/watch?v=wqZwQnh6ZtQ
      writen by Moz for YouTube changel logmaker360.
      13-04-2016

      code works on a car mp3 remote controller
      */

      #include <IRremote.h>
      int RECV_PIN = 6;
      int BLUE_LED = 13;
      int RED_LED = 12;

      IRrecv irrecv(RECV_PIN);
      decode_results results;

      void setup() {
      // initialize the digital pin as an output.
      pinMode(RECV_PIN, INPUT);
      pinMode(BLUE_LED, OUTPUT);
      pinMode(RED_LED, OUTPUT);
      irrecv.enableIRIn(); // Start the receiver
      Serial.begin(9600);
      }
      void loop() {
      int i=0;
      if (irrecv.decode(&results)) {

      translateIR();
      unknownRemoter();

       irrecv.resume(); // Receive the next value
      

      }
      }

      void translateIR() // takes action based on IR code received describing Car MP3 IR codes
      {

      switch(results.value){
      case 0xFFA25D:
      Serial.println(" CH- ");
      break;
      case 0xFF629D:
      Serial.println(" CH ");
      break;
      case 0xFFE21D:
      Serial.println(" CH+ ");
      break;
      case 0xFF22DD:
      Serial.println(" blue LED off ");
      digitalWrite(13,LOW);
      break;
      case 0xFF02FD:
      Serial.println(" blue LED on ");
      digitalWrite(13, HIGH);
      break;
      case 0xFFC23D:
      Serial.println(" PLAY/PAUSE ");
      break;
      case 0xFFE01F:
      Serial.println(" VOL- ");
      break;
      case 0xFFA857:
      Serial.println(" VOL+ ");
      break;
      case 0xFF906F:
      Serial.println(" EQ ");
      break;
      case 0xFF6897:
      Serial.println(" 0 ");
      break;
      case 0xFF9867:
      Serial.println(" 100+ ");
      break;
      case 0xFFB04F:
      Serial.println(" 200+ ");
      break;
      case 0xFF30CF:
      Serial.println(" 1 ");
      break;

      case 0xFF18E7:
      Serial.println(" 2 ");
      break;

      case 0xFF7A85:
      Serial.println(" 3 ");
      break;

      case 0xFF10EF:
      Serial.println(" 4 ");
      break;

      case 0xFF38C7:
      Serial.println(" 5 ");
      break;

      case 0xFF5AA5:
      Serial.println(" 6 ");
      break;

      case 0xFF42BD:
      Serial.println(" 7 ");
      break;

      case 0xFF4AB5:
      Serial.println(" 8 ");
      break;

      case 0xFF52AD:
      Serial.println(" 9 ");
      break;

      default:
      Serial.print(" unknown button ");
      Serial.println(results.value, HEX);

      }

      delay(500);

      }

      void unknownRemoter(){ //this function is from an old remoter see video.
      long RED_LED_OFF = 0xFF40BF;
      long RED_LED_ON = 0xFF906F;
      long LAST_BUTTON = 0xFFD02F;

      if (results.value == RED_LED_OFF){
      Serial.println ("Red led off");
      digitalWrite(12,LOW);
      }
      else if (results.value == RED_LED_ON )
      {
      Serial.println ("Red led on");
      digitalWrite(12,HIGH);
      }
      else if (results.value == LAST_BUTTON )
      {
      Serial.println ("CAMERA IMAGE button");
      }else{
      Serial.print(" still an unknown button ");
      Serial.println(results.value, HEX);
      }
      }

      gohanG Offline
      gohanG Offline
      gohan
      Mod
      wrote on last edited by
      #2

      @dick you would need to put a "send" for every case you see with an IR code. The problem is how you want to handle the commands (create a binary child for each button or a single multi value child)

      1 Reply Last reply
      0
      • DickD Offline
        DickD Offline
        Dick
        wrote on last edited by Dick
        #3

        Thanks for the reply but this is probably to big for me. I wanted to make an IR remote to operate the most common use Mysensors in my house without starting the Domoticz app,The results I wanted to connect using an Event in domoticz

        1 Reply Last reply
        0
        • Nca78N Offline
          Nca78N Offline
          Nca78
          Hardware Contributor
          wrote on last edited by
          #4

          Do you want to make an ir remote, or do you want to use an existing remote ?

          If you want to make one, then make a MySensors remote control directly.
          If you want to use an existing remote control, then I would process like this :

          • make 2 arrays of the same size, one for bytes that contains the child id, one (not sure of the data type) for related IR codes. If you don't have too many codes then you can make one 2 dimensional array and use same data type for child ID and for IR code (not too many so not taking up too much memory)
          • in the presentation method, loop in the array and present all child ids as buttons (or scenes, up to you)
          • in the code, when you receive an IR code, loop in the IR codes array to find the code. Then get the related child id in the child id array, and send a "on" mysensors message for this child.
          DickD 1 Reply Last reply
          0
          • Nca78N Nca78

            Do you want to make an ir remote, or do you want to use an existing remote ?

            If you want to make one, then make a MySensors remote control directly.
            If you want to use an existing remote control, then I would process like this :

            • make 2 arrays of the same size, one for bytes that contains the child id, one (not sure of the data type) for related IR codes. If you don't have too many codes then you can make one 2 dimensional array and use same data type for child ID and for IR code (not too many so not taking up too much memory)
            • in the presentation method, loop in the array and present all child ids as buttons (or scenes, up to you)
            • in the code, when you receive an IR code, loop in the IR codes array to find the code. Then get the related child id in the child id array, and send a "on" mysensors message for this child.
            DickD Offline
            DickD Offline
            Dick
            wrote on last edited by
            #5

            @nca78 I start experiment this weekend and will give it a try. Thanks for the ideas to make a working solution, in this case the use of an existing IR controle.

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


            5

            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