Cov txheej txheem:

Arduino Ua Haujlwm Nrog Ntau Cov Ntaub Ntawv (NYEEM/Sau): 4 Cov Kauj Ruam
Arduino Ua Haujlwm Nrog Ntau Cov Ntaub Ntawv (NYEEM/Sau): 4 Cov Kauj Ruam

Video: Arduino Ua Haujlwm Nrog Ntau Cov Ntaub Ntawv (NYEEM/Sau): 4 Cov Kauj Ruam

Video: Arduino Ua Haujlwm Nrog Ntau Cov Ntaub Ntawv (NYEEM/Sau): 4 Cov Kauj Ruam
Video: Computer Vision with Python! Resizing Images 2024, Hlis ntuj nqeg
Anonim
Arduino Ua Haujlwm Nrog Ntau Cov Ntaub Ntawv (NYEEM/Sau)
Arduino Ua Haujlwm Nrog Ntau Cov Ntaub Ntawv (NYEEM/Sau)

Nyob zoo cov neeg

Hnub no kuv nthuav qhia koj txoj haujlwm Arduino uas ua haujlwm nrog RTC daim ntaub thaiv uas tuaj yeem khaws cov ntaub ntawv. Lub luag haujlwm tseem ceeb ntawm txoj haujlwm no yog ua haujlwm nrog ntau cov ntaub ntawv uas khaws cia hauv daim npav sc. Txoj haujlwm no muaj cov lej uas ua haujlwm nrog peb cov ntaub ntawv uas khaws ncaj qha rau ntawm daim npav SD nrog arduino thiab RTC daim thaiv. Vim tias txoj haujlwm no ua haujlwm nrog DataLogger ntaub thaiv npog, cov ntaub ntawv ntawd tseem yuav raug khaws cia tib lub sijhawm raws li nws nyob hauv koj lub PC.

Txoj haujlwm no yog kho dua tshiab ntawm kuv qhov haujlwm kawg. Txoj haujlwm ntawd tuaj yeem pom ntawm qhov chaw qhia los ntawm lub npe Arduino Data Logger Shield Small Project. Yog tias koj muaj qee qhov teeb meem nkag siab qhov haujlwm no, kuv qhia koj kom pom yooj yim dua ib zaug.

Qhov sib txawv tseem ceeb ntawm ob txoj haujlwm no yog qhov haujlwm no siv 3 cov ntawv nyeem, lub sijhawm no peb nyeem cov ntaub ntawv los ntawm ob ntawm lawv. Vim tias peb tuaj yeem nyeem cov ntaub ntawv, peb tuaj yeem tau txais tus nqi nruab nrab ntawm cov av noo thiab qhov kub, uas tau khaws cia hauv sd card. Qhov no tseem yuav pom ntawm LCD txuas nrog Arduino.

Ib zaug ntxiv, yog tias koj yog tus tshiab rau Arduino thiab qhov no yog koj thawj qhov haujlwm uas siv DataLogger, Kuv hais kom mus thiab tshawb xyuas qhov txuas no https://www.instructables.com/id/Arduino-Data-Logg… thiab thaum koj tau txais txhua yam ntawm qhov ntawd, tuaj ntawm no thiab muaj kev lom zem ntxiv. Cia peb pib.

Kauj Ruam 1: Qhov Chaw

Qhov
Qhov
Qhov
Qhov
Qhov
Qhov

Raws li txhua lub sijhawm uas kuv sau cov phiaj xwm zoo li no kuv yuav pib nrog txhua ntu uas kuv tau siv nrog txoj haujlwm no. Kuv tseem yuav qhia qee qhov kev ntsuas uas tuaj yeem siv tau thiab tuaj yeem ua qhov haujlwm no txawv me ntsis.

Qhov:

  • Arduino uno rev3
  • Arduino Cov ntaub ntawv logger ntaub thaiv npog
  • SD daim npav nco
  • LCD 1602 zaub ntsuab nrog I2C (koj tuaj yeem siv lwm yam zaub)
  • DHT22 (DHT11 ua haujlwm zoo ib yam, tab sis qhov tseeb ntawm nws tsis zoo ib yam li dht22)
  • Ob peb jumper cables
  • Cov qhob cij
  • Roj teeb 9v

Koj tuaj yeem hloov qee qhov. Qhov zoo ntawm txoj haujlwm no yog nws tuaj yeem siv los khaws cov ntaub ntawv los ntawm lwm lub ntsuas. Kuv yuav sim ua haujlwm nrog cov pa luam yeeb, lossis infrared sensor. Nws ua haujlwm nrog lwm lub sensor. Koj tseem tuaj yeem hloov pauv koj Arduino ib yam nkaus, tab sis nco ntsoov tias Arduino yog qhov zoo tshaj plaws rau suiting Cov ntaub ntawv logger.

Kauj Ruam 2: Txuas Txhua Qhov Ua Ke

Txuas Txhua Qhov Ua Ke
Txuas Txhua Qhov Ua Ke

Qhov no yog qhov yooj yim txuas. Txawm tias schematic yog tib yam li txoj haujlwm yooj yim dua. Tab sis kuv yuav hais tias koj yuav tsum tau saib xyuas tus pin twg koj yuav siv. Txhua lub sijhawm tshuaj xyuas cov ntaub ntawv ntawm Data logger kom pom cov pins twg zoo tshaj rau siv, vim tias raws li kuv rov nco tau qee tus pins twb tau hais tseg thiab thaum kuv sim siv kuv lub sensor ntawm ib qho ntawm cov pins uas tau hais tseg nws tsis ua haujlwm.

Nyob rau sab saum toj ntawm cov kauj ruam no koj tuaj yeem pom schematic ua nrog fritzing. Qhov yooj yim yog qhov koj xav tau txuas koj cov ntaub ntawv logger nyob rau saum koj arduino. Txuas koj daim npav SD rau cov ntaub ntawv logger, thiab qhov kawg uas koj yuav tsum tau ua yog txuas dht sensor thiab lcd. Peb siv 5V los ntawm arduino rau + ib feem ntawm lub khob cij, GND rau - ib feem, thiab ua raws cov kab no koj txuas nrog + kab ntawm lub ntsuas thiab lcd rau + kab ntawm lub rooj noj mov. Tib yam mus rau - ntu, lawv tsuas yog mus rau kab uas ua raws -. Dht sensor txuas nrog tus pin 7 lub sijhawm no. LCD txuas nrog A4 thiab A5. Easy, tsis yog?

LCD:

  • VCC rau 5V (+ ib feem ntawm daim ntawv qhia zaub mov)
  • GND rau gnd (-part on breadboard)
  • SDA rau tus pin analog A4
  • SCL rau tus pin analog A5

TXH 22:

Kuv siv dht nrog lub rooj tsavxwm uas muaj peb tus pin los siv:

  • + rau 5V
  • - rau GND
  • tawm mus rau tus lej digital 7

Kauj ruam 3: Codding

Txoj cai sijhawm no nyuaj dua. Ib feem zoo ntawm nws tau tawm tswv yim yog li koj tuaj yeem nkag siab nws yooj yim.

Kuv yuav piav qhia txoj cai no ob peb ntu luv luv.

1. Thawj qhov yuav tsum nco ntsoov tias cov cai no yuav xav tau ob peb lub tsev qiv ntawv nruab rau hauv koj lub PC. Cov no yog: Sijhawm (TimeLib), Hlau, LiquidCrystal, DHT, OneWire, SPI, SD, RTClib. Tej zaum koj tuaj yeem siv qee lub tsev qiv ntawv tab sis cov tsev qiv ntawv no ua haujlwm rau kuv. 2. Tom qab ntawd peb tau txiav txim siab txhua yam uas xav tau rau txoj haujlwm no. DHT sensor yog ib qho yooj yim los txhais, koj tsuas yog xav hais tus pin uas yog lub cim txuas nrog thiab hom sensor. Tom qab ntawd koj yuav tsum txhais qee tus pin uas yuav siv rau SD daim npav thiab RTC tus pin. Thiab tom qab ntawd koj tuaj yeem pom cov kev hloov pauv siv rau txoj haujlwm no.

3. Txoj haujlwm siv ob peb txoj hauv kev thiab txhua yam ntawm lawv yog rau kev ua haujlwm nrog DHT sensor. Yog tias koj tab tom ua haujlwm nrog txoj haujlwm nrog hom ntsuas no koj tuaj yeem siv nws. Cov txheej txheem no yog getTemperature (), getMidTemperature (), getHumidity (), getMidHumidity (), readSensorData (), printLcdTemperature (), printHumidity (), printLcdMidTemperature (), printMidHumidity ().

4. Hauv kev teeb tsa muaj qee yam uas xav tau kom tiav. Ua ntej tshaj plaws koj yuav tsum tau txhais lub sijhawm. Vim tias peb tab tom siv RTC ntawm no peb xav kom muaj sijhawm zoo thaum peb Arduino khaws cov ntaub ntawv los ntawm lub ntsuas. Qhov ntawd yuav raug hais tawm hauv cov cai. Yog tias koj tsis txaus siab //RTC.adjust(DateTime(_DATE_, _TIME_)); kab koj tuaj yeem teem sijhawm rau koj qhov project. Tom qab koj teem sijhawm kom raug koj tuaj yeem tawm tswv yim ib feem ntxiv, thiab koj tuaj yeem siv koj li arduino yam tsis muaj computer. Qhov no txias heev vim tias koj tuaj yeem siv koj lub ntsuas cua sov hauv qee chav thiab khaws qhov ntsuas kub tsis tas yuav siv koj lub khoos phis tawj. Qhov thib ob uas yuav tsum ua yog siv koj daim npav SD uas yuav muaj cov ntaub ntawv khaws cia. Shield yuav sim saib seb puas muaj daim npav thiab pib ua nws. Yog tias tsis muaj cov lus yuam kev yuav raug qhia hauv Serial screen ntawm Arduino IDE.

Hauv kev teeb tsa yog thawj kauj ruam uas peb ua haujlwm nrog sau cov ntaub ntawv ntawm daim npav nco. Thawj yam uas tau sau rau ntawm daim npav yog ntawm cov ntaub ntawv datalog.txt. Lub sijhawm no peb tsuas yog lub sijhawm nkag mus rau peb lub cuab yeej, thiab peb tseem tsim kab me me ntawm cov npe (cov lej siv los cawm, thiab tseem siv sijhawm)

Ib feem kawg ntawm kev teeb tsa yog pib ua LCD, thiab dht sensor.

5. Loop ib feem yog qhov tseem ceeb ntawm txoj haujlwm. Ua haujlwm nrog lub sensor lub sijhawm no yooj yim heev vim nws siv tsuas yog ib txoj hauv kev uas tau nyeem cov txiaj ntsig uas lub sensor tau txais. Ib feem ntawm LCD kuj yooj yim heev. Tshooj tom ntej yog ib qho uas peb xav tau piav qhia ntawm no. Txoj haujlwm no ua qee yam txhua feeb. Ib feeb nws khaws cov ntaub ntawv rau datalog.txt. Cov ntaub ntawv no tuaj yeem nyeem los ntawm ib tus neeg uas tsis paub yuav ua li cas rau program arduinos. Lwm sab. Ib feeb nws txuag qhov kub ntawm datalogB.txt thiab ib feeb nws khaws cov av noo ntawm datalogC.txt. Peb xav tau datalogB.txt thiab dataLogC.txt yog li peb tuaj yeem nyeem los ntawm peb daim npav nco. Yog li yog peb tseem nyeem peb cov cai koj tuaj yeem pom tseem tias cov cai no nyeem nruab nrab qhov ntsuas kub thiab av noo thiab khaws lawv ua ib kab. Kuv xav ua cov cuab yeej uas siv tsuas yog kaum tus lej kawg ntawm cov ntawv. Yog li no txoj haujlwm no ib txwm dhau los ntawm qhov txiaj ntsig los ntawm daim npav, thiab khaws kaum qhov kawg. Uas tseem tau qhia ntawm peb lub LCD tom qab qee lub sijhawm

Kauj Ruam 4: Siv Arduino thiab SD Card Tom Qab

Siv Arduino thiab SD Card Tom Qab
Siv Arduino thiab SD Card Tom Qab
Siv Arduino thiab SD Card Tom Qab
Siv Arduino thiab SD Card Tom Qab
Siv Arduino thiab SD Card Tom Qab
Siv Arduino thiab SD Card Tom Qab
Siv Arduino thiab SD Card Tom Qab
Siv Arduino thiab SD Card Tom Qab

Ntawm no koj tuaj yeem pom dab tsi yog qhia ntawm LCD thiab txoj haujlwm ua haujlwm li cas. Tsis tas li kuv tso cov duab ntawm cov ntawv teev npe uas kuv tau khaws tseg no. Datalog.txt yog ib qho uas tuaj yeem siv los saib yuav ua li cas lub cuab yeej khaws txhua tus nqi. DatalogB thiab datalogC nyob ntawd koj tuaj yeem pom lawv zoo li cas. Lawv tau sau zoo li ntawd koj tuaj yeem siv txoj kev cais tawm thiab nyeem cov ntaub ntawv yam tsis muaj teeb meem.

Tag nrho cov ntsiab lus ntawm txoj haujlwm no yog kev tswj hwm cov ntaub ntawv uas nyob ntawm daim npav sd. Qee zaum peb xav tau cov cuab yeej uas tuaj yeem khaws nco thiab ntsuas kub kuj yog ib lub sijhawm zoo li ntawd. Qhov zoo yog qhov ntaub thaiv npog siv ntawm lub cuab yeej no tseem muaj RTC tus qauv, uas yog qhov zoo tshaj plaws rau lub sijhawm. Thaum peb tuaj yeem nyeem lub sijhawm tiag tiag, thiab khaws cov ntaub ntawv nrog peb lub cuab yeej, uas txhais tau tias nws tuaj yeem nqa tau.

Ua tsaug rau koj nyeem rau txoj haujlwm no. Kuv vam tias nws yuav pab koj tawm. Ua Tsaug.

Hais txog Sebastian

Pom zoo: