Dozy – multiway switch on DIN rail hardware

Module is based on Chinese “Smart Timer Staircase Din Rail Time Switch” ATMS1601.

Module’s main controller is a TYWE2S, based on ESP8285.

Original firmware operates through tuya-cloud. Like Dorfl/Detrius and Dee, we’ll be flashing custom firmware.

To flash firmware we need an RS232 interface with 3.3v. I was using FTDI.

We need 5 connection points.

TYWE2SFTDI
VCCVCC
GNDGND
RXTX
TXRX
IO0GND

Connection is pretty simple. Don’t forget to set 3.3v on FTDI! It’s necessary to pull IO0 to GND to boot in flash-mode.

Following GPIO’s are used in the module:

GPIOModeDescription
4outgreen LED (1 – off, 0 – on)
5outred LED (1 – off, 0 – on)
12outrelay (1 – open, 0 – closed)
13inbutton/switch (0 – released, 1 – pressed)

Set following parameters in the Arduino Studio:
Generic ESP8285 Module, CPU 80MHz, Crystal 26MHz, Flash Size 1MB

Firmware:

Leave a Reply