SMART LAMP
A biologically optimised light therapy lamp for the dark Danish winter.
PCB Design · Thermal Management · Gemini API · USB-C PD
The Problem
Over 10% of Danes suffer from winter depression (Seasonal Affective Disorder / SAD). In the dark Danish winter, with typical working hours from 8 to 16, natural sunlight exposure is critically low. While consumers turn to commercial 10W RGB LED wake-up lamps, these rely on narrow-band semiconductor LEDs that emit high-intensity blue light spikes to suppress melatonin and force waking, but they emit virtually zero Near-Infrared (NIR) energy (700nm to 1400nm).
This creates what Professor Glen Jeffery (UCL) identifies as an "Infrared Famine". Research shows that this NIR deficit causes a mitochondrial decline and metabolic deficiency. Exposure to long wavelength lighting within the first hours of waking increases the release of cholesterol, which is beneficial in numerous ways. Additionally, using bedside LED lighting in the evening suppresses melatonin negatively impacting the transition to sleep. A blackbody radiator does not have this effect, making it a very intuitive bedroom desk lamp replacement.
The Hypothesis
A hybrid lysterapi (light therapy) system combining high-CRI LEDs with a black-body radiator (tungsten-halogen) can deliver the full solar spectrum (400nm to 1500nm+). By using a HUSB237 negotiator to request 20V and high current from a standard USB-C PD power supply we can build a safe and biologically optimal wake-up lamp.
To validate this, we set out to build an ESP32-S3 controlled smart lamp:
- Negotiating 20V from standard USB-C PD chargers and driving halogen PWM dimming with soft-start logic to protect the filament.
- Managing halogen heat (>200°C) safely through a Scandinavian CNC-milled wood base and a passive, convection-cooled brushed aluminum top plate.
- Implementing zero-friction local controls, including double-clap triggers and voice-control without requiring a mobile app.
Iteration Log
V1 — Halogen driving PoC
The original proof-of-concept featured a classic ESP32, a 1.14" Tenstar T-Display, a mechanical analog joystick, and two series-connected 12V halogen bulbs.
Feedback: The user interface was intuitive, but incorporating the joystick in a clean design was troublesome. PCB got very hot due to radiation from halogen bulbs and high switching losses in the mosfet without using gate driver.
V2 — Voice Input and premium design
Input was changed to premium-feeling rotational encoder for single component input mechanism. An intuitive UI is made based on just turning, short press, double press and long press of the encoder. The single input system means changing multiple settings can be cumbersome. To address this, voice command entry (e.g., "Set alarm for 07:30") and double-clap triggers was added with a MEMS microphone module.
Initially, we implemented a local keyword spotting neural network (using Edge Impulse) running locally on the ESP32-S3. This leverages the fact that the sentence "set alarm" is identical in many languages, meaning a single wake word detection algorithm could be used for many languages. Although elegant, this means the device would always be "listening", which is not great in a bedroom. Instead, the microphone is only waken up by a double press which enabled a 5s recording that is sent to the Gemini API along with a prompt to return a certain format.
Alarm configurations are saved to the ESP32's non-volatile storage to save user input across power ups, reducing friction. The enclosure transitioned from simple 3d printed case to a wood base with a thick brushed aluminum top plate acting as a passive heatsink.
These are technically not v2, but rather v1.5 as this was a test for plastic with wooden "tape" around it. Functionally v2, but without paying up for wooden boxes and metal lid. Real v2 pictures coming soon.
Technical Build
Electronics & PCB
- Power Negotiation: HUSB237 chip configured to request 20V @ 5A from a standard USB-C PD charger.
- Switching: Low-side dimming with high-power N-channel MOSFETs driven by microcontroller through a gate driver is used for both LED and halogen light sources.
- Voltage Rails & MCU: LM2596 buck converter steps down 20V VCC to 5V to power the Waveshare ESP32-S3 with integrated 1.47" LCD display.
- Audio Capture: Knowles SPH0645LM4H-B omnidirectional I2S MEMS microphone.
- Custom PCB design: using EasyEDA and assembly by JLCPCB.
DSP Audio Pipeline
- Dual-Core Execution: Core 0 runs the UI and handles EC11 encoder interrupts. Core 1 runs the networking and audio tasks.
- Local Clap Detection: Core 1 continuously processes 1600-sample chunks of I2S microphone data. It calculates the raw signal peak and Root Mean Square (RMS). A transient spike with
peak > 11000andrms < 5000is flagged. If a double peak is detected within a 200ms–800ms window, the system flips a flag to shut off the lamp and dismiss active alarms. - Gemini Speech-to-Intent: Double-clicking the encoder button initiates recording. The ESP32-S3 records 5 seconds of audio into PSRAM, applies 6x software gain, downsamples from 16kHz to 8kHz, packages it with a 44-byte WAV header, base64-encodes it, and posts the JSON payload directly to the Google Gemini API. The system prompt instructs Gemini to output only
HH:MMvalues in JSON, which are then displayed on screen and used to change alarm settings.
Mechanical / Enclosure
- Thermals: Halogen bulbs operate at temperatures >200°C and the high power LEDs need to dissipate up to 50W of heat at maximum brightness. A brushed aluminum top plate is utilized as a massive passive heatsink to dissipate heat from halogen bulb mount and the PCB via natural convection.
Time Investment
| Phase | Hours (approx) |
|---|---|
| V1 | 50 |
| V2 | 30 |
| V3 | 25 |
| Total | 105 |