Hello everyone! I‘m new but this Forum already helped me alot.
But now I‘m stuck with a problem and couldn‘t find anyone with the same neither here or elsewhere.
So I‘ve recently been building 2 PWM Application using ESP32, ESPHome and Homeassistant.
The first one controls a Light through the 0-10V PWM-Input of a Meanwell LED Driver.
The second one controls the Speed of a 12V 4-Pin PC-Fan through its PWM Channel.
I was able to implement this on 2 separate ESP32 quite quickly and to my full satisfaction.
Now comes the part where I‘m stuck: Since the Light and the PC-Fan are in the same location, naturally I would like to let one single ESP32 control both the Light and the Fan.
But as soon as I add the second PWM Output for the PC-Fan in the ESPHome Config, the Light-PWM does not work. It goes to the minimum Output. So the light brightness is set to minimum although the corresponding Button in Homassistant is set to 50%.
The PC-Fans are working though…
I‘ve tried using different channels, but nothing changed.
I also tried to use separate GROUND Pins for the Optocoupler and the GROUND from 12V which is connected to ESP32.
What am I missing?
Here‘s the code I‘m using (at the moment 2nd part of the code is disabled since my Light wont work then)
output:
- platform: ledc
id: licht_pwm
pin: GPIO23
frequency: 1220Hz
inverted: true
channel: 0
# - platform: ledc
# id: umluft_pwm
# pin: GPIO17
# frequency: 25000Hz
# channel: 1
light:
- platform: monochromatic
name: "Licht"
output: licht_pwm
gamma_correct: 1.0
# fan:
# - platform: speed
# output: umluft_pwm
# name: "Lüfter"
I‘m not sure the Hardware/Wiring is important but to be sure I‘m still posting it:
For the light I‘m using a PC817 Optocoupler with a Resistance.
For the Fan I‘m directly injecting the PWM Signal into the PWM Channel of the PC Fan which has 4-Pins .
The 12Volts com from a separate Powersource, the ESP32 and 12Volt Powersource are connected through Ground.
The 12V positive Wire goes directly to the PC-Fan.
As I mentioned, both cases are working when on separate ESPs.
Thanks in advance!