Page 1 of 1

Can the ESP32 do SPWM (Sinusoidal PWM)

Posted: Sun May 26, 2019 1:08 pm
by mikemoy
I would like to start learning to play with SPWM (Sinusoidal PWM) to generate a sine wave via PWM to control a 3 phase DC brushless motor. I would like to try to mimic what others have done using an Atmel micro. Like this one.
https://github.com/Terbytes/Arduino-Atmel-sPWM

Annotation 2019-05-26 080336.jpg
Annotation 2019-05-26 080336.jpg (50.67 KiB) Viewed 7971 times


I have tried the MCPWM BLDC motor control example just to get all the hardware proved out.
https://github.com/espressif/esp-idf/tr ... dc_control

Atmel has OCRxA & OCRxB registers (Output Compare Register), which (unless I am wrong) the ESP32 does not. So I am trying to figure out a way to overcome this. The second thing that has me wondering if this is even possible is that the ESP32 is running the RTOS which is great but not really geared towards this kind of thing, so I am not sure if this is something I should even bother with doing because of the latency issues.

Anyone have any thoughts about this?

Re: Can the ESP32 do SPWM (Sinusoidal PWM)

Posted: Wed Jul 10, 2019 7:04 pm
by KlausKleister
Hi, i would like to do the exact same thing. I want to drive a dc motor with a damped sine function. Did you have any success?
Im am a total newbie btw but i need this for my thesis.

Re: Can the ESP32 do SPWM (Sinusoidal PWM)

Posted: Thu Jul 11, 2019 2:03 am
by mikemoy
Nope, just wound up using the BLDC example with some tweaking.