MP3 Remote Control + ESP-01 + Blynk QR Code

Thanks again to @Costas for the Blymk Magic. I extended my tests to 3 remote controls i use in my home, This remote i am sharing is the FULL Button version of the small MP3 remotes you can buy on ebay based on NEC Codes, i will upload a photo of the remote and a QR Code for the App and the Arduino sketch to make it all work. My sketch is based upon my own local blynk server so you may need to modify the sketch accordingly. The sketch is based upon using the cheapest ESP-01 module, so the PIN i am using is GPIO2, in the sketch it is this line
`IRsend irsend(2); //an IR emitter led is connected to GPIO pin 2

The physical LED hardware side comprises of a 5v wall adaptor and a proto board using a AMS1117 3.3V SOT223 voltage regulator, a 330 ohm resistor and a 2N3904 NPN Transistor and a 940NM IR LED. This arrangement is needed only if using the ESP-01 module so to eliminate it entering flash mode when starting up.
Please remember to ensure the IR LED is pointing at what ever device you are using in conjunction with your IR Receiver.

Library used /IRremoteESP8266

Arduino Sketch:-

    /*
     * IRremoteESP8266: IRsendGCDemo - demonstrates sending Global Cache-formatted IR codes with IRsend
     * An IR LED must be connected to ESP8266 pin 2
     * Version 0.1 30 March, 2016
     * Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009, Copyright 2009 Ken Shirriff, http://arcfn.com
     */

    #include <ESP8266WiFi.h>
    #include <BlynkSimpleEsp8266.h>
    #include <IRremoteESP8266.h>

    // You should get Auth Token in the Blynk App.
    // Go to the Project Settings (nut icon).
    char auth[] = "********************";

    // Your WiFi credentials.
    // Set password to "" for open networks.
    char ssid[] = "********************";
    char pass[] = "********************";
    char server[] = "********************";

    // Codes are in Global Cache format less the emitter ID and request ID. These codes can be found in GC's Control Tower database.



    IRsend irsend(2); //an IR emitter led is connected to GPIO pin 2
    void setup()
    {
      irsend.begin();
      Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
      Blynk.begin(auth, ssid, pass, server);
      // You can also specify server:
      //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
      //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
    }
    BLYNK_WRITE(V1){
      int onoff = param.asInt();
      if(onoff == 1){
        irsend.sendNEC(0xFFA25D, 32); // 32 bits, no repeat

    }

    }
    BLYNK_WRITE(V2){
      int mode = param.asInt();
      if(mode == 1){
        irsend.sendNEC(0xFF629D, 32); // 32 bits, no repeat
     }

     }
    BLYNK_WRITE(V3){
      int mute = param.asInt();
      if(mute == 1){
        irsend.sendNEC(0xFFE21D, 32); // 32 bits, no repeat

    }


    }
    BLYNK_WRITE(V4){
      int volup = param.asInt();
      if(volup == 1){
        irsend.sendNEC(0xFF906F, 32); // 32 bits, no repeat
    }

    }
    BLYNK_WRITE(V5){
      int voldown = param.asInt();
      if(voldown == 1){
        irsend.sendNEC(0xFFA857, 32); // 32 bits, no repeat

    }
    }
    BLYNK_WRITE(V6){
      int skipb = param.asInt();
      if(skipb == 1){
        irsend.sendNEC(0xFF02FD, 32); // 32 bits, no repeat
    }

    }
    BLYNK_WRITE(V7){
      int skipf = param.asInt();
      if(skipf == 1){
        irsend.sendNEC(0xFFC23D, 32); // 32 bits, no repeat

    }

    }
    BLYNK_WRITE(V8){
      int shuffle = param.asInt();
      if(shuffle == 1){
        irsend.sendNEC(0xFF9867, 32); // 32 bits, no repeat

    }


    }
    BLYNK_WRITE(V12){
      int play = param.asInt();
      if(play == 1){
        irsend.sendNEC(0xFF22DD, 32); // 32 bits, no repeat
    }

    }
    BLYNK_WRITE(V13){
      int usd = param.asInt();
      if(usd == 1){
        irsend.sendNEC(0xFFB04F, 32); // 32 bits, no repeat
    }

    }
    BLYNK_WRITE(V14){
      int eq = param.asInt();
      if(eq == 1){
        irsend.sendNEC(0xFFE01F, 32); // 32 bits, no repeat

    }

    }
    BLYNK_WRITE(V15){
      int ch0 = param.asInt();
      if(ch0 == 1){
        irsend.sendNEC(0xFF6897, 32); // 32 bits, no repeat
    }

    }
    BLYNK_WRITE(V16){
      int ch1 = param.asInt();
      if(ch1 == 1){
        irsend.sendNEC(0xFF30CF, 32); // 32 bits, no repeat

    }

    }
    BLYNK_WRITE(V17){
      int ch2 = param.asInt();
      if(ch2 == 1){
        irsend.sendNEC(0xFF18E7, 32); // 32 bits, no repeat
    }

    }
    BLYNK_WRITE(V18){
      int ch3 = param.asInt();
      if(ch3 == 1){
        irsend.sendNEC(0xFF7A85, 32); // 32 bits, no repeat
    }

    }
    BLYNK_WRITE(V19){
      int ch4 = param.asInt();
      if(ch4 == 1){
        irsend.sendNEC(0xFF10EF, 32); // 32 bits, no repeat

    }

    }
    BLYNK_WRITE(V20){
      int ch5 = param.asInt();
      if(ch5 == 1){
        irsend.sendNEC(0xFF38C7, 32); // 32 bits, no repeat
    }

    }
    BLYNK_WRITE(V21){
      int ch6 = param.asInt();
      if(ch6 == 1){
        irsend.sendNEC(0xFF5AA5, 32); // 32 bits, no repeat
    }

    }
    BLYNK_WRITE(V22){
      int ch7 = param.asInt();
      if(ch7 == 1){
        irsend.sendNEC(0xFF42BD, 32); // 32 bits, no repeat
    }

    }
    BLYNK_WRITE(V23){
      int ch8 = param.asInt();
      if(ch8 == 1){
        irsend.sendNEC(0xFF4AB5, 32); // 32 bits, no repeat

    }

    }
    BLYNK_WRITE(V24){
      int ch9 = param.asInt();
      if(ch9 == 1){
        irsend.sendNEC(0xFF52AD, 32); // 32 bits, no repeat
    }
     
    }
    void loop() {
      Blynk.run();
      
    }

MP3 REMOTE CONTROL:-

BLYNK QR CODE:-

APP SCREENSHOT:-
-

5 Likes

@jasperdog
thanks for this useful topic. but when I compile this project I got error ‘irsend does not name a type’

yeah because the IR library was changed earlier this year you need to include these 2 lines and then save and it should then compile. you may need to restart the arduino IDE

#include <IRsend.h>  // Needed if you want to send IR commands.
#include <IRrecv.h>  // Needed if you want to receive IR commands.

this is the hardware module i made in a plastic case, when the lid is on, only the IR LED is showing and pointing at the TV, hope this helps.

1 Like

Thanks so much. Problem is solved :heart_eyes:

Thank you @jasperdog for the great project. I followed your steps and now I’m able to control my IR devices.
I’ve just faced a problem here.
The +ve terminal of my IR emitter led is connected directly to GPIO pin 2 on NodeMCU board and the -ve terminal is connected to NodeMCU’s GND pin, and it’s working fine.
The problem is when NodeMCU got reset or temporarily loses power and come back online it doesn’t automatically reconnect to the WiFi network again unless I disconnect the IR LED, reset NodeMCU and connect IR LED again.
So do you have any idea why this happens?
Thanks in advance.

this was my crude but effective board i made

if you are using a nodemcu board. just choose a different pin from gio2

change this line from
IRsend irsend(2); //an IR emitter led is connected to GPIO pin 2
to this line
IRsend irsend(5); //an IR emitter led is connected to GPIO pin 5

so connect the +V to the D1 pin of your nodemcu

1 Like

Fantastic … it’s now working :wink:
Many thanks for your help, but do you know the reason behind why it’s not working when it was connected to GPIO pin 2?

gpio2 is notorious for doing that, especially on esp-01 boards,

For a regular boot both GPIO0 and GPIO2 need to be floating, or pulled up with a resistor to Vcc. If at a regular boot either GPIO0 or GPIO2 is LOW, it will not boot.

so in conclusion just choose any other gpio pin instead.
UPDATE after reading @PeteKnight comment below,it is safe to say that choosing either gpio4 or gpio5 are the 2 safest pins to use, this relates to either D2 OR D1 respectively when using nodemcu

Much appreciated … thanks again :wink:

You should read this thread:

Pete.

1 Like

that’s an interesting article.

Exactly, its in my bookmarked threads and probably the most useful piece of info that I’ve read for a long time.

Pete.

HOLA, gracias por tu gran aporte. podrías subir el esquema de conexión de pines y los materiale que usaste?. gracias

The physical LED hardware side comprises of a 5v wall adaptor and a proto board using a AMS1117 3.3V SOT223 voltage regulator, a 330 ohm resistor and a 2N3904 NPN Transistor and a 940NM IR LED. This arrangement is needed only if using the ESP-01 module so to eliminate it entering flash mode when starting up.
Please remember to ensure the IR LED is pointing at what ever device you are using in conjunction with your IR Receiver.

the photo of my homemade device is a good start.

gracias por tu respuesta. se poco de electrónica y quero saber como van soldados los componentes, podrias enviar una imagen de la parte inferior o un pequeño diagrama? muchas gracias-

sorry but i no longer have the physical unit.