Cov txheej txheem:

ESP8266 NodeMCU Nrog BME280 Gauges & Chart: 5 Kauj Ruam
ESP8266 NodeMCU Nrog BME280 Gauges & Chart: 5 Kauj Ruam

Video: ESP8266 NodeMCU Nrog BME280 Gauges & Chart: 5 Kauj Ruam

Video: ESP8266 NodeMCU Nrog BME280 Gauges & Chart: 5 Kauj Ruam
Video: NodeMCU V3 ESP8266 - обзор, подключение и прошивка в Arduino IDE 2024, Kaum ib hlis
Anonim
ESP8266 NodeMCU Nrog BME280 Gauges & Chart
ESP8266 NodeMCU Nrog BME280 Gauges & Chart
ESP8266 NodeMCU Nrog BME280 Gauges & Chart
ESP8266 NodeMCU Nrog BME280 Gauges & Chart

Cov Ntawv Zoo Nkauj thiab Daim Duab rau koj li ESP8266 NodeMCU Kev txhim kho pawg thawj coj nrog BME280 Kub, Vaum thiab Siab sensor. Thingspeak yuav khaws tag nrho koj cov ntaub ntawv hauv huab rau kev khaws rov qab txhua lub sijhawm rau xyoo (vam tias) yuav los. Cov ntsuas thiab daim ntawv yog nyob ntawm cov ntaub ntawv khaws cia ntawm yam khoom thiab tau hloov kho tshiab txhua txhua 5 feeb.

Yam Khoom Xav Tau:

ESP8266 NodeMCU Development board ($ 3.79 los ntawm Banggood.com Hong Kong)

Bosch BME280 ($ 5.63 los ntawm Banggood.com Hong Kong)

Breadboard Jumpers ($ 3.09 los ntawm Banggood.com Hong Kong)

Breadboard ($ 2.28 los ntawm Banggood.com Hong Kong)

Fais Fab Khoom, Pub dawb yog tias koj muaj lub xov tooj micro USB them

Micro USB cable, Pub dawb yog tias koj muaj ib qho lawm

Arduino IDE, Rub Tawm Dawb

Tau txais.ino &. HTML cov ntaub ntawv ntawm no

Kauj ruam 1: Tsim & teeb tsa Koj Cov Lus Hais Raws

Tsim & teeb tsa Koj Txoj Kev Hais Lus Zoo
Tsim & teeb tsa Koj Txoj Kev Hais Lus Zoo

1. Tsim ib qho nyiaj pub dawb Thingspeak thiab channel tshiab ntawm https://thingspeak.com, Hu rau tus channel "ESP8266-NodeMCU-12E-BME280"

2. Cov channel tshiab yuav tsum muaj 3 thaj chaw hu ua Kub Humidity Siab hauv qhov kev txiav txim tshwj xeeb ntawd (Nco tseg Thawj Tsab Ntawv Sau Npe).

3. Nco tseg koj li "channel ID" tshiab XXXXXX hauv qab "Channel Settings"

4. Nyem rau "API Keys" txuas thiab sau tseg ntawm koj "API Sau" thiab "Nyeem API Keys" XXXXXXXXXXXXXXX. Tsis tas li, ua qhov no rau pej xeem channel hauv kev sib qhia.

5. Tsim qhov thib ob Thingspeak channel uas yuav tuav lub "Hnub no" (txij thaum ib tag hmo) Cov ntaub ntawv qis heev. Hu nws "BME280 Txhua Hnub Cov Ntaub Ntawv Qis Qis Siab"

6. Cov channel tshiab no yuav tsum muaj 6 thaj chaw hu ua Tmax Tmin Hmax Hmin Pmax Pmin hauv qhov kev txiav txim tshwj xeeb ntawd (Nco tseg Thawj Tsab Ntawv Sau Npe).

7. Nco tseg ntawm "BME280 Txhua Hnub Muaj Cov Ntaub Ntawv Tsawg" "channel ID", "Nyeem" & "Sau API yuam sij" ib yam li hauv cov kauj ruam saum toj no.

Kauj Ruam 2: Teeb Arduino IDE, Cov Tsev Qiv Ntawv thiab teeb tsa BME280

Teeb Arduino IDE, Cov Tsev Qiv Ntawv thiab teeb tsa BME280
Teeb Arduino IDE, Cov Tsev Qiv Ntawv thiab teeb tsa BME280

8. Ua raws cov lus qhia rau kev txhim kho Arduino IDE & ESP8266 core ntawm

9. Hluav taws Arduino IDE yog li peb tuaj yeem teeb tsa plaub lub tsev qiv ntawv uas peb xav tau.

10. Koj yuav xav tau "Adafruit Unified Sensor Driver" lub tsev qiv ntawv, nruab nws hauv "Tus Thawj Saib Xyuas Tsev Kawm Ntawv" hauv Arduino IDE. Cov Ntawv Teev Npe suav nrog Lub Tsev Haujlwm Tswj Cov Tsev Qiv Ntawv tshawb fawb los ntawm Hom = "Pom Zoo" Cov ncauj lus = "Sensors" tom qab ntawd muab cov lus Adafruit Unified Sensor Driver rau hauv lub thawv tshawb nrhiav. Qhov koj xav tau hais tias "Adafruit Unified Sensor Driver by Adafruit"

11. Ntxiv rau, koj tseem yuav xav tau "Adafruit BME280 Library" nruab nws hauv "Tus Thawj Saib Xyuas Tsev Kawm Ntawv" hauv Arduino IDE. Menu Sketch Include Library Manage Libraries do a search by Type = "Recommended" Topic = "Sensors" then put the words Adafruit BME280 Library in the search box. Qhov koj xav tau hais tias "Adafruit BME280 Library los ntawm Adafruit"

12. Lwm lub tsev qiv ntawv koj xav tau yog Wire.h, nruab nws hauv "Tus Thawj Saib Xyuas Tsev Qiv Ntawv" hauv Arduino IDE. Cov ntawv qhia zaub mov, kos duab suav nrog Lub Tsev Qiv Ntawv Tswj Cov Tsev Qiv Ntawv Ua ib qho kev tshawb fawb los ntawm Hom = "Pab Txhawb" Lub Xeem = "Lub Teeb Pom Kev Tawm/Tso Tawm" tom qab ntawd muab lo lus Hlau rau hauv lub thawv tshawb nrhiav. Qhov koj xav tau hais tias "Hlau Built-in los ntawm Arduino" Feem ntau yuav nyob hauv qab ntawm kev xaiv.

13. Ib lub tsev qiv ntawv ntxiv, ESP8266WiFi, teeb nws hauv "Tus Thawj Saib Xyuas Tsev Qiv Ntawv" hauv Arduino IDE. Ntawv qhia zaub mov, kos duab suav nrog Lub Tsev Qiv Ntawv Tswj Cov Tsev Qiv Ntawv Ua ib qho kev tshawb fawb los ntawm Hom = "Pab Txhawb" Lub Xeem = "Kev Sib Txuas Lus" tom qab ntawd muab lo lus ESP8266wifi tso rau hauv lub thawv tshawb nrhiav. Qhov koj xav tau hais tias "ESP8266wifi Built-in los ntawm Ivan Grokhotkov"

14. I2C qhov chaw nyob rau BME280 yog hardcoded hauv Adafruit_BME280.h cov ntaub ntawv (saib kab #define BME280_ADDRESS 0x77) hauv Adafruit_BME280_Library nplaub tshev. Adafruit's BME sensor modules nyuaj siv rau I2C chaw nyob ntawm 0x77. Tab sis BME280 tuaj yeem muaj qhov sib txawv me ntsis I2C chaw nyob (0x76) yog tias nws sab nraud SDO tus pin yog hauv av. Yog tias koj siv lub ntsuas qhov ntsuas los ntawm tus neeg thib peb, nws yuav zoo li nws qhov chaw nyob yuav tsis sib xws nrog tus nqi pib hauv Adafruit lub tsev qiv ntawv. Piv txwv li, rau feem ntau ntawm BME280 sensor modules muaj nyob ntawm eBay lossis Aliexpress muaj lawv li I2C chaw nyob yog 0x76. Yog tias koj tsis tau txais cov lus teb los ntawm lub ntsuas ntsuas siv qhov chaw nyob tsis raug teeb tsa hauv Adafruit_BME280.h cov ntaub ntawv, koj yuav xav hloov nws mus rau 0x76.

BME280 & ESP8266 Cov Ntsiab Lus Sib Txuas. ESP8266 3.3V rau BME280 Vin, ESP8266 GND rau BME280 GND, ESP8266 D4 rau BME280 SCL, ESP8266 D3 rau BME280 SDA. 15. Qhib qhov muab ESP8266-NodeMCU-12E-BME280.html ua cov ntawv sau thiab sau koj "ESP8266-NodeMCU-12E-BME280" (Thawj channel koj tsim) "Channel ID" & "Nyeem API Key" rau variables key1 & chan1. Kuj tseem nkag mus rau "Nyeem API Ntsiab Lus" thiab "Channel ID" rau "BME280 Txhua Hnub Muaj Cov Ntaub Ntawv Tsawg" (Qhov thib ob channel koj tau tsim) rau key2 thiab chan2. Ib qho ntxiv, nkag mus rau koj lub sijhawm nyob ntawm UTC. Raws li hauv -5 rau kuv. Txhua qhov txiaj ntsig yuav tsum yog sab hauv cov lus qhia ib leeg 'XXXXX'. Txuag thiab tawm ntawm cov ntawv sau.

Txuas koj ESP8266 nrog lub USB cable rau koj lub khoos phis tawj ces xaiv koj lub chaw nres nkoj txuas ua USB chaw nres nkoj.

Linux cov neeg siv yuav tau hloov tus kheej txoj haujlwm ntawm USB chaw nres nkoj los sib tham nrog /dev /ttyUSB0 zoo li 'sudo chown yourusername /dev /ttyUSB0' lossis qhov uas koj tau xaiv ua koj qhov chaw nres nkoj hauv teeb.

Kauj Ruam 3: Ua Haujlwm ESP8266 Nrog Arduino IDE

Program ESP8266 Nrog Arduino IDE
Program ESP8266 Nrog Arduino IDE

16. Tom ntej no peb yuav npaj ESP8266. Txuas lub USB cable ntawm koj ESP8266 thiab koj lub computer.

Thauj cov ntawv New_BME_Sensor.ino muab rau hauv Arduino IDE. Koj lub ntsuas BME280 yuav tsum tau txuas rau D3 (SDA) & D4 (SCL) ntawm ESP8266. Nkag mus rau koj "ESP8266-NodeMCU-12E-BME280" (Thawj lub channel koj tau tsim) "Sau Qhov Tseem Ceeb" "Wireless SSID" & "Password" rau hauv ntu qhov tseeb ntawm daim duab. Tom qab ntawd nyem rau cov ntawv qhia zaub mov "Sketch" & "Upload". Tom qab koj rub cov duab kos (Kev nce qib mus txog 100%) rau koj li ESP8266 koj tuaj yeem qhib lub koos pij tawj saib (Icon sab xis zoo li lub iav loj) thiab pom koj cov ntaub ntawv luam tawm tom qab 5 feeb, txhua 5 feeb. Cov ntaub ntawv tau xa mus rau yam khoom sib tham ntawm 5 feeb sib nrug yog li nws yuav yog qee lub sijhawm ua ntej koj muaj cov ntaub ntawv muaj txiaj ntsig tab sis koj yuav tsum tau ntsuas ntsuas tom qab 5 feeb.

Nco ntsoov tias koj tau txais kev nyeem raug los ntawm BME280 hauv cov saib hauv qab.

Thawj qhov kev ntsuas yuav zoo li yog nan tsis raug.

Tos ob peb feeb kom txog thaum nyeem tom ntej thiab txheeb xyuas qhov nyeem tau zoo.

Kauj Ruam 4: Rov Qab Mus Rau Qhov Hais Lus Kom Ua Qee Cov Ntaub Ntawv Tweaking

Rov qab mus rau Thingspeak ua qee Cov Ntaub Ntawv Tweaking
Rov qab mus rau Thingspeak ua qee Cov Ntaub Ntawv Tweaking

17. Tam sim no, Thaum cov ntaub ntawv maj mam muab xa mus rau yam khoom zoo cia ua qee qhov tweaking kom tau txais qee cov ntaub ntawv ntxiv los ntawm qhov uas tau tshaj tawm. Rov qab mus rau lub vev xaib yam lus thiab hauv Thingspeak "BME280 Txhua Hnub Muaj Cov Ntaub Ntawv Tsawg Tus Nqi Qis" channel nplooj ntawv (Qhov thib ob channel koj tau tsim) nyem rau ntsuab "MATLAB Txheeb Xyuas" khawm. Xaiv Template "Custom (No Starter Code)"

18. Npe MATLAB Kev Tshawb Fawb "Xeem Min Max Txij Thaum Ib Tag Hmo".

19. Luam the MATLAB Analysis.txt code rau hauv qhov chaw muab. Nkag mus rau "channel ID" rau "ESP8266-NodeMCU-12E-BME280" (Thawj channel koj tau tsim) rau hauv "readChannelID". Nkag mus rau "BME280 Txhua Hnub Cov Ntaub Ntawv Qub Qub" (Qhov thib ob channel koj tau tsim) Sau "Channel ID" & "Sau Cov Ntsiab Lus" rau hauv sau NewChannelID & writeAPIKey hwm. Kuv paub nws suab tsis meej pem (rov nyeem dua). Nyem tseg thiab khiav. Yog tias koj tau ua nws raug thiab nyeem cov channel yog pej xeem koj yuav pom tsis muaj qhov yuam kev thiab nws ua tiav luam tawm qhov txiaj ntsig. Nco tseg, Koj yuav pom qhov yuam kev yog tias tsis muaj cov ntaub ntawv tau muab tso rau hauv cov channel ntawd. Txawm hais tias qhov yuam kev txuas ntxiv mus. Yog tias xav tau koj tuaj yeem rov mus nyem Nyem tseg thiab khiav kom ntseeg tau tias nws ua haujlwm thaum cov ntaub ntawv tau raug xa tawm.

20. Tom ntej no, peb yuav tsum tsim "Lub Sijhawm Tswj" kom tua cov cai no txhua 5 feeb thiab peb cov ntaub ntawv tau sau rau hauv channel "BME280 Txhua Hnub Muaj Cov Ntaub Ntawv Tsawg" (Qhov thib ob channel koj tau tsim). Los ntawm nplooj ntawv tseem ceeb ntawm "BME280 Txhua Hnub Muaj Cov Ntaub Ntawv Tsawg" (Qhov thib ob channel koj tsim) xaiv Cov Apps nyob rau saum toj. Hauv qab qhov kev xaiv "TimeControl" tom qab ntawv khawm ntsuab "New TimeControl". Lub npe nws "Xa High Temps ESP8266". Xaiv koj thaj tsam sijhawm yog xav tau thiab xaiv "Rov Rov Qab" hauv Zaus. Xaiv feeb nyob rau hauv Kev Rov Rov Los. Teem kom khiav txhua 5 feeb. Kev nqis tes yuav tsum yog MATLAB Kev Tshawb Fawb thiab "Txoj Cai Los Ua" yog "Xeem Min Max Txij Thaum Ib Tag Hmo". Txuag Sijhawm Tswj.

Kauj Ruam 5: Hloov Kho Cov Ntaub Ntawv HTML

Kho qhov Muab Cov Ntaub Ntawv HTML
Kho qhov Muab Cov Ntaub Ntawv HTML

Kho cov ntaub ntawv HTML thiab nrhiav cov lus uas hais tias "******** Hloov Kuv 1 ntawm 8 *********" Hloov cov no rau qhov koj nyiam.

Sau ntawv:

Qee qhov ntawm cov ntawv thiab kab ntawv txhua lub lim tiam yuav tsis sau kom raug kom txog thaum koj muaj ib hnub thiab tag nrho lub lim tiam ntawm cov ntaub ntawv rau ntu 24 Hr thiab Lub Limtiam thiab daim duab. Thaum koj muaj ib pawg ntawm cov ntaub ntawv koj tuaj yeem nthuav dav ntawm kab ntawv nrog lub log log (Txoj Cai Nyem rau Pib dua). Koj tseem tuaj yeem muaj qhov ntsuas thib plaub (raws li pom hauv cov duab) los ntawm lwm lub sensor los ntawm lwm channel tab sis kuv tau ua tiav qhov feem cuam tshuam. Yog tias koj hnov savy, nqes nws. Kuj tseem muaj qee qhov teeb meem sijhawm uas yuav tsum paub txog. Koj yuav tsis muaj cov ntaub ntawv tam sim no tab sis nws yuav tsum yog tsawg dua 5 feeb qub. Qhov no los ntawm thaum lub sijhawm tswj hwm raug rho tawm haujlwm, Thaum cov ntaub ntawv raug xa los ntawm ESP8266 thiab thaum koj rub / rov ua dua lub vev xaib.

Qhib qhov muab ESP8266-NodeMCU-12E-BME280.html cov ntaub ntawv hauv koj lub vev xaib thiab koj yuav tsum pom cov ntsuas thiab daim duab nyob hauv.

Tau txais.ino &. HTML cov ntaub ntawv ntawm no

Pom zoo: