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

Dear all, I kindly ask for your assistance

I´m using wemos D1 mini
and I want to run a simple program that provides pulses at the d2 port.
The pulses trigger by timer event

I observe some extra pulses at port d2 which are not caused by the timer routine at all !
The program works fine when I comment out the line Blynk.run() in the main loop
Any idea ?
Is it possible that Blynk.run() causes hardware pulses at port D2 ???

My program looks like this:

void …
timer.setInterval(10L, myTimerEvent)


void myTimerEvent()
{ digitalWrite( Step_Pin, digitalRead( Step_Pin ) ^ 1 )

D2 is the very ordinary GPIO 4 so it’s highly unlikely that Blynk.run would be pulsing the pin.

Can you post a basic sketch that demonstrates the pulsing.

This is for testing only
but there will be something like a burst group every few seconds ( I see it on my scope)
but only when the line Blynk.run() is present

#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
// You should get Auth Token in the Blynk App.
char auth[] = "xxxxxxxxxxx";//my Stepper_2
#define MY_file_name "my Stepper_2"

#define Step_Pin D2
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);
  Serial.begin(38400);
  Serial.println();
  Serial.println(F(MY_file_name));
  Blynk.begin(auth, ssid, pass);
  My_OTA_setup();
  timer.setInterval(2L, myTimerEvent);   // Setup a function to be called every msec
  Serial.println(F("setup_END"));
}

void loop()
{
  Blynk.run();
  timer.run(); // Initiates SimpleTimer
  ArduinoOTA.handle();  // see next TAB OTA
}

BLYNK_WRITE(V5) {
  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, 0);
  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
    var++;
  }

  digitalWrite( Step_Pin, 1);
}


Where are your libraries?

I added the missing lines

my libraries are included in #include MY_WiFi.h
so I do not miss

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <ArduinoOTA.h>       // for local OTA updates
#include <SimpleTimer.h>

OK I now have a sketch that compiles.

Are you saying your scope is showing HIGH and LOW on D2 that are not called in your your sketch?

yes, there are every few seconds a group of pulses it looks like a data transmission packet
of some bits

I am not seeing any movement on D2 with a multimeter from your basic sketch.

Have you tried a multimeter?

Why 38400 baud when ESP’s are fine with 115200?

Genuine or fake WeMos?

I do not think that you will see the issue with a multimeter
That burst Group comes with about 20 to 50 nsec every few secounds.
But it is nearly not possible to trigger it because the program itself provides 1khz pulses

it is a genuine wemos

the baud rate should be independent of the issue

Is the pulse affecting your sketch?

Yes, I have done a PCB for a stepper motor driver
And I use D2 to clock the stepper
so thees pulses will cause trouble

Strange
I changed the D2 to D0 and I observed the same issue
a burst group occurs every several seconds

and again the issue disappears when I delete the blynk.run

So my question should be if there is a conflict between timer.run and blynk.run

Can you try the PUSH DATA example and see if any of the pins are pulsing.

Sorry I do not understand what is meant by PUSH DATA

It’s a sketch in the Arduino IDE, in Sketch Builder and on GitHub.

Could the several seconds be 10 seconds i.e. the Blynk heartbeat burst?

may be good idea
I will check tomorrow now it´s to late for me
thank you very much for today

1 Like

maybe those bursts actually are not because of blynk, rather because of wifi communication?
and when you remove blynk.run you do no get them because there is not too much wifi activity…

you could try a new sketch, without blynk, just try pinging some url say every minute, and see if there are bursts?

if my theory is right, those burst can be caused by:

  • defective board
  • poorly designed psu (filter caps, etc)
  • poorly designed pcb (90 degree traces instead of 45, components too close to wifi antenna, poor grounding, etc)

to temp. resolve the problem you could try adding some (weak) pull down resistor to the pin.
just my 2 cents…

1 Like

I think this OP may have found some “leakage” what with all the timer action running in the background.

While I haven’t any ESPs or oscilloscopes (real ones - my pocket DSO barely counts) to play with, I have (using Arduinos) often noticed (and commented on) jittering/pulses, that come and go in notable cycles with servos, and cause issues with other sensors that rely on fast and precise timing (i.e. HC-SR04).

I have always just associated it with all that extra timer activity going on in the background when Blynk is active, and worked around it by enabling and disabling Servos only when needed and only reading the sensors on timed functions.

I haven’t tested it yet, but I wonder if disabling the internal Analog/Digital pin operations (and stick with Vpins for all App control) may help?

#define BLYNK_NO_BUILTIN   // Disable Blynk's built-in analog & digital pin operations

Dearest @Gunner, how about you pm me your address and I order you a Wemos or two just for the heck of if, or so I can enlighten you with the joy of esp? :smile: I’m sad inside that you are stuck with arduinos still :wink: