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 ???
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);
}
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
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…
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? I’m sad inside that you are stuck with arduinos still