Relays start up (Przekazniki uruchamiają się)

Witam mam problem z blynk. Problem polega na tym że jak jest przerwa w dostawie pradu i po ponownym wlaczeniu prądu przekaźniki samoczynnie uruchamiaja się i np zapala się swiatlo. Kod standardowy esp. Plytka wemos d1 r2.


Hi, I have a problem with the fluid. The problem is that as there is a break in the power supply and when the power is switched on again, the relays automatically start up and, for example, the light is on. Standard code esp. Wemos d1 r2 plate.

potrzebuje trochę więcej szczegółów - używasz pinów cyfrowych czy wirtualnych? Czy odtwarzasz stany pinów z serwera po powrocie zasilania -Blynk.syncAll() ? najlepiej wkleić kod lub link do kodu wtedy analiza przypadku jest łatwiejsza
a tak btw zapraszam na blynk.pl - staram się tam po naszemu opisać działanie BLYNKa
lub pisz na blynk.pl@gmail.com
Krzycho


Need some more details - are you using digital or virtual pins? Do you restore the pin states from the server when the power returns - Blynk.syncAll ()? The best way is to paste the code or link to the code then the case analysis is easier
and so btw I invite you to blynk.pl - I try to describe our BLYNK’s work there
or write on blynk.pl@gmail.com
Stompi

1 Like

@tomixps

Hello and welcome to the official Blynk forum. If necessary please use English translation, as that is the predominant universal language used here. I have added Google Translated text for the benefit of other users reading this.

Your issue is either due to the normally pulled HIGH pin state of some ESP dev boards, and/or your relay is one of those that triggers ON with a LOW signal instead of a HIGH signal. Try a different pin or immediately pull the necessary pin LOW (or HIGH) in your sketch startup. with pinMode().

Witam
Poniżej jest mój kod:


Hello
Below is my code:

> #include <SimpleTimer.h>
> #define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
> #include <ESP8266WiFi.h>
> #include <BlynkSimpleEsp8266.h>
> #include <OneWire.h>
> #include <DallasTemperature.h>
> 
> #define ONE_WIRE_BUS 2        // This is the ESP8266 pin
> OneWire oneWire(ONE_WIRE_BUS);
> DallasTemperature sensors(&oneWire);
> 
> DeviceAddress tempSensor1 = { 0x28, 0xFF, 0x76, 0xB6, 0x86, 0x16, 0x05, 0xEB }; // Adres temperatury #1
> DeviceAddress tempSensor2 = { 0x28, 0xFF, 0x72, 0x55, 0x80, 0x16, 0x05, 0xE4 }; // Adres temperatury #2
> DeviceAddress tempSensor3 = { 0x28, 0xFF, 0x27, 0xF1, 0x85, 0x16, 0x04, 0x6F  }; // Adres temperatury #2
> 
> 
> char auth[] = "";  // Kod BLYNK
> char ssid[] = "";  // Login WIFI
> char pass[] = "";    // Hasło WIFI 
> 
> SimpleTimer timer;
> int pin = D0; // Pin cyfrowy krancówka
> WidgetLED led1(V5); // Pin wirtualny krancowy
> int pin2 = D1; // Pin cyfrowy krancówka
> WidgetLED led2(V6); // Pin wirtualny krancowy
> int pin3 = D2; // Pin cyfrowy krancówka
> WidgetLED led3(V7); // Pin wirtualny krancowy 
> int pin4 = D3; // Pin cyfrowy krancówka
> WidgetLED led4(V8); // Pin wirtualny krancowy 
> 
> int tempC1, tempC2, tempC3;         // Variables for storing temperatures
> 
> void setup()
> {
>   Serial.begin(9600);
>   Blynk.begin(auth, ssid, pass);
> 
>   while (Blynk.connect() == false) {
>     // Wait until connected
>   }
> 
>   sensors.begin();
>   timer.setInterval(1000L, brama1); //Sprawdzanie stanu
>   timer.setInterval(1000L, brama2); //Sprawdzanie stanu
>   timer.setInterval(1000L, brama3); //Sprawdzanie stanu
>   timer.setInterval(1000L, brama4); //Sprawdzanie stanu
>   sensors.setResolution(tempSensor1, 9);   // More on resolutions: http://www.homautomation.org/2015/11/17/ds18b20-how-to-change-resolution-9101112-bits/
>   sensors.setResolution(tempSensor2, 9);
>   sensors.setResolution(tempSensor3, 9);
>   // These timers are used so that data does not flood Blynk
>   timer.setInterval(1000L, sendSensor1);  //  Czas pomiaru temperatury #1
>   timer.setInterval(1000L, sendSensor2);  //  Czas pomiaru temperatury #2
>   timer.setInterval(1000L, sendSensor3);  //  Czas pomiaru temperatury #2
> }
> 
> void loop()
> {
>   Blynk.run();
>   timer.run();
> }
> 
> void sendSensor1() {
>   sensors.requestTemperatures();                // Polls the sensors
>   tempC1 = sensors.getTempC(tempSensor1);  // C - celsjusza / F - fahrenheita
> 
>   Blynk.virtualWrite(1, tempC1);  // 1 Pin wirtualny 
> }
> 
> void sendSensor2() 
> {
>   sensors.requestTemperatures();
>   tempC2 = sensors.getTempC(tempSensor2);
> 
>   Blynk.virtualWrite(2, tempC2);  // 2 Pin wirtualny 
> }
> void sendSensor3() 
> {
>   sensors.requestTemperatures();
>   tempC3 = sensors.getTempC(tempSensor3);
> 
>   Blynk.virtualWrite(3, tempC3);  // 3 Pin wirtualny 
> }
>   void brama1()
> {
> if(digitalRead(pin) == 1){
>   led1.on();
> }
> else{
>   led1.off();
> }
> }
> void brama2()
> {
> if(digitalRead(pin2) == 1){
>   led2.on();
> }
> else{
>   led2.off();
> }
> }
> void brama3()
> {
> if(digitalRead(pin3) == 1){
>   led3.on();
> }
> else{
>   led3.off();
> }
> }
> void brama4()
> {
> if(digitalRead(pin4) == 1){
>   led4.on();
> }
> else{
>   led4.off();
> }
> }

Nie widze portów gdzie są te przekażniki podpięte? nie ma tez deklaracji ustawień protów w setup()


Can not see the ports where these relays are connected? There are no pin settings in setup ().

Hi fellows I have the same problem as the companion tomixps.
I have configured two pushbuttons on the digital inputs 8 and 9 whenever I connect power is connected to the D8, and tested on different digital inputs and simpre same as the first is powered alone.

it is solved by changing the relay system.

that operate with an opto-coupler
Relays that only work with transistors work well do not operate when you connect power

D1 - oświetlenie led 1
D4 - oświetlenie led 2
D0 - otwieranie / zamykanie bramy - Opening / closing the door

Chyba tego nie mam


I do not think so

BLYNK_CONNECTED() {
Blynk.syncAll();
}

Działa Pozdrawiam i dziękuje.


Works Greetings and thanks.