Close
0%
0%

Blink an LED on ESP32 board with Tuya Link SDK

Setup the Tuya platform with the Espressif’s ESP32 boards and further use it to control an LED through an Android device.

Similar projects worth following
996 views
0 followers

Tuya is an all-in-one IoT Platform that enables the user to build smart IoT solutions by connecting devices efficiently, securely, and reliably. 

This is a getting started article to set up the Tuya platform with the Espressif’s ESP32 boards via Tuya Link SDK. Further, we use it to control an LED through an Android device. When the switch in the Tuya Smart App is turned ON, the LED connected to the ESP32 board glows and vice versa.

View all 7 components

  • 1
    Hardware Connections for Tuya Link SDK

    The ESP32 board is placed on a breadboard. The positive terminal of the LED is connected to digital pin 5 of the ESP32 board and the negative terminal is connected to the ground pin via the ballast resistor as shown in the following circuit diagram.

    Hardware Connections Tuya Link SDK

  • 2
    Software Setup: Tuya IoT Platform

    Login to your Tuya Account or if you don’t have an account then create one using the SignUp option.

    Tuya Link SDK Login Page

    Once Logged In, an overview of the platform is visible. Click the Create button to start a new Project.

    Tuya Dashboard

    To develop the application for ESP32 click on ‘Can’t find the category?’. The following custom creation menu should appear.

    Tuya Custom Category Creation

    Fill the required fields as done above and click Create. A pop-up box will appear, just close it to get the following screen.

    Tuya Function Dashboard

    Here, we’ll add a custom function of the following settings.

    Custom Function Creation

    Click OK. The function will now be visible.

    Tuya link SDK custom function visible

    Tuya Smart Application Graphical User Interface (GUI) now needs to be developed. For that, simply switch to the Device Panel tab and select ‘Create Blank Panel’.

    Device Panel Tab

    Following are the steps to complete the UI Studio procedure.

    You can always test and release the application before moving further.

    Note: The testing procedure requires you to install and login to the Tuya Smart Application on your Android and enter the same login email id here.

    UI test and release

    UI Testing Process

    Once back to the Tuya IoT platform, it’s now time to generate a license for Link SDK.

    license generation for Tuya Link SDK

    Select Link SDK Cloud Access Mode from the Hardware Development Tab. Click on the ‘Select’ button provided to place the License order. Click ’Get 2 Free Licenses’ and complete the steps to finally download a .xlsx file with uuid and key.

    Now it’s time to install tuyaos-link-sdk to avail connectivity to Tuya Smart Application via Python 3.x. On your Windows PC run the following commands to clone the GitHub repository and install the tuyaos-link-sdk.

    git clone https://github.com/tuya/tuyaos-link-sdk-python.git
    python -m pip install ./tuyaos-link-sdk-python

    tuyaos-link-sdk install python

    Open the ledapp.py file from the GitHub repo in the editor. Edit and change the productid, uuid, authkey and the COM port of your connected ESP32 device in the file. We’ll further use this file in the output section of this article.

  • 3
    Software Setup: Tuya Smart Application

    Install the Tuya Smart App from the Google Play Store of your Android Device.

    Tuya Smart App Google Play Store

    Login to your Account or if you don’t have one create one!

    Tuya Smart Account Login

    Now from the add device section click the scanner button to scan the QR code generated by the ledapp.py file.

    Tuya Smart Add device
    Tuya Smart Add device Options

    Tuya Smart Scan

    Now the ESP Application will be added to the All Devices section of the Tuya Smart App.

View all 5 instructions

Enjoy this project?

Share

Discussions

condaana0069 wrote 03/12/2024 at 10:29 point

Using the Tuya platform with Espressif's ESP32 boards to control an LED through an Android device is a reliable and commonly used method for IoT (Internet of Things) projects. The Tuya platform provides comprehensive cloud services and SDKs that allow developers to easily connect and control various devices, including ESP32-based devices like LED controllers, smart switches, and more

  Are you sure? yes | no

Anwar Bashir wrote 02/05/2024 at 18:36 point

Hi, after installing git and cloning and pip there is no file called ledapp.py. What am I doing wrong?

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates