While waiting on the opamps and other components to arrive I began work on the program.
I found a few examples online but not many of them supported dimming or had really clunky methods of making the device smart including having to set up an MQTT server. I appreciate that those can really make a device connected, but I did not feel it was worth it just for controlling lights. All I wanted was to be able to control the lights with alexa.
I eventually came across a video by Tech StudyCell on youtube that did exactly what I wanted: https://iotcircuithub.com/esp32-pwm-led-dimmer/
This used the Espalexa library and presents itself as a simple dimmable light.
The example code only supported a single light and had a pot for use when the esp could not connect to wifi.
I modified the code so that it had 4 output channels and supported 4 inputs so that a manual button could be added. The button would cycle between off, auto (smart), and on. If you use the manual button to turn the light on or off, the next smart command will override it to prevent it getting stuck in a certain state.
I'm not ready to post the code yet as it is still very hacked together and messy while I am in the middle of the project. Once I have functional boards I will clean it up and share it.
I was able to successfully get alexa controlling the brightness of 4 led. The 5th red one indicates if wifi connection failed.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.