-->
Page 1 of 2

nodeMCU + ArduinoIDEproblem

PostPosted: Fri Jan 22, 2016 10:20 am
by brunoudi
Hi,

I already made a search for a similar problem, but didn't find a answer.

I'm making a dimmer with nodeMCU-ESP8266 but the zeros cross interrupts are not working very well.

With LUA script it misses around 30-40% of the zero crossing.

Then I changed to arduino IDE, which is faster, but it still misses around 10% of the zero crossing.

During the tests I also changed the nodeMCU for a Arduino. It worked 100%.

In my opinion, it could be:

1) Considering the lower voltage (3.3V) the zero cross system is not sensible enough to catch 100% of the signals.

2) The ESP8266 is not faster enough.

I would like to hear your opinion/sugetions.

My circuit is pretty much like the attachment.

Re: nodeMCU + ArduinoIDEproblem

PostPosted: Fri Jan 22, 2016 3:33 pm
by schufti
Disable wifi modem and test again ...

Re: nodeMCU + ArduinoIDEproblem

PostPosted: Fri Jan 22, 2016 4:04 pm
by Gigel
Probably you're missing out events due to the slower handling on the ESP8266 side, because of the nodeMCU crap, and WiFi stack stuff. The zero-crossing rate is pretty low.

For an AC signal at 60 Hz, which means that the AC signal crosses zero, reaches peak positive voltage, crosses zero, reaches peak negative voltage and returns to zero 60 times each second, resulting is a period of 1/60 sec or 16.67 milliseconds.
The time between two zero-crossings (a half cycle) occurs in 8.33 milliseconds.

The ESP8266 clock runs at 26 MHz (at least on my board) and of course this is probably internally multiplied to some 80 MHz, which is 80,000,000 cycles per second, so one clock cycle takes 0.0125 microseconds. A single half cycle of the 60 Hz AC signal contains 666,400 clock cycles. Plenty of speed on ESP8266 to detect the slower zero-crossing.

Try without the nodeMCU crap, and if still not working as desired, try also with the WiFi off.

Regards,
G

Re: nodeMCU + ArduinoIDEproblem

PostPosted: Sat Jan 23, 2016 9:42 am
by xtal
have you scoped you zero crossing to verify where the led conducts compared to the input,,,leds
turn on between .9-1.6 volts , if you supply a 3v p to the led , you could be >30% delay.....
I would re-think the zero cross detector..
You have about 8.3 ms between crossings, I would not think the LUA overhead is that bad..
But it could be .....!