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.
- Is this project for you?
- Why trailing-edge?
- Features
- Specifications
- Release/fabrication of version 2.0
- Repository structure
- Bill of materials
- Build
- Usage
- Versions, releases and compatibility
- Contributing
- License
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
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.
- 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
| 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) |
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.
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.
π Recommended for fabrication.
βββ 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
- 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.
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.
- skills: soldering 2, experience with mains electricity
- tools: soldering iron, hot air gun (recommended), 3D printer or access to 3D printing service, multimeter
Download the release bundle.
- 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
Tip
Use the provided interactive BOM ("ibom.html") as a soldering guide.
ESP32-C3-12F (recommended)
- solder R13
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.
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
- don't solder R23
PC817XI (not recommended)
- solder the optoisolator on footprint U3
- solder R23
- 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.
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
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).
- solder R12
- solder header J4
- no need to solder R9 and R10
Use a USB to serial adapter.
- 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/.
- plastic chassis: install the heat-set threaded inserts in the holes using a soldering iron
- resin chassis: no preparation needed
- 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.
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: Initial state of the bulb when powered.
- Transition length: How fast the bulb changes brightness in milliseconds.
- LED: red/blue/white: set the ambient brightness of the LEDs.
Web server (included in web_server.bin):
This is useful if you don't have Home Assistant, but want to control the device remotely.
There are three LEDs on the board:
- red (top, led_1): ambient / rotation feedback
- blue (top, led_2): ambient / status indicator
- white (bottom, led_3): ambient
Light effects can be cycled with the rotary encoder or chosen directly from a UI.
- Pulse (low, fast)
- Pulse (low, slow)
- Pulse (high, fast)
- Pulse (high, slow)
- Pulse (full, fast)
- Pulse (full, slow)
- Flicker (soft)
- Flicker (intense)
Each fabrication run results in a GitHub release.
- Semantic versioning (major.minor), no patch versions.
- PCB, chassis, and top plate are versioned independently.
- Same major versions fit together.
Every type of contribution is welcome, like improvements or corrections to the:
- schematic/PCB design
- documentation
- enclosure (chassis and top panel) design
- ESPHome configuration
Contributions can be made as improvements or as variants (e.g. different enclosure design, ESPHome configuration, etc.).
gitGraph
commit tag: "v1.0"
branch improve_x
checkout improve_x
commit id: "Improve x"
commit id: "Re-generate exports"
commit id: "Update board documentation"
checkout main
merge improve_x tag: "v1.1"
branch replace_y
checkout replace_y
commit id: "Replace y"
commit id: "Generate exports"
commit id: "Compile binaries"
commit id: "Update all documentation"
checkout main
merge replace_y tag: "v2.0"
You're welcome to post your builds in Discussions: Show and tell.
This project is licensed under the MIT License.
Disclaimer: This project involves mains voltage electricity. The author assumes no liability for injury, damage, or regulatory violations. Build and use at your own risk. Ensure compliance with local electrical codes and regulations.











