Cov txheej txheem:

Yuav Ua Li Cas Tsim Lub Chaw Huab Cua Siv XinaBox thiab Ubidots Hla HTTP: 7 Cov Kauj Ruam
Yuav Ua Li Cas Tsim Lub Chaw Huab Cua Siv XinaBox thiab Ubidots Hla HTTP: 7 Cov Kauj Ruam

Video: Yuav Ua Li Cas Tsim Lub Chaw Huab Cua Siv XinaBox thiab Ubidots Hla HTTP: 7 Cov Kauj Ruam

Video: Yuav Ua Li Cas Tsim Lub Chaw Huab Cua Siv XinaBox thiab Ubidots Hla HTTP: 7 Cov Kauj Ruam
Video: QHIA QHOV TSEEB - KUB VAJ LOOG TSUA NEW MUSIC VIDEO 2022 2024, Hlis ntuj nqeg
Anonim
Yuav Ua Li Cas Tsim Lub Chaw Huab Cua Siv XinaBox thiab Ubidots Hla HTTP
Yuav Ua Li Cas Tsim Lub Chaw Huab Cua Siv XinaBox thiab Ubidots Hla HTTP

Kawm paub yuav ua li cas thiaj tsim koj tus kheej Chaw Nres Tsheb Huab Cua ntawm Ubidots, siv XinaBox xChips (IP01, CW01 thiab SW01)

Duab
Duab

ESP8266 Core thiab Wi-Fi module (xChip CW01) tso cai rau cov neeg siv xa cov ntaub ntawv los ntawm XinaBox's modular xChips mus rau huab. Cov ntaub ntawv no tuaj yeem saib xyuas nyob deb ntawm Ubidots, qhov uas cov neeg siv tuaj yeem siv qhov zoo ntawm lawv cov cuab yeej IoT.

XChip SW01 Advanced Weather Sensor (Bosch BME280) ntsuas kub, av noo thiab huab cua siab, los ntawm qhov siab, huab puag thiab dej lwg taw tes tuaj yeem suav tau.

Hauv qhov kev qhia no peb siv HTTP raws tu qauv kom xa cov ntaub ntawv ntsuas mus rau Ubidots. Qhov no tseem tuaj yeem ua tiav siv MQTT raws tu qauv.

Txog qhov kawg ntawm phau ntawv qhia no, koj yuav tuaj yeem saib xyuas thiab ntsuas huab cua ntawm koj lub XinaBox cov cuab yeej los ntawm txhua qhov chaw nyob deb siv Ubidots.

Kauj ruam 1: Yuav tsum tau ua

  • 1x CW01 - WiFi tub ntxhais (ESP8266/ESP -12F)
  • 1x IP01 - USB Programming Interface (FT232R)
  • 1x SW01 - Huab Cua Zoo Tshaj (BME280)
  • 1x XC10 - 10 -Pob xBUS Cov Txuas
  • Arduino IDE Cov
  • Ubidots tus account

Kauj ruam 2: Teeb Kho Vajtse

Txuas CW01, SW01 thiab IP01 ua ke siv XC10 xBUS txuas. Koj tuaj yeem txuas nws raws li qhia hauv daim duab hauv qab no. Thov saib phau ntawv qhia no yuav ua li cas sib sau ua ke xChips feem ntau.

Duab
Duab

Tom qab ntawd, txuas koj lub cuab yeej thiab PC los ntawm IP01 USB. Txog qhov no, koj yuav tsum tau siv xFlasher software txhawm rau nyem qhov chaws thaum npaj tau. Saib phau ntawv qhia no ntawm kev siv xFlasher.

Kauj Ruam 3: Teeb Arduino IDE

1. Nruab Arduino IDE 1.8.8

2. Nruab cov tsev qiv ntawv no rau Arduino: ESP8266 Arduino, Ubidots ESP8266, xCore, xSW01.

NCO TSEG: Yog tias koj tsis paub yuav ua li cas rau Nruab cov tsev qiv ntawv, thov mus saib qhov txuas: Txhim kho Arduino cov tsev qiv ntawv

3. Nrog ESP8266 lub platform teeb tsa, xaiv ESP8266 lub cuab yeej koj ua haujlwm nrog. Hauv qhov xwm txheej, peb tab tom ua haujlwm nrog "CW01 (ESP12F module)". Txhawm rau xaiv koj lub rooj tsavxwm los ntawm Arduino IDE, xaiv Cov Cuab Yeej> Pawg "NodeMCU 1.0 (ESP12E module)".

NCO TSEG: ESP12F thiab ESP12E sib pauv tau rau lub hom phiaj no.

Kauj Ruam 4: Nkag Siab Txoj Cai

Xws li cov tsev qiv ntawv:

#suav nrog "UbidotsMicroESP8266.h"

#ncig #ncig

Nkag mus rau koj li Wi-nkaus thiab Ubidots Cov Ntawv Pov Thawj:

#define TOKEN "Koj-Token" // Muab tso rau ntawm no koj cov Ubidots TOKEN

#define WIFISSID "Koj-SSID" // Muab koj li Wi-nkaus SSID #define PASSWORD "password-of-ssid" // Muab koj tus password Wi-nkaus rau ntawm no

Koj qhov tshwj xeeb Ubidots TOKEN tau txais los ntawm koj tus lej Ubidots. Xa mus rau qhov txuas hauv qab no txhawm rau kawm paub nrhiav qhov twg koj li Ubidots TOKEN.

Ib zaug teeb tsa, saib cov lus rau kev piav qhia tus kheej:

void teeb tsa () {

// Debugging ntawm 115200 siv cov saib xyuas Serial.begin (115200); // Txuas mus rau Access Point client.wifiConnection (WIFISSID, PASSWORD); // I2C kev sib txuas lus pib Wire.begin (); // Pib SW01 Sensor SW01.begin (); // Qhia qee qhov qeeb, 2-3 feeb qeeb (DELAY_TIME); }

Loop txoj haujlwm, kom nws khiav thiab hloov kho tas li:

void voj () {

// Tsim kom muaj qhov sib txawv los khaws cov ntaub ntawv nyeem los ntawm SW01 ntab tempC, av noo, siab, alt; // Tsim cov cuab yeej hloov pauv tempC = 0; av noo = 0; siab = 0; alt=0; // Poll Sensor rau sau cov ntaub ntawv SW01.poll (); // Txuag cov ntaub ntawv rau cov cuab yeej hloov pauv tempC = SW01.getTempC (); // Kub hauv Celsius Serial.println ("Kub:"); Serial.print (tempC); Serial.println (" *C"); Serial.println (); vaum = SW01.getHumidity (); Serial.println ("Vaum:"); Serial.print (av noo); Serial.println (" %"); Serial.println (); siab = SW01.getpressure (); Serial.println ("Siab:"); Serial.print (siab); Serial.println ("Pa"); Serial.println (); alt=SW01.getAltitude (101325); Serial.println ("Qhov siab:"); Serial.print (alt); Serial.println ("m"); Serial.println (); // Tsim ubidots hloov pauv client.add ("Kub (*C)", tempC); ncua (500); client.add ("Vaum (%)", av noo); ncua (500); client.add ("Siab (Pa)", siab); ncua (500); client.add ("Qhov siab (m)", alt); // Xa txhua qhov dots client.sendAll (muaj tseeb); // ncua ntawm lub sensor nyeem kom ruaj khov ncua (DELAY_TIME); }

Txoj cai tiav:

#suav nrog "UbidotsMicroESP8266.h"

#include #include #define TOKEN "Your-Token" // Muab tso rau ntawm no koj li Ubidots TOKEN #define WIFISSID "Koj-SSID" // Muab koj li Wi-nkaus SSID #define PASSWORD "password-of-ssid" // Muab tso rau ntawm no koj li Wi-nkaus password Ubidots tus thov kev pab (TOKEN); const int DELAY_TIME = 2000; xSW01 SW01; // Tsim cov khoom ntawm SW01 sensor void teeb () {Serial.begin (115200); client.wifiConnection (WIFISSID, PASSWORD); Hlau.begin (); // Pib SW01 Sensor SW01.begin (); ncua (DELAY_TIME); } void loop () {// Tsim kom muaj qhov sib txawv los khaws cov ntaub ntawv nyeem los ntawm SW01 ntab tempC, av noo, siab, alt; tempC = 0; av noo = 0; siab = 0; alt=0; // Poll Sensor rau sau cov ntaub ntawv SW01.poll (); // Txuag cov ntaub ntawv rau qhov sib txawv cim xeeb tempC = SW01.getTempC (); // Kub hauv Celsius Serial.println ("Kub:"); Serial.print (tempC); Serial.println (" *C"); Serial.println (); vaum = SW01.getHumidity (); Serial.println ("Vaum:"); Serial.print (av noo); Serial.println (" %"); Serial.println (); siab = SW01.getpressure (); Serial.println ("Siab:"); Serial.print (siab); Serial.println ("Pa"); Serial.println (); alt=SW01.getAltitude (101325); Serial.println ("Qhov siab:"); Serial.print (alt); Serial.println ("m"); Serial.println (); // Tsim ubidots hloov pauv client.add ("Kub (*C)", tempC); ncua (500); client.add ("Vaum (%)", av noo); ncua (500); client.add ("Siab (Pa)", siab); ncua (500); client.add ("Qhov siab (m)", alt); // Xa txhua qhov dots client.sendAll (muaj tseeb); // ncua ntawm lub sensor nyeem kom ruaj khov ncua (DELAY_TIME); }

Kauj ruam 5: Nkag mus rau Ubidots

1. Qhib koj tus account Ubidots. Koj yuav pom lub cuab yeej npe "ESP8266" nrog 4 qhov sib txawv (saib duab hauv qab no).

Kev pom lub cuab yeej

Duab
Duab

Variables visualization

Duab
Duab

Yog tias koj xav hloov lub npe ntaus ntawv, siv tus lej:

client.setDataSourceName ("New_name");

Kauj Ruam 6: Tsim Dashboards hauv Ubidots

Dashboards (zoo li qub thiab hloov pauv) yog cov neeg siv cuam tshuam los teeb tsa thiab nthuav tawm cov cuab yeej cov ntaub ntawv thiab kev nkag siab tau los ntawm cov ntaub ntawv. Dashboards muaj cov cuab yeej uas tso saib cov ntaub ntawv ua kab kos, ntsuas, tswj, cov ntxhuav, kab kos, thiab lwm qhov loj me, cov duab, thiab cov ntawv.

Txhawm rau tsim Dashboard tshiab hauv koj tus lej Ubidots, xa mus rau Ubidots qhia hauv qab no kom kawm paub yuav ua li cas.

Ib yam li kev siv, thaum koj Ubidots Dashboard tau tsim koj yuav tsum muaj qee yam zoo ib yam li cov duab hauv qab no:

Duab
Duab

TSWV YIM TSHUAJ: Tseem muaj ntau yam teeb duab thiab qhia cov cuab yeej. Yog tias koj xav kawm paub ntau ntxiv txog qhov no, peb pom zoo kom koj txheeb xyuas phau ntawv qhia no.

Duab
Duab

Kauj ruam 7: Cov ntsiab lus

Hauv qhov kev qhia no, peb tau qhia yuav ua li cas rau tus lej thiab txuas XinaBox Weather station rau Ubidots. Qhov no ua rau kev saib xyuas tej thaj chaw deb thiab tuaj yeem ua tiav hauv 10-15 feeb.

Lwm tus nyeem kuj tseem pom muaj txiaj ntsig…

  • UbiFunctions: Muab cov ntaub ntawv los ntawm AmbientWeather Platform rau Ubidots
  • Kev Tshawb Fawb: Cov Qauv Hluav Taws Xob Pib
  • Kev Tswj Kub Kub nrog Ubidots MQTT thiab NodeMcu

Pom zoo: