IOT step on pit road (a) based on little love and ESP8266 students Blinker control lamp

IOT step on pit road (a) based on little love and ESP8266 students Blinker control lamp

Really boring to stay at home, little love fiddle students to pass the time, want to try the smart home features, suffer no intelligent devices, just happen to have a WiFi module, Zhaxian inspiration, why not own a smart device DIY it, something broke our hearts step on pit road starts
Here Insert Picture Description

First, prepare materials

  • Esp8266WiFi module
  • Intelligent devices with little love students
  • USB to TTL serial module
  • A cell phone (download Mi APP, BlinkerAPP)

Second, the students love the small official developer documentation

Here Insert Picture Description
Little love the students temporarily open individual developers interface, but can be based on third-party cloud service connection millet cloud
Here Insert Picture Description
after some human flesh comparison, the final lock Blinker Things platform, the easiest, most likely entry ( official says )

Three, Blinker open platform

1. Blinker Kan网

Here Insert Picture Description
It is very simple, but there is quick taste of chicken, no matter, easy to use on the line

2. development environment to build a wave

  1. Download and install arduino IDE development environment
    Download: https://share.weiyun.com/5aNlfTg
    There pit (fucked me a full three days, the success of the official introduction of three minutes to build smart device dragged into 3 days): arduino2 / bin / avr-g ++ : no such file or directory that BUG, change the environment variables (the working people of blood and tears ah ~)
    Here Insert Picture Description
  2. Packaged esp8266 download the installation package, unzip and run directly to
    Download: https://pan.baidu.com/s/19yEQ4UDF-bQCzt3BsdV6Yw
    https://share.weiyun.com/5CGEKJO
  3. Blinker Download Library
    Download: https://github.com/blinker-iot/blinker-library/archive/master.zip
    to extract the zip to E: \ XXOO \ XXOO \ arduino -1.8.8-windows \ arduino-1.8. 8 \ libraries in
    Here Insert Picture Description
  4. APP download and install Blinker
    Android: http://cdn.diandeng.tech/blinker-2.3.1-release.apk
    IOS: https://apps.apple.com/cn/app/id1498805902

3. esp8266 & WiFi access

  1. Get Device Secret Key in the blinker
    Here Insert Picture Description

  2. Select ESP8266
    Here Insert Picture Description

  3. ATK-ESP8266 to burn the firmware program, led by blinker control the onboard
    connection with DuPont line USB to TTL serial module and ATK-ESP8266 module: Here Insert Picture Description
    the line after a good connection can be connected to PC, back to the IDE, open [file] -> [example] -> [Blinker] -> [Blinker_Hello] -> [] Hello_WiFi Here Insert Picture Descriptionfind, into their own

char auth [] = "abcdefghijkl" ; // blinker app acquired in the preceding step in Key Secret
char SSID [] = "ABCDEFG"; // you WiFi hotspot name
char pswd [] = "123456789" ; / / your WiFi password

After the completion of the program to be uploaded, the wire pulled wifi module IO_0, leave it open, and restart the WiFi module

  1. Open the app under control tryHere Insert Picture Description

Fourth, the students love the small access

1. Mi binding Blinker

Open-meter house, my inside to find third-party devices, find lighting technology , binding account

2. Service Interface burned into firmware

Open the file Hello_wifi

#define BLINKER_WIFI
#define BLINKER_MIOT_LIGHT		//添加这一行,就能支持小爱控制

#include <Blinker.h>

//setup()函数中
...
Blinker.begin(auth, ssid, pswd);
    Blinker.attachData(dataRead);
    BlinkerMIOT.attachPowerState(miotPowerState);		//添加这一行,作用是注册下面的回调函数

    Button1.attach(button1_callback);
...

//setup()函数前添加如下代码
void miotPowerState(const String & state)
{
    BLINKER_LOG("need set power state: ", state);

    if (state == BLINKER_CMD_ON) {
        digitalWrite(LED_BUILTIN, LOW);

        BlinkerMIOT.powerState("on");
        BlinkerMIOT.print();
    }
    else if (state == BLINKER_CMD_OFF) {
        digitalWrite(LED_BUILTIN, HIGH);

        BlinkerMIOT.powerState("off");
        BlinkerMIOT.print();
    }
}

After editing, re-burning process, restart WiFi module, and then add the device in the small speakers love or rice at home, you can see our equipment in the smart home diy small list of speakers in love

V. Xiuer

Here Insert Picture Description

Released four original articles · won praise 4 · Views 170

Guess you like

Origin blog.csdn.net/qq_43907537/article/details/105018110