ESP8266 RGB WW CW Tuya led

Hello,

I have bought a Tuya ESP8266 RGB WW CW led light as a test.
I want to be able to control it by myself without using the cloud service.

It looks similar to this, except that i have R, G, B, WW, CW:

The pins are labeled as well, i see GND, TX, RX, 3.3V, IO0.
Am i able to make my own software via the Arduino IDE? I assume i can when i connect the ESP8266 to my computer via an USB to TTL converter, but how can i know which pins are used for the leds, i didn't find any information on what led driver is being used and i down't know exactly how the schematic is.

I am not at home now but i can make a picture of my exact model.

Thanks already for the help

1 Like

Yeah, you can. At least, if you are 100% sure it uses a ESP. Be sure to NOT connect it to mains when programming (or even having the programmer hooked up!).

About the pins, just try them. Good start would be the pins mentioned with the picture.

Or if you want easy, have a look at Tasmota.

I am sure it is the ESP2866, it is labeled on the controller.
I tried to program it with tuya-convert but it said the light couldn not be programmed because it was not supported.

I will not connect it to mains when programming it, but am i able to test the leds or do i need to programm it, disconnect from the pc and than test it?

Yeah, sadly some devices come with a newer version of Tuya which doe snot work with TuyaConvert anymore.

But yeah, you need mains to test it. Two options to not have to connect and disconnect the usb to serial:

  1. Make firmware with OTA support. That way you only need the usb-serial the first time after which you can push changes via OTA and thus leave the bulb connected to mains.

  2. Just flash Tasmota, even just for a test. In Tasmota you can select which pins to use for what via a webpage. Via the webpage you can even upload a new .bin to reprogram it.

Thank you for the reply, if this will work i want to make a simple "adapter" (3d print) i can hold against the PCB to program it, flashing it with Tasmoto is also a good idea to test the pins.

Making the firmware with OTA support was also on my 'todo' list because i am sure in the future i would want to update some firmware.

Yesterday i tried to flash tasmoto and i got it working. It got an IP address and i could connect to it and try to change the light (different gpio pins got different colors or brightness).

After that i tried to flash my own software. It worked good but i wanted to flash another program to test gpio pins.

When i reconnected the light to my USB to TTL converter and connected it to the computer it wouldn’t flash anymore. I rechecked the USB to ttl converter and noticed i used the wrong pins on the USB to TTL converter. That means the following pins where connected:

+5V > GND + IO0
GND > TX
RXD > RX
TXD > 3.3V

Stupid ofcourse but the cables are in the right way, only shifted one pin on the USB to TTL converter.
Since this happened i cannot flash anything to the ESP8266 anymore. Did i destroy something or can i check / fix this?

Thanks!

PS: This is what Arduino IDE shows:

esptool.py v2.8
Serial port COM3
Connecting........_____....._____....._____....._____....._____....._____.....____Traceback (most recent call last):
 File "...\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/upload.py", line 65, in <module>
   esptool.main(cmdline)
 File ".../Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool\esptool.py", line 2890, in main
   esp.connect(args.before)
 File ".../Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool\esptool.py", line 483, in connect
   raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header

bluebirdsoftware:
Since this happened i cannot flash anything to the ESP8266 anymore. Did i destroy something or can i check / fix this?

It was working and you could flash it with a certain arrangement of connections.

You then connected the power backward.

You can no longer program it with the original arrangement of connections.

It is dead. :astonished:

Dammit, why was i that stupid.
But i bought 2 new ones so in a few weeks i can try again

Oops, yeah, think it's indeed dead. :frowning:

I bought 2 new ones to test but now i am wondering how i should start building the software for the ESP8266. Do i best use some library or can i just set PWM signals to every gpio pin and see what it does?

I tried with Tasmota and i got lights but i couldn’t really figure out how to set it up exactly (all the sliders where just black or one color and changing the slider did some random lights)

@septillion:
i now see your signature with the led library, will this work?
https://github.com/septillion-git/FadeLed

Yeah, you can just PWM or even just on/off an output. And yeah, that library works fine with an ESP. I would not bother using it (or any library) while figuring out the pins. Once you've figured out which pins are used my library is nice to implement fading an/or gamma correction :slight_smile:

But a hint to just figure out the pins with Tasmota. After loading Tasmota (and config to you network) just go to Configuration => Configure template. And just set a pin to PWM 1. Now you should have a single slider for that GPIO on the home page (Main menu). Use that to check that GPIO and just repeat everything for the next GPIO. (Back to configure template etc)

That is what i did but i could set every pin to PWM, and PWM_i (?) or something (not sure what it was exactly anymore)

Next to the pwm i got a dropdown with value 1 till 5? I couldn’t find what to choose but i will try it when i have the new lights

@bluebirdsoftware, just set 1 GPIO at a time to PWM and just use PWM 1.

PWM_i is inverted aka for active low applications. So not very relative here but should work as well to find the right pins.

Thank you, as soon as i have the new lights i will do that

Today i got the new light. I flashed Tasmotizer and i figured out which GPIO pins changed what lights. Thanks for the help to do that.

After that i tried to flash my own arduino code to the ESP8266 but i cannot get that working.

The Arduino IDE keeps connecting with the device. The first connection seems to work but after hard resetting it keeps connecting.

Am i doing something wrong? I also don’t know if it is the 1MB flash size but that is selected by default.

esptool.py v2.7
Serial port COM4
Connecting...
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: ec:fa:bc:7a:55:33
Uploading stub...
Running stub...
Stub running...
Manufacturer: 85
Device: 6014
Detected flash size: 1MB
Hard resetting via RTS pin...
esptool.py v2.7
Serial port COM4
Connecting........_____....._____....._____....._____....._____....._____.....____Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.0/tools/upload.py", line 25, in <module>
    esptool.main(fakeargs)
  File "C:/Users/User/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.6.0/tools/esptool\esptool.py", line 2841, in main
    esp.connect(args.before)
  File "C:/Users/User/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.6.0/tools/esptool\esptool.py", line 483, in connect
    raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
_
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header

Well, i got it working, after uninstalling and reinstalling the ESP8266 in board manager i got it working again.

I managed to flash my own program to the ESP8266 and control all the lights.
What would be the best approach to sync multiple lights together?

I can make a "group" and set 10 lights the same color, but making a "running light" would be more difficult. Any tips on the best way to program this?

I would say or a "orchestrator" device they all connect to or you would have to do something with broadcasting and figuring out a master device.