Giter Club home page Giter Club logo

tuya-iotos-embeded-demo-wifi-ble-smart-planter's Introduction

Tuya IoTOS Wi-Fi and BLE Indoor Garden Demo

中文版 | English

Overview

This demo describes how to implement a smart indoor garden through Tuya IoTOS SDK. With Tuya Cloud, Tuya Smart app, and Tuya Wi-Fi or Wi-Fi+BLE modules, you can easily implement IoT-enabled functions such as remote control, data monitoring, and remote control.

Implemented functions:

  • Light monitoring
  • Temperature and humidity monitoring
  • Soil moisture monitoring
  • Water tank level monitoring
  • Automatic light filling
  • Automatic spraying
  • Automatic heating
  • Automatic ventilating
  • Automatic water tank filling
  • Automatic watering

Quick start

Download and compile

  • Download Tuya IoTOS Wi-Fi and BLE SDK

  • Download the demo to apps directory under the SDK directory

    $ cd apps
    $ git clone https://github.com/tuya/tuya-iotos-embeded-demo-wifi-ble-smart-planter
  • Execute the following command in the SDK root directory to start compiling:

    $ cd ../
    $ sh build_app.sh apps/tuya-iotos-embeded-demo-wifi-ble-smart-planter tuya-iotos-embeded-demo-wifi-ble-smart-planter 1.0.0
  • For more information about burning and authorizing module, see Burn and Authorize WB Series Modules.

Directory structure

├── src  
|    ├── plant_driver
|    |        ├── bh1750.c            // BH1750 light sensor driver
|    |        ├── rs2255.c            // RS2255 analog multiplexer
|    |        ├── sht21.c             // SHT21 humidity and temperature sensor driver
|    |        └── plant_pwm.c         // Light board driver. Call the PWM API in the SoC layer for repackaging
|    ├── plant_soc                    // Tuya SDK APIs in the SoC layer
|    ├── tuya_device.c                // Application entry file
|    ├── app_plant.c                  // Main application layers of the smart indoor garden
|    └── plant_control.c              // The control logic of each functional component of the smart indoor garden
|
├── include                           // Header file directory
|    ├── plant_driver
|    |        ├── bh1750.h
|    |        ├── rs2255.h
|    |        ├── sht21.h
|    |        └── plant_pwm.h
|    ├── plant_soc
|    ├── tuya_device.h
|    ├── app_plant.h
|    └── plant_control.h
|
└── output                            // Compilation output

Demo entry

Entry file: tuya_device.c

Important functions: device_init()

  • Call tuya_iot_wf_soc_dev_init_param() to initialize the SDK, configure the operating mode and pairing mode, register callback functions, and store the firmware key and PID.
  • Call tuya_iot_reg_get_wf_nw_stat_cb() to register the network status callback function.
  • Call application layer initialization function app_plant_init().

DP related

  • Data flow of DP sending: dev_obj_dp_cb() -> deal_dp_proc()
  • API of DP reporting: dev_report_dp_json_async()
Function name OPERATE_RET dev_report_dp_json_async(IN CONST CHAR_T *dev_id,IN CONST TY_OBJ_DP_S *dp_data,IN CONST UINT_T cnt)
devid Device ID. If the device is a gateway, MCU, or SoC, devid is NULL. If the device is sub-device, devid is sub-device_id.
dp_data The name of DP struct array.
cnt The number of DP struct arrays.
Return OPRT_OK: Succeeded. Other: Failed.

I/O list

RS2255 BH1750 SHT21 Water level sensor Soil moisture sensor Light board Mist maker Watering pump Infrared bulb Fan Water tank pump
A P6 SDA P6 SDA P6 AO channel_x1 AO channel_x2 PON P8 Relay P24 Relay P14 Relay P20 Relay P21 Relay P22
B P7 SCL P7 SCL P7 RON P9

Evaluation kits

For more information about SDK, see Sandwich Evaluation Kits.

For the full document, see Fully-Functional Smart Indoor Garden.

Technical support

You can get support from Tuya through the following accesses:

tuya-iotos-embeded-demo-wifi-ble-smart-planter's People

Contributors

coral-hu avatar flyingcys avatar funnybunnyqaq avatar homer173 avatar zlinoliver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.