Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Martin L
#80578 I'm currently working on a Firebase controlled dimmer switch using the esp8266. The way it works is that I have a zeroCrossing detection interrupt which tells me when the AC phase is changing (freq. 120HZ). Whenever the zeroCrossing is detected a timer starts and when the timer matches the wanted dimming value it turns on the switch and turns it off before the next cycle. This part works perfectly, the problem I'm having is that whenever I try to get the dimming value from Firebase everything else seems to stop for a moment and although I can read the value and dim the lights properly, each time I want an update the light flickers.
I think that the Wifi functions are somehow interfering with the other ongoing processes but don't really know how to fix this...
User avatar
By btidey
#80586 If you are using the software interrupt (attachinterrupt) for a GPIO then those can suffer fairly variable latencies, particularly when wifi activity is occurring.

You may do better to use a direct timer interrupt mechanism (e.g timer1) to reduce any flicker effects due to latency in responding.
User avatar
By gibo77
#81316 I have the same case with my Dimmer and use the Fauxmo library for Alexa command.

The Wifi do not respond when the AttachInterrupt is used, somehow sometimes. the Interrupt Service Routine is only two lines and very short. Sometimes I see my router dropping the ESP8266. I know this for a fact because if I use simple wifi sketch without the Interrupts, my router do not drop the ESP8266 and all is good.

The Fauxmo creator told me that AsyncTCP library has internal interrupts, which I think mess with the external AttachInterrupt. From what I know two interrupts are a big NO in Arduino environments.

If I fail on ESP8266, I might move on to ESP32, which is much expensive. It is sad to see that ESP8266 is only good for Wifi application that closes and open a switch. :shock: :shock:

I will try a few test and let you know.