Software for a led dimmer that made some time ago works really well. This brought me to the idea of making a smart ledbulb with the help of an esp32, a fet module and pieces of ledstrip. The plan is to have a housing that could fit in an E27 fitting. Inside are the electronics and outside ledstrips. This way we would get a nice dimable smart ledlamp. We can build it in a tiffany table light p.e.
This bulb is really smart, it has 4 timers, remembers the dim value and has a nice webpage where everything can be configured.
Some of the key features are:
Easy to connect to a wifi network
Secured with an administrator password.
The administrator can grant a user with limited privileges.
We can connect external pushbuttons to dim up/down and switch.
Easy software update via OTA
Webpage is mobile friendly.
From inside the network, switching via an api can be done without authentication.
from outside the network switching is only possible via the website.
The first result is not very nice to look at but it works very well. The design with 10 pieces of strips is however not convenient to make. The amount of light is also not impressive. For a tiffany moodlight it would be sufficient.
With this in mind i redesigned the housing in such way that it is shorter and has a larger diameter. This would allow to mount more length of ledstrip. Another advantage is that there is only one connection point, so less wires and more space for the electronics.
The hardware
There are only a few components involved. The total costs are about 5 Euro.
1 x ESP32 super mini c3
1 x FET module for arduino
1 x wall plug dc supply 5v 1A
a cob ledstrip 5v 3mm cutable
some wires
Building it:
There are multiple ways to make this bulb. We can cut the strips and mount them vertically on the housing. More convenient is to wrap 1 piece of strip around the cylindric housing.
Some of the main key steps are:
- cut the ledstrip and solder short wires to the solderpads.
- print the housing
- program the ESP32 with the software .bin file
- Solder the things together and test.
- glue the strip(s)
The software:
The software has to be plug and play so that it can easely be installed in any network by anyone.
This bulb has a wifi config portal that allows to connect to the wifi network and configure some basic properties.
So how does this work: When the device is powered on, it tries to connect to a network. When this failes, it starts an accesspoint. The lamp is on contineously now on a low dimlevel.
You can connect your PC or Phone wifi to this AP and your browser will open the config portal automatically. Or you can open a website with http://192.168.4.1. The ESP serves a webpage that allowes us to configure the network
credentials and more.
When this is done, the device restarts, checks if there's a network connection and than starts in Station mode. The lamp flashes 3 times. Now we can switch it via its webpage, web api, mosquitto and by using the button.
The working:
The lamp can be controlled by a webinterface. In the frontpage we can switch the lamp on and off by clicking a button or move a slider. The slipder sets a dim level that we can save so that this is the default light output.
Furthermore we can activate 4 timers to switch automatically for instance from 10 min. after sunset to 23:30hr.