Cov txheej txheem:

Ua Koj Cov Tsob Ntoo SMART! (Los ntawm Arduino): 5 Kauj Ruam
Ua Koj Cov Tsob Ntoo SMART! (Los ntawm Arduino): 5 Kauj Ruam

Video: Ua Koj Cov Tsob Ntoo SMART! (Los ntawm Arduino): 5 Kauj Ruam

Video: Ua Koj Cov Tsob Ntoo SMART! (Los ntawm Arduino): 5 Kauj Ruam
Video: Tsis Siab Los Hlub Tiag - SODA Poj Laib Khej Me (Cover) 2024, Kaum ib hlis
Anonim
Image
Image
Cov Ntaub Ntawv Yuav Tsum Tau
Cov Ntaub Ntawv Yuav Tsum Tau

Yog li koj ib txwm xav paub yuav ua li cas ntxiv thev naus laus zis rau koj cov nroj tsuag? Nrog txoj haujlwm txias no, koj tuaj yeem ua kom ntseeg tau tias koj cov ntoo zoo nkauj ib txwm nyob hauv lawv qhov xwm txheej zoo. Tom qab ua qhov haujlwm no koj yuav:

  • Kawm paub siv analog-output sensors
  • Kawm paub yuav ua li cas tso saib cov ntaub ntawv ntawm OLED cov lus
  • Ua rau koj tsob ntoo luag ntxhi yog tias txhua yam zoo thiab quaj yog tias muaj qee yam tsis raug.

Ntse cog; Lub hauv paus ntawm lub tswv yim yog dab tsi?

Tam sim no, Peb tuaj yeem nce kev ua haujlwm tau zoo, nyiam ua haujlwm, ua neej nyob, thiab lwm yam los ntawm kev ntxiv thev naus laus zis rau peb cov cuab yeej thiab khoom nrog cov khoom siv hluav taws xob yooj yim. Ntxiv cov txuj ci dag dag rau tej yam uas peb mob siab txog yog qhov txaus nyiam heev thiab xav tsis thoob. Tej zaum koj yuav tau pom Lub Tsev Ntsuab uas siv ntse tswj thiab saib xyuas ntawm cov nroj tsuag, paj, thiab lwm yam. Lawv tuaj yeem tswj lub sijhawm thiab dej ntawm cov nroj tsuag, teeb pom kev zoo, ntsuas kub, thiab ntau lwm yam tseem ceeb thiab ua tau zoo. Nws yog qhov pib zoo nkag mus rau lub ntiaj teb zoo siab no thiab kawm paub yuav ua li cas. Hauv txoj haujlwm no, peb yuav tau txais cov ntsiab lus tsim nyog hais txog peb cov nroj tsuag qhov xwm txheej; xws li cov av noo, qhov kub ib puag ncig, thiab qhov pom kev ntawm cov nroj tsuag tuaj yeem txais. Kev saib xyuas cov ntaub ntawv no tuaj yeem pab peb ib txwm khaws peb cov nroj tsuag kom zoo. Nyeem cov ntaub ntawv los ntawm cov ntsuas los ntawm Arduino yog qhov yooj yim heev thiab saib xyuas tias ntawm cov zaub tsis nyuaj li. Yog li, koj tseem tos dab tsi? Cia peb ua peb cov nroj tsuag ntse!

Kauj Ruam 1: Cov Ntaub Ntawv Xav Tau

  • Arduino Nano R3 (× 1pcs)
  • DHT11 Vaum thiab Kub Sensor (× 1 pcs)
  • 0.96inch SPI 128X64 OLED Display Module (× 1)
  • YwRobot Av Moisture Sensor Module (× 1 pcs)
  • LDR Sensor (× 1 daim)
  • Ribbon Cable (× 1 pcs)

Kauj ruam 2: Circuit Court

Circuit Court
Circuit Court

Muaj ob peb lub ntsiab lus tseem ceeb uas koj yuav tsum tau mloog. Ua ntej, koj xav tau lub zog siv hluav taws xob uas tuaj yeem muab tsawg kawg 5V thiab 20mA. Yog tias koj lub zog siv hluav taws xob tsis tau raws li cov xwm txheej no, koj yuav tsum txuas cov qauv rau 5V tus pin ntawm Arduino (Tsis txhob siv 3v3). Koj kuj yuav tsum nco ntsoov tias OLED zaub nrog SPI raws tu qauv tau siv. Yog tias koj cov zaub yog I2C, koj yuav tsum txuas lawv rau A4 thiab A5 pins ntawm Arduino. Ib qho ntxiv, lub ntsuas dej noo siv ntawm no muaj 2 tus pin thiab yog li ntawd lub rooj sib hais lub tshuab hluav taws xob nrog ib qho kev tso tawm analog yog qhov tsim nyog. DHT11 lub ntsuas tuaj yeem ntsuas ob qho kub thiab av noo, tab sis peb peb cov cai qhia qhov kub thiab txias nkaus xwb. Koj tuaj yeem ntxiv cov av noo los ntawm kev ntxiv ob peb kab ntawm cov cai.

Kauj ruam 3: Sib dhos

Sib dhos
Sib dhos
Sib dhos
Sib dhos
Sib dhos
Sib dhos

Txij li thaum peb lub lauj kaub paj me me thiab muaj qhov txwv qhov chaw, peb tau siv cov kab xaim nyias nyias uas tsim nyog rau peb lub lauj kaub paj.

Txhawm rau txuas cov xov hlau no, nws yog qhov zoo dua los cais tus pin headers los ntawm cov khoom siv. Ua ntej, OLED zaub tus pin header yuav tsum tau desoldered. Txhawm rau ua qhov no, koj tuaj yeem siv cov hlau txuas tab sis lub rhaub dej kub zoo dua.

Cov zaub OLED tau nyam rau ntawm lub rooj tsavxwm uas muab SPI kev sib txuas lus. Txhawm rau kom pom qhov zoo dua ntawm cov zaub thiab zais cov xov hlau, koj tuaj yeem cais cov zaub vaj huam sib luag los ntawm pawg thawj coj saib. Siv rab riam ntse los ua qhov no.

Tam sim no nws yog lub sijhawm los txuas cov xov hlau rau ntawm lub rooj tsavxwm. Lub rooj tsavxwm yuav muab tso rau hauv cov xuab zeb ntub, yog li peb yuav tsum ua txhua qhov kev sib txuas thiab cov khoom siv tsis muaj dej. Ua ntej tshaj, peb npog nws nrog Lub Hnab Yas. Tom qab ntawd peb npog nws los ntawm lub raj ntsws. Koj yuav tsum sov nws kom lo rau ntawm lub rooj tsavxwm. Tam sim no sau cov nqaws los ntawm cov kua nplaum kub.

Lub ntsuas dej noo uas peb tau xaiv, yuav tsum muaj lub tshuab cais cais. Ua ntej, cais tus pin headers, tom qab ntawd ua rau lawv tsis muaj dej.

Rau LDR sensor, Koj yuav tsum txuas 10k ohm resistor ntawm GND thiab sensor tus pin. Qhov no yuav tsum tau ua kom tsis muaj dej.

Rau Qhov ntsuas kub, Koj yuav tsum txuas 10k ohm resistor ntawm Vcc thiab Tus pin teeb liab.

Tam sim no nws yog lub sijhawm los txuas txhua lub ntsuas thiab ntsuas cov qauv rau Arduino Nano. Tom qab ua tiav kev sib dhos, tsis txhob hnov qab kuj tseem ua rau Arduino tsis muaj dej.

Tam sim no nchuav qee cov xuab zeb los ntawm lub lauj kaub (tsis yog txhua qhov ntawd, nws muaj teeb meem rau tsob ntoo) thiab muab lub rooj tsavxwm thiab lub ntsuas pa (tshwj tsis yog ntsuas qhov ntsuas kub) sab hauv. Qhov ntsuas kub yuav tsum tawm ntawm lub lauj kaub. Tam sim no sau lub lauj kaub nrog cov xuab zeb tshem tawm.

Peb txhua tus ua tiav! Cia peb upload cov cai.

Kauj ruam 4: Code

Hauv txoj cai no, Peb siv SSD1306 thiab DHT lub tsev qiv ntawv rau OLED zaub thiab DHT 11. Koj yuav tsum xub ntxiv cov tsev qiv ntawv no, tom qab ntawv suav thiab xa cov cai rau Arduino Nano. Yog tias nws yog thawj zaug koj khiav Arduino board, tsis txhob txhawj. Tsuas yog ua raws cov theem no:

  1. Mus rau www.arduino.cc/en/Main/Software thiab rub tawm software ntawm koj li OS.
  2. Nruab IDE software raws li qhia.
  3. Khiav Arduino IDE thiab tshem cov ntawv sau thiab luam cov cai hauv qab no hauv kab ntawv sau.
  4. Nkag mus rau qhov kos duab thiab suav nrog cov tsev qiv ntawv (Rub cov tsev qiv ntawv los ntawm cov txuas hauv qab no). Tam sim no nyem ntxiv ZIP tsev qiv ntawv thiab ntxiv cov tsev qiv ntawv.
  5. Xaiv lub rooj tsavxwm hauv cov cuab yeej thiab cov laug cam, xaiv Arduino Nano.
  6. Txuas Arduino rau koj lub PC thiab teeb tsa com chaw nres nkoj hauv cov cuab yeej thiab chaw nres nkoj.
  7. Nias lub Upload (Xub kos npe) khawm.
  8. Koj tau npaj txhij!

Kauj ruam 5: Dab tsi ntxiv?

Dab Tsi Ntxiv?
Dab Tsi Ntxiv?

Tam sim no koj tuaj yeem tsim txoj haujlwm no rau koj nyiam. Nov yog qee qhov qhia tias koj tuaj yeem ntxiv lawv rau txoj haujlwm:

  • Koj tuaj yeem muaj lub moos tso saib thiab ntsuas lub sijhawm ntawm cov xwm txheej sib txawv thiab kwv yees lub sijhawm ntawm cov xwm txheej uas cog xav tau dej lossis ntau lub teeb. koj yuav tsum ntxiv RTC tus qauv zoo li DS1307 thiab ntxiv qee cov cai nyeem lub sijhawm thiab daim ntawv qhia hnub thiab tso tawm ntawd lossis khaws qee yam ntawm lawv kom muaj cov ncauj lus kom ntxaws ntxiv ntawm tsob ntoo.
  • Los ntawm kev ntxiv lub suab nrov, koj tuaj yeem teeb tsa lub tswb uas ceeb toom koj txog kev cog ntoo. piv txwv li thaum cov xuab zeb qhuav heev, nws tuaj yeem nrov 1 zaug hauv ib teev.
  • Peb teeb tsa ob qho emoji rau cov xwm txheej sib txawv. Koj tuaj yeem ntxiv ntau lub ntsej muag qauv rau txhua qhov xwm txheej. Txog qhov no koj yuav tsum nyeem OLED cov lus qhia kom paub hloov pauv koj cov duab rau Hex code.

Pom zoo: