Module is based on WiFi Curtain Blind Switch module from LoraTap.
Module’s main controller is a TYWE2S, based on ESP8285.
The great thing about this module, is a full and independent access to relays and GPIO’s. Means with custom firmware it’s possible to turn it into two-channel light switch. Though it’s also possible to make a mistake in relays-control logic – it’s possible to close both relays and burn blinds engine. Therefore we gonna be carefull 🙂
There are two versions of the module in the official store: V1 and V2. I’ve ordered and inspected both of them. I can tell that quality of V2 is higher – soldering is cleaner, cuts are more precise. Though schematics and components are exactely same in both versions. The main difference is in the firmware. V2 supports switch-buttons, while V1 work properly with toggle buttons. But I don’t think it makes a big deal here, as we are going to flash own firmware anyways. In my opinion it doesn’t really makes sense to pay extra for ‘perfect cuts’.
Original firmware isn’t interesting for us. It operates through tuya-cloud. First of all it’s requires permanent internet-connection. Then it might get communication delays. Also it’s not so easy to get control from own software (though community are reverse engeneering). Last but not least, I don’t entrust external access to my private zone. Therefore gonna nail it. 🙂
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 |
3 | out | LED (1 – off, 0 – on) |
4 | in | switch S1 (1 – released, 0 – pressed) |
5 | in | switch S2 (1 – released, 0 – pressed) |
12 | out | relay L1 (0 – open, 1 – close) |
13 | in | pairing button (1 – released, 0 – pressed) |
14 | out | relay L2 (0 – open, 1 – close) |
It’s easy to solder connection wires. During development and testing I was using following setup (be carefull with 220v connection! don’t forget to disconnect FTDI from computer. It’s disconnected on the picture)
Set following parameters in the Arduino Studio:
Generic ESP8285 Module, CPU 80MHz, Crystal 26MHz, Flash Size 1MB
Gonna flash two options: