ct-Open-Source / tuya-convert

A collection of scripts to flash Tuya IoT devices to alternative firmwares
MIT License
4.65k stars 499 forks source link

TW-02-based (WinnerMicro W600-based) smart socket #572

Closed reivilibre closed 4 years ago

reivilibre commented 4 years ago

I have a Tuya-based smart socket which unfortunately turned out not to be ESP8266-based (woops, I didn't realise they existed and so didn't pay much attention when ordering).

I cracked it open.

Turns out it is based on a ESP-alike 'TW-02' module which uses the ARM-based W600. W600 seems to have MicroPython ports and so on — I believe it should be possible to find/make firmware images for it if it comes to it.

So my question now would be — can we get tuya-convert to flash it?

I don't see anything in the code that would fundamentally stop an attempt to flash an ESP image to a non-ESP board, though warnings are produced.

However, it seems to me that the same API call is being made again and again — see logs, it feels as though it isn't progressing and even if I had a W600-compatible firmware image, it wouldn't get around to using it.

I have never seen tuya-convert against an ESP device and don't know where to start with this endeavour – if it is at all possible.

Do you have any more insight?

smarthack-mqtt.log smarthack-psk.log smarthack-udp.log smarthack-wifi.log smarthack-web.log

deiger commented 3 years ago

@ceaswaran it seems it would be cleaner to replace with a Tuya TYWE2S, as it can be soldered right in place of the current module. The only place I could find it for sale though is here.

guilfer-dev commented 3 years ago

@ceaswaran it seems it would be cleaner to replace with a Tuya TYWE2S, as it can be soldered right in place of the current module. The only place I could find it for sale though is here.

Way easier! =) Thank you!

CValdec commented 3 years ago

Hi!

I'm trying to substitute a TW-02 in a plug with an esp8285 based ESP-M4. The contacts in my board are the same as @Hendrikdenhond shows. I've configured all the inputs: Capture+_2020-12-07-00-35-21

When I plug anything I get an accurate voltage reading, but no reading on power or current: Capture+_2020-12-07-00-43-53

Any thoughts about what can be happening here? I've double and triple checked the connections among BL0937 and my ESP

Hendrikdenhond commented 3 years ago

Did you put a load (lamp, device, etc...) in your plug?

Did you connect the contacts of the plug to the right I/O on your board based on your configuration? Config of your tasmota looks different from mine...

CValdec commented 3 years ago

When the screen capture was done, a 50W led focus was connected to the plug. When the relay is open, the focus lights and the voltage reading begins, but nothing on power or current.

I've checked several times all the connections with a multimeter from the pins of the BL0937 to the GPIOs I've assigned. I've tested changing the GPIOs used in my ESP. At the very beginning I assigned the button to GPIO13, but I moved it to GPIO0 just to have another free GPIO and moved the SEL to GPIO13, playing with GPIOs 4, 5 and 12 with CF and CF1.

I think the configuration screen was modified in 9.1.0 tasmota version. Just in case I'm gonna try flashing an elder version (8.4.0)

Hendrikdenhond commented 3 years ago

As the voltage and current reading uses the same pin (CF1)but it changed by the selection (sel) pin. I would take a close look if the SEL pin and the CF pin are connected good and set to the right gpio.

CValdec commented 3 years ago

I think I've just found a bug in the 9.1.0 version. I've flashed the 8.4.0 version and now it works flawless.

I have not changed anything else. Fortunately I have solved it, it was driving my crazy Capture+_2020-12-07-10-07-24

potados99 commented 3 years ago

Hi!

I've recently got a 12V LED dimmer from aliexpress. I opened it up, and fount that it had TW-03 inside. I felt no hope in re-flashing the MCU for use of tuya-convert and ESP Home, so I decided to replace it with my ESP-01.

IMG_3911

Screen Shot 2021-04-28 at 2 32 27 PM

The LED was driven by an N-channel MOSFET(AO3414), and the gate of the FET was controlled by PB8 pin of the MCU. The pin was also pulled down to ground. Since the GPIO of the ESP will be low at the boot due to the pull-down, I used GPIO3(Rx) to control the FET.

IMG_3913

IMG_3916

IMG_3918

IMG_3920

I desoldered the TW-03 and placed ESP-01 with proper connections. And it worked.

Hope this helps someone, and thank you @Hendrikdenhond for encouraging me!

satbeppo commented 2 years ago

I got an ELIVCO Model: LSPA9 and replace Chip with a TYWE2S.

The Metering Chip is a BL0942 an I get it finally to work.

Here is my config. EliVCO LSPA9 with BL0942

i hope it could help someone

jtauscher commented 1 year ago

If anyone is interested in reflashing the TW-02 / W600 Chip with "Tasmota-like" firmware, I did it like this:

  1. Download wm_tools from https://github.com/w600/wm_tools
  2. Get firmware e.g. "OpenW600_1.15.514.fls" from https://github.com/openshwprojects/OpenBK7231T_App/releases for w600
  3. Connect 3.3V (or 5V before voltage regulator) , GND, Rx/Tx to any UART converter
  4. Open CMD and erase chip like C:\tmp>wm_tools.exe -p COM4 erase_flash . (For me it only worked without specifying baud rate in a explicit way)
  5. Flash firmware like C:\tmp>wm_tools.exe -p COM4 write_flash OpenW600_1.15.514.fls. If it returns error, either reset device or try erasing chip again.

Pin config in W600:

PA5 -> Btn PB8 -> LED_n PB13 -> BL0937CF1 PB15 -> Relay PB16 -> BL0937SEL PB18 -> BL0937CF

For CB2S Chips check the openBK project: https://github.com/openshwprojects/OpenBK7231T_App