-->
Page 1 of 2

ESP8266 Wifi messing with interrupts

PostPosted: Fri Feb 15, 2019 3:29 pm
by Martin L
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...

Re: ESP8266 Wifi messing with interrupts

PostPosted: Sat Feb 16, 2019 6:08 am
by schufti
did you ever think on using the board search with "dimmer" ????

Re: ESP8266 Wifi messing with interrupts

PostPosted: Sat Feb 16, 2019 7:07 am
by btidey
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.

Re: ESP8266 Wifi messing with interrupts

PostPosted: Sun Mar 24, 2019 12:06 pm
by gibo77
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.