Cov txheej txheem:

WIFI Weather Station Nrog Magicbit (Arduino): 6 Kauj Ruam
WIFI Weather Station Nrog Magicbit (Arduino): 6 Kauj Ruam

Video: WIFI Weather Station Nrog Magicbit (Arduino): 6 Kauj Ruam

Video: WIFI Weather Station Nrog Magicbit (Arduino): 6 Kauj Ruam
Video: 20 MOMENTS YOU WOULDN'T BELIEVE IF NOT FILMED 2024, Hlis ntuj nqeg
Anonim
Image
Image

Cov ntawv qhia no qhia yuav ua li cas tsim chaw nres tsheb huab cua los ntawm Magicbit siv Arduino uas tuaj yeem tau txais cov ntsiab lus los ntawm koj lub xov tooj ntse.

Khoom siv

  • Magicbit
  • USB-A rau Micro-USB Cable
  • Magicbit DHT11 sensor module

Kauj ruam 1: Zaj dab neeg

Hauv qhov kev qhia no peb yuav kawm paub yuav ua li cas ua lub chaw nres tsheb huab cua siv Magicbit dev board nrog DHT11 sensor module. Los ntawm kev siv xov tooj ntse peb tuaj yeem tau txais cov ntsiab lus hais txog huab cua qhov twg Magicbit nyob.

Kauj Ruam 2: Txoj Kev Xav thiab Txoj Kev

Hauv qhov chaw nres tsheb huab cua no peb cia siab tias yuav tau txais cov ntaub ntawv hais txog qhov kub thiab txias nyob qhov twg peb xav tau. Ua ntej, peb yuav tsum tau txais cov ntaub ntawv los ntawm lub ntsuas cua uas nkag siab rau qhov kub thiab txias. Tom qab ntawd cov teeb liab tso tawm ntawm lub ntsuas cua tau muab rau lub microcontroller uas muaj WIFI adapter txuas nrog internet. Rau txhua yam no peb tsuas siv Magicbit core board thiab DHT11 sensor module uas tuaj yeem ntsaws ncaj qha rau Magicbit. Magicbit muaj ESP32 processor. Yog li nws muaj inbuilt WIFI txuas rau txuas nrog Internet. Tom qab ntawd peb hloov peb cov ntaub ntawv ntsuas mus rau huab platform thiab los ntawm kev siv cov app tshwj xeeb peb tsim peb cov kev cai sib cuam tshuam thiab qhia cov ntsiab lus siv nws. Rau lub hom phiaj ntawd peb siv Blynk daim ntawv thov. Cov app no yog IOT raws app. Tab sis nws yooj yim heev thiab peb tuaj yeem ua ntau txoj haujlwm los ntawm nws. Tsis tas li nws txhawb rau ntau hom txheej txheem xws li Arduino, Esp32 thiab ntxiv rau. Koj tuaj yeem tau txais cov ncauj lus ntxaws ntxaws txog qhov app no thiab ntawm no/tsis siv lub platform los ntawm kev mus hauv qab txuas.

blynk.io/en/getting-started

Kauj Ruam 3: Teeb Kho Vajtse

Teeb Software
Teeb Software

Qhov no yooj yim heev. Txuas lub sensor module rau Magicbit. Thaum txuas Magicbit rau lub computer siv micro USB cable.

Kauj ruam 4: Teeb Software

Teeb Software
Teeb Software
Teeb Software
Teeb Software

Feem ntau ntawm txoj haujlwm no yog ua tiav hauv kev teeb tsa software. Hauv txoj kev xav thiab txheej txheem, peb tau hais tias peb siv Blynk daim ntawv thov los tso saib peb cov ntaub ntawv. Yog li cia teeb qhov ntawd.

Ua ntej koj yuav tsum rub tawm thiab teeb tsa Blynk app los ntawm play store rau koj lub xov tooj Android lossis los ntawm app khw rau koj ios. Ces qhib nws. Tam sim no nws tau thov kom tso npe lossis nkag mus. Qhov ntawd yooj yim heev. Yog tias koj thawj zaug siv daim ntawv thov no, tom qab ntawd muab koj tus email chaw nyob thiab ntaus txhua tus lej koj xav tau thiab sau npe

Tom qab nkag mus rau Blynk ces xaiv lub cim tshiab ua haujlwm thiab koj yuav nkag mus rau nplooj ntawv tshiab. Tom qab ntawd nkag mus rau koj lub npe project thiab nws nug yam twg ntawm pawg thawj coj saib uas koj siv thiab hom kev txuas twg koj siv los sib tham nrog tus tsim tawm. Teem qhov ntawd ESP32 dev thiab WIFI. Tam sim no nyem qhov tsim khawm thiab yow yuav pom qee qhov zaws hauv cov zaub. Raws li qhov tam sim no koj yuav tsum txheeb xyuas koj tus email inbox. Vim tias lawv tau xa koj qee qhov kev lees paub token code rau koj txoj haujlwm. Txheeb xyuas koj tus email kom ntseeg tau tias koj tau txais nws. Peb siv cov cai no hauv peb Arduino qhov chaws tom qab. Tam sim no koj muaj qhov chaw ua haujlwm khoob thiab koj tuaj yeem kho nws raws li koj nyiam

Tam sim no nyem qhov cim kos npe zoo nyob rau sab saum toj ntawm lub vijtsam thiab koj yuav nkag mus rau nplooj ntawv tshiab. Nws muaj ntau txoj kev xaiv hu ua widgets. Cov cuab yeej siv los tso saib cov ntaub ntawv thiab tswj cov cuab yeej nyob deb. Koj tuaj yeem kawm paub ntau ntxiv txog qhov no ntxiv los ntawm qhov txuas no

docs.blynk.cc/#:~:text=Now%20imagine%3A%2… a%20blynk%20of%20an%20eye.

Hauv txoj haujlwm no peb sawv cev rau peb cov ntaub ntawv siv ob lub ntsuas ntsuas sib piv thiab peb qhia qhov sib txawv ntawm peb cov ntaub ntawv nrog lub sijhawm siv cov duab. Yog li peb siv ob lub ntsuas thiab ib daim ntawv qhia super. Los ntawm kev xaiv cov widgets koj tuaj yeem ntxiv lawv rau koj nplooj ntawv ua haujlwm

Tam sim no peb muaj cov khoom ntshuam los ua kom tiav. Qhov ntawd yog teeb tsa cov cuab yeej no hauv txoj kev tsim nyog. Txhawm rau ua qhov ntawd koj muaj peev xwm nkag mus rau teeb tsa ntawm txhua lub widget. Los ntawm txhaj ib qho widget koj tuaj yeem nkag mus txheeb cov chaw ntawm tus widget uas koj tau nyem. cia hloov qhov chaw ntawm txhua tus widget. vim tias peb siv cov cuab yeej sab laug los qhia cov ntsiab lus ntawm cov av noo thiab txoj cai widget kom paub meej qhov kub thiab txias, xub nkag mus rau qhov chaw ntawm sab laug ntsuas lub ntsuas cua los ntawm txhaj rau nws. Teeb qhov nyiam thiab lub npe kom ntsuas thiab Xaiv cov xim uas koj xav tau los qhia koj cov ntaub ntawv av noo los ntawm kev ntsuas. Teeb lub tswv yim li V5 thiab thaj tsam rau 0 txog 100. V5 txhais tau tias pom 5 tus pin. Qhov no txhais tau tias app tau txais cov ntaub ntawv los ntawm kev pom 5 tus pin. tsis yog tus lej thib tsib tsim ESP32. Visual 5 tus pin tsuas yog siv rau kev sib txuas lus ntawm pawg thawj coj thiab app ntawm internet. Nws tsis yog tus pin tiag. Cov av noo yuav qhia ntawm 0 thiab 100. Kuj teeb tsa tus nyeem ntawv rau 1. yog li cov ntaub ntawv nyeem yuav hloov tshiab hauv txhua ib ob. Koj tuaj yeem hloov nws los ntawm txhua tus nqi. tab sis ntau zaus 1s yog qhov zoo rau tau txais cov ntaub ntawv yam tsis tau ncua

Hneev rov qab mus rau qhov project tso tawm thiab nkag mus rau qhov ntsuas qhov ntsuas tau zoo thiab hloov cov teeb tsa zoo li peb tau ua ua ntej. Nco ntsoov teeb lub tswv yim ua V6 tus pin. Vim tias peb twb tau siv V5 kom tau txais cov ntaub ntawv cov av noo

Tam sim no mus rau qhov chaw teeb tsa super thiab teeb lub npe tsim nyog thiab xim. Tom qab ntawd ntxiv ob cov ntaub ntawv ntws. Thawj qhov rau cov av noo thiab qhov thib ob rau qhov kub thiab txias. Tom qab ntawd mus rau cov chaw teeb tsa cov ntaub ntawv los ntawm txhaj rau cov qhab nias sib luag nyob rau sab xis ntawm lawv. Tom qab ntawd xaiv lub teeb duab. Hauv qhov no peb teev qhov ntawd raws li tus qauv txuas ntxiv mus. tom qab ntawd teeb tsa cov tswv yim ua V5 thiab V6 rau ob qho ntaub ntawv ntws. Hauv qhov ntsuas kub cov ntaub ntawv teeb tsa peb teeb tsa ntxiv raws li Celsius thiab hauv cov av noo peb teeb tsa ntawd ua %. Koj tuaj yeem hloov lwm qhov chaw koj xav qhia

Tam sim no peb ua tiav ib feem ntawm app. Tab sis yam tsis tau xa cov ntaub ntawv raug cai mus rau Magicbit, peb tsis tuaj yeem txuas nrog cov app no. Yog li cia saib seb yuav ua li cas.

Thawj theem peb suav nrog cov tsev qiv ntawv tshwj xeeb rau tsim kev sib txuas internet siv WIFI. Cov tsev qiv ntawv twb tau teeb tsa nrog koj li Magicbit board hauv Arduino tshwj tsis yog Blynk lub tsev qiv ntawv. Yog li mus rau Sketch> suav nrog Lub Tsev Qiv Ntawv> Tswj Tsev Qiv Ntawv thiab tshawb nrhiav Blynk lub tsev qiv ntawv thiab nruab nws qhov tshiab tshaj plaws. kuj koj tuaj yeem rub lub tsev qiv ntawv los ntawm qhov txuas no

github.com/blynkkk/blynk-library

Tom qab rub tawm nws, mus rau Sketch> suav nrog Tsev Qiv Ntawv> ntxiv zip tsev qiv ntawv thiab xaiv cov ntawv zip uas koj tau rub tawm.

Tom ntej no koj yuav tsum teeb tsa peb lub npe WIFI thiab tus lej zais hauv tus lej txhawm rau txuas rau internet. Tam sim no theej thiab muab tshuaj txhuam tus lej Auth Token uas koj tau txais los ntawm email. Txheeb xyuas qhov twg peb lub sensor txuas nrog rau Magicbit. Hauv qhov no tus pin txuas yog 33. Hauv kev teeb tsa koj tuaj yeem pom muaj ob lub pins virtual. Teem cov pins li V5 thiab V6. Yog tias koj siv tus pin sib txawv hauv app ces hloov qhov ntawd hauv cov cai. Thaum cov cai tau ua haujlwm hauv tus txheej txheem, ua ntej nws txuas yog WIFI. Tom qab ntawd xa cov ntaub ntawv dhau ntawm internet hla V5 thiab V6. Qhov no yog cov txheej txheem looping. Tam sim no xaiv qhov tseeb com chaw nres nkoj thiab xaiv pawg thawj coj saib ua magicbit. Tam sim no nws yog lub sijhawm los rub nws

Tom qab tso cov cai ua tiav Magicbit pawg thawj coj yuav txuas rau koj li WIFI tau txais. Raws li koj qhov xwm txheej ib puag ncig nws tuaj yeem qeeb lossis txheej txheem sai dua.

Tam sim no mus rau koj txoj haujlwm hauv Blynk app thiab nws lub sijhawm los sim nws ua haujlwm. Nyem lub voos xwmfab zoo li tus khawm khawm lub cim.if koj lub app txuas nrog koj pawg thawj coj ntawm internet, tom qab ntawd koj yuav tau txais qee qhov zaws los ntawm app. Zoo, Nws ua haujlwm. Tam sim no koj tuaj yeem pom qhov ntsuas kub thiab av noo los ntawm ob lub ntsuas thiab lawv qhov sib txawv los ntawm kab ntawv.

Kauj ruam 5: Troubleshooting

Yog tias koj nyem qhov haujlwm ua haujlwm khawm thiab yog tias nws tsis yog nws teb. Tom qab ntawd,

  • Tos me ntsis. Vim tias qee zaum pawg thawj coj nyuaj nrhiav pom koj li WIFI raws li koj qhov xwm txheej ib puag ncig. kuj qeeb internet txuas tuaj yeem yog vim li cas rau qhov ntawd.
  • Txheeb xyuas tus lej Auth thiab WIFI cov ntsiab lus muaj tseeb hauv koj tus lej koj tau nkag mus.
  • Hloov WIFI kev sib txuas.

Kauj Ruam 6: Arduino Code

/*************************************************************

Rub tawm lub tsev qiv ntawv Blynk tshiab kawg ntawm no:

github.com/blynkkk/blynk-library/releases/latest Blynk yog lub platform nrog iOS thiab Android apps los tswj Arduino, Raspberry Pi thiab nyiam hauv Is Taws Nem. Koj tuaj yeem yooj yim tsim cov duab cuam tshuam rau txhua qhov koj cov haujlwm los ntawm kev yooj yim rub thiab xa cov widgets. Downloads, docs, tutorials: https://www.blynk.cc Sketch generator: https://examples.blynk.cc Blynk zej zog: https://community.blynk.cc Ua raws li peb: https://www.fb. com/blynkapp Blynk lub tsev qiv ntawv tau ntawv tso cai nyob hauv MIT daim ntawv tso cai Qhov piv txwv no yog nyob rau pej xeem. ********************************************************** ****** *********** Qhov piv txwv no qhia tau tias tus nqi tuaj yeem raug thawb los ntawm Arduino mus rau Blynk App li cas. CEEB TOOM: Rau qhov piv txwv no koj yuav xav tau Adafruit DHT lub tsev qiv ntawv sensor: https://github.com/adafruit/Adafruit_Sensor https://github.com/adafruit/DHT-sensor-library App project teeb tsa: Tus nqi tso saib txuas nrog V5 Tus Nqi Zaub widget txuas rau V6 ******************************************** *****************//*Hais tawm qhov no kom tsis txhob luam tawm thiab txuag chaw*/ #define BLYNK_PRINT Serial #include #include #include #include "DHT.h" // Koj yuav tsum tau txais Auth Token hauv Blynk App. // Mus rau Qhov Chaw Haujlwm (icon txiv ntoo). char auth = "****************"; // auth token tau txais koj ntawm email // Koj li ntawv pov thawj WiFi. // Teeb tus password rau "" rau qhib tes hauj lwm. char ssid = "**********"; /// koj lub npe wifi npe char pass = "**********"; // wifi password #define DHTPIN 33 // Tus lej digital twg peb txuas nrog rau // Tsis pom zoo yam twg koj tab tom siv! #define DHTTYPE DHT11 // DHT 11 //#define DHTTYPE DHT22 // DHT 22, AM2302, AM2321 //#define DHTTYPE DHT21 // DHT 21, AM2301 DHT dht (DHTPIN, DHTTYPE); BlynkTimer timer; // Lub luag haujlwm no xa Arduino lub sijhawm txhua txhua ob rau Virtual Pin (5). // Hauv app, Widget's nyeem zaus yuav tsum tau teeb tsa rau PUSH. Qhov no txhais tau tias // uas koj txheeb xyuas ntau npaum li cas xa cov ntaub ntawv mus rau Blynk App. void sendSensor () {ntab h = dht.readHumidity (); ntab t = dht.readTemperature (); // lossis dht.readTemperature (tseeb) rau Fahrenheit yog (isnan (h) || isnan (t)) {Serial.println ("Ua tsis tau zoo nyeem los ntawm DHT sensor!"); rov qab; } // Koj tuaj yeem xa tus nqi txhua lub sijhawm. // Thov tsis txhob xa ntau tshaj 10 qhov nqi ib pliag. Blynk.virtualWrite (V5, h); Blynk.virtualWrite (V6, t); } void teeb () {// Debug console Serial.begin (115200); ncua (1000); Blynk.begin (auth, ssid, dhau); // Koj tseem tuaj yeem hais qhia server: //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80); //Blynk.begin(auth, ssid, dhau, IPAddress (192, 168, 1, 100), 8080); dht.begin (); // Teeb lub luag haujlwm kom raug hu ua txhua lub sijhawm thib ob.setInterval (1000L, sendSensor); } tsis muaj dab tsi voj () {Blynk.run (); timer.run (); }

Pom zoo: