Cov txheej txheem:

Temp and Humidity Alert Siv AWS thiab ESP32: 11 Cov Kauj Ruam
Temp and Humidity Alert Siv AWS thiab ESP32: 11 Cov Kauj Ruam

Video: Temp and Humidity Alert Siv AWS thiab ESP32: 11 Cov Kauj Ruam

Video: Temp and Humidity Alert Siv AWS thiab ESP32: 11 Cov Kauj Ruam
Video: Azure IoT with Raspberry Pi-Send Temperature and Humidity Sensor Data to Azure IoT Hub using Python 2024, Hlis ntuj nqeg
Anonim
Temp and Humidity Alert Siv AWS thiab ESP32
Temp and Humidity Alert Siv AWS thiab ESP32

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 xa cov ntaub ntawv no mus rau AWS

Kauj ruam 1: HARDWARE 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 Daws Teeb Meem ntawm ± 1.7%RH ± 0.5 ° C. Ua li 500, 000 Kev xa tawm los ntawm 2 AA Roj Teeb. Measure -40 ° C txog 125 ° C nrog Cov Roj Teeb uas Ciaj sia Cov Kev Ntsuas no. Zoo Tshaj 2 -mais LOS Ntau & 28 mais nrog High-Gain Antennas. Interface rau Raspberry Pi, Microsoft Azure, Arduino thiab Ntau

Siv Software:

  • Arduino IDE Cov
  • AWS

Tsev qiv ntawv siv:

  • PubSubClient Library
  • Hlau.h
  • AWS_IOT.h

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

Kev Tshaj Tawm Txoj Cai rau ESP32 Siv Arduino IDE
Kev Tshaj Tawm Txoj Cai rau ESP32 Siv Arduino IDE
Kev Tshaj Tawm Txoj Cai rau ESP32 Siv Arduino IDE
Kev Tshaj Tawm Txoj Cai rau ESP32 Siv Arduino IDE
Kev Tshaj Tawm Txoj Cai rau ESP32 Siv Arduino IDE
Kev Tshaj Tawm Txoj Cai rau ESP32 Siv Arduino IDE
  • Rub tawm thiab suav nrog PubSubClient Library thiab Wire.h Library.
  • Rub tawm Zip cov ntaub ntawv ntawm AWS_IoT, los ntawm qhov muab txuas thiab tom qab muab rho tawm, muab lub tsev qiv ntawv tso rau hauv koj lub tsev qiv ntawv Arduino.
  • Koj tuaj yeem tau txais tus lej Arduino ntawm no.
  • Koj yuav tsum muab koj lub AWS tshwj xeeb MQTT_TOPIC, AWS_HOST, SSID (WiFi Npe) thiab Lo lus zais ntawm lub network muaj.
  • MQTT lub ncauj lus thiab AWS HOST tuaj yeem sab hauv Yam-Sib Tham ntawm AWS-IoT console.
  • Sau thiab xa ESP32_AWS.ino code.
  • Ua ntej xa cov cai ntxiv daim ntawv pov thawj hauv AWS_IOT nplaub tshev rau aws_iot_certficates.c, uas tau ua tiav hauv cov kauj ruam ntxiv.
  • 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 kom AWS Ua Haujlwm

Image
Image

Tsim Yam thiab Ntawv Pov Thawj

  • THING: Nws yog tus sawv cev virtual los ntawm koj lub cuab yeej.
  • CERTIFICATE: Pov thawj qhov tseeb ntawm tus THING.
  • Open AWS-IoT
  • Nyem rau ntawm tswj -THING -Register THING.
  • Nyem rau tsim ib yam nkaus.
  • Muab lub npe thiab hom.
  • Nyem rau tom ntej no.
  • Tam sim no koj daim ntawv pov thawj nplooj ntawv yuav qhib, nyem rau Tsim Daim Ntawv Pov Thawj.
  • Rub tawm Cov Ntawv Pov Thawj no, feem ntau yog tus yuam sij ntiag tug, daim ntawv pov thawj rau qhov no thiab root_ca thiab khaws cia rau hauv cov ntawv cais.
  • Sab hauv daim ntawv pov thawj root_ca nyem rau ntawm Amazon lub hauv paus CA1-Luam nws-Muab tshuaj txhuam rau notepad thiab khaws nws ua cov ntawv root_ca.txt hauv koj daim ntawv pov thawj.

Tsim Txoj Cai

  • Nws txiav txim siab qhov haujlwm twg lub cuab yeej lossis tus neeg siv tuaj yeem nkag tau.
  • Mus rau AWS-IoT interface, Nyem rau Secure-Policies.
  • Nyem rau Tsim.
  • Sau tag nrho cov ntsiab lus tsim nyog xws li lub npe txoj cai, Nyem Tsim.
  • Tam sim no rov qab mus rau AWS-IoT interface, Nyem rau Secure-Certificates thiab txuas txoj cai tsim tam sim no rau nws.

Kauj Ruam 5: Ntxiv Tus Kheej Ntiag Tug, Daim Ntawv Pov Thawj thiab Root_CA rau Code

Ntxiv Ntiag Tug, Ntawv Pov Thawj thiab Root_CA rau Code
Ntxiv Ntiag Tug, Ntawv Pov Thawj thiab Root_CA rau Code
Ntxiv Ntiag Tug, Ntawv Pov Thawj thiab Root_CA rau Code
Ntxiv Ntiag Tug, Ntawv Pov Thawj thiab Root_CA rau Code
Ntxiv Ntiag Tug, Ntawv Pov Thawj thiab Root_CA rau Code
Ntxiv Ntiag Tug, Ntawv Pov Thawj thiab Root_CA rau Code
  • Qhib koj daim ntawv pov thawj rub tawm hauv koj cov ntawv sau (Notepad ++), feem ntau yog tus yuam sij ntiag tug, hauv paus_CA thiab daim ntawv pov thawj ntawm yam thiab kho lawv raws li hom aws_iot_certficates.c hauv AWS_IOT nplaub tshev.
  • Tam sim no qhib koj daim ntawv AWS_IoT hauv koj lub tsev qiv ntawv Arduino -My Document. Mus rau C: / Users / xyz / Documents / Arduino / libraries / AWS_IOT / src, nyem rau ntawm aws_iot_certficates.c, qhib nws ntawm tus editor thiab muab tag nrho cov ntawv pov thawj kho lawv ntawm qhov chaw xav tau, txuag nws.

Kauj Ruam 6: Tau Txais Cov Lus Qhia

Image
Image
Tau Txais Cov Zis
Tau Txais Cov Zis
  • Mus sim hauv AWS_IoT console.
  • Sau koj li MQTT cov ncauj lus rau Cov npe sau npe hauv koj daim ntawv pov thawj xeem.
  • Tam sim no koj tuaj yeem saib koj cov ntaub ntawv huab cua thiab av noo.

Kauj Ruam 7: Tso Tawm

Tso zis
Tso zis

Kauj Ruam 8: Cov Kauj Ruam Ua Ntawv Ceeb Toom

Image
Image
Cov Kauj Ruam Los Ua Ntawv Ceeb Toom
Cov Kauj Ruam Los Ua Ntawv Ceeb Toom
  • Koj teeb tsa Amazon Kev Pabcuam Ceeb Toom Yooj Yim (Amazon SNS) rau tsim kev ceeb toom xa ntawv mus rau tus txais chaw nyob rau qhov sib txawv ntawm qhov kub thiab txias.
  • Mus rau AWS IoT console -Click on Act.
  • Tsis muaj ib txoj cai -Nyem rau tsim txoj cai.
  • Ntawm nplooj ntawv no Lub npe txoj cai piv txwv li AlertTempEsp32, tseem muab cov lus piav qhia (Tsim kev ceeb toom xa ntawv ntawm Temp thiab Humidity sensors cov ntaub ntawv).
  • Tam sim no tsim Txoj Cai Lus Nug Nqe Lus (SQL nqe lus rau kev ua cov ntaub ntawv los ntawm qhov chaw). Qhov lus no siv yog

SELECT*FROM '$ aws/yam/Temp_Humidity_esp32/duab ntxoov ntxoo/hloov tshiab'.

  • $ aws/yam/Temp_Humidity_esp32/duab ntxoov ntxoo/hloov tshiab, Mus rau AWS IoT Console -Manage -Thing -Nyem rau ntawm koj qhov Tsim -Interact.
  • Txhawm rau xaiv qhov nqis tes Nyem rau ADD Action.
  • Xaiv xa lus raws li SNS ceeb toom thawb.
  • Tam sim no Configure Action xaiv. rau SNS lub hom phiaj-xaiv Tsim. Sau lub npe rau SNS lub ncauj lus, xws li Temp_Humidity_Esp32Topic. Message Format -Raw. Tsim lub luag haujlwm -Temp_Humidity_Esp32TopicRole.
  • Ntxiv Kev Ua.
  • Tsim txoj cai.
  • Tsim Amazon SNS xa cov lus los ntawm koj li Amazon SNS lub ncauj lus rau koj tus email inbox. Nyem rau Cov Kev Pabcuam.
  • Nrhiav SNS. Nyem rau ntawm SNS.
  • Hauv Amazon SNS -Nyem rau Kev Sau Npe. Xaiv lub ncauj lus ARN. Protocol -Email -Muab koj li email chaw nyob uas ceeb toom kom xa tuaj.
  • Tam sim no nyem rau ntawm Tsim Kev Sau Npe.
  • Tom qab txhaj rau Tsim Kev Sau Npe. Koj yuav tsum tau lees paub Kev Sau Npe los ntawm nyem rau ntawm qhov xa ntawv, uas tau xa mus rau koj tus lej xa ntawv ID.
  • Paub meej tias Subscription txuas.

Kauj Ruam 9: Tsim Amazon SNS

  • Tsim Amazon SNS xa cov lus los ntawm koj li Amazon SNS lub ncauj lus rau koj tus email inbox. Nyem rau Cov Kev Pabcuam.
  • Nrhiav SNS. Nyem rau ntawm SNS.
  • Hauv Amazon SNS -Nyem rau Kev Sau Npe. Xaiv lub ncauj lus ARN. Protocol -Email -Muab koj li email chaw nyob uas ceeb toom kom xa tuaj.
  • Tam sim no nyem rau ntawm Tsim Kev Sau Npe.
  • Tom qab txhaj rau Tsim Kev Sau Npe. Koj yuav tsum tau lees paub Kev Sau Npe los ntawm nyem rau ntawm qhov xa ntawv, uas tau xa mus rau koj tus lej xa ntawv ID.
  • Paub meej tias kev tso npe txuas.

Pom zoo: