Wemos goes offline after rawIR is sent

Hello everybody,

This is my first topic and I’m new to the Blynk Community. Lately, I’ve been testing around with the combination of Blynk and IRremote on my Wemos D1 Mini Lite. My goal is to make a digital remote for my devices using the code below. However, somehow when I press a button in the app to send the raw IR command the device goes offline and needs to reconnect to the internet. I’ve been trying to use other forms but couldn’t find a solution and therefore hoped someone could help me in the right direction.

Kind regards,


#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>

uint16_t X_vdown[24]={1000,600, 600,1150, 500,650, 550,850, 600,1150, 600,550, 500,650, 550,1500, 600,1400, 600,550, 600,850, 550};  

#define IR_SEND_PIN D2

IRsend irsend(IR_SEND_PIN);

char auth[] = " ";
char ssid[] = " ";
char pass[] = " ";

void setup()
  Blynk.begin(auth, ssid, pass);

    irsend.sendRaw(X_vdown, 68, 38); 

void loop()

1 Like

How long does it take for the IR send routine to complete?
Maybe add some serial print messages with the current millis value just before and after the IR send command to figure out the answer to that question.

If it’s too long then that will be why Blynk is timing out. I wouldn’t have expected that to be the cause of the problem, but it’s a good place to start.

Also, have you tried using a different pin for the IR LED?


I’ve been testing a little with your surgestions, it takes on average about 649515 micro seconds to run the IR raw command, I’ve no idea whether this is too long for the Blynk timing or not. However, something strange did happen, I was able to run the virtual pin a few times before the device went offline.

Unfortunately using other ports resulted in the same problem.


That’s 0.65 seconds, so that shouldn’t be causing any Blynk timing issues.

Not sure what else to suggest I’m afraid.


Just thinking about this a bit more, how are you measuring the time in microseconds? I’d have expected your reply to be in milliseconds.


Bear Pete,

For measuring the the time I used the following commands:


    Serial.println();                       //  2 chars: CR and LF
    Serial.print("Start: ");                //  7 chars
    unsigned long time_start = micros();

    irsend.sendRaw(X_vdown, 68, 38); 

    Serial.print(time_start);               //  6 chars
    Serial.print("  End: ");                   //  4 chars
    unsigned long time_end = micros();
    Serial.print("  Difference: ");

Also, I tried to use the following command instead of the sendRaw:

    irsend.sendSAMSUNG(0xE0E0E01F, 32); //Volume up

But this time I had no problems with the Wemos going offline, therefore I think that you might be right with the Blynk timing issues. However, for my project I also need to send some sendRaw commands, do you might know some trick to fix this timing issue?


1 Like

Of course, I’d forgotten about the micros() command.

I think that middle parameter in the irsend.sendRaw command (68 in your case) is supposed to be the length of the command that you’re sending. Your command consists of 23 values (although you’ve defined your array as 24), so I think this value should be 23.

I cant see how that would cause your disconnections, as the sendRaw is completing quickly, but might be worth a look.


Dear Pete,

I changed the value to 23 and it is working. Now the command time is about 17300 micro seconds with is much smaller than before. Thanks for your help!:grinning::grinning:


1 Like

Don’t ask me to explain why, but glad its working and that I was able to help.

I’ll mark the thread as solved.


irsend.sendRaw(X_vdown, 24, 38)