Esp8266 turns the relay automatically on after reboot in syncall()

Hi, I’m using esp8266 for my project.
I’m using digital pins. Im having a trouble with my relays.
I’m using timers also with the blynk server.
The problem is, when reboots the esp8266 turns on the relay which is connected to the timers.
I don’t know what’s the reason . please help me with this project.
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.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[] = "

void setup()
// Debug console

pinMode(05, OUTPUT);
pinMode(04, OUTPUT);
pinMode(00, OUTPUT);
pinMode(02, OUTPUT);
pinMode(14, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode(15, OUTPUT);
digitalWrite(05, HIGH);
digitalWrite(04, HIGH);
digitalWrite(00, HIGH);
digitalWrite(02, HIGH);
digitalWrite(14, HIGH);
digitalWrite(12, HIGH);
digitalWrite(13, HIGH);
digitalWrite(15, HIGH );

Blynk.begin(auth, ssid, pass);



void loop()

Have you gotten the chance to search for this link yet?

oh… probably not

Well, here is the link anyway
I searched for esp8266 relay pins.

  digitalWrite(relayPin, 1); // high before pinMode stops relay chattering during bootup
  pinMode(relayPin, OUTPUT);
  pinMode(relayPin, HIGH);

Actually I used Blynk.syncAll()
Which is working well with the blynk and the esp8266.
But I have 4 timers in my relay board out of 8 relay switch.
Only those 4 turns on at the time of start up.

I need that switch to be off state.

see this link:

@Mahesh015 you don’t appear to be very good at reading things.

You didn’t read (or at least if you did read then you didn’t follow) the information that was automatically placed in your first post before deleting it. It contained information about how to post code in the forum so that it displays correctly.
Please go back to your first post in this topic, edit the post (using the pencil symbol at the bottom of the post, and add-in the necessary backtick symbols - like this:

Secondly, you haven’t followed the link that @lvennard and now @ErfanDL have posted.

My advice would be to stop using digital pins and use virtual pins instead, and to be very careful about which GPIO pins you choose. Also, Blynk.syncAll() is generally regarded as being problematic, especially with digital pins. You’re best doing syncs on individual named virtual pis when you change your code to work that way.


Hi thanks for your reply…
Can you give me a code for virtual pins.

Hi thanks for your reply. I tried but I doesn’t work…
Can you show me the code for virtual pins.
Thanks in advance :slightly_smiling_face:

(Removed unformatted code)

this is my program. the problem is, after reboot all relay goes high untill the esp8266 comes online… please help with this

You did it again!

And please don’t start new topics asking exactly the same thing. I’ve deleted that new topic - use this one please.


1 Like

Ok sir