TuyaOpen Development Empowered by AI Coding

Last Updated on : 2025-09-17 03:00:43download

Overview

In the era of the AI technology boom, everything around us can be redefined and empowered with intelligence. Today, let us explore an exciting project: building a personalized smart desktop chatbot using the Tuya T5AI-Board development board.

Leveraging the robust support of the TuyaOpen framework and Tuya AI Agent, even novices with zero foundation can easily achieve “no-code” development with the AI Coding tool. It can keenly capture emotional fluctuations in chats and show images in real time to convey emotional tension. More surprisingly, in a short time, the development board can transform into a fully functional game console, effortlessly transitioning from a chat assistant to an entertainment device.

Effect demo

Initial effect Final effect
TuyaOpen Development Empowered by AI Coding TuyaOpen Development Empowered by AI Coding

About TuyaOpen

TuyaOpen stands out as an open-source framework for AIoT development, built on top of the proven commercial-grade TuyaOS IoT system. TuyaOpen delivers cross-platform architecture, component-based design, and enterprise-grade security compliance, all rigorously validated through global deployment across hundreds of millions of devices and millions of users.

TuyaOpen integrates an on-device AI inference engine, supports the Tuya Cloud AI Agent Hub, and enables device-cloud integrated multimodal AI capabilities. You can seamlessly integrate compliant large language models, such as DeepSeek, Qwen, and Doubao, or flexibly connect to globally leading AI services, such as ChatGPT, Claude, and Gemini. In a diverse tool ecosystem, a wide range of AI capabilities can be achieved, including but not limited to text and voice chats, image generation, and video generation.

Hardware preparations

Get to know the T5AI-Board development board.

For detailed parameters of the development board, refer to the table below:

Device Parameter
T5AI-Board Main module:
  • T5-E1-IPEX module, ARMv8-M Star (M33F) @480MHz
  • 16 KB ITCM and 16 KB DTCM
  • 8 MB SiP flash memory
  • 16 MB SiP PSRAM
  • 640 KB shared SRAM
Screen
  • RGB565 touch screen
  • 480 x 320 pixels
  • Display driver chip: ILI9488
  • Touch driver chip: GT1151

TuyaOpen Development Empowered by AI Coding

Clone the repository, build, and flash the firmware

Search for TuyaOpen.ai in your browser to go to the TuyaOpen Git repository, and copy the repository URL as shown below. Clone the TuyaOpen SDK to your local device, and then add the AI chatbot project your_chat_bot to the chats, allowing the AI Coding tool to automatically perform building and flashing.

  • Github repository: https://github.com/tuya/TuyaOpen
  • Gitee repository: https://gitee.com/tuya-open/TuyaOpen

Prompt template

Refer to the following template to write prompts for the AI Coding tool, guiding it to build and flash the firmware to the project.

Help me build and flash the firmware to this project.
Set up the environment.
Help me build and flash the firmware to this project. Refer to the README documentation and the links below for specific methods.
Environment setup
https://tuyaopen.ai/docs/quick-start/enviroment-setup
Build the project:
https://tuyaopen.ai/docs/quick-start/project-compilation
Flash the firmware:
https://tuyaopen.ai/docs/quick-start/firmware-burning

TuyaOpen Development Empowered by AI Coding

Authorize the development board

If the device still cannot be discovered in the Tuya app after flashing is completed, the development board needs to be authorized.

Open the your_chat_bot project and configure the following parameters in the file apps/tuya.ai/your_chat_bot/include/tuya_config.h.

  • TUYA_OPENSDK_UUID: The UUID can be obtained free of charge. Scan the QR code below to contact Tuya support.
  • TUYA_OPENSDK_AUTHKEY: The AuthKey can be obtained free of charge. Scan the QR code below to contact Tuya support.
TuyaOpen Development Empowered by AI Coding

TuyaOpen Development Empowered by AI Coding

For detailed steps, refer to Authorize Devices.

If the T5 module you purchased has already been flashed with the TuyaOpen license, you do not need to fill in the UUID and AuthKey.

Prepare images

On an image generation website, create images corresponding to the following 7 emotions: happy, angry, sad, shocked, confused, like, and thinking. Then, resize the images to 240 × 240 pixels. Due to the limited flash space on the T5 development board, larger images occupy more flash storage, so resizing is necessary.

Currently, the Tuya AI Agent can return up to 21 emotion values based on the chats, as listed in the table below:

Emoji Expression Emoji Expression Emoji Expression
😶 Neutral 😳 Embarrassed 😌 Relaxed
🙂 Happy 😯 Surprised 🤤 Delicious
😆 Laughing 😱 Shocked 😘 Kissy
😂 Funny 🤔 Thinking 😏 Confident
😔 Sad 😉 Winking 😴 Sleepy
😠 Angry 😎 Cool 😜 Silly
😭 Crying 🙄 Confused 😍 Loving

Add images to the project

In embedded development, showing images on the screen is often a complex process. When coding manually, images need to be cropped to a fixed size and then converted into C arrays. Also, consider factors such as screen dimensions and image storage location.

Therefore, when using the AI Coding tool, the more detailed and specific the prompt, the more accurate and ideal the final implementation tends to be. If reference cases, code snippets, or requirement documents are available, it is advisable to provide them to the tool for context. Clearly defining technical details in advance can further enhance the relevance of the tool’s output and reduce subsequent adjustment efforts.

For example, when instructing the AI to implement image display functionality, explicitly direct it to convert the image into a C array format. Otherwise, the AI might default to using file path references and attempt to directly open image files in formats such as PNG or JPG. Moreover, given the variety of image encoding formats like RGB565 and RGB888, failing to specify the format in advance, even if the display effect is eventually achieved through multiple debugging and compilation cycles, can significantly increase the number of iterations and debugging costs.

Typical image encoding formats

The following table lists common encoding formats for PNG images.

Scenario Typical encoding format and description
Desktop display (PNG)
  • RGB24: Standard true color
  • ARGB32: Supports transparency
Embedded UI (for example, LVGL) RGB565/Indexed color: Uses 16-bit color or indexed color to save resources
Game/video rendering RGBA8888: High-performance GPUs typically use 32-bit formats

Prompt template

To enable the AI Coding tool to accurately understand requirements, it is essential to clearly specify parameters such as the target device’s supported image formats, dimensions, and storage locations. This approach effectively reduces the number of compilation and debugging iterations, thereby improving development efficiency. For specific configurations, refer to the following template.

Objective: Add the images from the image folder to the your_chat_bot project. Replace the current text-based emotion displays in src/display/ui/ui_chatbot.c with image-based representations corresponding to the emotion values. Images must be converted to LVGL RGB565 format and stored as C arrays.
Constraints: If ROM overflows, reduce the number of images to 4 key ones: happy, sad, angry, and love.
Technical requirements: Screen resolution: 480 (H) × 320 (W) pixels. GUI library: LVGL v8.
Verification: Compilation is successful, and there is no ROM overflow. The images are displayed correctly after flashing.
Fallback: If 240 × 240 resolution fails, try 120 × 120 or further reduce the number of images.

TuyaOpen Development Empowered by AI Coding

After accurately identifying your core intent, the AI Coding tool can automatically generate a Python-based image conversion utility within the target project.

TuyaOpen Development Empowered by AI Coding

Add 2048 game interface

Before developing the 2048 game interface, use the AI Coding tool to plan the interface design. After you provide constraints such as the controller chip performance and screen pixel dimensions, the tool will design a 4 × 4 game board layout. If the actual performance meets requirements, a 5 × 5 board layout can be considered for future implementation.

This step is to verify whether the final output of the AI Coding tool aligns with expectations before sending commands for implementation. If discrepancies are found, additional constraints can be incorporated into the prompt to refine the results.

Prompt template

After reviewing the 2048 game interface design planned by the AI Coding tool, instruct it to create the interface with the following requirements: Include a toggle button on the screen to enable switching between the chat interface and the game interface. Meanwhile, save the 2048 game interface as a separate UI file for easier project management.

Objective: Help me add a 2048 game interface to the your_chat_bot project. Only implement basic 2048 game functionality with score tracking. A toggle button should allow switching between the chat interface and the game interface.
Constraints: Screen resolution: 480 (H) × 320 (W) pixels. Game interface: 4 × 4 grid layout.
Verification: Compilation is successful, and there is no ROM overflow. The images are displayed correctly after flashing.

TuyaOpen Development Empowered by AI Coding

Try out

At this point, you have developed the desktop chatbot based on the TuyaOpen open-source chat project your_chat_bot. It supports emotion-based image replacement and integration with a 2048 game interface.

Attached here is the final generated sample firmware file: your_chat_bot_QIO_1.0.1.bin. You can obtain the firmware and complete the flashing process to try out the final outcome.

Tips for writing effective prompts

  • During project or demo development, it is recommended to first use AI tools to outline and summarize the overall functional architecture. Then, based on this architecture, send development commands to improve results.

  • The more detailed the initial prompt, the better the final implementation. Provide reference materials to the AI tool, if any. Predefining technical details is even more beneficial. For example, when implementing on-screen image display, specify that images must be converted to C array format and define the exact encoding format, such as RGB565 and RGB888. Without specifying the encoding format, the number of debugging iterations might increase significantly.

  • For crafting prompts, you can refer to the following template:

    Objective: [What needs to be achieved]
    Constraints: [Any limitations or restrictions]
    Technical context: [Tools/methods to be used]
    Validation: [How to confirm success]
    Fallback: [What to do if initial attempts fail]
    

    Example:

    Objective: Change the emotional image size from 64 × 64 to 240 × 240 pixels.
    Constraints: If ROM overflows, reduce the number of images to 4 key ones: happy, sad, angry, and love.
    Technical context: Regenerate using the png_to_c_array.py tool and update CMakeLists.txt.
    Verification: Compilation is successful, and there is no ROM overflow. The images are displayed correctly after flashing.
    Fallback: If 240 × 240 resolution fails, try 120 × 120 or further reduce the number of images.
    

Recommended projects for quick start

Ideas begin with imagination — T5 development boards help bring them to life! Start building your first project in just a weekend, with full technical support from the official tutorial.

Smart voice assistant

Ideal for beginners in AI development, this project delivers three core features:

  • Control smart home devices, such as lights and air conditioners, via voice commands.
  • Respond to voice commands to play music, set reminders, and more.
  • Customize your own voice wake words.

Pet care assistant

Perfect for pet-loving developers, this project enables:

  • Automated feeding: Schedule pet meals automatically, ideal for owners during travel.
  • Remote interaction: Play with cats or “walk” dogs remotely via real-time controls.

Creative lighting art

Designed for makers interested in developing visually striking projects, such as:

  • Voice-controlled color-changing lights
  • Music-synchronized strip lights