Introduction for H.A
Home Assistant is a great piece of program. In the last year I’ve been busy with Home Assistant. If you don’t know it ,it is time to include this in your life!I have heard of it but i have never take it take it seriously. So, i spent one day on searching for it and i realize that it is neither a program, nor a simple operating system. It is an assemblage of many “programs” that many many people are working on it and many companies had rely on it their products. It is an automated way, that everyone of us has in the back of his head. So that control electronic devices without out every day presence. Believe me, it can do much more that you just think right now. And day after day it becomes ever better, including more and more.
Here, i am going to show how to dim an incandescence lamp or any other load at 230v AC with an esp8266. Of course it can be done with a esp32, but for this simple operation it is overkill to use esp32. I will not start from begging, it means you are familiar with H.A (installation, configuration and many other stuff). You can also see here more info about controlling AC phase with Arduino.
Schematic and files
You can see schematic diagram below and pcb board also. I made it on a prototype board and it work perfect.I have add a indicator led at d6 out, that is also dimmable according to the load.
Download 3d printed files, made with openscad
Here, you can see yaml code that you need to add to your dimmer.yaml in ESPHome
sensor: - platform: wifi_signal name: "Dimmer WiFi Signal" update_interval: 60s - platform: uptime name: Dimmer uptime output: - platform: ac_dimmer id: dimmer1 gate_pin: D6 min_power: 10% method: leading init_with_half_cycle: false zero_cross_pin: number: D5 mode: INPUT_PULLUP inverted: yes light: - platform: monochromatic output: dimmer1 name: Dimmerized Light
Check also AC Dimmer Component espHome page for explanation every command
At the video below, you can see pulses at pin 1 of the moc3021, so moc3021 trigger input of the triac. Keep in mind that those pulses are not random. Those must start, exactly when zero cross detection occur, so that change positive and negative waveform phase, you may read here for more information .
There is also another board for ac dimmer that instead of H11L1M is use 4n25. I have check it but it does not work with esp8266 , it work perfect only with esp32. With H11L1M and esp8266 it operate perfect, i have not any flicker at all.