New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP8266 - PWM Freq Flicker (Most likely still broken PWM Code) #914
Comments
I'm afraid this is something that's never going to work on ESP8266. There is no hardware PWM peripheral on ESP8266 so PWM is done with software. Realistically you'll never be able to do anything much above 1000 Hz, and even then it might be a bit rough. It could produce an exception for any frequency above 1000 I guess, but to be honest that might just annoy a lot of people and you could still make it glitchy by adding loads of PWMs. If you want proper peripherals, and lots of them (SPI, I2C, PWM, ADC, etc) then you'll need to use a board with a separate Microcontroller. The Espruino boards will do it, and there should be a WiFi Espruino board coming in a month or two as well. |
Just to add - realistically there's no need for 30kHz dimming on an LED strip. Use ~100Hz and you should be fine. Although even with that, WiFi can get in the way of the PWM timer and can cause glitchiness. You might need to use external PWM hardware, or another microcontroller. |
I see. So it would be possible to use for example an arduino nano to do the pwm work (until the espruino with wi-fi is available) ? Any suggestions on how to communicate with said arduino? |
Yes, you could write some C code to receive data and do stuff and could connect via serial - it could be a bit of a pain though. Or you could use a PCA9685 - after all, it's designed to drive LEDs. Adafruit even do one on a board. Or... simplest might actually be to get an Espruino Pico, flash your ESP8266 with the AT command firmware, connect it up, and access WiFi that way. |
For ESP8266 there is a replacement for the SDK PWM code: https://github.com/StefanBruens/ESP8266_new_pwm Maybe someone whats to jump in and do the replacement. Comment from @gfwilliams (#1175)
|
I had this same flickering problem driving an LED strip using PWM on the ESP8266 with MicroPython. I tried disabling that Access Point interface and the problem is 100% resolved for me. The "station" interface is still active and I am able to run a web server on the board while doing PWM and it works fine, flicker-free. The MicroPython code for this is:
|
@stefan-sherwood please share your analogWrite statement |
I am not changing the clock frequency because it works fine as is, but you can double the default 80 MHz ESP8266 clock.
Sorry about using MicroPython examples but that's what I'm using. |
Seem there is no interest after six month to implement this, so lets close this. |
I'm trying to PWM an LED Strip running 1v86.171 using
It flickers terribly even though it shouldn't since its 30000hz. Setting the freq value higher makes it light up at full brightness constantly. The freq param works since it does work well with low hz values like 1-100hz
The text was updated successfully, but these errors were encountered: