Cheap UK WiFi Bulbs with Tasmota - teardown help (TYWE3S)

15192163788186635548458717434888
These are not my modifications. Came like this, the bulb used to restart randomly.

Tuya only produces these modules. You can find the exact same module on bulbs as well as smart plugs. They all run different firmware. I think the OEM is “sunyesmart”. The vendor I got mine from, seems to be a reseller.

Hi! Any news on the espurna pull request? Thanks!

Hi,
I have accidently got this lamp from ebay (was searching for Sonoff B1 - some lamps have Sonoff B1in their description but are not).
I disassembled and unsoldered the ESP board. It tells on the printed circuit board for the connection of the TYW3S:
top left down:
RST
ADC
EN
IO16
IO14 DAT
IO12 WW
IO13
VCC

top right down:
TxD
RxD
CW IO5
CLK IO4
IO0
IO2
IO15
GND

soldering some wires onto the board, I was able to flash Tasmota 5.12 on it.
With Module type “18 Generic” I used GPIO 5 as PWM1 and with “SetOption15 1” I got a slider for dark and bright. So this works.
I was not able to get the color working. GPIO 4 clock and GPIO 14 should be used to address the SM16726 with RGB values.
Unfortunately I am not yet able to compile ESP8266 code, I just use images and flash those.


I removed the 2 capacitors, too, to have better access for soldering on the ESP module. Nevertheless, I killed some tracks and ripped of some lands.


This picture shows the flashing interface. Power comes through the USB-Serial interface! Do not connect to the mains!

I connect the LED-PCB to an arduino as programming this way is much easier for me.
15 … 20 VDC was used to drive the LEDs. I used 0,35mm isolated copper wire for the connections.

And yes, I was able to control RGB-LEDs and white LED. White was easy.

I am using the Arduino serial input tool to input hex values as RRGGBBCW and for some debug output, i.e. 12FFC005 (12 for R, FF for G, C0 for B, 05 for white)
Extracts from my program …
For the white:

int CWpin = 9; // the PWM pin is attached to D9
byte CW = 0; // brightness of the LEDs, initally zero

and for the RGB-LEDs using the SM16726 (same protocol as SM16716) …

#include “FastLED.h”
#define NUM_LEDS 1 // as 1 LED with 3 colors.
#define DATA_PIN 3
#define CLOCK_PIN 13

CRGB leds[NUM_LEDS]; // this is the array of leds used by FastLED

in the setup:
FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); //SM16716 is said to be equiv. to SM16726

in the loop with R, G, B being declared as Byte:
leds[0] = CRGB(R,G,B); // prepare the data
FastLED.show(); // update the color LEDs

analogWrite(CWpin,CW); //update the cold white

So it is time to bring this into ESP using IO4 for clock, IO14 for data and IO5 for the cold white.

Thanks so much! Can you confirm if both the sm16716 and sm16726 use the same protocol??

Yes I can confirm that SM16716 and SM16726 have same protocol:

  1. I used FastLED.h library with SM16716 protocol

and that worked as I described in the above commands (with Arduino). Colors are as expected, no disorder in red, green, blue.

  1. I read it somewhere.

There should be a semi working build of espurna that supports the bulb at https://github.com/TomHodson/espurna I haven’t gotten the PWM white channel to work yet because I don’t really understand how espurna does PWM. I also bitbanged the protocol but it would probably be better to use FASTLED because it incorporates nice color correction code.

I actually have bought a very similar yet different light bulb on amazon. Also trying to get tasmota on it. I made a thread for it a while ago: Lyasi/Meamor Smart Bulb flashing?

Hi,

First want to say thank you for the information people have already posted on here, it helped me out greatly in trying to hack this bulb to work in a way I wanted, so thanks!

I just created an account on here to share the work I had done on incorporating this bulb into a great project called diyHue, it still has some bugs, but is functioning. Check it out here:

https://github.com/mariusmotea/diyHue/tree/master/Lights/Arduino/fastLED_SM16726_RGBW_Bulb

Hope this helps some people in getting it work in a way they want.

Sorry if this has been answered elsewhere. I looked but couldn’t find it.
For flashing the TYWE3S module, do we need to ground GPIO0 ?
I’ve tried grounding it as well as just straight through, but couldn’t get upload the firmware.

Would appreciate any help getting me started off on this basic step.

Thank you.
-Ash.

I received one of these bulbs from an Ebay seller who marked it as a Sonoff B1. Has anyone had any success flashing over the air?

I have a bulb that looks identical to yours. How did you get the base off?
Thanks in advance.

It’s OK - I got it. Pushed a thin screwdriver through the little slots and then it unscrewed easily. Hopefully I can now add something to this discussion.

OK - I am making some progress.

  1. Unscrewed the bulb
  2. Attached a header to the TYWE3S pins
  3. Flashed MicroPython to the chip. I’m not going to lie, it took me ages to get this to happen. I just kept retrying.
  4. Enabled webrepl so I can connect to the bulb remotely

  1. Small python program to test the white leds
from machine import Pin, PWM
import utime
p5 = Pin(5)             # define the pin
pwm5 = PWM(p5)          # setup pwm on pin
pwm5.freq(500)          # set pwm frequency

for i in range(1024):   # ramp up from 0 to 1023
    pwm5.duty(i)        # set the duty cycle
    utime.sleep(.05)    # wait 50ms

The bulb comes up nicely

I am struggling with the rgb aspect. My bulb does not have any chips on the LED board. I tried the protocol for the SM16726, and it either lights the bulb full blue or turns it off. Testing then showed that clocking out a single 0 , or 1, will turn the blue off, or on, respectively.
Anyone got any ideas?

I got a bit further. I can PWM the blue on pin 14, and the red on pin 4. I can’t seem to get green on any pin.

I now have a fully working bulb. The pcb was slightly damaged in my earlier attempts to dismantle the bulb. I have repaired that and now find the red, green and blue work from PCM, just like the white. I have uploaded my software, which is in Micropython.

configuration.yaml has:

light:
 - platform: mqtt_json
    name: "TYWE3S"
    state_topic: "home/rgb1/status"
    command_topic: "home/rgb1/set"
    brightness: true
    rgb: true
    white_value: true
    brightness_scale: 100

Here is the control

If anyone is interested I will publish the code.

@Beantree I’d be interested, looks good! I’ve been tinkering with other bits and this is still in parts on my shelf…

Hi @henkez73
I have put the code on GitHub at https://github.com/AnthonyKNorman/ESP8266-Home-Assistant-RGB-Bulb

Let me know how you get on!