Getting started with Tuya IoT platform
(Last Updated On: July 20, 2021)

Table of Contents:

Introduction:

In this video, we will look at the Tuya IoT platform. by the end of the video, you are able deploy a tuya IoT platform-based IoT device that offers you to connect and control anything from anywhere in the world.

What is Tuya?

Tuya Smart is a leading global IoT Cloud Platform that connects the intelligent needs of brands, OEMs, developers, and retail chains.
The platform provides developers a one-stop IoT PaaS-level solution that contains hardware development tools, global cloud services, and smart business platform development, tuya offering comprehensive ecosystem empowerment from technology to marketing channels to build the world’s leading IoT Cloud Platform.

I see tuya as the future of IoT and a universe of possibilities.

tuya

Now, Let’s see how to create a Thing in tuya smart IoT platform that offers you to connect and control anything from anywhere in the world.

How to create a Thing in the tuya smart IoT platform?

This process contains three main steps.

1. Creating a thing on the Tuya IoT platform and Activating it on the tuya PMS platform.
2. Burning authorizations of tuya into the ESP8266 module.
3. Interfacing ESP8266 module with Arduino UNO and Programming the same device to connect with tuya smart IoT platform.

Let’s dive deeper into each step.

Video Tutorial: Getting started with the Tuya IoT platform

This tutorial is also available in video format, you can watch the below videos or continue reading this article.

Before going further, make sure you have the following components with you.

  1. Arduino UNO
  2. Arduino Uno Programming cable
  3. ESP8266 module.
  4. MicroUSB cable to program the ESP8266 module.
  5. breadboard
  6. Some connecting wires

1. Creating a thing on the Tuya IoT platform and Activating it on the tuya PMS platform.

First of all, visit the Tuya IoT platform using this link.

Signup by providing the required info and then confirm your email. If you register on Tuya Smart IoT platform using this link, you will get $7 coupon, you can use them to purchase any tuya modules on the same platform.

Then login to the Tuya IoT platform using the same credentials.

tuya login

If you find the website in the Chinese language, you can change it to English from here.

Then click on the create a product, Then make sure you are in the standard category.

tuya change language

In this tutorial, I am going to discuss controlling a light source from the tuya IoT platform. So, go to the Lighting category and light source.

select solution type, custom solution. then click on the bulb icon. Provide a name for your device, if you wish you can also provide a model for it. then check protocol WiFi-Bluetooth and power type standard power consumption, after that click on create button.

That’s it a new product/ device has been created on the tuya IoT platform.

Tuya PID

Now, copy the product id or say PID and mail it to “[email protected]” together with your Tuya IoT account name as the subject.

After some time, you will receive a token from the Tuya DevOps team.

Tuya Token

Then, visit the tuya PMS platform using the link provided in the description. signup by providing all required details, then log in using the same credentials.

tuya pms platform

If you find the website in the Chinese language, you can change it to English from top right corner

Click on Production management, work order management, then activation code verification. Input Token ID that you just receive over mail and confirm.

tuya token activation
Please note that the One Token ID can only be activated by one user.

That’s it. The token was activated successfully. Thus the first step was completed.

2. Burning authorizations of the tuya thing into the ESP8266 module.

We will use the TYDA software application to burn the authorization into the ESP8266 module. Download the installation package from this link.

Install the Tuya_TYDA_Install_V2.4.0 and log in with your PMS account by clicking the Online Login button.

You can choose Automatic Login and Remember The Password if you want to log in automatically, whenever you have opened the software.

After successful login, the following page should appear.

TYDA

If you find the software in the Chinese language, go to the video, I have clearly known how to change the language of the softare.

Now, connect ESP8266 to your PC using any USB interface and install ESP8266 driver CP210x from the same folder. If you ever programmed an ESP8266 module with a computer you can skip this step.

tuya esp8266

after successful installation, go to device manager from the Windows start menu and click on the ports section. you will find a silicon lab CP210x driver installed. note down the comport no, generally it would be COM3.

CP210X

Then, come back to the TYDA application and select the setup option from the file menu. select burning baudrate 921600 and testing baudrate 9600 and leave the rest of the configurations as default. then click on the ok button.

tyda

Click Enter Token to input the token which is activated on the tuya PMS platform and select workstation-Burning Authorization, also check the firmware download option. then click on okay.

tyda

Now, select the previously noted com port and click on the run button.

tyda

a few seconds after the burning procedure will begin and continue until 100%, then you will see the following success page on the software.

tyda
If the burning fails, make sure you have installed the driver properly, or selected the right port, or put the ESP8266 module in the programming mode or not.

If the following success page appeared on the software, congratulations… you have successfully burned tuya authorizations into the ESP8266 module.

After burning authorizations, disconnect esp8266.

3. Interfacing ESP8266 module with Arduino UNO and Programming to connect with Tuya smart IoT platform.

Here is the circuit diagram to interface the ESP8266 module with Arduino, The Arduino UNO will communicate with ESP8266 over serial communication. Here we are using the serial port of both Arduino and ESP8266 to make them communicate with each other.

Tuya smart IoT circuit diagram

Now open ArduinoIDE. We are going to use the Tuya library for this project. Tuya has published its official library in the Arduino library manager, so we can install it directly from the library manager.

 

Click the Sketch menu and then Include Library > Manage Libraries. Find Tuya_WiFi_MCU_SDK and install.

Tuya arduino library

or you can download the same library from the tuya’s GitHub page and add the package to the Arduino library folder after unzipping it.

then restart the ArduinoIDE, and verify that the Tuya library appears in Contributed libraries section by going to the following directory.

Now, go to the examples section from the file menu and search for Tuya_WiFi_MCU_SDK, and open the start example.

tuya start example

Now Connect Arduino Uno with PC

Then check uploading configurations board Arduino Uno, and select the right port. then compile the code and upload it to the Arduino UNO

Arduino comport

If you face any problems while uploading, just disconnect ESP8266 and try uploading again. because The connection between these two boards might interfere with the uploading.

After successful uploading, take out your mobile and install the tuya smart app from the play store.

then create a new account and log in to it.

tuya smart app installation guide

Now, connect the GPIO pin 7 of the Arduino to the ground for 3 to 4 seconds to put the device into pairing mode.

tuya pairing mode
The onboard led will flicker if the module in pairing mode.
Now go to the tuya smart app and add the device. follow the instructions which are shown on the app.

Tuya smart app add devices

 

 

Upon successful pairing, you are able to control the onboard led of Arduino UNO as shown here.

On State:

tuya on state

Off State:

tuya off state

This led internally connected to pin 13, We can simply interface the 230v bulb with the same pin using a relay and control the same bulb.

That’s it for the tutorial.

I hope you have enjoyed the video and learned something new from this episode. see you soon on the next video. bubye…together let’s innovate the future with IoT.

Video Tutorial:

By Veeru

One thought on “Getting started with Tuya IoT platform | How to Deploy a thing on Tuya Smart IoT Platform.”
  1. I thoroughly enjoyed reading your insightful article on IoT intelligent platforms. It’s fascinating to see how these platforms are revolutionizing the world of connected devices and unlocking new possibilities for businesses and consumers alike.

    Your discussion about the benefits of IoT intelligent platforms in terms of efficiency, scalability, and improved decision-making resonated with me. Indeed, by leveraging advanced analytics, machine learning, and real-time data processing, these platforms enable organizations to optimize their operations and drive meaningful insights. The ability to seamlessly integrate devices, sensors, and data streams within a unified ecosystem is a game-changer, empowering businesses to make data-driven decisions with greater speed and accuracy.

    Thank you for sharing your expertise and shedding light on this exciting field. I look forward to reading more of your insightful articles in the future.

Leave a Reply