Skip to the content
PCBKitNew board
2 layers95 × 46 mmLEDDs, the printed circuit board in 3D

PCB and enclosure design of a trailing edge light bulbs dimmer

Size
95 × 46 mm
Copper layers
2
Thickness
1.1 mm
Parts
91
Nets
59
Pads
252
Tracks, vias
460, 92
Pours
66
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
22 Feb 2025
Updated
7 Mar 2026

Overview

LEDDs is an open-source printed circuit board by VasilKalchev, from the VasilKalchev/LEDDs repository on GitHub, published under the MIT licence. It is a 2-layer board of 95 × 46 mm with 91 parts on 59 nets, routed with 460 tracks and 92 vias.

It is built around the HLK-PM03, AP2112K-3.3 and ESP32-C3-12F, with the H11L1SR2M, 1N4148W and MMBT3904 among its other parts. Its parts include 31 resistors, 16 capacitors, 13 diodes, 6 transistors and 5 ICs. It belongs with the home automation and IoT boards and the ESP32 and RISC-V boards of this library.

Main components

10

README

readme.md

LEDDs

trailing-edge dimmer for LED bulbs

schematic_pcb firmware chassis

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.

ledds

[!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

ParameterValue
Input voltage230 VAC
Maximum output power100 W
Idle power draw~0.3 W
Protectionsfuse and MOVs
Microcontroller moduleESP32-C3-12F 1
Dimensions100 × 51 × 25 mm (W × D × H)
ConnectivityWi-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.


Release/fabrication of v2.0

Status: Stable

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

text
├── 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:

  1. Ordering the PCB, the chassis and the components.
  2. Assembling the PCB.
  3. Flashing and configuring the firmware.
  4. 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

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.

interactive BOM preview

Microcontroller module

ESP32-C3-12F (recommended)

esp32-c3-12f
  • solder R13
ESP8266 ESP-12F (not recommended) esp-12f
  • 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

h11l1
  • solder the optoisolator on footprint U4
  • solder C13
PC817XI (not recommended) pc817
  • 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.

relay
  • 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
boot button

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)
uart
  • 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.

screenshot of the device in 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.

screenshot of the web UI

LED indicators

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

Default light effects

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)

:page_with_curl: Versions, releases and compatibility

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.

:coffee: Contributing

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.).

mermaid
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.

License

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.

Footnotes

  1. Also compatible with ESP8266 ESP-12F, but not recommended. ↩

  2. Trickiest part is the USB-C port. The board can be ordered pre-assembled. ↩

Parts

91
QtyValueFootprintReferences
820kResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR3, R4, R5, R11, R12, R13, R23, R25
7100nCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC3, C4, C5, C6, C10, C13, C14
61N4148WDiode_SMD:D_SOD-123D2, D6, D7, D8, D9, D10
420kResistor_SMD:R_1206_3216Metric_Pad1.30x1.75mm_HandSolderR28, R29, R30, R31
491kResistor_SMD:R_1206_3216Metric_Pad1.30x1.75mm_HandSolderR16, R17, R18, R19
31uCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC7, C8, C9
320mmMountingHole:MountingHole_3.2mm_M3_DIN965_Pad_TopBottomH1, H2, H3
3240Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR6, R8, R22
3MMBT3904Package_TO_SOT_SMD:SOT-23Q1, Q2, Q3
20Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR14, R15
2100nCapacitor_THT:C_Rect_L13.0mm_W6.0mm_P10.00mm_FKS3_FKP3_MKS4C1, C15
2275VVaristor:RV_Disc_D9mm_W3.5mm_P5mmRV1, RV2
230Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR24, R26
2330Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR1, R2
25k1Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR9, R10
2IPN80R900P7Package_TO_SOT_SMD:SOT-223-3_TabPin2Q5, Q6
2PC817XIPC817XI:SOIC254P975X460-4NU3, U5
2Screw_Terminal_01x02TerminalBlock:TerminalBlock_bornier-2_P5.08mmJ1, J5
2UF4004UF4004:DIOAD1055W87L533D272D11, D12
2~Button_Switch_SMD:SW_Push_SPST_NO_Alps_SKRKSW1, SW2
1100kResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR21
110uCapacitor_SMD:CP_Elec_5x5.7C12
1120Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR7
1220Resistor_SMD:R_1206_3216Metric_Pad1.30x1.75mm_HandSolderR27
1220uCapacitor_SMD:CP_Elec_8x6.5C2
1330uCapacitor_SMD:CP_Elec_8x10C16
14.7nCapacitor_SMD:C_1206_3216Metric_Pad1.33x1.80mm_HandSolderC11
1500mAFuse:Fuse_Schurter_UMZ250XF1
156kResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR20
1AP2112K-3.3Package_TO_SOT_SMD:SOT-23-5U1
1BZV55C15Diode_THT:D_DO-41_SOD81_P7.62mm_HorizontalD13
1Conn_01x02_PinConnector_PinSocket_2.54mm:PinSocket_1x02_P2.54mm_VerticalJ2
1Conn_01x06Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ4
1ESP32-C3-12FESP32-C3-12F:ESP32-C3-12F_RFSU2
1GNDDTestPoint:TestPoint_Pad_D1.0mmTP1
1H11L1SR2MH11L1SR2M:IC_H11L1SR2MU4
1HLK-PM03Converter_ACDC:Converter_ACDC_Hi-Link_HLK-PMxxA1
1MMBT3906Package_TO_SOT_SMD:SOT-23Q4
1Relay_DPDTRelay:HK19FK1
1RotaryEncoder_SwitchRotary_Encoder:RotaryEncoder_Alps_EC11E-Switch_Vertical_H20mmRE1
1SolderJumper_2_BridgedJumper:SolderJumper-2_P1.3mm_Bridged_RoundedPad1.0x1.5mmJP1
1SolderJumper_2_OpenJumper:SolderJumper-2_P1.3mm_Open_RoundedPad1.0x1.5mmJP2
1USB_C_Receptacle_USB2.0_14PConnector_USB:USB_C_Receptacle_GCT_USB4110J3
1blueLED_SMD:LED_0805_2012Metric_Pad1.15x1.40mm_HandSolderD4
1high voltage signLOGOSS1
1redLED_SMD:LED_0805_2012Metric_Pad1.15x1.40mm_HandSolderD3
1whiteLED_SMD:LED_0805_2012Metric_Pad1.15x1.40mm_HandSolderD1
1~LED_SMD:LED_0805_2012Metric_Pad1.15x1.40mm_HandSolderD5

Questions

How big is the LEDDs PCB?

It measures 95 × 46 mm and has 2 copper layers, 1.1 mm thick.

What parts does the LEDDs use?

91 parts, built around the HLK-PM03, AP2112K-3.3, ESP32-C3-12F and H11L1SR2M. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the LEDDs KiCad files?

From the VasilKalchev/LEDDs repository on GitHub, at the commit this page was made from: the board is hw/LEDDs.kicad_pcb and its schematic enclosure/top_plate/v2.0-bicycle/hw/top_plate.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the LEDDs design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).

Similar boards

  • 2 layers96.5 × 53.3 mmNodeVote, the printed circuit board in 3D

    NodeVote

    phong516/iotVisionLab

    3 parts
  • 2 layers24.5 × 15.2 mmMidi io, the printed circuit board in 3D

    Midi io

    Harvie/Designs

    Plans of physical things that i've designed

    13 parts3
  • 4 layers100 × 60 mmPikocore gamepad, the printed circuit board in 3D

    Pikocore gamepad

    sebasdv/pikocore_gamepad

    Fork of pikocore ported to run on the Waveshare RP2350-PiZero + GamePi13 handheld — full-color LCD dashboard, 12-button menu, and save/load state on a lo-fi sampler that was originally knob-only.

    76 partsMIT
  • 2 layers105.5 × 81.1 mmBuck, the printed circuit board in 3D

    Buck

    almondsun/DynamicSystemsAndControl

    Dynamic Systems and Control coursework: Buck converter modeling, reports, KiCad PCB and STM32 firmware

    57 parts
  • 2 layers124.5 × 99.1 mmVetrnik power, the printed circuit board in 3D

    Vetrnik power

    ondras12345/vetrnik

    Electronics for heating water with power from a 2 kW wind turbine

    138 parts
  • 2 layers60 × 43 mmNixie 2, the printed circuit board in 3D

    Nixie 2

    christianjanev/nixie

    27 parts
  • 4 layers42.4 × 66.1 mmNB IoT PCB rev 1 1, the printed circuit board in 3D

    NB IoT PCB rev 1 1

    JurCag/NB_IoT_app

    Project utilizes NB-IoT technology to transmit sensory data to the cloud, while simultaneously enabling local communication through BLE mesh.

    58 parts3
  • 2 layers146.6 × 112.5 mmBody Control Module, the printed circuit board in 3D

    Body Control Module

    Mustafa614/Body-Control-Module-Mini

    This Module are controlling wipers,baclights,door statues and comminicates with another ecu's via can bus

    74 parts