Page 1 of 1
ESP32 PWM!
Posted: Mon Apr 01, 2024 6:25 pm
by jgu1
HI all!
I need to control a PWM via potentiameter in anothe project. First I test it in a simple testprogram. When I simulate the program it doesn´t work, I don´t see the PWM on the Graph. I have not test in real word yet, so I don´t know if it work,
What am I do wrong, please?
Br Jorgen
Re: ESP32 PWM!
Posted: Mon Apr 01, 2024 7:02 pm
by chipfryer27
Hi Jorgen
The PWM component needs to have a PWM Timer selected and has a period overflow of 255 for 8-bit devices and 65535 for 16-bit devices which also needs to be set according to your device.
I see your slider has a range of 0-4095 so you could perhaps use the Map component to scale to 0-255 for your Duty?
Hope this helps.
Regards
Re: ESP32 PWM!
Posted: Mon Apr 01, 2024 7:42 pm
by jgu1
Hi chipfryer27
Many thank´s for your help. Yes I managed to get it work in simulation after your advice. I have compile to chip, no uotput
I use theanalog (warm ) Analog 4 = pin 32 and for the PWM out I use CH4 with pin B3 = D11
Do you have any advice?
Re: ESP32 PWM!
Posted: Mon Apr 01, 2024 8:08 pm
by chipfryer27
Hi Jorgen
I don't use the ESP32 that much but from what I see with View > Target (showing pins)
I agree that the Slider is connected to IO32 / ADC4 PortB.0 but I'm unsure where you get D11 for the PWM. Is that a typing error?
How are you measuring the output? You will need a scope or an analyser on the pin to see the duty change.
Regards
Re: ESP32 PWM!
Posted: Mon Apr 01, 2024 8:31 pm
by jgu1
Hi again!
I disvoverd that if I change the channel I saw that Pin was changing Timer A and B so I try to use Channel 1 and pin A15 then I get fine PWM out
I not managed it by any of the BPins. But anyway, by help from you I can continue my project.
I think it is tricky with pinnumbers with ESP32, no logig
Again thank´s
Br Jorgen
Re: ESP32 PWM!
Posted: Mon Apr 01, 2024 8:40 pm
by chipfryer27
Hi
I think it is tricky with pinnumbers with ESP32, no logig
It certainly seems that way
Glad you have it working now.
Regards