I’ve been working slowly on a project over the past few weeks to create a smart dimmer switch that mimics a standard UK style analogue dimmer switch.
I have many analogue dimmers around my house but of course these wont dim a smart bulb such as Hue.
There are loads of advantages of smart bulbs that I want to take advantage of, but also want to keep the same experience as with traditional lighting controls - e.g. for children, guests etc.
I select a Sonoff basic as the basis for the project as they:
- are cheap
- are easy to obtain
- expose enough GPIOs for a KY-040 rotary encoder (needs 3) without messing around (I reused the UART TX/RX GPIOs on the header)
- built in power supply (as opposed to nodemcu etc)
- widely used, with generally good experiences
- easy to flash - just solder on that header…
Originally I was planning to hack up other peoples project as a code base, but I discovered that ESPEasy supports MQTT and rotary encoders. This made the project a matter of configuration in a webpage rather than C coding (not my forte). ESPEasy is great!
£5 for the Sonoff
£1 for the KY-040 encoder
£0.69 for the blank plate
The dupont cables and 5 pin header I had already in bits boxes
The knob was salvaged from a broken dimmer I already had (and fits the encoder perfectly!)
This is cheaper than most analogue dimmers
Testing prior installation - Demo Video
I needed to trim ends off the Sonoff as the next challenge is that I need to get it in here:
As you can see the sonoff is a tight fit even without the casing and connected wiring
I also need to work out how to implement a long press in ESPEasy so that I can toggle the relay - eg bulb change or if HA is down… any advice on this is welcome!
I’ll post a follow up with the ESPEasy and HA configs sometime soon…