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.

| 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






