Close
0%
0%

TUYA IoT Smart Gas Knob

This project aims to develop a device that assists in the timely control of the gas knob using the TUYA IoT cloud platform.

Similar projects worth following
237 views
0 followers
Introduction-

Are you a foodie and love to cook? Maybe yes or maybe, no? But you can’t deny one thing, like it or not, but you need to cook food, we all need to cook food, and that’s our daily need. The most important appliance we need in our kitchen without which you can’t cook is a Cooking Burner, or you can call it a cooking stove in India. We primarily use Liquefied Petroleum Gas (LPG) as fuel, and few use inductions, but the function is more or less the same and has problems. If you are a person like me who loves to cook and try some new dishes like drum rice, you sometimes have a short-term memory loss problem and forget to turn off your burner’s knob.

Introduction-

Are you a foodie and love to cook? Maybe yes or maybe, no? But you can’t deny one thing, like it or not, but you need to cook food, we all need to cook food, and that’s our daily need. The most important appliance we need in our kitchen without which you can’t cook is a Cooking Burner, or you can call it a cooking stove in India. We primarily use Liquefied Petroleum Gas (LPG) as fuel, and few use inductions, but the function is more or less the same and has problems. If you are a person like me who loves to cook and try some new dishes like drum rice, you sometimes have a short-term memory loss problem and forget to turn off your burner’s knob.

Eventually, I ended up making Burnt rice, just kidding, but this is a very common problem. Taking this problem into account, its seriousness is noticeable for older people who need to cook but can’t stand up for a very long time just to adjust the flame or young moms who want to tackle their little monsters and cook simultaneously. Now there is an intelligent solution to these problems, where you can handle your other activities like watching TV, hanging out in the garden, or even changing diapers. You don’t need to worry about your food set up on the burner, and a smart knob will take care of that. 

Keeping your Gas knobs on for a very long time can lead to hazardous accidents every year. This can turn your food and your home into ashes if not taken care of. And unfortunately, we don’t have any such safety. 

Overview of Project-

This project aims to develop a device that assists in the timely control of the gas knob using the TUYA IoT cloud platform. We’ll be creating an automatic burner control using a microcontroller and sensors for assisting and safety measurements, which helps control Gas Knob position (High, Medium, Low). We’ll be using a Gas sensor, Temperature and humidity sensor, and PIR sensor.

If by any circumstances, we keep our gas knob high, and the food is getting roasted, this is detected by temp and humidity sensors, and an immediate alert will be sent to the user via Tuya cloud. For gas leakage detection, we have a Gas sensor. Suppose you are sitting in the bedroom or hanging out and check who is present in the kitchen. The presence of any person in the kitchen will be sensed by the PIR sensor and the data is sent to the user. The widespread use of this project will make use of the burner efficiently and save fuel.  

TUYA IoT Platform

 Combining Cloud platforms with IoT makes it a lot easier to build, analyze, and manage devices. To cater to that need, Tuya, a global leading IoT cloud platform, launched its Cloud Development Platform in 2020. Tuya’s Cloud Development platform offers a SaaS (Software as a Service) development framework, the most widespread type of cloud app. Developers just need a Tuya-enabled device and code, and the Cloud service will handle the rest. So, developers won’t have to worry about spending money on a separate software and updating it every time. Tuya also offers OpenAPI for app developers and many other APIs to integrate your project with. Once the Tuya-enabled device is connected to the internet, app developers can use OpenAPI or the firmware offered by the Tuya itself to build Android, iOS, and web applications quickly.

To know more about the Tuya IoT platform and how to get started, refer to the links below:

https://developer.tuya.com/en/saas-development-framework?_source=19ea467a23656a5cb2f00ca04c47c11e

https://iot.tuya.com/cloud/?code=1234&_source=7249ab79fc1429854d902ebd585699d9

Why TUYA

I decided to use the Tuya IoT platform because it is simple, powerful, and can run on cheap modules like Esp8266. Also, the Tuya IoT platform gives you a drag-and-drop MIT app inventor-like feature to build your own IoT android and iOS mobile app on the go. So, your prototype can be the next smarter IoT product with the Tuya platform. For more details on Tuya, check https://steptostem.com/2021/08/getting-started-with-arduino-iot-control-with-tuya-iot-platform/...

Read more »

JPEG Image - 161.63 kB - 09/28/2021 at 10:38

Preview
Download

  • 1 × Arduino UNO
  • 1 × ESP8266 Board
  • 1 × DHT11 Temp sensor
  • 1 × MQ135 Gas Sensor
  • 1 × Servo motor MG990

View all 7 components

  • 1
    Creating Product on TUYA

    I am going to use the Tuya IoT platform to develop a smart device from scratch. The simplicity and fast response time of the Tuya IoT cloud are amazing, all you need to do is set up function definitions, design app panel, and burn authorization firmware, and your device is ready to go with Tuya Android and iOS app. 

    On the Tuya cloud development platform, the first thing you need to do is register using your email and create your free account. The free trial versions with a limited time period are available if you’re interested in just experiencing the platform for now. Follow these simple steps.  

    Cloud > Development > Create Cloud Project

    Create ➡ Can’t find the category?

    Enter the required product information:

    Protocol ➡ Wi-Fi

    Power Type ➡ Standard Power Consumption

     Create custom function definitions for your sensors with the below-shown data type and properties. Select the features you want to add to your product from Standard functions or create new ones (Custom) if not supported by Standard functions. Standard functions indicate the functions provided by Tuya for their product categories. Since there are lots of built-in products, it is easy to find the functions you need. Also, you can create your specialized functions named Custom functions, depending on your project.

    The data point (DP) is the abstract representation of a function, and each function has an ID and data type.

    Data Point ID (DP ID): indicates the code of a data point (function). Tuya Cloud sends or receives data through data point IDs. I created four custom DP for PIR, Gas, Temp, and humidity sensors and one motor controlling DP for controlling Gas knob (you can add more functions such as timer, lighting, sound, and many more).

    If you wish to add some of your own DPs and customize your project, Tuya can do that easily by customizing the DPs by clicking edit and add DP.

    Select standard Tuya ESP8266 module SDK in the hardware development section. Even if you don’t, it’s okay. If you have a Standard TUYA module SDK, select the appropriate one or place an order, Tuya will deliver it.

  • 2
    Designing our App Panel Interface

    Making our own App Panel Interface is amazing, but you should look at the pre-designed App panel that Tuya provides. According to your project and selected DP, it will automatically show you a catchy App panel designs list. If you wish to make your own, then select the blank panel.

    You would be able to see all your DP UI elements which you can modify. In fact, there are lots of UI available for you to drag-and-drop and make a fantastic panel. Once it’s ready, click on the release button. I have also added chart and log elements for greater data summarization.

    Once your panel is released, you should see and use it by scanning through the Tuya IoT app on mobile.

     Authorizing ESP8266 with Tuya IoT firmware

    To use the NodeMCU ESP8266 as a Tuya product for this project, you need to flash and authorize it with the required firmware. To authorize the ESP8266, you have to send the product ID (PID) and your Tuya IoT account name (e-mail) to devops@tuya.com. After a while, they will send you a Token ID. Then, follow the steps below:

    First, go to the Tuya PMS service page https://pms.tuya.com/en/login .and sign up for an account if you don’t have one. Then, go to

    Production Manage ➡Work Order Management ➡ Activation Code Verification

    To activate the production certificate for the product, enter the Token ID. When the Token ID is confirmed, the ESP8266 is ready to be flashed and authorized. Remember, only once ID can authorize from a single account. To check your activated Tokens, go to the Activation Code List in the Production Manage -> Work Order Management list. You can download the cloud auth token burning application from the PMS console Software Download section or Download installations package on the Google drive https://drive.google.com/file/d/1SF-rM5qDLaPJiuMHrkqFauVyRXSSHMkj/view?usp=sharing from Tuya ESP8266 guide (link in the reference section) and log in with your PMS account.

    You should keep in mind a few steps while setting up TYDA software; you may face the same problem that I faced and got them corrected. 

    • When you download your Zip file, make sure you extract it on the desktop by creating a separate folder. Don’t try to extract it in a program file in Windows C. You can extract it anywhere but try to keep it on the desktop. 
    • After extracting, go to the TYDA application, run it as administrator and install the software. 
    • After Installing, open TYDA and log in using your PMS account details with the same email and password, or else it will show an error.
    • If it’s in Chinese till login, you click the first option, and after entering TYDA, select the language change option as shown.

    Solution-

    Set the baud rate and test baud as shown in the above image. Also, click on Enter Token button and enter the token you got from the Tuya devops@tuya.com email reply.

    Connect the NodeMCU V3 LoLin ESP8266 to the computer via a USB cable and select its port number, such as COM5. If you did not use it with the Arduino IDE or other compilers before, you might need to install its driver. Finally, click on flash to burn auth tokens. You would see a green box with success if nothing breaks.

  • 3
    Programming and flashing Arduino

    I will make this part simpler by going into details of the Tuya IoT Arduino library. First, import all required libraries to work with sensors and ESP8266 over Serial. Setup Tuya Serial connection

    1. DHT11 Library: Download

    2. MQ-135 Library: Download

    3. Adafruit SSD1306 Library: Download

    Start with defining and adding the library. 

    Define and store all DP ids we made on the Tuya IoT platform while creating our new device.

    Define all the variables 

    Fill your PID from Tuya IoT console and firmware version like shown below,

    In void setup( ) let us initialize all callbacks to Tuya IoT cloud,

    In the loop part, we need to start the UART service to allow Arduino to receive and send data to ESP8266 over serial, and ESP8266 sends it to Tuya IoT cloud.

    First, check if the device is in network mode or not and connected to the cloud; you would be able to see the status via led; if led is stable, it means it is connected to the cloud. If blinking, it means in connection mode.

    Now, implement your program logic to send data to Tuya IoT cloud and App Panelmcu_dp_update(DPID, value, 1); send your data values like this if the device is connected to the cloud.

    Set sensors data and send to Tuya cloud

    We also have the dp_process() function but it is to be used when you want to receive commands and take control over Arduino pins, like controlling actuators, just implement a switch case and do required actions based on triggered char did value. Check the previous tutorial here on the usage of dp_process(),

    At last update all values, it ensures that all your data values are updated continuously; you can try skipping mcu_dp_update(DPID, value, 1) in void loop() since we already got a dp_update_all() function running continuously to update all values but make sure those variables are global.

    APP Panel Interface setup on the phone

                        

    Reference Links:

View all 3 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

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