# PWM not working on ESP32

**URL:** https://forum.xod.io/t/pwm-not-working-on-esp32/6573
**Category:** XOD Programming Questions
**Created:** [June 12, 2023, 1:32pm UTC](https://forum.xod.io/t/pwm-not-working-on-esp32/6573 "2023-06-12T13:32:06Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![idhoworth](https://avatars.discourse-cdn.com/v4/letter/i/ecb155/32.png) [@idhoworth](https://forum.xod.io/u/idhoworth)
#### Post date: [June 12, 2023, 1:32pm UTC](https://forum.xod.io/t/pwm-not-working-on-esp32/6573/1 "2023-06-12T13:32:06Z")

</div>

Any ideas anyone? I have an application using PWM write, the program works fine with a Mega 2560 pro but I would prefer to use an ESP32 board because of the speed, the program runs fine on the ESP board but I get absolutely zero PWM output. Any ideas???

---

<div class="post-metadata">

### Author: ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)
#### Post date: [June 12, 2023, 3:27pm UTC](https://forum.xod.io/t/pwm-not-working-on-esp32/6573/2 "2023-06-12T15:27:38Z")

</div>

There is not much we can do to help with out additional information. The two most likely things to check are:

1. Are you using PWM pin on new board? Only specified pins support PWM. You may have to change to a different pin when you change boards.
2. Try a diff PWM pin. PWM requires timers. Other nodes also require timers. Occasionally, XOD will try to reuse 1 timer for multiple functions, breaking code.

---

<div class="post-metadata">

### Author: ![idhoworth](https://avatars.discourse-cdn.com/v4/letter/i/ecb155/32.png) [@idhoworth](https://forum.xod.io/u/idhoworth)
#### Post date: [June 12, 2023, 9:09pm UTC](https://forum.xod.io/t/pwm-not-working-on-esp32/6573/3 "2023-06-12T21:09:44Z")

</div>

Thanks for the quick reply, I tried several pwm pins, nothing. I then tried just loading the esp32 dev board up with just a pwm write and a tweek number, again no pwm output at all. I also tried other esp32 boards with the same result.

---

<div class="post-metadata">

### Author: ![wayland](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/wayland/32/1590_2.png) [@wayland](https://forum.xod.io/u/wayland)
#### Post date: [June 12, 2023, 10:22pm UTC](https://forum.xod.io/t/pwm-not-working-on-esp32/6573/4 "2023-06-12T22:22:18Z")

</div>

That’s strange. I’ve just tested **xod/gpio/pwm-write** on an esp32 board labelled: “ESP32-WROOM-32”. I connected an led module (with built-in resistor) to pin 16 and GND. With the following patch I was able to adjust the brightness of the led using the tweak node:  
 ![Screenshot 2023-06-12 at 23.14.52](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/4/48ce58cac3e4047e84094ed479471993de3d5bbd.png)

I chose “ESP32 Dev Module” as the board model and used default parameters:

 ![Screenshot 2023-06-12 at 23.12.42](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/5/5f0aecee4c87327aaf70a1050369fe8f72bd7572.png)

How are you testing the output of the PWM pin?

---

<div class="post-metadata">

### Author: ![idhoworth](https://avatars.discourse-cdn.com/v4/letter/i/ecb155/32.png) [@idhoworth](https://forum.xod.io/u/idhoworth)
#### Post date: [June 12, 2023, 10:56pm UTC](https://forum.xod.io/t/pwm-not-working-on-esp32/6573/5 "2023-06-12T22:56:58Z")

</div>

Testing it with a scope and a test meter

---

<div class="post-metadata">

### Author: ![idhoworth](https://avatars.discourse-cdn.com/v4/letter/i/ecb155/32.png) [@idhoworth](https://forum.xod.io/u/idhoworth)
#### Post date: [June 12, 2023, 11:31pm UTC](https://forum.xod.io/t/pwm-not-working-on-esp32/6573/6 "2023-06-12T23:31:04Z")

</div>

just tried again on pin 16, zero pwm on the scope and zero volts on my test meter. Tried with a 30 pin esp32 board and then with a 38 pin one. Same result.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/eb7348baa04192c2ef932d1db54d44f09f8a7888.png) [@system](https://forum.xod.io/u/system)
#### Post date: [July 12, 2023, 11:31pm UTC](https://forum.xod.io/t/pwm-not-working-on-esp32/6573/7 "2023-07-12T23:31:32Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
