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


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!

Hi @Beantree thanks! Now I just need to solder on some wires to the tywe3s so I can flash micropython on it.

Hi I was recently sent a rgbw wifi bulb with this module in, but it looks as tho the rgb leds are driven directly from the gpio pins of the module (through transistors). I have managed to find the white, red, and blue gpio pins but have not been able to find green, am running espeasy r120 on it and have been manually sending PWM commands to the listed gpio pins.

gpio4 - red
gpio5 - white
gpio14 - blue
??? - green

i forgot to do a continuity check on the pins leading to the led module before i reassembled and fitted the light in the socket and i cant be bothered getting it down again xD… if they are using either of the uart pins for green, how would i give the command for pwm to that pin?

do you guys think there might be any way of putting firmware in one of these Tuya devices Over-The-Air ?

I’ve bought a couple of bulbs, but there are no pads for RX, TX or GND.
Also the esp isn’t accessible without destroying the bulb’s housing :frowning:

Any thoughts ?

Has someone any experience with this version?
There are two ICs I can’t identify.
One is labeled “SLM211A 1821” and one is labeled “AJ1818 25Q80CS1G U7S029”.
I tried getting it to work with FastLED and LED type SM16716 with CLK on GPIO4 and DAT on GPIO14.
But only red is working.