Smart light

This article describes how to create a DIY smart light with HomeGenie Mini color-light firmware using ESP32-C3/S3 Mini/Zero development board and addressable RGB LED pixels.

The DIY smart light consist of three parts:

You can see the assembled mood lamp and the controller in the video below. The video shows the functionality of buttons and a summary of the main features of color-light firmware.

Product features:

Example schedules include Dusk and Dawn scenes, that trigger in proximity of sunrise or sunset, and Auto off timeout that turns the light off after a certain period of inactivity.
Using an external motion and light sensor is possible to implement further automated scenarios since the device can "talk" directly to other devices using HomeGenie API or generic HTTP calls.

LED controller kit v1.5

The LED controller kit consists of a PCB shield for ESP32-C3/S3 Zero development board, and a 3D printed enclosure. This device can control WS2812x and compatible RGB LED types for a maximum power of 10-15W.
The 3D printed translucent enclosure let the onboard RGB LED be visible and create a nice color/status feedback even if no LED strip is connected yet.

PCB shield

On the upper side of the PCB there are two buttons, while on the lower side there are the two 9-pin header rails on which the ESP32 board is connected, and the JST connector cable to which the LED strip is connected.

Components listing

Depending on the number of pixels of the LED strip, the "Max power" setting must be configured correctly so as not to exceed the capacity of the power supply used..

This setting can be tweaked using the HomeGenie Panel app or using the API. By default, the maximum power limit is set to 25%, capable of driving up to 200 LED pixels considering a maximum requirement of 40mA for each pixel.

Max LED power % formula:

<power_supply_ampere> / (<number_of_pixels> * <ampere_per_pixel>) * 100 = <max_ampere_perc>

So, with a 2A power supply and a LED strip of 144 pixels with a consumptions of 40mA (0.04A) each pixel, the max power is 35% :

2 / (144 * 0.04) * 100 = 34.72222
'Max power' settings

Consult the specifications of the connected LED strip to determine the actual maximum mA consumption of each pixel.
The LED controller has been successfully tested with LED strips up to 3 meters long and up to 488 pixels.

Plastic enclosure

Printed using translucent PETG material, the enclosure takes about 45 minutes to print with a 0.4mm nozzle and 0.16mm layer height on an A1-mini 3D printer.

Assembly instructions

STEP 2

Insert the PCB and the ESP32 board.


Open media

Device configuration

Once assembled, to become a fully functional LED controller, HomeGenie Mini color-light firmware must be uploaded to the device.

The firmware can be uploaded directly from this page using the firmware upload form at the end of this article: select the target SoC model (ESP32-C3 or ESP32-S3 in this case) and click the "Create device" button.

Now, the LED controller is ready to be configured and connected to Wi-Fi following the instructions in the Device Setup page.

NOTE: color-light firmware also works on any other LED controller embedding an ESP32 or ESP8266 SoC, this might just require to set different GPIO parameters in the firmware upload form.
The options selected by default in the upload form are meant to be used with this LED Controller Kit.

Archie 🌀 mood lamp

Archie is a 3D printed 1m LED strip casing in the shape of an Archimedean spiral. The spiral has always been an important symbol in ancient cultures, it is believed to represent cycles, growth and transformation. Also present in nature in various forms, it is a sort of magical symbol.

For this reason and for the mesmerizing colors and animations implemented with color-light firmware, Archie is perfect as a mood lamp for meditation and as a portal to explore inner worlds. Some studies and initiatives already suggest that there might be some kind of healing properties in light and colors especially when combined with sounds as a method to reduce stress and anxiety.

So, despite the name, it might be worth trying the Panel app's "Party Mode" in combination with listening to some good relaxing music.

Archie Mood Lamp is an original concept and design by G-Labs licensed under CC BY-NC 4.0

Automation examples

Every HomeGenie Mini device can implement on its own even complex automated tasks thanks to the integrated Scheduler, that beside preset actions, can run JavaScript code to implement user-definable actions.

Linked lights

In the video below you can see how to link multiple devices so that they can be controlled all together by simply acting on one of them. This is achieved by adding two schedules that are triggered when the device is turned on or off and which consequently turn on or off all the devices associated to the schedule itself, which in the example below are the other two lights.

For simplicity, the solution in this video is a "zero-code" solution and is implemented by creating two different schedules with preset actions. One for the "turn on" action, and the other for the "turn off" action.
An optimized solution can be implemented using a single schedule with custom action script instead of preset actions. The script code is the following:

$$.boundModules.level = event.value

The script is executed every time the "Status.Level" event occurs, therefore, every time the light level ("event.value") changes, the levels of the modules associated to the schedule ("boundModules") are also set to the same value.

The following image shows an example "Linked.Lights" schedule configuration.

Linked Lights schedule

Module event trigger and action to perform


Open media

In this example, the "Linked.Lights" schedule is implemented by the "Main Light" device. So, every time the level of the "Main Light" changes, the "Floor Lamp" and the "Ceiling Light" levels are also automatically set to the same value.

Project files download

LED controller kit

PCB Gerber download REV. 19

Enclosure 3MF download REV. 2

Archie 🌀 mood lamp

LED strip casing 3MF download REV. 16

Smart Light project files by G-Labs licensed under CC BY-NC 4.0

Create this device now! 🪄

Connect your ESP32 / ESP8266 microcontroller to the USB port of this computer, select the desired firmware version, and click the "Create device" button to upload HomeGenie Mini firmware to the device.

1. Select device type

2. Select firmware flavor

3. Let the magic happen!

Installing firmware directly from this page works only in browsers with Web Serial API enabled.

See the Device setup page for further information about configuring a HomeGenie Mini device.

forum Q & A Discussion Forum

Source code

This firmware pre-compiled binaries and source code are available on GitHub:

folder_open color-light

Modules and API

In addition to the common Device API, the following modules and API are implemented by this device.

C1 module

This is the master module that controls all LEDs simultaneously.

Domain / Address

HomeAutomation.HomeGenie/C1

Properties

Commands

L1 ... L<num> modules

These modules control the LED corresponding to the number <num>.

Domain / Address

HomeAutomation.HomeGenie/L<num>

Properties

Commands

 
Next arrow_right 

More topics

Setup

Programming

forum Q & A Discussion Forum
HomeGenie
MINI 1.2 — Documentation