newrudeman

[Course Design] Internet of Things +540724A

 
Overview

Introduction : Use esp8266 to connect to the lighting technology platform, and you can use Tmall Genie and Xiaoai voice control. There are relays, RGB lights, and photoresistors. Use ESP8266 to learn the data upload and distribution of lighting technology. Developed using Arduino IDE, it is easy to get started and you can quickly understand the use of the Internet of Things. ESP8266 can also be used to connect to other cloud platforms to implement IoT functions.

 

0.esp8266, Arduino development environment setup (Note: Both methods are available, just choose one)

Website: https://www.jianshu.com/p/adc5e62bdf5f 

Or https://www.jianshu.com/p/cb0274d612b5

 

Diandeng Technology: https://www.diandeng.tech/doc/getting-start-8266, (Note: Using the Diandeng blinker requires the Arduino library, which can be found on the Diandeng official website)

1.在点灯文档中心——>快速开始——>esp8266-WiFi接入,找到The first sample program of Dian Deng Technology, use the "Dian Deng blinker" APP, create a new one on the APP"btn-abc"名称按键即可实现使用按键控制esp12f模块自带led的开/关

Need to complete: 1. Create the key of the new device in Dian Deng APP, fill in the wifi name and password

char auth[] = "Your Device Secret Key";

char ssid[] = "Your WiFi network SSID or name";

char pswd[] = "Your WiFi network WPA password or WEP key";

#define BLINKER_PRINT Serial
#define BLINKER_WIFI

#include <Blinker.h>

char auth[] = "Your Device Secret Key";
char ssid[] = "Your WiFi network SSID or name";
char pswd[] = "Your WiFi network WPA password or WEP key";

// 新建组件对象
BlinkerButton Button1("btn-abc");
BlinkerNumber Number1("num-abc");

int counter = 0;

// 按下按键即会执行该函数
void button1_callback(const String & state) {
    BLINKER_LOG("get button state: ", state);
    digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
}

// 如果未绑定的组件被触发,则会执行其中内容
void dataRead(const String & data)
{
    BLINKER_LOG("Blinker readString: ", data);
    counter++;
    Number1.print(counter);
}

void setup() {
    // 初始化串口
    Serial.begin(115200);

    #if defined(BLINKER_PRINT)
        BLINKER_DEBUG.stream(BLINKER_PRINT);
    #endif

    // 初始化有LED的IO
    pinMode(LED_BUILTIN, OUTPUT);
    digitalWrite(LED_BUILTIN, HIGH);
    // 初始化blinker
    Blinker.begin(auth, ssid, pswd);
    Blinker.attachData(dataRead);
    Button1.attach(button1_callback);
}

void loop() {
    Blinker.run();
}

2.在点灯文档中心——>设备端开发与SDK——>Arduino支持,可以找到How to use the BlinkerRGB color component

(1) Initialization, creating objects

#define RGB_1 "RGBKey"

BlinkerRGB RGB1(RGB_1);

(2) Callback function for processing RGB  received data

void rgb1_callback(uint8_t r_value, uint8_t g_value, 
                    uint8_t b_value, uint8_t bright_value)
{
    digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
    BLINKER_LOG("R value: ", r_value);
    BLINKER_LOG("G value: ", g_value);
    BLINKER_LOG("B value: ", b_value);
    BLINKER_LOG("Rrightness value: ", bright_value);
}

(3)  Register the callback function in setup()

RGB1.attach(rgb1_callback);

3.在点灯文档中心——>项目实战——>温湿度计,可学到如何上传数据。

Please complete it yourself, please refer to the attachment C file

 

4.在点灯文档中心——>语音助手接入,可学到如何接入语音助手。

Please complete it yourself, please refer to the attachment C file

 

Summary: After completing these four steps, you can learn the basic data upload and distribution of the Dian Deng Technology IoT platform, and voice assistant access. The attached C file is the same code as the Arduino code, which implements lighting APP, LED control, relay control, RGB control, photoresistor value upload, and adds Xiao Ai to control the LED switch.

 

Outlook: After completing this, if you are interested in the Internet of Things, you can continue to add the button (GPIO0 button) distribution function. The Dian Deng Technology platform encapsulates the Internet of Things process, which is suitable for igniting students' interest in learning the Internet of Things. It is recommended that students who are interested in the Internet of Things continue to use this development board to learn other Internet of Things platforms. Suggestion: Ali Life IoT Platform (i.e. Ali Feiyan Platform) is very good. Alios things developed by Ali can quickly connect to Ali Feiyan Platform. Alios things address: https://github.com/alibaba/AliOS-Things/blob/rel_3.1.0/README-zh.md

 

 

 

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-19 20:39:15

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号