Step-by-Step Tuya Smart Lighting Product Design

Step 1: Select a Module

Wi-Fi Modules

Bluetooth mesh Modules (Tuya)

Bluetooth mesh Modules (SIG)

Zigbee Modules

Step 2: Select a Module Power Supply Mode

AC-DC Constant-Voltage Power Supply

DC-DC Constant-Voltage Power Supply

* Low dropout (LDO) regulators are not recommended for powering Wi-Fi modules. If an LDO regulator is used, use a chip with 500 mA or higher power supply current and ensure good heat dissipation. When the input voltage is higher than 5 V, a switch-type power chip is recommended.

Step 3: Install the Module and Antenna

Similar to light, wireless signals may be blocked by metal in the transmission path. If an antenna is mounted on a metal surface, the module cannot work properly.

To use a module in a sphere lamp, ensure that the module's antenna is out of the opening groove of the alumina substrate and that the onboard antenna is higher than the alumina substrate. When the light source is not affected and there are no shadows, position the antenna out of the lamp cup's shielding environment as much as possible.

When using a module in a lamp with a metal cover, for example, a downlight or spotlight lamp or lamp used outdoors, consider the antenna RF design and use an external antenna if needed. To use a module in a drive, keep the module away from components such as the transformer and inductor.

Step 4: Select an LED Light Driving Method

AC-DC Constant-Current Driver for Monochromatic Lamps (W)

Advantages: high efficiency, high power factor (PF), good constant-current characteristics, high linearity, and adjustable, wide output voltage range

Disadvantages: strong electromagnetic interference (EMI), high cost, noise during PWM light adjustment, and complex PCB layout

The module generates PWM signals.

* Linear AC-DC constant-current driver

Advantages: low cost, no EMI issue, simple PCB layout, and no noise during PWM light adjustment

Disadvantages: low efficiency, narrow voltage range, poor constant-current characteristics, poor linearity, fixed output voltage, and low PF

The module generates PWM signals.

AC-DC Constant-Current Driver for Bi-Color Lamps (CW)

The solution has the CW and CCT control modes. The CW mode uses 2-channel PWM signals for simultaneous control of the brightness and color temperature. The 2-channel PWM signals are CW and WW signals, which respectively control the white light with a high color temperature and warm light with a low color temperature. During 1-channel light adjustment, CW signals are used. The CCT mode uses 2-channel PWM signals for separate control of the brightness and color temperature. The Bright signals control the brightness, and the CCT signals control the color temperature. For details, see the pin configuration.

Advantages: high efficiency, good constant-current characteristics, high linearity, and good light adjustment

Disadvantages: strong EMI, circuit noise, large color temperature offset when the duty cycle is small, complex circuit layout, and high cost

The module generates 2-channel PWM signals: CW and WW.

* Linear AC-DC constant-current driver in CW mode

Advantages: low cost, no EMI issue, simple PCB layout, and no noise during PWM light adjustment

Disadvantages: low efficiency, narrow voltage range, poor constant-current characteristics, poor linearity, fixed output voltage, and large color temperature offset when the duty cycle is small

The module generates 2-channel PWM signals: CW and WW.

Advantages: high efficiency, good constant-current characteristics, high linearity, basically no color temperature offset, good light adjustment, simulated brightness control, low cost, simple circuit layout, and no noise

Disadvantages: strong EMI and higher cost than the linear AC-DC constant-current driver in CW mode

The module generates 2-channel PWM signals: Bright and CCT.

Constant-Current Driver for RGB Lamps

The module generates 3-channel PWM signals: PWMR, PWMG, and PWMB. The linear constant-current driver ensures constant RGB current output.

The I2C DAT and CLK signals can control RGB or RGBCW lamps, requiring only several control pins. The module generates I2C DAT and CLK signals to the drive chip to ensure constant RGB current. To use the I2C solution, pay attention to the PCB layout. I2C signals are vulnerable to interference from switch signals (AC-DC drive circuit). If the interference is serious, add a 10 pF to 50 pF filter capacitor to the DAT and CLK signal circuits during PCB layout design to reduce interference.

Note: Pull-up resistors need to be added to the physical circuits of the peripheral I2C DAT and CLK signals. Typically, the resistance value is 4.7 kiloohms, which can be adjusted based on the actual scenario.

Use the BJT or MOSFET switch to control RGB through PWM signals. The RGB current is variable and discrete. Add a resistor for the red light control channel to limit the current because the red light diode has a low voltage. In this case, under the same input conditions as the constant-current solution, the loss is increased. Note: The bead voltage cannot be greatly different from the input voltage.

AC-DC I2C-controlled Linear Constant-Current Driver for RGBCW Lamps

Advantages: simple solution, simple peripheral parameters, low cost, and requires only the DAT and CLK signals for control

Disadvantages: driven by linear constant current, and DAT and CLK signals are vulnerable to interference

Note: The RGB light needs to be powered separately. An AC-DC + DC-DC power supply solution is recommended.

Step 5: Define Module Pins

In network configuration mode, the CW pin generates a high or low level to indicate the network configuration status. The CW pin is used for 1-channel light control. For cold and warm light control in CW mode, the CW and WW pins control the cold and warm light, respectively. In CCT control mode, the Bright and CCT pins respectively control the brightness and color temperature.

The following tables define the module pins.

WIFI:

Espressif Systems:

TYWE3S TYWE3L TYWE5P

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
IO5WCWBright
IO13WWCCT
IO4 RSCL
IO12 G
IO14 BSDA
IO16 Low-power

TYWE3SE

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
IO22WCWBright
IO13WWCCT
IO5 RSCL
IO25 G
IO14 BSDA
IO33 Low-power

TYWE1S TYLC4

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
IO5WCWBright
IO13WWCCT
IO4 RSCL
IO12 GLow-power
IO14 BSDA

TYWE2S TYWE2L

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
IO14WCWBright
IO12WWCCT
IO5 RSCL
IO4 GLow-power
IO13 BSDA

TYLC5

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
IO14WCWBrightRSCL
IO12WWCCTBSDA
IO4 GLow-power

TYLC6 TYLC8

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
IO14WCWBrightRSCL
IO12WWCCTBSDA
IO13 GLow-power

TYLC6E

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
IO4WCWBright
IO5WWCCTR
IO12 GSDA
IO14 BSCL
IO13 Low-power

TYLC2V

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
IO5WCWBright
IO12WWCCTR
IO14 GSDA
IO4 BSCL
IO13 Low-power

Realtek module pins:

WR1 (Pin-compatible with TYWE1S)

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
GPIOA_5WCWBright
GPIOA_18WWCCT
GPIOA_22 RSCL
GPIOA_15 GLow-power
GPIOA_14 BSDA

WR3 and WR3L (Pin-compatible with TYWE3S and TYWE3L)

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
GPIOA_12WCWBright
GPIOA_0WWCCT
GPIOA_5 RSCL
GPIOA_15 G
GPIOA_14 BSDA
GPIOA_19 Low-power

WR3E and WR3LE (Pin-compatible with TYWE3S and TYWE3L)

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
GPIOA_12WCWBright
GPIOA_22WWCCT
GPIOA_5 RSCL
GPIOA_15 G
GPIOA_14 BSDA
GPIOA_29 Low-power

WR5P (Pin-compatible with TYWE5P)

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
GPIOA_12WCWBright
GPIOA_5WWCCT
GPIOA_14 RSCL
GPIOA_15 G
GPIOA_0 BSDA
GPIOA_22 Low-power

RLC2V and RLC7V (Pin-compatible with TYLC2V)

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
GPIOA_5WCWBright
GPIOA_12WWCCTR
GPIOA_14 GSDA
GPIOA_15 BSCL
GPIOA_0 Low-power

RLC4 (Pin-compatible with TYLC4)

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
GPIOA_5WCWBright
GPIOA_12WWCCT
GPIOA_19 RSCL
GPIOA_15 GLow-power
GPIOA_14 BSDA

WR2L (Pin-compatible with TYWE2L)

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
GPIOA_15WCWBright
GPIOA_14WWCCT
GPIOA_19 RSCL
GPIOA_12 GLow-power
GPIOA_5 BSDA

WR2E (Pin-compatible with TYWE2S)

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
GPIOA_15WCWBright
GPIOA_24WWCCT
GPIOA_12 RSCL
GPIOA_19 GLow-power
GPIOA_5 BSDA

WR2 (Pin-compatible with TYWE2S)

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
GPIOA_15WCWBright
GPIOA_14WWCCT
GPIOA_12 RSCL
GPIOA_0 GLow-power
GPIOA_5 BSDA

Tuya Bluetooth mesh module pins:

TYBY3

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
GPIOA_15WCWBright
GPIOA_14WWCCT
GPIOA_12 RSCL
GPIOA_0 GLow-power
GPIOA_5 BSDA

TYBT4L (Pin-compatible with TYWE3S)

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
GPIOA_15WCWBright
GPIOA_14WWCCT
GPIOA_12 RSCL
GPIOA_0 G
GPIOA_5 BSDA
GPIOA_5 Low-power

TYBT8 (Pin-compatible with TYLC5)

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
PWM1WCWBrightRSCL
PWM0WWCCTBSDA
PWM4 GLow-power

SIG Bluetooth mesh module pins:

BT3L (Pin-compatible with TYWE3S)

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
TL_B5WCWBright
TL_C2WWCCT
TL_B4 RSCL
TL_C3 G
TL_D2 BSDA
TL-D7 Low-power

BT8C (Pin-compatible with TYLC5 and TYBT8)

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
PWM1WCWBrightRSCL
PWM0WWCCTBSDA
PWM4 GLow-power

Zigbee module pins

TYZS3 and TYZS1L (Pin-compatible with TYWE3S)

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
GPIO3WCWBright
PWM1WWCCT
PWM2 RSCL
PWM3 G
SWO BSDA
GPIO0 Low-power

TYZS15 (Pin-compatible with TYLC5, TYBT8, and BT8C)

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
PWM3WCWBrightRSCL
PWM1WWCCTBSDA
PWM2 GLow-power

TYZS9V (Pin-compatible with TYLC2V)

I/O InterfaceWCWCCTRGB(PWM)RGB (I2C)
PWM2WCWBright
GPIO2WWCCTR
PWM3 GSDA
PWM1 BSCL
GPIO0 Low-power

The following figures show pins on some modules:

When the Espressif Systems 8266 chip is being powered on, some I/O interfaces are unstable and have weak output with a high pulse for 180 ms during initialization. As a result, the high level-driven light blinks. To prevent this scenario, connect pull-down resistors whose resistance is less than or equal to 3.3 kiloohms to these I/O interfaces. A lower resistance may be required according to the peripheral circuit. For details, see the following initial pin status table.

Initial pin status:

PinInitial StatusRecommended Configuration
IO2Pulled upAdd an external pull-down resistor.
IO4High resistanceAdd an external pull-down resistor.
IO5High resistanceAdd an external pull-down resistor.
IO12Pulled upAdd an external pull-down resistor.
IO13Pulled upAdd an external pull-down resistor.
IO14Pulled upAdd an external pull-down resistor.
IO15Low-level
IO16High-level