Hello everyone,
I’ve just received my (first) ESP32 and trying to use it as a controller for a 120mm PWM fan in my network cabinet.
I took example on this topic using ESPHome with ledc output. What changes in my case is that my fan is a PWM PC fan (4pin, 12V) so I assume i don’t need the MOS Module, right ?
Here’s my diagram :
Here’s my ESPHome config :
esphome:
name: fans
platform: ESP32
board: nodemcu-32s
wifi:
ssid: "XXXXXX"
password: "XXXXXX"
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "XXXXXX"
ota:
password: "XXXXXX"
output:
- platform: ledc
pin: GPIO12
frequency: 10000 Hz
id: cabfan
fan:
- platform: speed
output: cabfan
name: "Network Cabinet Fan"
The upload is successful and I see my fan.network_cabinet_fan in Home Assistant.
When I change speed, I can see the ESP32’s onboard LED flash, I see logs in ESPHome but nothing is happening on the fan, it stays at full speed.
I unfortunately don’t have an oscilloscope (Or LED) to check if the PWM signal is good or not. When checking with a multimeter, I can see the voltage between the ESP Pins G12 and GND as following :
Low speed : -2.10V ±0.05V
Medium speed : 1.0V ±0.05V
High speed : 0V ±0.2V
These values are with the ESP’s GND, so do I have to connect ESP32’s GND to PSU’s GND ?
I tried to do it but in the logs I’m seeing this :
[13:44:49]Guru Meditation Error: Core 0 panic'ed (IllegalInstruction). Exception was unhandled.
[13:44:49]Memory dump at 0x400fdcf8: ffffffff ffffffff 3df03dd4
[13:44:49]Core 0 register dump:
[13:44:49]PC : 0x400fdcff PS : 0x00060430 A0 : 0x8010a1e3 A1 : 0x3ffb5ef0
e[32mINFO Need to fetch platformio IDE-data, please stand bye[0m
e[32mINFO Running: platformio run -d fans -t idedatae[0m
[13:44:50]A2 : 0x3ffcceb8 A3 : 0x3ffd368c A4 : 0x3ffb5f50 A5 : 0x0000007f
[13:44:50]A6 : 0x3ffd3831 A7 : 0x3ffd370a A8 : 0x3ffd3833 A9 : 0x01f25000
[13:44:50]A10 : 0x01f25000 A11 : 0x00001000 A12 : 0x00000016 A13 : 0x3ffd386c
[13:44:50]A14 : 0x0000e815 A15 : 0x00000007 SAR : 0x00000020 EXCCAUSE: 0x00000000
[13:44:50]EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000000
[13:44:50]
[13:44:50]Backtrace: 0x400fdcff:0x3ffb5ef0 0x4010a1e0:0x3ffb5f40 0x4010ad71:0x3ffb6080 0x4014f279:0x3ffb60a0 0x4008f7ce:0x3ffb60f0 0x40088d95:0x3ffb6130
e[33mWARNING Found stack trace! Trying to decode ite[0m
[13:44:50]
[13:44:50]Rebooting...
Also, in the logs I see the following speeds being sent :
[13:47:42][D][speed.fan:036]: Setting speed: 0.33
[13:47:45][D][speed.fan:036]: Setting speed: 0.66
[13:47:47][D][speed.fan:036]: Setting speed: 1.00
Do I have to change them from 0 to 255 instead of 0 to 1 ?
Thanks for your help