This is a nice hack, but I'm always very wary of playing with large voltages because it's too easy for things to go wrong. Instead, for controlling mains devices, I recommend a Sonoff S20:<p><a href="https://esphome.io/devices/sonoff_s20.html" rel="nofollow">https://esphome.io/devices/sonoff_s20.html</a><p>I usually flash ESPurna onto it (Tasmota and ESPhome are also good choices), it's very easy to do and it's extremely reliable and hopefully has a lower chance of fire than anything I'd make.
The pinout of that ESP32 board says 3.3V but the author feeds 5V into it. But apparently it works :)<p>Something else I didn't quite understand: they write "NodeMCU ESP32 which is a small IoT device with a USB port and is programmable in ESPHome". Does that mean that the little board itself does not need to be flashed? That, out of the box, it's controllable/programmable in ESPHome, which is webbased?<p>Looks like a fun little project, all in all. Kudos for documenting and sharing it!
Cool DIY guide to make a smarter fan!<p>I was playing around with upgrading my own fan last year and ended up adding person-tracking capabilities so that the fan automatically stays pointed at me when I move. I ended up started a company, Following Fan, that builds and sells these tracking fans!
I have this same exact fan! And the remote recently stopped working so I was thinking of doing something really similar to this. Glad to see it worked out.
I recently came across this neat button pusher IoT gadget (used it to control the boiler in our rented accommodation): <a href="https://www.switch-bot.com/products/switchbot-bot" rel="nofollow">https://www.switch-bot.com/products/switchbot-bot</a><p>A less intrusive and safer alternative for those not quite comfortable with mains diy.
For those less keen on mains voltage - some wifi smart plugs can be flash with tasmota without opening them.<p>Tricky but is you need a fan that powers on when it gets juice. Something that requires a button press won’t work
I have the same fan, I'll love to control it with esp32.
Is he using 3 relays to trigger on/off, rotation and speed? Also, from what I see, he is not detecting the previous state?