Skip to content

This repository contains the software, schematics, and 3D printing files for a bedside lamp with various modes controlled by a button. It includes details on hardware components, software installation using PlatformIO or Makefile, and 3D printing instructions

License

Notifications You must be signed in to change notification settings

Friedjof/GlowLight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

70 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒŸ GlowLight - Smart Mesh Bedside Lamp

License: GPL v3 Platform: ESP32-C3 Framework: Arduino

A beautiful, smart bedside lamp with mesh networking capabilities, gesture controls, and multiple lighting modes. Built on ESP32-C3 with 3D-printed components and WS2812B LED strips.

๐Ÿ“‹ Table of Contents

โœจ Features

  • ๐ŸŽจ Multiple Lighting Modes: Static colors, rainbow, beacon, candle effect, and more
  • ๐Ÿค Mesh Networking: Synchronize multiple lamps wirelessly
  • ๐Ÿ‘‹ Gesture Control: Hand proximity sensing with VL53L0X distance sensor
  • ๐Ÿ”˜ Physical Controls: Simple button interface for mode switching
  • ๐Ÿ  3D Printable: Complete STL files for custom lamp housing
  • ๐Ÿ”ง Easy Setup: One-command installation with interactive configuration
  • ๐Ÿ“ฑ Device Management: Automatic ESP32 detection and flashing
  • ๐Ÿ’พ Backup System: Configuration backup and restore

๐ŸŽญ Available Lighting Modes

Active Modes

  • ๐ŸŽจ StaticMode: Single solid color with full brightness control
  • ๐ŸŒˆ ColorPickerMode: Cycle through color spectrum with distance sensor
  • ๐ŸŒˆ RainbowMode: Classic flowing rainbow effect with speed control
  • โœจ RandomGlowMode: 10-color random transitions with zen to party speeds
    • NEW v3.3.0: Enhanced with 10 scientifically distributed colors (every 36ยฐ in HSV space)
    • Features: Pause/transition cycles, inherited brightness control, mesh synchronization
    • Speed modes: Zen (meditative) โ†’ Normal โ†’ Lebendig (energetic) โ†’ Hektisch (party)

Development Modes (Commented)

  • ๐Ÿ•ฏ๏ธ CandleMode: Realistic candle flicker simulation
  • ๐Ÿšจ BeaconMode: Beacon/alert patterns for notifications
  • ๐ŸŒ… SunsetMode: Natural sunset simulation for bedtime
  • ๐Ÿ’ซ StrobeMode: Synchronized strobe effects across mesh network
  • ๐ŸŽฎ MiniGame: Interactive games using distance sensor

Note: Development modes are available in the codebase but commented out in main.cpp. Uncomment to enable additional lighting effects.

๐Ÿ“ธ Gallery

Assembled Lampshade Rainbow Mode USB-C Port

-> Rainbow Mode Demo Video

Modes

This is an overview of the different modes available in the lamp. The modes can be toggled using the button.

๐Ÿ”— Mesh Communication (NEW)

Communication

-> Mesh Network Demo Video

Now you can configure a mesh network between the lamps. The lamps can communicate with each other and synchronize the modes. The communication is done using the PainlessMesh library.

You can set the mesh SSID and password in the include/GlowConfig.h file. The default values are GlowMesh and GlowMesh. This authentication is necessary to prevent unauthorized access to the mesh network and allows you to split the network into different groups.

๐Ÿ”ง 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

Main Components

Main Components

Tools and Materials

  • 3D printer + filament (white and a color of your choice)
  • Soldering iron + solder
  • 2x Heat shrink tube
  • Screwdriver

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.

Printed Parts Assembled Lamp Base Final Assembly

Soldering

The components are connected to the ESP32C3 using the following diagram:

Soldering Diagram

The Button does not require a resistor, as the ESP32C3 has internal pull-up resistors.

This table also shows the connections:

Component Pin ESP32C3 Pin
Button 1 GND
2 GPIO 4
VL53L0X VCC 5V
GND GND
SDA GPIO 6
SCL GPIO 7
WS2812B VCC 5V
GND GND
DI GPIO 3

The VL53L0X is the distance sensor, the WS2812B is the LED strip, and the Button is the push button.

Button, Sensor, ESP32C3, and LED Wiring Setup

Threaded Insert

To attach the lampshade to the base, a threaded insert is used. The insert is placed in the base, and the lampshade is screwed onto it.

Thread Insertion Soldering Lid Attachment Screw Bottom Side

๐Ÿš€ Quick Setup

Setup Script

Get started in just one command! The GlowLight setup system will guide you through the entire installation process:

curl -fsSL https://raw.githubusercontent.com/friedjof/GlowLight/master/install.sh > install.sh && bash install.sh

Alternative download method:

wget https://raw.githubusercontent.com/friedjof/GlowLight/master/install.sh && bash install.sh

What the installer does:

  1. ๐Ÿ” Checks system requirements (Python 3.8+, Git)
  2. ๐Ÿ“ฆ Installs dependencies automatically for your OS (Ubuntu/Debian, Fedora, Arch, macOS)
  3. ๐Ÿ“‚ Downloads the GlowLight project to ~/GlowLight
  4. ๐Ÿ› ๏ธ Launches the interactive setup system with a beautiful menu interface

Interactive Setup Features:

  • โš™๏ธ Project Configuration: Set up mesh network and GPIO pins with guided wizards
  • ๐Ÿ”จ Build & Flash: Compile and upload firmware to your ESP32-C3 with one click
  • ๐Ÿ“ฑ Device Management: Automatic ESP32 device detection and management
  • ๐Ÿ“บ Serial Monitor: Real-time device monitoring with logging
  • ๐Ÿ”ง PlatformIO Setup: Automatic PlatformIO installation and management
  • ๐Ÿ’พ Backup System: Configuration backup and restore functionality

Manual Installation

If you prefer to set up manually:

# Clone the repository
git clone https://github.com/friedjof/GlowLight.git
cd GlowLight

# Run the setup system
python3 scripts/setup.py

๐Ÿ“ฆ Software Installation (Advanced)

This is a PlatformIO project. The setup system above handles everything automatically, but for manual installation, 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

For more details on the libraries, refer to the platformio.ini file.

๐Ÿ‘จโ€๐Ÿ’ป 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.

Classes

Classes

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.

๐Ÿ“„ License

This project is licensed under the GNU General Public License v3.0. For more information, see the LICENSE file.


โš ๏ธ Beta Notice

This is a beta version of the project. The software is still under development, and the hardware may require some adjustments. I cannot guarantee that the project will work as expected and will not be responsible for any damage caused by the project.

๐ŸŽฏ Quick Start Reminder

New to GlowLight? Get started with just one command:

curl -fsSL https://raw.githubusercontent.com/friedjof/GlowLight/master/install.sh | bash

The setup system will guide you through everything! ๐Ÿš€

About

This repository contains the software, schematics, and 3D printing files for a bedside lamp with various modes controlled by a button. It includes details on hardware components, software installation using PlatformIO or Makefile, and 3D printing instructions

Topics

Resources

License

Stars

Watchers

Forks