Skip to the content
2 layers59.2 × 42.9 mmSonoff, the printed circuit board in 3D

Simple sonoff PCB built around the ESP-01 devboard.

Size
59.2 × 42.9 mm
Copper layers
2
Thickness
1.6 mm
Parts
27
Nets
21
Pads
88
Tracks, vias
285, 28
Pours
1
Routed
Yes
KiCad
KiCad 8.0 (file 20240108)
Created
30 Mar 2022
Updated
17 May 2024

Overview

Sonoff is an open-source printed circuit board by LoZioo, from the LoZioo/DIY-Sonoff repository on GitHub, published under the MIT licence. It is a 2-layer board of 59.2 × 42.9 mm with 27 parts on 21 nets, routed with 285 tracks and 28 vias.

It is built around the HLK-2M03. Its parts include 3 resistors, 3 connectors, 2 capacitors, 2 diodes and 2 transistors. It belongs with the microcontroller boards boards and the ESP8266 boards of this library.

Main components

1

README

README.md

DIY-Sonoff

Simple sonoff based on the ESP-01 devboard.

Table of contents

Requirements

To download the needed KiCad libraries, you must cd schematics/lib and run the clone.sh script.

3D enclosure

The STL files for the 3D enclosure could be retrived here.

Assembly

  • You must check the size of the C2 capacitor before soldering it because it can be too high to be mounted under the ESP-01 module.
  • The R3 resistor must be mounted if you are going to use the RST pin on the J3 header, otherwise you can place a short circuit instead.
  • When you have finished mounting everything, you must map the ESP-01 GPIOs to the corresponding input and outputs.

GPIOs mapping

You can map the four ESP-01 GPIOs by using the solder pads JPx on the back of the PCB. For example, if you want to use the GPIO2 as an output to control the K2 relay, you can put a solder bridge on JP6 between the GPIO2 and OUT-2 labels. This feature has been introduced in this version because of the behaviour of the GPIOs during the bootloader stage and to make the circuit fully adaptable to every possible situation.

Inputs and outputs

On the PCB, the IN-x pads are shorted directly to the screw terminal J2, while the OUT-x pads are shorted to the gate pin of the corresponding Qx MOSFET.

ESP8266 bootloader GPIOs configurations

When booting an ESP8266 microcontroller, the bootloader reads the following pins to establish the boot configuration:

GPIO15GPIO0GPIO2Boot mode
LOWLOWHIGHSerial programming (bootloader mode)
LOWHIGHHIGHBoot from flash
HIGHANYANYBoot from SD card

Note: On the ESP-01 dev board, the GPIO15 is not exposed and is held low by the hardware, so you can ignore the first column.

Said that, when booting the already programmed module, you must ensure that the second column configuration is selected. That's accomplished by the resistors R1 and R2 on the PCB.

ESP8266 GPIOs behaviour

GPIOInputOutputBootloader behaviourNotes
GPIO0It must be held high during the boot phase. After, pulled up by R1.Pulled up at boot by R1. After, it's clean.Pulled up by R1Boot fails if pulled low.
GPIO1It must be held high during the boot phase.It's the UART TX pin and when booting, the bootloader sends out debug data for ~8ms. For that reason, you should not use that pin to control a relay.Bootloader UART debug outputBoot fails if pulled low. UART TX pin.
GPIO2It must be held high during the boot phase. After, pulled up by R2.Pulled up at boot by R2. After, it's clean.High at boot and pulled up by R2Boot fails if pulled low.
GPIO3CleanIt's the UART RX pin. It's should be high at boot but other than that, it's clean.High at bootUART RX pin.

Suggested configurations

Smart plug

\IN-1IN-2OUT-1OUT-2
GPIO0X
GPIO1
GPIO2X
GPIO3

Sonoff

\IN-1IN-2OUT-1OUT-2
GPIO0X
GPIO1X
GPIO2X
GPIO3X

Firmware

To control the board, you can:

  • Use a precompiled firmware like Tasmota or ESPHome.
  • Build your own firmware using Arduino, ESP8266 RTOS SDK, ESP8266 NonOS SDK...

Circuit and PCB

Circuit PCB PCB

Previews

Preview 1 Preview 2 Preview 3 Preview 4

References

Parts

27
QtyValueFootprintReferences
8SolderJumper_3_OpenJumper:SolderJumper-3_P1.3mm_Open_Pad1.0x1.5mmJP1, JP2, JP3, JP4, JP5, JP6, JP7, JP8
310kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P2.54mm_VerticalR1, R2, R3
21N4007Diode_THT:D_DO-41_SOD81_P2.54mm_Vertical_KathodeUpD1, D2
22N7000Package_TO_SOT_THT:TO-92_InlineQ1, Q2
2MountingHoleMountingHole:MountingHole_4.5mm_Pad_TopBottomH1, H2
2Relay_SPDTRelay_THT:Relay_SPDT_Omron-G5LE-1K1, K2
1100nFCapacitor_THT:C_Rect_L7.2mm_W2.5mm_P5.00mm_FKS2_FKP2_MKS2_MKP2C1
1100uFCapacitor_THT:CP_Radial_D6.3mm_P2.50mmC2
1Conn_02x03_Odd_EvenConnector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_VerticalJ3
1ESP-01_2x04ESP8266:ESP-01U1
1HLK-2M03Converter_ACDC:Converter_ACDC_Hi-Link_HLK-2MxxPS1
1LOGOLOGOG***
1Screw_Terminal_01x04TerminalBlock_4Ucon:TerminalBlock_4Ucon_1x04_P3.50mm_HorizontalJ2
1Screw_Terminal_01x06TerminalBlock:TerminalBlock_bornier-6_P5.08mmJ1

Similar boards

  • 2 layersIntegracion radio mas Reg ADC, the printed circuit board in 3D

    Integracion radio mas Reg ADC

    uri98/Radio-FM-and-voltage-regulator-integrated

    Integrated Radio PCB Design ## Objective Design of an integrated radio circuit focusing on signal integrity and noise reduction.

    19 parts
  • 2 layers47.6 × 27.3 mmMmc usb 1, the printed circuit board in 3D

    Mmc usb 1

    rusefi/rusefi

    rusefi - GPL internal combustion engine control unit

    27 parts1.2k
  • 2 layers77.4 × 77.4 mmCORAZON LEDS CON FADE, the printed circuit board in 3D

    CORAZON LEDS CON FADE

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    27 parts915
  • 2 layers44.2 × 29.3 mmI2c tiny usb, the printed circuit board in 3D

    I2c tiny usb

    harbaum/I2C-Tiny-USB

    Cheap and simple I²C to USB interface

    27 parts454
  • 2 layers22 × 42 mmNvme bm to e, the printed circuit board in 3D

    Nvme bm to e

    CRImier/MyKiCad

    My KiCad boards. Can't be bothered uploading individually anymore, so here you go.

    27 parts253GPL-3.0
  • 2 layers80 × 61 mmPicoProducer, the printed circuit board in 3D

    PicoProducer

    pjgpetecodes/pico-streamdeck

    This project is an OBS Controller using a Raspberry Pi Pico and CircuitPython.

    27 parts230MIT
  • 2 layers186 × 45 mmAddOnD, the printed circuit board in 3D

    AddOnD

    freeDSP/freeDSP-aurora

    freeDSP ADAU1452 with 8 analog input, 8 analog outputs, S/P-DIF I/O, ADAT I/O, USB Audio Class2, WiFi, Bluetooth

    27 parts226CC-BY-SA-4.0

Questions

How big is the Sonoff PCB?

It measures 59.2 × 42.9 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Sonoff use?

27 parts, built around the HLK-2M03. 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 Sonoff KiCad files?

From the LoZioo/DIY-Sonoff repository on GitHub, at the commit this page was made from: the board is schematics/sonoff.kicad_pcb and its schematic schematics/sonoff.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Sonoff 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).