Cov txheej txheem:

Pib Nrog Ntev Ntau Yam Wireless Kub thiab Kev Ruaj Ntseg: 7 Cov Kauj Ruam
Pib Nrog Ntev Ntau Yam Wireless Kub thiab Kev Ruaj Ntseg: 7 Cov Kauj Ruam

Video: Pib Nrog Ntev Ntau Yam Wireless Kub thiab Kev Ruaj Ntseg: 7 Cov Kauj Ruam

Video: Pib Nrog Ntev Ntau Yam Wireless Kub thiab Kev Ruaj Ntseg: 7 Cov Kauj Ruam
Video: Yim laus yim do hau _phees lauj _fullmusic MV 2023 2024, Kaum ib hlis
Anonim
Pib Nrog Ntev Ntau Wireless Wireless Kub thiab Kev Ruaj Ntseg
Pib Nrog Ntev Ntau Wireless Wireless Kub thiab Kev Ruaj Ntseg

Qee zaum kev co yog qhov ua rau muaj teeb meem loj hauv ntau daim ntawv thov. Los ntawm lub tshuab shafts thiab cov kabmob mus rau qhov ua haujlwm nyuaj, kev co ua rau lub tshuab puas, hloov thaum ntxov, kev ua haujlwm qis, thiab ua rau muaj kev cuam tshuam loj rau qhov raug. Kev saib xyuas thiab sijhawm rau lub sijhawm ntsuas ntawm kev co hauv lub tshuab tuaj yeem daws qhov teeb meem ntawm kev puas tsuaj thaum ntxov thiab hnav thiab rhuav ntawm lub tshuab ib feem.

Hauv cov lus qhia no, peb yuav ua haujlwm ntawm IoT ntev-ntau wireless kev co thiab ntsuas kub. Cov no yog cov qib qib ntsuas nrog ntau yam kev siv dav xws li.

  • Hlau ua
  • Kev tsim hluav taws xob
  • Mining
  • Khoom noj thiab dej haus

Yog li, Hauv Cov Lus Qhia no peb yuav ua raws cov hauv qab no:

  • Kev teeb tsa Wireless Sensors siv XCTU thiab Labview UI.
  • Tau txais qhov tseem ceeb ntawm kev co los ntawm lub sensor.
  • Nkag siab txog kev ua haujlwm ntawm xbee ntaus ntawv thiab xbee raws tu qauv.
  • Kev teeb tsa lub peev xwm WiFi thiab IP teeb tsa siv lub portal raug kaw

Kauj Ruam 1: Kev Kho Vajtse thiab Software Tshwj Xeeb

Kho vajtse thiab Software Specification
Kho vajtse thiab Software Specification
Kho vajtse thiab Software Specification
Kho vajtse thiab Software Specification
Kho vajtse thiab Software Specification
Kho vajtse thiab Software Specification

Kho vajtse Specification

  • Wireless Kev co thiab Kub Sensors
  • Zigmo Txais
  • ESP32 BLE/ WiFi ntaus ntawv

Specification ntawm Software

  • Arduino IDE Cov
  • LabView Utility

Kauj Ruam 2: teeb tsa Wireless Sensor thiab Zigmo Txais Txais Siv XCTU

Teeb tsa Wireless Sensor thiab Zigmo Txais Txais Siv XCTU
Teeb tsa Wireless Sensor thiab Zigmo Txais Txais Siv XCTU
Teeb tsa Wireless Sensor thiab Zigmo Txais Txais Siv XCTU
Teeb tsa Wireless Sensor thiab Zigmo Txais Txais Siv XCTU

Txhua lub cuab yeej IoT xav tau cov txheej txheem kev sib txuas lus los tso lub cuab yeej hla huab thiab teeb tsa lub wireless sib txuas ntawm cov khoom sib txawv.

Nov yog Wireless Sensors thiab Zigmo Receiver siv lub zog qis thiab kev daws teeb meem ntev XBee. XBee siv ZigBee raws tu qauv uas qhia meej txog kev ua haujlwm hauv 902 txog 928 MHz ISM bands.

Xbee tuaj yeem teeb tsa siv XCTU software

  1. Tshawb nrhiav Xbee ntaus ntawv lossis ntxiv Xbee ntaus ntawv tshiab los ntawm txhaj rau lub cim sab laug sab saum toj.
  2. Cov cuab yeej yuav raug teev nyob rau sab laug ntawm lub vaj huam sib luag.
  3. ob npaug nias rau ntawm lub cuab yeej kom pom cov teeb tsa.
  4. Tam sim no nyem rau ntawm lub cim icon nyob rau sab xis saum toj
  5. Koj tuaj yeem pom tus nqi los ntawm lub console tso tawm
  6. Ntawm no peb tau txais cov kab lus ntawm qhov ntev 54 bytes
  7. cov bytes no yuav tau kho ntxiv kom tau txais qhov txiaj ntsig tiag. cov txheej txheem kom tau txais qhov kub thiab txias tiag tiag tau hais hauv cov theem tom ntej.

Kauj Ruam 3: Kev Ntsuas Kub thiab Kev Ntsuas Kev Ntsuas Siv Labview Utility

Kev Ntsuas Kub thiab Kev Ntsuas Kev Ntsuas Siv Labview Utility
Kev Ntsuas Kub thiab Kev Ntsuas Kev Ntsuas Siv Labview Utility
Kev Ntsuas Kub thiab Kev Ntsuas Kev Ntsuas Siv Labview Utility
Kev Ntsuas Kub thiab Kev Ntsuas Kev Ntsuas Siv Labview Utility

Lub Sensor khiav hauv ob hom

  • Kev teeb tsa hom: teeb tsa Pan ID, ncua sijhawm, Tsis rov ua dua thiab lwm yam Ntxiv rau qhov no dhau ntawm qhov kev qhia no thiab yuav piav qhia hauv cov lus qhia tom ntej.
  • Hom Khiav: Peb tab tom khiav lub cuab yeej hauv Hom Khiav. Thiab txhawm rau txheeb xyuas cov txiaj ntsig no peb tab tom siv Labview Utility

Labview UI no qhia pom qhov tseem ceeb hauv cov duab zoo. Nws qhia txog tam sim no nrog rau qhov txiaj ntsig yav dhau los. Koj tuaj yeem mus rau qhov txuas no txhawm rau rub Labview UI.

nyem rau ntawm Run icon los ntawm cov ntawv qhia zaub mov nplooj ntawv kom mus rau hom khiav.

Kauj Ruam 4: Kho DHCP/Static IP Settings Siv Captive Portal

Configuring DHCP/Static IP Settings Siv Captive Portal
Configuring DHCP/Static IP Settings Siv Captive Portal
Configuring DHCP/Static IP Settings Siv Captive Portal
Configuring DHCP/Static IP Settings Siv Captive Portal
Configuring DHCP/Static IP Settings Siv Captive Portal
Configuring DHCP/Static IP Settings Siv Captive Portal

Peb tab tom siv lub portal raug kaw kom txuag tau WiFi cov ntaub ntawv pov thawj thiab kom yuj dhau IP chaw. Txog kev qhia ntxaws ntxaws ntawm lub portal raug kaw, koj tuaj yeem hla cov lus qhia hauv qab no.

Lub qhov rooj raug kaw muab rau peb xaiv los xaiv ntawm Static thiab DHCP nqis. Tsuas yog nkag mus rau daim ntawv pov thawj zoo li IP zoo li qub, Subnet Mask, lub qhov rooj thiab Wireless Sensor Gateway yuav tau teeb tsa ntawm tus IP ntawd.

Kauj Ruam 5: Txuag WiFi Chaw Siv Captive Portal

Txuag WiFi Chaw Siv Captive Portal
Txuag WiFi Chaw Siv Captive Portal

Ib lub vev xaib raug teeb tsa nyob qhov twg cov npe qhia pom muaj WiFi tes hauj lwm thiab muaj RSSI. Xaiv WiFi network thiab tus password thiab nkag mus xa. Cov ntaub ntawv pov thawj yuav raug cawm hauv EEPROM thiab IP chaw yuav raug cawm hauv SPIFFS. Xav paub ntau ntxiv txog qhov no tuaj yeem pom hauv phau ntawv qhia no.

Kauj Ruam 6: Tshaj Tawm Kev Nyeem Ntawv Sensor rau UbiDots

Ntawm no peb tab tom siv Wireless Kub thiab Kev Ruaj Ntseg nrog ESP 32 lub qhov rooj txais tos kom tau txais qhov kub thiab txias cov ntaub ntawv. Peb tab tom xa cov ntaub ntawv mus rau UbiDots siv MQTT raws tu qauv. MQTT ua raws li kev tshaj tawm thiab sau npe ua haujlwm qhov kev thov thiab lus teb. Nws yog nrawm dua thiab ntseeg tau dua li HTTP. Qhov no ua haujlwm raws li hauv qab no.

Nyeem Cov Wireless Sensor Cov Ntaub Ntawv

Peb tau txais 29-byte thav duab los ntawm Wireless Kub thiab Kev Ruaj Ntseg. Cov thav duab no tau muab coj los ua kom tau qhov kub thiab txias cov ntaub ntawv

yog (Serial2.available ()) {data [0] = Serial2.read (); ncua (k); yog (cov ntaub ntawv [0] == 0x7E) {Serial.println ("Tau Txais Pob"); thaum (! Serial2.available ()); rau (i = 1; i <55; i ++) {data = Serial2.read (); ncua (1); } yog (cov ntaub ntawv [15] == 0x7F) /////// txhawm rau txheeb xyuas yog tias cov ntaub ntawv tau txais raug yog {yog (cov ntaub ntawv [22] == 0x08) //////// xyuas kom tseeb tias hom sensor yog qhov tseeb {rms_x = ((uint16_t) (((data [24]) << 16) + ((data [25]) << 8) + (data [26]))/100); rms_y = ((uint16_t) (((data [27]) << 16) + ((data [28]) << 8) + (data [29]))/100); rms_z = ((uint16_t) (((data [30]) << 16) + ((data [31]) << 8) + (data [32]))/100); max_x = ((uint16_t) (((data [33]) << 16) + ((data [34]) << 8) + (data [35]))/100); max_y = ((uint16_t) (((data [36]) << 16) + ((data [37]) << 8) + (data [38]))/100); max_z = ((uint16_t) (((data [39]) << 16) + ((data [40]) << 8) + (data [41]))/100);

min_x = ((uint16_t) (((data [42]) << 16) + ((data [43]) << 8) + (data [44]))/100); min_y = ((uint16_t) (((data [45]) << 16) + ((data [46]) << 8) + (data [47]))/100); min_z = ((uint16_t) (((data [48]) << 16) + ((data [49]) << 8) + (data [50]))/100);

cTemp = ((((cov ntaub ntawv [51]) * 256) + cov ntaub ntawv [52])); roj teeb ntab = ((cov ntaub ntawv [18] * 256) + cov ntaub ntawv [19]); ntab voltage = 0.00322 * roj teeb; Serial.print ("Tus lej Sensor"); Serial.println (cov ntaub ntawv [16]); Serial.print ("Hom Sensor"); Serial.println (cov ntaub ntawv [22]); Serial.print ("Firmware Version"); Serial.println (cov ntaub ntawv [17]); Serial.print ("Kub hauv Celsius:"); Serial.print (cTemp); Serial.println ("C"); Serial.print ("RMS kev co hauv X-axis:"); Serial.print (rms_x); Serial.println ("mg"); Serial.print ("RMS kev co hauv Y-axis:"); Serial.print (rms_y); Serial.println ("mg"); Serial.print ("RMS kev co hauv Z-axis:"); Serial.print (rms_z); Serial.println ("mg");

Serial.print ("Kev co qis hauv X-axis:");

Serial.print (min_x); Serial.println ("mg"); Serial.print ("Kev co tsawg hauv Y-axis:"); Serial.print (min_y); Serial.println ("mg"); Serial.print ("Kev co tsawg hauv Z-axis:"); Serial.print (min_z); Serial.println ("mg");

Serial.print ("ADC tus nqi:");

Serial.println (roj teeb); Serial.print ("Roj teeb Voltage:"); Serial.print (qhov hluav taws xob); Serial.println ("\ n"); yog (voltage <1) {Serial.println ("Sijhawm Hloov Lub Roj Teeb"); }}} lwm {rau (kuv = 0; kuv <54; kuv ++) {Serial.print (cov ntaub ntawv )); Serial.print (","); ncua (1); }}}}

Txuas rau UbiDots MQTT API

Suav nrog cov ntawv header rau txheej txheem MQTT

#include "PubSubClient.h"

txhais lwm qhov kev hloov pauv rau MQTT zoo li lub npe neeg siv, tus tswv lag luam chaw nyob, token ID (Peb tab tom nqa tus lej token los ntawm EEPROM)

#define MQTT_CLIENT_NAME "ClientVBShightime123" char mqttBroker = "yam.ubidots.com"; char them [100]; lub ntsiab lus [150]; // tsim qhov sib txawv los khaws cov cim token ID String tokenId;

Tsim cov kev hloov pauv kom khaws cov ntaub ntawv sib txawv thiab tsim cov cim sib txawv los khaws cov ncauj lus

#define VARIABLE_LABEL_TEMPF "tempF" // Txheeb xyuas cov ntawv sib txawv #txhais VARIABLE_LABEL_TEMPC "tempC" // Txheeb xyuas cov ntawv sib txawv #define VARIABLE_LABEL_BAT "puav" #define VARIABLE_LABEL_HUMID "ntub" // Txheeb xyuas cov ntawv sib txawv

char title1 [100];

char topic2 [100]; char nqe 3 [100];

tshaj tawm cov ntaub ntawv rau cov ncauj lus MQTT hais lub payload yuav zoo li {"tempc": {tus nqi: "tempData"}}

sprintf (topic1, "%s", ""); sprintf (topic1, "%s%s", "/v1.6/devices/", DEVICE_LABEL); sprintf (payload, "%s", "");

// Ntxuav lub payload sprintf (payload, "{"%s / ":", VARIABLE_LABEL_TEMPC);

// Ntxiv tus nqi sprintf (payload, "%s {" value / ":%s}", payload, str_cTemp);

// Ntxiv tus nqi sprintf (payload, "%s}", payload);

// Kaw cov phau ntawv txhais lus kab lus Serial.println (them nyiaj);

Serial.println (client.publish (topic1, payload)? "Luam tawm": "tsis tau tshaj tawm");

// Ua tib yam rau lwm lub ncauj lus ib yam nkaus

client.publish () tshaj tawm cov ntaub ntawv rau UbiDots

Kauj Ruam 7: Pom Cov Ntaub Ntawv

Visualizing Cov Ntaub Ntawv
Visualizing Cov Ntaub Ntawv
  • Mus rau Ubidots thiab nkag mus rau koj tus lej nyiaj.
  • Nkag mus rau Dashboard los ntawm Cov Ntaub Ntawv tab teev rau saum.
  • Tam sim no nyem rau "+" icon ntxiv cov widgets tshiab.
  • Xaiv tus widget los ntawm daim ntawv thiab ntxiv qhov sib txawv thiab cov khoom siv.
  • Cov ntaub ntawv ntsuas tuaj yeem pom ntawm lub dashboard siv cov cuab yeej sib txawv.

Zuag qhia tag nrho Code

Over Code rau HTML thiab ESP32 tuaj yeem pom nyob hauv GitHub qhov chaw cia khoom no.

  1. ncd ESP32 breakout board.
  2. ncd Wireless kub thiab Vaum Sensors.
  3. pubsubclient
  4. UbiDots

Pom zoo: