Reset blynk - 4 relays on


I have a problem with my project. I want to control the blinds with Blynk. I was able to connect and the control works well. Only during the reset for a short time before the data has been synchronized using the Blynk.syncAll command all 4 relays switch on. This cannot be the case, because it will turn on two directions of work on the engine. The engine will be damaged. Is it possible to set the pin states to low when establishing a connection?

Are you using virtual pins? (You should be).
syncAll isn’t the best way to go. Synchronise just the virtual pins that you’re using.


PeteKnight I am not using virtual pins. how to use virtual pins for this particular example?


I think you’re using active low or low-level triggered type of relays, which turn ON when controlling signal level is 0.
Normally, when a board is first turned ON or reboot, the output signal level are LOW or 0 for a while, until you take control by digitalWrite(pin, HIGH) to the pin.

If this is the case, you have to issue the digitalWrite() command very early in the booting process, trying to force the relay OFF by using digitalWrite(pin, HIGH) commands to the corresponding pins.

For example:

void setup()
   // These commands must be at the beginning of code
   //Initialize relay pins as output
  pinMode(relay1_pin, OUTPUT);
  pinMode(relay2_pin, OUTPUT);
  pinMode(relay3_pin, OUTPUT);
  pinMode(relay4_pin, OUTPUT);

  // Force relay to OFF
  digitalWrite(relay1_pin, HIGH);
  digitalWrite(relay2_pin, HIGH);
  digitalWrite(relay3_pin, HIGH);
  digitalWrite(relay4_pin, HIGH);

  // Then all the necessary initialization hereafter

Certainly, you’d better use BLYNK_CONNECTED() along with Blynk.syncVirtual() or Blynk.syncAll() to synchronize the relays’ status with what stored in the server.

If you use active high or high-level triggered type of relays, use have to reverse the logic from digitalWrite(pin, HIGH) to digitalWrite(pin, LOW) at start.