Module is based on Chinese “Smart Timer Staircase Din Rail Time Switch” ATMS1601.
Module’s main controller is a TYWE2S, based on ESP8285.
![](http://de.ibn.by/wp-content/uploads/2021/04/dozy_tywe2s-300x288.jpg)
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.
![](http://de.ibn.by/wp-content/uploads/2020/02/ftdi-300x226.jpg)
We need 5 connection points.
![](http://de.ibn.by/wp-content/uploads/2021/04/dozy_contacts.jpg)
TYWE2S | FTDI |
VCC | VCC |
GND | GND |
RX | TX |
TX | RX |
IO0 | GND |
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:
GPIO | Mode | Description |
4 | out | green LED (1 – off, 0 – on) |
5 | out | red LED (1 – off, 0 – on) |
12 | out | relay (1 – open, 0 – closed) |
13 | in | button/switch (0 – released, 1 – pressed) |
Set following parameters in the Arduino Studio:
Generic ESP8285 Module, CPU 80MHz, Crystal 26MHz, Flash Size 1MB
![](http://de.ibn.by/wp-content/uploads/2020/02/Arduino-1.8.10.png)