Hello
I have an assembled circuit based on ESP32 devkit 1, hooked up to a 4x20 LCD display via i2c, with ds18b20 sensors and thermocouple, and ssr relay (omron). A web server set up where I display the sensor data.
I have a button connected to the gpio32 (other end to ground) I use a software pullup.
The button handles the interrupt. Generally everything works, but I noticed that sometimes a random interruption occurs, first when I plug the ds18 sensor into the bus, then when I connect the power supply (250VAC) from the relay, (it feeds the phase through the relay, while the N is shorted to the N of the receiver), (plug into the socket on the wall).
I don't know if this is a software fault or rather interference from the mains, I use a charger from motorola to power the ESP32.
.
Based on the value from the eeprom it executes the program, but that's another issue, it works fine.
The only problem, is that sometimes (during a random interrupt) it writes the opposite state to the eeprom than it was, as if I used the.... button
(it writes to the eeprom, because from the web page I can also change the state of the output - the inputPraca2 variable is used for that)
greetings
Small update. I am powering the esp32 from the powerbank and now when plugging in the 250VAC plug there is no random interrupt. So interference is to blame.
I have an assembled circuit based on ESP32 devkit 1, hooked up to a 4x20 LCD display via i2c, with ds18b20 sensors and thermocouple, and ssr relay (omron). A web server set up where I display the sensor data.
I have a button connected to the gpio32 (other end to ground) I use a software pullup.
The button handles the interrupt. Generally everything works, but I noticed that sometimes a random interruption occurs, first when I plug the ds18 sensor into the bus, then when I connect the power supply (250VAC) from the relay, (it feeds the phase through the relay, while the N is shorted to the N of the receiver), (plug into the socket on the wall).
I don't know if this is a software fault or rather interference from the mains, I use a charger from motorola to power the ESP32.
#define sw1 32
pinMode(sw1, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(sw1), sw1_ISR, RISING);
/******************************************************
bool przerwanie = false;
void IRAM_ATTR sw1_ISR(){
swCzas = millis();
if (swCzas - popswCzas > 250){
przerwanie = true;
popswCzas = swCzas;
}
}
/******************************************************
if (przerwanie){
swCzas = biezacyCzas;
praca = (EEPROM.read(1)); //wczytaj ON/OFF z EEPROM
if (praca == "1"){
EEPROM.write(1, 0);
EEPROM.commit();
praca = "false";
inputPraca2 = "false";
}
if (praca == "0"){
EEPROM.write(1, 1);
EEPROM.commit();
praca = "checked";
inputPraca2 = "true";
swCzas = biezacyCzas;
}
while (biezacyCzas - swCzas <= 2000UL){ /*pusta petla*/}
Based on the value from the eeprom it executes the program, but that's another issue, it works fine.
The only problem, is that sometimes (during a random interrupt) it writes the opposite state to the eeprom than it was, as if I used the.... button
(it writes to the eeprom, because from the web page I can also change the state of the output - the inputPraca2 variable is used for that)
greetings
Small update. I am powering the esp32 from the powerbank and now when plugging in the 250VAC plug there is no random interrupt. So interference is to blame.