100%
diy-sonoff sonoff view
Description

Imported from GitHub: michel-anglus/DIY-Sonoff · commit 7768594 · license MIT

Description

Simple sonoff PCB built around the ESP-01 devboard.

README

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

Comments
Sign in to comment

No comments yet. Be the first to ask about this board.