GlowLight





GlowLight is a custom-designed bedside lamp built around an ESP32-C3 microcontroller, combining functionality with aesthetic appeal. It features multiple lighting modes controllable via a single button and offers touchless brightness adjustment using a VL53L0X distance sensor. With the integration of the PainlessMesh library, multiple GlowLight units can communicate and synchronize their modes seamlessly.
The project provides comprehensive assembly instructions, including 3D-printed housing components, circuit diagrams, and software setup using PlatformIO or a Makefile. All necessary files and additional information are available in the associated GitHub repository: github.com/Friedjof/GlowLight.
If you need assistance structuring other sections of your Instructables article—such as the materials list, step-by-step assembly guide, software installation, or troubleshooting tips—feel free to ask.
Supplies



Hardware Components
- DUBEUYEW ESP32-C3 Development Board Mini
- VL53L0X distance sensor
- Simple push button (height ≥ 6mm)
- WS2812B 5V LED strip (11 LEDs)
- External 5V power supply
- USB-C and some other necessary cables
- 3x M3 threaded insert
- 3x M3 screws
Tools and Materials
- 3D printer + filament (white and a color of your choice)
- Soldering iron + solder
- 2x Heat shrink tube
- Screwdriver
https://github.com/Friedjof/GlowLight/?tab=readme-ov-file#hardware-components
3D Printing




You can find the 3D models in the /printing folder. The models are designed to be 3D printed and assembled. The lamp consists of three parts: the base, the lampshade, and the lampshade holder.
https://github.com/Friedjof/GlowLight/?tab=readme-ov-file#soldering
Soldering


The components are connected to the ESP32C3 using the following diagram. Choose a suitable length for the wires. Better a bit too long than too short.
https://github.com/Friedjof/GlowLight/?tab=readme-ov-file#soldering
Software Installation
This is a PlatformIO project. To compile and flash the software to the ESP32C3, PlatformIO must be installed. Once installed, you can open the project in PlatformIO and flash the software onto the ESP32C3.
Alternatively, a Makefile is included, allowing you to flash the software via the command line. For this, PlatformIO must be installed, and the PLATFORMIO environment variable should point to the PlatformIO executable.
If you're familiar with Nix-shell, you can use the shell.nix file to set up the environment for PlatformIO.
PlatformIO Commands
- pio run: Compiles the software
- pio run --target upload: Flashes the software to the ESP32C3
- pio run --target clean: Removes compiled files
- pio device monitor: Opens a terminal to view the ESP32C3 output
Makefile Commands
- make: Compiles the software
- make upload: Flashes the software to the ESP32C3
- make clean: Removes compiled files
- make monitor: Opens a terminal to view the ESP32C3 output
- make flash: Flashes the software and opens the monitor
- make start: Cleans, compiles, flashes the software, and opens the monitor
Libraries Used
- ArrayList for dynamic arrays
- Button2 for button input handling
- Adafruit_VL53L0X for the distance sensor
- FastLED for LED control
For more details on the libraries, refer to the platformio.ini file.
https://github.com/Friedjof/GlowLight/?tab=readme-ov-file#software-installation
Development

The software is written in C++ and is structured as a typical PlatformIO project. The main file is src/main.cpp, which contains the setup and loop functions. The different modes, services, and the controller are implemented in separate files in the /lib folder.
Modes
Every mode is a class that inherits from the AbstractMode class. The abstract class already implements the basic functions that every mode should have. In every mode, the following functions must be implemented: setup, customFirst, customLoop, last, and customClick.
- setup: This function is called once when the mode is added to the controller when the lamp is turned on.
- customFirst: This function is called once when the mode is newly selected.
- customLoop: This function is called every loop iteration.
- last: This function is called once when the mode is removed from the controller.
- customClick: This function is called when a double click is detected from the button.
https://github.com/Friedjof/GlowLight/?tab=readme-ov-file#development