Cov txheej txheem:

ThingSpeak, ESP32 thiab Long Range Wireless Temp thiab Vaum: 5 Kauj Ruam
ThingSpeak, ESP32 thiab Long Range Wireless Temp thiab Vaum: 5 Kauj Ruam

Video: ThingSpeak, ESP32 thiab Long Range Wireless Temp thiab Vaum: 5 Kauj Ruam

Video: ThingSpeak, ESP32 thiab Long Range Wireless Temp thiab Vaum: 5 Kauj Ruam
Video: Connect to ThingSpeak (ESP32 + Arduino series) 2024, Hlis ntuj nqeg
Anonim
ThingSpeak, ESP32 thiab Long Range Wireless Temp thiab Vaum
ThingSpeak, ESP32 thiab Long Range Wireless Temp thiab Vaum

Hauv qhov kev qhia no, peb yuav ntsuas qhov sib txawv ntawm qhov kub thiab txias cov ntaub ntawv siv Temp thiab humidity sensor. Koj tseem yuav kawm paub yuav xa cov ntaub ntawv no mus rau ThingSpeak li cas. Yog li koj tuaj yeem txheeb xyuas nws los ntawm txhua qhov chaw rau cov ntawv thov sib txawv

Kauj ruam 1: Kho vajtse thiab Software xav tau

Kho vajtse thiab Software yuav tsum tau
Kho vajtse thiab Software yuav tsum tau
Kho vajtse thiab Software yuav tsum tau
Kho vajtse thiab Software yuav tsum tau

Kho vajtse:

  • ESP-32: ESP32 ua kom yooj yim siv Arduino IDE thiab Arduino Wire Language rau IoT daim ntawv thov. Qhov ESp32 IoT Module no sib txuas Wi-nkaus, Bluetooth, thiab Bluetooth BLE rau ntau yam kev siv sib txawv. Cov qauv no tau los ua tiav nrog 2 CPU cores uas tuaj yeem tswj tau thiab siv zog ib tus zuj zus, thiab nrog lub moos hloov pauv tau ntawm 80 MHz txog 240 MHz. Qhov ESP32 IoT WiFi BLE Module nrog Kev Sib Txuas USB tau tsim los kom haum rau txhua qhov khoom ncd.io IoT. Saib xyuas cov ntsuas thiab tswj kev xa tawm, FETs, PWM cov tswj, solenoids, li qub, lub cev muaj zog thiab ntau ntxiv los ntawm txhua qhov chaw hauv ntiaj teb no siv nplooj ntawv web lossis nplooj siab rau server. Peb tsim peb tus kheej version ntawm ESP32 kom haum rau NCD IoT cov cuab yeej, muab cov kev xaiv nthuav dav ntau dua li lwm yam cuab yeej hauv ntiaj teb! Kev koom ua ke USB chaw tso cai yooj yim ntawm ESP32. ESP32 IoT WiFi BLE Module yog lub platform zoo kawg rau IoT daim ntawv thov txhim kho. Qhov ESP32 IoT WiFi BLE Module no tuaj yeem tsim kho siv Arduino IDE.
  • IoT Long Range Wireless Kub Thiab Vaum Sensor: Muaj Ntau Yam Wireless Wireless Kub Kub Sensor. Qib nrog Sensor Kev daws teeb meem ntawm ± 1.7%RH ± 0.5 ° C. Txog li 500, 000 Kev Tshaj Tawm los ntawm 2 AA Roj Teeb. Kev ntsuas -40 ° C txog 125 ° C nrog Cov Roj Teeb uas Ciaj sia Cov Kev Ntsuas no. Zoo Tshaj 2-mais LOS Range & 28 mais nrog High-Gain Antennas. Interface rau Raspberry Pi, Microsoft Azure, Arduino, thiab Ntau Ntxiv.
  • Ntev-Ntau Wireless Wireless Mesh Modem nrog USB Interface

Siv Software

  • Arduino IDE Cov
  • ThingSpeak

Qiv Siv

  • PubSubClient Library
  • Hlau.h

Arduino Client rau MQTT

Lub tsev qiv ntawv no muab cov neeg siv los ua qhov yooj yim tshaj tawm/sau npe xa xov nrog lub server uas txhawb MQTT

Yog xav paub ntxiv txog MQTT, mus saib mqtt.org.

Rub tawm

Qhov hloov tshiab kawg ntawm lub tsev qiv ntawv tuaj yeem rub tawm los ntawm GitHub

Cov ntaub ntawv

Lub tsev qiv ntawv los nrog tus lej piv txwv piv txwv. Saib Cov Ntaub Ntawv> Piv Txwv> PubSubClient hauv Arduino daim ntawv thov. Cov ntaub ntawv API tag nrho.

Kho vajtse sib xws

Lub tsev qiv ntawv siv Arduino Ethernet Client API rau kev cuam tshuam nrog cov khoom siv sib txuas hauv qab. Qhov no txhais tau tias Nws Tsuas Ua Haujlwm nrog cov naj npawb ntawm cov laug cam thiab cov tiv thaiv, suav nrog:

  • Arduino Ethernet
  • Arduino Ethernet Shield
  • Arduino YUN - siv suav nrog YunClient nyob rau hauv qhov chaw ntawm EthernetClient, thiab nco ntsoov ua Bridge.begin () ua ntej
  • Arduino WiFi Shield - yog tias koj xav xa cov ntawv ntau dua 90 bytes nrog daim thaiv no, pab kom MQTT_MAX_TRANSFER_SIZE xaiv hauv PubSubClient.h.
  • SparkFun WiFly Shield - thaum siv nrog lub tsev qiv ntawv no
  • Intel Galileo/Edison
  • ESP8266
  • ESP32 Tam sim no lub tsev qiv ntawv tsis tuaj yeem siv nrog kho vajtse raws li ENC28J60 nti - xws li Nanode lossis Nuelectronics Ethernet Shield. Rau cov ntawd, muaj lwm lub tsev qiv ntawv muaj.

Cov Tsev Qiv Hlau

Lub tsev qiv ntawv Hlau tso cai rau koj sib txuas lus nrog I2C cov cuab yeej, feem ntau tseem hu ua "2 xaim" lossis "TWI" (Ob Txoj Kev Siv Hluav Taws Xob), tuaj yeem rub tawm los ntawm Wire.h

Kev Siv Yooj Yim

  • Wire.begin () Pib siv Wire hauv hom tswv, qhov uas koj yuav pib thiab tswj cov ntaub ntawv xa mus. Qhov no yog qhov siv ntau tshaj thaum cuam tshuam nrog feem ntau I2C cov khoom siv sab hauv.
  • Wire.begin (chaw nyob) Pib siv Wire hauv hom qhev, qhov uas koj yuav teb ntawm "chaw nyob" thaum lwm I2C masters chips pib sib tham. Kev kis
  • Wire.beginTransmission (chaw nyob) Pib kis tshiab rau lub cuab yeej ntawm "chaw nyob". Master hom yog siv.
  • Wire.write (cov ntaub ntawv) Xa cov ntaub ntawv. Nyob rau hauv hom tswv, pibTransmission yuav tsum raug hu ua ntej.
  • Wire.endTransmission () Hauv hom kev ua haujlwm, qhov no xaus qhov kev sib kis thiab ua rau tag nrho cov ntaub ntawv tsis raug xa mus.

Txais

  • Wire.requestFrom (chaw nyob, suav) Nyeem "suav" bytes los ntawm ib lub cuab yeej ntawm "chaw nyob". Master hom yog siv.
  • Wire.available () Rov qab tus naj npawb ntawm bytes muaj los ntawm kev hu xov tooj txais.
  • Wire.read () Tau txais 1 byte.

Kauj Ruam 2: Tshaj Tawm Txoj Cai rau ESP32 Siv Arduino IDE

  • Ua ntej rub tawm cov cai koj tuaj yeem pom qhov ua haujlwm ntawm lub ntsuas cua ntawm qhov muab txuas.
  • Rub tawm thiab suav nrog PubSubClient Library thiab Wire.h Library.
  • Koj yuav tsum muab koj tus lej API, SSID (WiFi Lub Npe) thiab Lo lus zais ntawm lub network muaj.
  • Sau thiab xa cov cai Temp-ThinSpeak.ino.
  • Txhawm rau txheeb xyuas qhov kev sib txuas ntawm lub cuab yeej thiab cov ntaub ntawv xa mus, qhib lub ntsuas saib. Yog tias tsis pom cov lus teb, sim tshem koj lub ESP32 thiab tom qab ntawd txuas nws dua. Nco ntsoov tias tus nqi baud ntawm Serial monitor tau teeb tsa rau tib qho uas tau teev tseg hauv koj tus lej 115200.

Kauj Ruam 3: Serial Monitor Output

Serial Monitor Output
Serial Monitor Output

Kauj Ruam 4: Ua ThingSpeak Ua Haujlwm

Ua ThingSpeak Ua Haujlwm
Ua ThingSpeak Ua Haujlwm
Ua ThingSpeak Ua Haujlwm
Ua ThingSpeak Ua Haujlwm
Ua ThingSpeak Ua Haujlwm
Ua ThingSpeak Ua Haujlwm
  • Tsim tus as khauj ntawm ThnigSpeak.
  • Tsim cov channel tshiab, los ntawm txhaj rau Channels.
  • Nyem rau ntawm My Channels.
  • Nyem Tshiab Channel.
  • Hauv New Channel, npe lub channel.
  • Npe Lub Npe Sab Hauv Hauv Channel, Teb yog qhov sib txawv uas cov ntaub ntawv tau tshaj tawm.
  • Tam sim no tseg Channel.
  • Tam sim no koj tuaj yeem pom koj tus lej API ntawm lub dashboard. Mus rau tus kais ntawm lub vev xaib thiab pom koj 'Sau Api Key' uas yuav tsum tau hloov kho tshiab ua ntej xa cov cai rau ESP32.
  • Thaum Channel tau tsim koj yuav muaj peev xwm saib koj qhov kub thiab txias nyob rau hauv tus kheej saib nrog Cov Teb koj tsim hauv Channel.
  • Txhawm rau tsim cov duab ntawm Temp thiab Humidity cov ntaub ntawv, koj tuaj yeem siv MATLAB Visualization.
  • Txhawm rau qhov no mus rau App, Nyem rau MATLAB Visualization.
  • Sab hauv nws xaiv Kev Cai, hauv qhov no, peb tau xaiv cov phiaj xwm kub thiab cua nrawm ntawm ob qhov sib txawv y-axes 8 ua piv txwv. Tam sim no nyem tsim.
  • MATLAB tus lej yuav rov tsim dua tshiab raws li koj tsim kev pom tab sis koj yuav tsum hloov kho daim npav ID, nyeem tus lej ID, tuaj yeem tshawb xyuas daim duab hauv qab no.
  • Tom qab ntawd txuag thiab khiav cov cai.
  • Koj yuav pom cov phiaj xwm.

Pom zoo: