ESP8266 frequency generator


I started an ESP8266 square wave frequency doubler project for my Air Conditioner modification.
The idea is to reach frequency doubling with triggering new square for upper and lower edges.
But this is the far target.  :)


But what is the ESP01 pure performance ? 

1. with LUA

ESP family CPU speed is 80MHz as default, but you can switch to 160Mhz which sound good but reality is disappointing output frequency is somewhere 6khz.

So lets start check what is max frequency generating LUA language:

        

        node.setcpufreq(node.CPU160MHZ) 
gpio.mode(4, gpio.OUTPUT)

tmr.wdclr()
for count = 1,102400 do
   gpio.write(4,1)
   gpio.write(4,0)    
end





Conclusion: MAX frequency is ~6,6 KHz with LUA.


This is the theoretical max frequency with LUA. 
Each new code line will slow down the out frequency.

For example if you make a longer sound loop the loop detection in NodeMCU will stop your loop after 5 sec. (as a workaround you have to reset the inner watchdog. but in this case freq. slow down.


node.setcpufreq(node.CPU160MHZ)  gpio.mode(4, gpio.OUTPUT)
tmr.wdclr()
for count = 1,102400 do
    gpio.write(4,1)
    gpio.write(4,0)  
end 




So we have to use another language because LUA script language is slow for this.

Lets check micropython or Arduino IDE(C++)


2. with Micropython

Some speed improvement  almost double, but similar league in performance as LUA.  


3. Arduino IDE(C++)

Best performance -as expected. :)  

124 KHz !!!! 
which is 20 times faster than LUA or MicroPython







Nincsenek megjegyzések:

Megjegyzés küldése