trailing-edge dimmer for LED bulbs
LEDDs is an open-source hardware, DIY, smart dimmer for 230 V LED bulbs. It is built around the ESP32-C3-12F and is designed to sit on a desk or table, replacing standard inline cord switches.
The project consists of a PCB, a 3D-printable chassis, and a top plate designed as a PCB. It runs ESPHome for integration with Home Assistant and features a rotary encoder so it can be controlled easily or used as a standalone device.

[!CAUTION]
MAINS VOLTAGE: This device operates at 230 VAC. Touching live components can result in serious injury or death.
- Only build if you have relevant experience with high-voltage electronics.
- Always unplug before opening!
- While the design includes safety features (fuse, MOVs), it is not a certified design and should be treated with caution.
Table of contents
Is this project for you?
This project is suitable if you:
- have experience with mains-powered electronics
- want a LED bulbs dimmer for a desk
This project is NOT suitable if you:
- are new to electronics
- need a certified wall dimmer
Why trailing-edge?
Most dimmers use leading-edge (TRIAC) dimming (designed for incandescent bulbs). They modulate power to the load by cutting the beginning of the AC half cycle. This creates a voltage spike that can cause buzzing and reduced lifespan in the capacitive power supplies found in LED bulbs.
LEDDs uses trailing-edge dimming. By using MOSFETs to cut the waveform at the end of the AC cycle, there isn't a positive voltage spike. This results in:
- reduced electrical noise and buzzing
- smoother dimming with reduced flicker
- lower minimum brightness levels
The schematic and PCB can be viewed in KiCanvas.
:star: Features
- ESP32-C3 based with ESPHome firmware for integration with Home Assistant
- Standalone operation, doesn't require Home Assistant
- Rotary encoder control: rotate to dim, press+rotate for effects, press for on/off
- LEDs: red (rotation feedback), blue (status indicator), white (ambient)
- Included enclosure design: 100 mm × 51 mm × 25 mm - ideal for desk lamp modifications
- Low idle power: ~0.3 W
- Open source: MIT licensed
:straight_ruler: Specifications
| Parameter |
Value |
| Input voltage |
230 VAC |
| Maximum output power |
100 W |
| Idle power draw |
~0.3 W |
| Protections |
fuse and MOVs |
| Microcontroller module |
ESP32-C3-12F [^1] |
| Dimensions |
100 × 51 × 25 mm (W × D × H) |
| Connectivity |
Wi-Fi, USB-C (programming) |
[^1]: Also compatible with ESP8266 ESP-12F, but not recommended.
[!IMPORTANT]
Designed for 230 VAC at 50 Hz.
Usage with 120 VAC at 60 Hz will probably require adjusting the component values of the zero-cross and the voltage regulator circuits.
Release/fabrication of v2.0
Status: Verified working.
The fabricated board from this release is fully functional. Minor issues may exist but do not affect operation: /doc/releaselog.md v2.0.
:memo: Recommended for fabrication.
:open_file_folder: Repository structure
├── hw/ # main PCB design (KiCad project)
│ ├── lib/ # symbols and footprints
│ ├── assets/ # fonts and graphics
│ └── export/ # scripts for exporting gerbers, BOM and schematics/PCB PDFs
├── fw/ # ESPHome YAML configurations and firmware binaries
├── doc/ # additional documentation
│ ├── releaselog.md # main PCB release log
│ ├── changelog.md # main PCB change log
├── enclosure/
│ ├── chassis/ # 3D printable chassis
│ │ ├── releaselog.md # chassis release log
│ │ ├── changelog.md # chassis change log
│ │ ├── vX.Y-variant_a/
│ │ └── vX.Y-variant_b/
│ └── top_plate/ # top plate design (KiCad project)
│ ├── releaselog.md # top plate release log
│ ├── changelog.md # top plate change log
│ ├── vX.Y-variant_a/
│ └── vX.Y-variant_b/
└── img/ # photos and renders
:euro: Bill of materials
- components: ~€15
- PCB: €4 (ordered as prototype board)
- top plate: €0-4 (can be combined with the main PCB)
- chassis: €4-10 (when ordered)
Check out the BOM provided in the release bundle for complete components list.
:hammer: Build
Overview
Building LEDDs consists of four main steps:
- Ordering the PCB, the chassis and the components.
- Assembling the PCB.
- Flashing and configuring the firmware.
- Wiring and final assembly.
Prerequisites
- skills: soldering [^2], experience with mains electricity
- tools: soldering iron, hot air gun (recommended), 3D printer or access to 3D printing service, multimeter
[^2]: Trickiest part is the USB-C port. The board can be ordered pre-assembled.
Download the release bundle.
1. Ordering the components
- PCBs: order the main PCB and the top plate PCB from your preferred fabricator
- gerbers for JLCPCB: available in the bundle
- for other fabricators - use KiCad to generate gerbers according to the manufacturer's instructions
- chassis: choose a variant from the provided STL files
2. PCB assembly instructions
[!TIP]
Use the provided interactive BOM ("ibom.html") as a soldering guide.
Microcontroller module
ESP32-C3-12F (recommended)
ESP8266 ESP-12F (not recommended)
- insulate pins 12 and 13 from the PCB pads using kapton/electrical tape
- solder JP2
- don't solder R13
- don't solder R6 and D3 ("led_1")
- don't solder R8 and D5 ("led_3")
ESP8266 doesn't support native USB and requires an external USB to serial adapter for programming.
Zero-cross optoisolator
The PCB has footprints for a choice between 2 optoisolators that connect the zero-cross signal to the MCU.
H11L1SR2M
- solder the optoisolator on footprint U4
- solder C13
PC817XI (not recommended)
- solder the optoisolator on footprint U3
- no need to solder C13
This optoisolator is the same as the one used for controlling the MOSFET's gate, but didn't work well for the zero-cross circuit.
Skipping the relay
The relay is used to power off the mains part of the circuit when the load is turned off. This is intended as a peace of mind feature and can be omitted.
- use a wire to short pin 11 to 14
- use a wire to short pin 21 to 24
- no need to solder C3, D2, R2 and Q1
Skipping the rotary encoder
If the rotary encoder is not required - solder a push button (SW2) so boot mode can be entered manually.
- no need to solder R3, R4, C4, C5 and C6
A modified top plate (without a hole in the middle) is recommended for safety reasons (not currently available).
Using the UART header instead of the USB for programming (not tested)
- solder R12
- solder header J4
- no need to solder R9 and R10
Use a USB to serial adapter.
3. Flashing the firmware
- Connect to the board via USB-C.
- Use ESPHome's web flasher to upload one of the provided firmware binaries.
- hass.bin: Home Assistant + rotary encoder
- web_server.bin: self hosted web server + rotary encoder
- standalone: rotary encoder only
- Set your Wi-Fi credentials using the ESPHome web flasher.
- Test before wiring.
[!TIP]
The YAML configurations of the provided binaries are available under /fw/esphome/yaml/.
4. Preparing the enclosure
- plastic chassis: install the heat-set threaded inserts in the holes using a soldering iron
- resin chassis: no preparation needed
5. Final assembly
- Mount a knob to the rotary encoder.
- Place the PCB inside the chassis.
- Screw the mains power cable to the terminal on the left (marked with a power plug). Don't connect power until fully assembled.
- Screw the lamp socket cable to the terminal on the right (marked with a bulb).
- Pass the screws through the top plate and place the spacers on the screws.
- Screw the top plate through the PCB into the chassis.
:bulb: Usage
Control
Directly (possible with all firmware variants):
- press: on/off
- rotate: brightness adjustment
- press + rotate: cycle lighting effects
Home Assistant (included in hass.bin):
Integrating the device in Home Assistant: https://esphome.io/guides/getting_started_hassio/#connecting-your-device-to-home-assistant.

The "Configuration" section allows customization of the device:
- Bulb power rating: input the power rating of the bulb, this is used for the power estimation sensor ("Power [est]").
- Gamma correct: Adjust the dimming curve to appear linear to the human eye.
- Minimum level: The lowest level at which the bulb emits light. Note: this value needs to be updated every time gamma correction is changed.
- Restore mode