Whilst on holiday last week I thought i would do something productive but that seemed like work so I bought some cheap noname wi-fi smart LED lighbulbs off ebay and flashed them with Tasmota firmware, since the particular bulb I bought wasnt listed on the Tasmota Device Templates Repository and I have no idea if they accept an entry for a bulb with no identifying marks I thought i'd put something here incase its of use to anyone.
Reliability: I have at this point had 10 of these bulbs running for about a week, one of them has just died.
The pinout and device string for this light:
- GPIO4 Cold White PWM 4
- GPIO5 Warm White PWM 5
- GPIO12 Green PWM 2
- GPIO13 Blue PWM 3
- GPIO14 Red PWM 1
{"NAME":"Smart Candlelights","GPIO":[0,0,0,0,419,420,0,0,417,418,416,0,0,0],"FLAG":0,"BASE":18}
This is going to be difficult as the one I bought had literally no branding on it at all, not even on the box, its just a box marked "Wifi smart LED candle light" the side of the box suggest there are varients of this light in gold, silver, black and white and every combination of RGB, cool white and warm white you could make.
And the ebay listing looked like this:
Showing a silver body and a base with 2 holes that I presume are used during manufacturing to twist the base perhaps? and importantly the listing said it used "Tuya smart" or "Smartlife" app, so there was a good chance it could be reflashed. In this case the bulb was listed as RGB+3000K but what was delivered was RGB+3000K+6000K (RGBCCT) so already its going to be hit and miss what turns up if you order them so I can't recommend it.
Opening up one of the bulbs wasn't hard with the diffuser being held on with a screw thread and some silicone goop, looking inside revealed the red, green, blue, cool white and warm white led's, which was when I realised these were a better deal than I had thought, all mounted on a PCB whose only discernable markings were: "SYCG05 RGB+C+W V1.0"
This was just a quick peek as I was getting started with this, after I had got the bulbs working I sacrificed one for the greater good to see the internals properly, those pictures are at the end of this document.
The ebay listing said the bulb could be controled with either the "Tuya smart" or "Smartlife" app which suggested that it should be possible to reflash it using a great bit of software called tuya-convert on a raspberry-pi 3 or other linux machine with wifi, this may not be true in the future however as Tuya have updated their firmware to stop you doing this I was lucky and the firmware was an older type that could be converted, the conversion process was:
- install tuya-convert following the instructions on github
- run ./start_flash.sh and wait when it says press ENTER
- Connect your phone or secondary device to the the “vtrust-flash” access point. Make sure to accept any prompts that there is no internet access and you want to stay connected. (aparently this is required)
- Put the bulb in EZ mode (instructions from Tuya's FAQ )
- Turn off light first. Switch light with the steps: Switch on-off-on-off-on (time interval cannot exceed 10 seconds), flashing lights represents successful reset; if no light flashes, please repeat the steps above;
- Quick light flashes (4 times per second), represent EZ mode;
- Slow light flashes (2 times per 3 seconds) represent AP mode;
- Under EZ mode, turn off lights and then switch light with the steps: Switch on-off-on-off-on (time interval cannot exceed 10 seconds). Light begins to slowly flash, representing that it has switched to AP mode and vise versa.
- Now press Enter, follow the instructions and flash the tasmota firmware
- The bulb will now appear as an access point so connect to this network and open the webpage at 192.168.4.1 and configure the bulbs Wi-Fi credentials.
- Connect back to your network and open the devices webpage and use the firmware upgrade page to upgrade to the latest Tasmota firmware, I had to do this in 2 steps first uploading tasmota-minimal.bin then once it had rebooted repeating this but using tasmota.bin since the bulb only has 1Mb flash and the upgrade requires enough free space in flash to store the new firmware before reflashing.
- Finally open up the "Configuration" > "Configure Other" page and paste in the Template {"NAME":"Smart Candlelights","GPIO":[0,0,0,0,419,420,0,0,417,418,416,0,0,0],"FLAG":0,"BASE":18}
- Your light should now work
This isnt really meant to be a how to, more a description of what I did so its possible I missed a step or didnt describe it well so for more information see the tuya-convert and Tasmota documentation for authoritative information on flashing and using Tasmota.
When I had first flashed Tasmota obviously I had no idea what was connected to what, there is a guide to working this out in the Tasmota documentation, and fortunately for me I only had to proceed as far as setting all the GPIO's as relays and then toggling them in turn to find out what colour was controlled by what GPIO pin. Now the template could be changed to set unused GPIO's to none and the ones that control the LED's to PWM ,Tasmota expects the order of the LED's to be Red,Green,Blue,ColdWhite,WarmWhite on PWM 1,2,3,4,5 so for this bulb the results i got were:
- GPIO4 Cold White PWM 4
- GPIO5 Warm White PWM 5
- GPIO12 Green PWM 2
- GPIO13 Blue PWM 3
- GPIO14 Red PWM 1
Which gave me a template of:
{"NAME":"Smart Candlelights","GPIO":[0,0,0,0,419,420,0,0,417,418,416,0,0,0],"FLAG":0,"BASE":18}
Now that I know this it would seem that this bulb is the same or similar hardware to this Julun JL-021 that is listed in the template directory.
If you are trying this with some other unknown bulb and it uses an LED controller chip of some sort it wont be so simple, the guide does give some hints at detecting controllers by setting the GPIO's to switches and reading the status to see what pins are pulled up or down, I also found on a different bulb with an SM16716 chip that when the SM16716 PWR pin was toggled on the bulb lit up a dull light blue which might help id what you have and then find CLK and DAT by looking for pullups.
After all of this I decide I quite liked the lights but being unbranded I should probably check inside for electrical horrors, I also wanted to know if any of the test points visible on the PCB were connected to the ESP8266 i.e. could you reflash it using a serial connection without having to destroy the lamp, this might be important knowledge in the future as Tuya seem to be trying to prevent their hardware being reflashed. To this end the vise of knowledge and some pliers were used to mangle the bulb open and free the PCB from the silicone glue, you can see some photos of it below. Unfortunately the only connections between the round sub board that carries the esp8266 and the led pcb are marked R,G,B,W,C,VCC,GND which are self explainatory but sadly means there is no way to make the serial connections to allow flashing from the front of the board, if tuya-convert doesnt work or you somehow brick the device thats the end of it.
The PSU wrapped in yellow tape, and a plastic disc covering the back of the electronics for a degree of electrical insulation, the red wire has broken off during extraction of the board, it was soldered to the point marked VCC on the board.
Oddly GND was soldered to a capacitor and power to the VCC pin, the cutout in the plastic insulating disc suggest it was intended to connect GND to the marked GND pin on the disc, I dont know why this wasnt done, the whole board is a bit how-ya-doing with 2 unused female connectors that to me look like they were intended to be the power connectors.
Front of the PSU with what i assume are only the finest quality "oyee" caps although they do claim a 130°C rating. I hope they live up to that rating but im not going to be surprised if the lights start blinking and playing up in a few years.
The back of the psu.