Control a ceiling fan using Esphome and NodeMCU

Hello There,

I’m sorry for the open end question but I’m completely new to this and really need some advice.

I want to control a ceiling fan using ESPHome and NodeMCU, I also want to have manual control using touch buttons, I don’t know if it is possible or not, but I want to have touch buttons to change speed of the fan manually and even through the HA.

Can someone please guide me on how to get started, I tried researching a lot but it all bounced.

Thank you in advance.

If you’re “completely new to this” then I’d recommend against this route.

If you’re determined, here is a thread that talks about a solution that was built with the components you mention.

I used a Bond Home which integrates into HA natively and emulates the remote that came with your Fan (assuming it did). This allows non-HA and HA use simultaneously and the Bond Home has the added advantage of being able to emulate other RF remotes too.

Caseta also makes a fan control switch which will do what you want.

I’ve been thinking of using this… but I don’t want to use blynk and replace it with ESPHome…

I already have Google Assistant connected to my HA… manual method, so I want to control my fan using the same thing…

Another option is to consider a shelly 1 device. I have a shelly 1 that I use for my fireplace control and still have the switch to control manually.

But the shelly 1 won’t allow for fan speed changes.

I’d strongly recommend against putting something like that inside your wall. It’s fine if you want to leave it exposed (as in the video), but burying it in a wall is asking for trouble.

That said, can’t help you with that particular implementation, hopefully someone else joins in.

Can I use PWM Fan output with this??

As you have not told us anything about your fan it is impossible to say.

Also one of these may be better https://itead.cc/product/sonoff-ifan03-wi-fi-ceiling-fan-and-light-controller/

It is a dumb ceiling fan with no features at all…

So just a single speed?

4 speed regulator…

So most have a capacitance based speed control. For different speeds different capacitors are switched in and out.

I believe that the sonoff acts exactly the same way. In which case it would be a straight swap.

PWM is not a great fit with fans. I used a dimmer with a fan in one house. It introduced a lot of noise from the fan. Generally not recommended.

What’s wrong with this?? My code is working correctly and I can turn off the fan and on as well
But it only works on full speed and lower speed of 1,2 and 3 doesn’t work
I’m using: 2.2uF 400V x1 3.3uF 400V x1 220kohm 1/4W x2 2.2 ohm 1/4W x2
This all components I’m using to control the fan speed
But it doesn’t seem to work… speed 1,2 and 3 doesn’t work but 4 works well

I don’t know. No circuit diagram. No code. Impossible to say.

1 Like


Here we go with the circuit diagram