Cov txheej txheem:

Raspberry Pi Barometer Huab Cua Clock: 9 Kauj Ruam (nrog Duab)
Raspberry Pi Barometer Huab Cua Clock: 9 Kauj Ruam (nrog Duab)

Video: Raspberry Pi Barometer Huab Cua Clock: 9 Kauj Ruam (nrog Duab)

Video: Raspberry Pi Barometer Huab Cua Clock: 9 Kauj Ruam (nrog Duab)
Video: Raspberry Pi: Use a BMP180 Sensor to display Temp and Barometric Pressure 2024, Hlis ntuj nqeg
Anonim
Raspberry Pi Barometer Huab Cua Sijhawm
Raspberry Pi Barometer Huab Cua Sijhawm

Hauv cov lus qhia no kuv yuav qhia koj li cas tsim kom muaj Tus Qauv Ntsuas Kub / Barometer moos siv Raspberry Pi 2 nrog BMP180 I2C sensor tso saib ntawm Adafruit 4 tus lej 7 ntu I2C zaub. Tus Pi kuj tseem siv DS3231 lub sijhawm tiag tiag I2C moos qauv kom khaws sijhawm thaum Pi rov pib dua.

Lub moos loops hla 4 theem rau 5 vib nas this txhua. Ua ntej nws qhia qhov ntsuas kub hauv Celsius, tom qab ntawd hauv Fahrenheit ces qhov ntsuas siab hauv kPa *(nws taug tus lej no mus rau sab laug vim tias muaj tus lej tsawg) thiab thaum kawg nws qhia txog qhov hloov pauv ntawm qhov ntsuas barometric nruab nrab ntawm tam sim no thiab nruab nrab ntawm teev dhau los

Dab tsi ua rau lub moos no txawv rau feem ntau yog tias nws siv MySQL database ntawm Pi txhawm rau sau cov ntaub ntawv los ntawm BMP180 txhua feeb. Raws li qhov ntsuas qhov ntsuas tam sim no tsis muaj txiaj ntsig zoo li nws txav mus los lossis qis dua lub sijhawm muab sijhawm, nws siv cov ntaub ntawv no los xam qhov nruab nrab ib teev nyob nruab nrab ntawm 2 teev thiab 1 teev dhau los thiab sib piv qhov ntawd rau qhov siab tam sim no. Qhov tseem ceeb ntawm kev ntsuas barometric feem ntau qhia txog kev txhim kho huab cua thiab qhov poob loj tuaj yeem ceeb toom txog cua daj cua dub tuaj.

Lub moos tau nyob hauv tsev 3D luam tawm ABS lub tsev nrog BMP180 hauv lub hau ntswj nyob tom qab ntawm lub moos kom tiv thaiv cua sov tsim los ntawm Pi los ntawm kev cuam tshuam rau qhov ntsuas kub. Kuv yuav muab Autodesk 123D Design schematic yog tias koj xav luam koj tus kheej.

Lub moos tau siv nrog tus qauv USB phab ntsa wart thiab kos ib ncig 450 mA tag nrho.

Kuv yuav tsis nkag mus rau cov ntsiab lus ntau dhau ntawm kev teeb tsa yooj yim ntawm Pi thiab I2C raws li qhov no tau npog hauv ntau lwm cov lus qhia uas kuv yuav muab txuas.

Kauj ruam 1: Npaj Pi

Npaj Pi
Npaj Pi

Teeb koj li Raspberry Pi - Paub meej ntawm Raspberrypi.org

  1. Rub tawm thiab teeb tsa koj xaiv Linux Kev faib tawm ntawm daim npav SD - Kuv siv Raspbian
  2. Plug rau hauv pi thiab khau raj nws
  3. Kuv siv lub micro WiFi adapter txuas tus pi rau kuv lub router raws li lub moos nyob hauv tsev tsis pom qhov chaw nres nkoj Ethernet.
  4. Kuv siv lub taub hau hom uas koj txuas rau pi siv SSH yog li txhua yam koj xav tau ntsaws yog lub zog.
  5. Kho I2C ntawm Pi - Kuv ua raws cov lus qhia no ntawm Adafruit qhov chaw.

Kauj Ruam 2: Hlau Txhua Qhov

Hlau Nws Txhua Qhov
Hlau Nws Txhua Qhov

Txhua qhov qauv kuv siv hauv txoj haujlwm no yog 5V zam thiab siv I2C uas yog 2 txoj kab hlau txuas siv rau IC's txhawm rau sib txuas lus nrog lwm tus, yog li cov xov hlau yooj yim zoo nkauj. Txuas txhua VCC mus rau 5V, Txhua Pawg Ua Ke thiab txhua SCA thiab SCL kab ua ke raws li cov txheej txheem. Ua hauj lwm tiav.

Kauj Ruam 3: Ntsuam Xyuas Koj I2C

Ntsuam Xyuas Koj I2C
Ntsuam Xyuas Koj I2C

Ib feem ntawm kev teeb tsa I2C yog khiav i2cdetect uas yuav tsum zoo li cov duab txuas yog txhua yam txuas nrog kom raug.

Hauv qab no yog cov chaw nyob sib txuam

  1. 0x70 = 7 Segment Zaub
  2. 0x77 = BMP180 Tus pas ntsuas kub / ntsuas cua ntsuas
  3. 0x68 = DS3231 Sijhawm Sijhawm Sijhawm Sijhawm
  4. 0x57 = DS3231 ntawm board EEPROM rau khaws cov ntaub ntawv ceeb toom.

Kauj ruam 4: Nruab MySQL thiab PhpMyAdmin

Nruab MySQL thiab PhpMyAdmin
Nruab MySQL thiab PhpMyAdmin

Txhim kho mySQL yog ncaj ncaj rau pem hauv ntej yog tias koj ua raws cov lus qhia ntawm no

sudo apt-tau nruab mysql-server

Kuv kuj tau teeb tsa phpMyAdmin uas yog lub vev xaib uas khiav ntawm Apache uas koj tuaj yeem siv los tsim thiab tswj hwm mySQL databases. Tutorial ntawm no

sudo apt-tau nruab phpmyadmin

Thaum teeb tsa kuv teeb tsa cov ntaub ntawv hu ua BP180 siv phpMyAdmin nrog cov qauv raws li cov duab.

Kuv kuj tseem siv tus nab npawb nab npawb hu ua mysqlDB uas koj tuaj yeem teeb tsa siv

sudo apt-tau nruab python-mysqldb

Kauj ruam 5: Nruab Python Modules

Rub tawm thiab teeb tsa hauv qab no nab nab modules uas koj yuav siv los txuas rau lub ntsuas.

  1. Adafruit_BMP085 tus qauv
  2. SDL_DS3231 tus qauv
  3. Adafruit 7 Segment module

Kauj Ruam 6: Tus lej nkag mus rau Database

Cov kab ntawv hauv qab no tau siv los ntsuas qhov ntsuas kub thiab ntsuas siab thiab raug hu los ntawm tsab ntawv cron (Linux cov phiaj xwm teem tseg) uas ua haujlwm txhua 5 feeb. Txhawm rau kawm paub siv crond txheeb xyuas qhov kev qhia no.

NB! Tsis txhob thab trashing kuv cov txuj ci coding, Kuv tsis yog tus tsim khoom yog li muaj tej zaum yog ib lab zoo dua, nrawm dua, du dua, huv txoj hauv kev los ua qhov no

Koj yuav pom hauv txoj cai qhov ntsuas kub tau qis dua 7 degrees uas yog sib npaug rau cov cua sov uas tsim los ntawm Raspberry Pi txawm tias muaj BMP180 teeb tsa nyob sab nraud ntawm lub tsev. Thaum kuv xub xub muaj nws sab hauv lub tsev nws kub txog 15 degrees kub dua ib puag ncig. Nws zoo li yog kab zoo nkauj, tab sis kuv tsis tau muaj lub sijhawm los sim ib qho dhau los. Kev tawm tswv yim ntawm koj cov kev paub yuav zoo siab.

Kauj Ruam 7: Txoj Cai Los Zaub Temp

Code rau Zaub Temp
Code rau Zaub Temp
Code rau Zaub Temp
Code rau Zaub Temp
Code rau Zaub Temp
Code rau Zaub Temp
Code rau Zaub Temp
Code rau Zaub Temp

Txoj cai no raug hu los ua voj voog los ntawm cov zaub raws li qhov taw qhia.

Ib zaug ntxiv, Kuv tsis yog tus tsim khoom yog li cov cai yog ntxhib, tab sis nws ua haujlwm

Kauj Ruam 8: Cov Ntawv Luam 3D

3D Luam Ntawv Tshaj Tawm
3D Luam Ntawv Tshaj Tawm
3D Luam Ntawv Tshaj Tawm
3D Luam Ntawv Tshaj Tawm
3D Luam Ntawv Tshaj Tawm
3D Luam Ntawv Tshaj Tawm
3D Luam Ntawv Tshaj Tawm
3D Luam Ntawv Tshaj Tawm

Tom ntej no yog kev tsim ntawm lub thaiv. Qhov no yog qhov nyuaj heev vim tias cov duab zoo li yuav ua rau tawg vim tias qee qhov ntawm lub plhaub sab nraud tsuas yog 2 hli tuab. Kuv xub kos cov lus thuam ntawm Pi thiab txhua ntu thiab tom qab ntawd tsim lub thaiv ib puag ncig nws. Cov ntawv luam tawm nyob ib ncig 7 teev ntawm kuv RapMan 3.2 (uas yog lub tshuab luam ntawv qeeb qeeb) ntawm 0.25 txheej tob.

Cov txheej txheem txuas nrog tau ua tiav hauv Autodesk 123D Tsim uas kuv xav tias yog ib qho zoo heev ntawm cov software pub dawb.

Nco tseg qee qhov ntawm qhov zoo li qhov xav tau txhawm rau txhawm rau Pi tsis nyob hauv kev tsim vim nws zoo dua los laum cov no tom qab yog tias koj luam tawm warps me ntsis. Tuav tes ruaj khov 3 hli laum ntsis yog txhua yam koj xav tau. Kos qhov tob ntawm me ntsis nrog qee daim kab xev kom koj tsis txhob yuam kev ncaj qha los ntawm koj li 7 teev sau ib yam li kuv tau ua.

Kauj Ruam 9: Yam Ua

Yam Ua
Yam Ua
  1. Lub Sijhawm Tiag tiag yog qhov ntxiv tom qab lub thawv ntawv tau luam tawm rau lub sijhawm thib 5 yog li tam sim no nws tau kub kub rau ntawm ib sab ntawm lub thawv ntawv uas tsis zoo li yog li kuv xav rov tsim dua thiab ntxiv ib qho chaw rau nws.
  2. Qhov ci ntawm 7 ntu qhia tam sim no tau teeb rau nws yog qhov ci tshaj plaws uas tsis pom zoo rau lub teeb pom kev zoo. Kuv xav ntxiv daim duab tiv thaiv rau sab saum toj ntawm lub thawv ntawv thiab kho 7 ntu ci ci raws qhov xwm txheej teeb pom kev ib puag ncig.
  3. Muaj qee qhov teeb meem tsim me nrog lub hauv paus tawg uas tseem yuav raug kho.
  4. Cov tswv yim twg yog txais tos.

Kuv vam tias koj nyiam qhov kev qhia no thiab pom nws txhawb siab txaus kom coj koj mus. Lub tswv yim yog los muab lub platform uas koj tuaj yeem siv los ntxiv koj tus kheej lub tswv yim. Muaj kev lom zem!

Pom zoo: