2022-04-23 23:02:42 +02:00
2022-04-23 23:02:42 +02:00
2022-04-23 23:02:42 +02:00
2022-04-20 19:13:38 +02:00
2022-04-23 23:02:42 +02:00
2022-04-20 19:13:38 +02:00
2022-04-23 23:02:42 +02:00

LibreTuya

PlatformIO development platform for IoT modules manufactured by Tuya Inc.

Note: this project is work-in-progress.

Board List

A (mostly) complete* list of Tuya wireless module boards.

  Module Name MCU Flash RAM Pins** Wi-Fi BLE Platform name
WB1S BK7231T @ 120 MHz 2 MiB 256 KiB 18 (11 I/O) ✔️ ✔️ -
WB2L BK7231T @ 120 MHz 2 MiB 256 KiB 7 (5 I/O) ✔️ ✔️ -
WB2S BK7231T @ 120 MHz 2 MiB 256 KiB 11 (8 I/O) ✔️ ✔️ -
WB3L BK7231T @ 120 MHz 2 MiB 256 KiB 16 (12 I/O) ✔️ ✔️ -
WB3S BK7231T @ 120 MHz 2 MiB 256 KiB 16 (11 I/O) ✔️ ✔️ -
WB3S-IPEX BK7231T @ 120 MHz 2 MiB 256 KiB 16 (11 I/O) ✔️ ✔️ -
WB8P BK7231T @ 120 MHz 2 MiB 256 KiB 10 (8 I/O) ✔️ ✔️ -
WBLC5 BK7231T @ 120 MHz 2 MiB 256 KiB 6 (3 I/O) ✔️ ✔️ -
WBLC9 BK7231T @ 120 MHz 2 MiB 256 KiB 8 (6 I/O) ✔️ ✔️ -
CB1S BK7231N @ 120 MHz 2 MiB 256 KiB 18 (11 I/O) ✔️ ✔️ -
CB2L BK7231N @ 120 MHz 2 MiB 256 KiB 7 (5 I/O) ✔️ ✔️ -
CB2S BK7231N @ 120 MHz 2 MiB 256 KiB 11 (8 I/O) ✔️ ✔️ -
CB3L BK7231N @ 120 MHz 2 MiB 256 KiB 16 (11 I/O) ✔️ ✔️ -
CB3S BK7231N @ 120 MHz 2 MiB 256 KiB 22 (14 I/O) ✔️ ✔️ -
CB3S-NL BK7231NL (?) @ 120 MHz 2 MiB 256 KiB 22 (14 I/O) ✔️ ✔️ -
CB3SE BK7231N @ 120 MHz 2 MiB 256 KiB 22 (17 I/O) ✔️ ✔️ -
CB8P BK7231N @ 120 MHz 2 MiB 256 KiB 10 (8 I/O) ✔️ ✔️ -
CBLC5 BK7231N @ 120 MHz 2 MiB 256 KiB 6 (3 I/O) ✔️ ✔️ -
CBLC9 BK7231N @ 120 MHz 2 MiB 256 KiB 8 (6 I/O) ✔️ ✔️ -
CBU BK7231N @ 120 MHz 2 MiB 256 KiB 21 (18 I/O) ✔️ ✔️ -
CBU-IPEX BK7231N @ 120 MHz 2 MiB 256 KiB 21 (18 I/O) ✔️ ✔️ -
CBU-NL BK7231N (?) @ 120 MHz 2 MiB 256 KiB 21 (18 I/O) ✔️ ✔️ -
WR1 RTL8710BN @ 125 MHz 1 MiB 256 KiB 18 (11 I/O) ✔️ -
WR1-IPEX RTL8710BN @ 125 MHz 1 MiB 256 KiB 18 (11 I/O) ✔️ -
WR1E RTL8710BN @ 125 MHz 2 MiB 256 KiB 18 (11 I/O) ✔️ -
WR2 RTL8710BN @ 125 MHz 2 MiB 256 KiB 11 (8 I/O) ✔️ -
WR2E RTL8710BN @ 125 MHz 2 MiB 256 KiB 11 (8 I/O) ✔️ -
WR2L RTL8710BX @ 62.5 MHz 2 MiB 256 KiB 7 (5 I/O) ✔️ -
WR2LE RTL8710BX @ 62.5 MHz 2 MiB 256 KiB 7 (5 I/O) ✔️ -
wr3 WR3 RTL8710BN @ 125 MHz 2 MiB 256 KiB 16 (12 I/O) ✔️ realtek-ambz
WR3E RTL8710BN @ 125 MHz 2 MiB 256 KiB 16 (12 I/O) ✔️ -
WR3L RTL8710BX @ 125 MHz (?) 2 MiB 256 KiB 16 (12 I/O) ✔️ -
WR3LE RTL8710BX @ 62.5 MHz 2 MiB 256 KiB 16 (12 I/O) ✔️ -
WR3N RTL8710BN @ 125 MHz 2 MiB 256 KiB 16 (10 I/O) ✔️ -
WR4 RTL8710BN @ 125 MHz 1 MiB 256 KiB 16 (12 I/O) ✔️ -
WR5E RTL8710BX @ 62.5 MHz 2 MiB 256 KiB 15 (12 I/O) ✔️ -
WR6-H RTL8710BN @ 125 MHz 2 MiB 256 KiB 18 (12 I/O) ✔️ -
WR6 RTL8710BN @ 125 MHz 2 MiB 256 KiB 18 (12 I/O) ✔️ -
WRG1 RTL8711AM @ 166 MHz 4 MiB 2048 KiB 25 (20 I/O) ✔️ -
XR1 XR809 @ 160 MHz 2 MiB 384 KiB 18 (11 I/O) ✔️ -
XR1-IPEX XR809 @ 160 MHz 2 MiB 384 KiB 18 (11 I/O) ✔️ -
XR3 XR809 @ 160 MHz 2 MiB 384 KiB 22 (17 I/O) ✔️ -
WE1S ESP8266EX @ 80/160 MHz 2 MiB 36 KiB 18 (11 I/O) ✔️ -
WE2L ESP8285 @ 80/160 MHz 1 MiB 50 KiB 7 (5 I/O) ✔️ -
WE2S ESP8285 @ 80/160 MHz 1 MiB 50 KiB 11 (8 I/O) ✔️ -
WE3L ESP8266 @ 80/160 MHz 2 MiB 50 KiB 16 (12 I/O) ✔️ -
WE3S ESP8266 @ 80/160 MHz 2 MiB 50 KiB 16 (12 I/O) ✔️ -
WE3SE ESP32 @ 240 MHz 4 MiB 520 KiB 22 (17 I/O) ✔️ ✔️ -
WE5P ESP8266 @ 80/160 MHz 1 MiB 50 KiB 15 (11 I/O) ✔️ -

* Only modules featuring at least Wi-Fi. WBR, JWBR, CR, (TY)JW and (TY)LC Series are not included here

** I/O count includes GPIOs, ADCs, PWM outputs and UART, but doesn't count CEN/RST and power pins.

Project structure

arduino/
├─ <platform name>/				Arduino Core for specific platform
│  ├─ cores/						Core files
│  ├─ libraries/					Supported built-in libraries
boards/
├─ <board name>/				Board-specific code
│  ├─ variant.cpp					Arduino variant initialization
│  ├─ variant.h						Arduino variant pin configs
├─ <board name>.json			PlatformIO board description
builder/
├─ frameworks/					Framework builders for PlatformIO
│  ├─ <platform name>-sdk.py		Vanilla SDK build system
│  ├─ <platform name>-arduino.py	Arduino Core build system
├─ main.py						Main PlatformIO builder
fixups/
├─ <platform name>/				Code fix-ups to replace SDK parts
platform/
├─ <platform name>/				Other platform-specific files
│  ├─ bin/							Binary blobs (bootloaders, etc.)
│  ├─ ld/							Linker scripts
tools/
├─ <tool name>/					Tools used during the build
platform.json				PlatformIO manifest
platform.py					Custom PlatformIO script

Platforms

A list of platforms currently available in this project.

Platform name Supported MCU(s) Arduino Core Source SDK (PIO framework)
realtek-ambz Realtek AmebaZ SoC (RTL87xxB) ✔️ framework-realtek-amb1 (amb1_sdk)

Realtek Ameba

The logic behind naming of Realtek chips and their series took me some time to figure out:

  • RTL8xxxA - Ameba1/Ameba Series
  • RTL8xxxB - AmebaZ Series
  • RTL8xxxC - AmebaZ2/ZII Series
  • RTL8xxxD - AmebaD Series

As such, there are numerous CPUs with the same numbers but different series, which makes them require different code and SDKs.

  • RTL8195AM
  • RTL8710AF (found in amb1_arduino)
  • RTL8711AM
  • RTL8710BN
  • RTL8710BX (found in Tuya product pages)
  • RTL8710B? (found in amb1_sdk)
  • RTL8711B? (found in amb1_sdk)
  • RTL8710CM
  • RTL8722CSM (found in ambd_arduino)
  • RTL8720DN (found in ambd_arduino)
  • RTL8721DM
  • RTL8722DM (found in ambd_arduino)
  • and probably many more

Different Ameba series are not compatible with each other. Apparently, there isn't a public SDK for AmebaZ that can support C++ properly (yet).

Arduino Core support status

Note: this list will probably change with each functionality update.

  realtek-ambz
Core functions ✔️
GPIO/PWM/IRQ ✔️//✔️
Analog input
UART I/O ✔️
Flash I/O
LIBRARIES
SPI
SPIFFS
Wire
BLE -
Wi-Fi
HTTP
NTP
OTA
MDNS
MQTT
SD

Legend:

  • ✔️ working
  • broken
  • untested
  • not implemented (yet?)
  • - not applicable
Description
No description provided
Readme 2.6 MiB
Languages
C 55.8%
C++ 32.4%
Python 10.8%
Assembly 1%