Does blynk cause some pulses to wemos d1 mini port D2?

Here is my code
I shorten it to represent the issue some what better

//#define BLYNK_DEBUG
//#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <MY_WiFi.h> // MY_personal WiFi including OTA Blynk simple timer
/* the following stuf is includet in MY_WiFi.h so I do not miss to implement it anymore
 #include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <ArduinoOTA.h>       // for local OTA updates
#include <SimpleTimer.h>
SimpleTimer timer;
 * */
// You should get Auth Token in the Blynk App.
char auth[] = "xxxxxxxxx";//my Stepper_2
#define MY_file_name "my Stepper_2"
#define Step_Pin D0
int var = 0;
int tor_status =0;
int countdown = 999;
void setup()
{ pinMode(BUILTIN_LED, OUTPUT);  // initialize onboard LED as output
  pinMode(Step_Pin, OUTPUT);
  delay (500);
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(1L, myTimerEvent);   // Setup a function to be called every msec

void loop()
{;; // Initiates SimpleTimer
  ArduinoOTA.handle();  // see next TAB OTA
  tor_status = (param.asInt() ); // pinData variable will store value that came via Bridge
  Serial.println(F("got V5 value = "));
  Serial.println (tor_status);

void myTimerEvent()  //this is for example only change it to your ISR needs
  digitalWrite( Step_Pin, LOW);
  if (countdown-- < 0)
    digitalWrite( BUILTIN_LED, digitalRead( BUILTIN_LED ) ^ 1 ); // blink x/sec
    countdown = 999;
  var = 0;
  while (var < 2000) {
    // do something for testing only

  digitalWrite( Step_Pin,HIGH);

you can try to put the critical part of the stepper code in interrupt function. that way the mcu will not do anything else, so will not disturb the steps.

also, most stepper drivers have a standby / disable pin. you can control this pin with the wemos, and just turn on the stepper driver just before you send the commands for it, and turn off right after the steps are done.

in one of my older project i’ve done exactly the same way, on d1 mini pro, and didn’t had any issues.

(in stepper driver datasheet you can find the info how many us or ns you have to wait between turning on the driver and sending the first pulse)

I´m a bit confused because I use the wemos D1 mini several times together with blynk.
Unfortunately my PC burns down and I have to rebuild all my stuff again.
I needed to setup everything to my new notebook

My stepper runs before great and I never observed such an issue
I do not belief that the issue comes from my new notebook.
But I want to give this information because it might be useful to find the root cause

I´m offline for several hours

I always saw a servo jitter cycle that often matched a timer cycle, so unless you needed to use SimpleTimer in your past setup, it might not have been as noticeable… but now that BlynkTimer is built in, it may be noticeable even if you don’t actively use timers. Plus, the developers are always adding stuff, so who knows how that affects timer usage (assuming that is the cause of your noted signals).

Yes you are right
I´m still most frustrated.

What I know up to now is that there is an effect caused by blynk may be a BUG
I assume that the blynk heartbeat will modified the timer.setInterval
By that the timing of my ISR is disturbed and this causes the false pulses.

I do not find any work around to get a stable timing for my ISR

I hope that one of the developers will take a look on this

Or it is just the result of many core routines sharing the internal timers… there are only so many milliseconds in a day :stuck_out_tongue_winking_eye:

@vshymanskyy is this something you can assist with and/or explain, if you have time?

1 Like

What exactly does your stepper motor do?

it will drive a linear stepper motor.
With a high requirement for precise timing
and a wide range of stepper frequency

Yes but I’m wondering if a temporary fix is to disable after sending the signal via the internet but before stepping the motor. It might not be possible to do this but without knowing precisely what the motor does it’s impossible to be sure.

Because I want to change the frequency at any time I do not believe that I can switch of

You would be turning back on once the step has completed. All very quickly but maybe not quick enough for your project.

Perhaps set an indefinite hearbeat Expected Data usage for Hardware connection 'heartbeat' to blynk server?

1 Like

Dear Sirs, could you please give some advice?
What I know up to now is that there is an effect caused by blynk
I assume that the blynk heartbeat will modified the timer.setInterval
By that the timing of my ISR is disturbed and this causes the false pulses.

I do not find any work around to get a stable timing for my ISR


The developers had already been notified (and where probably already aware of this topic), but it is a weekend and they are already very busy… And the answer may simply be something like “that’s the nature of the hardware timers”, as a simple Google search can find many issues making a smooth and non-blocking stepper driver out of an Arduino/ESP (and thats without running something complex like Blynk in the background).

And even if there is a “fix” it could take days/week/months, etc. as honestly, I don’t see super precision steppers as being very high on the overall IOT list of things to control… Have a CNC or 3D printer but want to control it from across the parking lot or the world… DON’T install Blynk on the main controlling MCU, rather find a way of interfacing with the controls…

Which leads to this suggestion… you might want to look at workarounds involving dedicated MCU controller(s) for your steppers. It is not uncommon to have multiple Arduinos all linked via serial, I2C, etc. to a master (one running Blynk in this case)… thus allowing for the need of dedicated processing power, I/O and speed.


Hi All

The following excellent video on ESP8266 and weird behaviour especially for GPIO2; might shed some light.

GOTO 19 mins into video where GPIO2 weird issues is discussed :


@Brummer are you sure your oscilloscope readings match to the default Blynk 10 second heartbeat?

I was just thinking from the video link provided by @mars that you might want to try switching from D0 (GPIO 16 special reset pin) to a regular pin like D1 / D2 (GPIO 5 /4).

Wasn’t the OP using D2 at the beginning (with scoped readings), before switching to D0? Or are you saying switch back to D2 and recheck the scope for any changes?

1 Like

@Gunner yes you are right I was just looking at one of the more recent sketches, so perhaps the reset pin D0 / GPIO 0 is not the specific issue. Nonetheless I would always try to use regular pins rather than the special pins.

thank you very much for this interesting link.

I changed the port but got the same issue
and yes as far I can compare the debug output with my scope the effect is synchron to the heartbeat.
I assume that the heartbeat will have an effect to the timer routine so it stops for several msec and then there are some extra pulses…
For my opinion it is a bug.

thank you for your advices, and yes you are right I´m now thinking about if it was a good idea to use the D1 mini together with blynk for my project.
BUT I love blynk and this great forum.
Also I like the D1 mini
I do not have so much programming experience and it is hard to figure out what is going on within the deepness of blynk
So I hope someone will find a fix for this Issue