Cov txheej txheem:

Yuav Ua Li Cas Nyeem DHT Cov Ntaub Ntawv ntawm LCD Siv Raspberry Pi: 6 Cov Kauj Ruam
Yuav Ua Li Cas Nyeem DHT Cov Ntaub Ntawv ntawm LCD Siv Raspberry Pi: 6 Cov Kauj Ruam
Anonim
Yuav Ua Li Cas Nyeem DHT Cov Ntaub Ntawv ntawm LCD Siv Raspberry Pi
Yuav Ua Li Cas Nyeem DHT Cov Ntaub Ntawv ntawm LCD Siv Raspberry Pi

Qhov kub thiab qhov txheeb ze cov av noo yog qhov tseem ceeb

cov ntaub ntawv huab cua hauv ib puag ncig. Ob qho tuaj yeem yog cov ntaub ntawv chaw nres tsheb huab cua mini xa tawm. Nyeem koj qhov ntsuas kub thiab txheeb ze cov av nrog Raspberry Pi tuaj yeem ua tiav siv ntau yam sib txawv ntawm cov qauv thiab ntxiv-ons. Hauv qhov kev qhia no, peb yuav siv qhov sib xws Sensor DHT11 los nyeem qhov kub thiab yuav nthuav tawm cov ntaub ntawv ntawm 16-ntsis LCD zaub.

Kauj ruam 1: DHT Sensor

DHT Sensor
DHT Sensor

DHT11 lub ntsuas tuaj yeem ntsuas cov txheeb ze thiab qhov kub nrog qhov tshwj xeeb hauv qab no

Kub Ntau Yam: 0-50 ° C

Qhov Kub Kub: ± 2 ° C.

Vaum Ntau Yam: 20-90% RH

Cov av noo raug: ± 5 %

Kauj Ruam 2: Txhim Kho Adafruit LCD Library ntawm Raspberry Pi:

Txhim Kho Adafruit LCD Library ntawm Raspberry Pi
Txhim Kho Adafruit LCD Library ntawm Raspberry Pi

Nrog lub plhaub ntawm koj lub raspberry pi qhib, ua raws cov lus qhia hauv qab no txhawm rau teeb tsa Adafruit LCD zaub lub tsev qiv ntawv hauv raspberry pi. Tus nqi ntawm qhov kub thiab txias yuav muab tso rau ntawm lub vijtsam LCD

Kauj Ruam 1: Nruab git ntawm koj li Raspberry Pi los ntawm kev siv kab hauv qab no. Git tso cai rau koj los clone ib qhov project cov ntaub ntawv ntawm Github thiab siv nws ntawm koj li Raspberry pi. Peb lub tsev qiv ntawv nyob ntawm Github yog li peb yuav tsum teeb tsa git txhawm rau rub lub tsev qiv ntawv ntawd rau hauv pi.

apt-tau nruab git

Kauj Ruam 2: Cov kab hauv qab no txuas rau GitHub nplooj ntawv uas lub tsev qiv ntawv tam sim no tsuas yog ua kab rau clone cov phiaj xwm phiaj xwm ntawm Pi home directory

git clone git: //github.com/adafruit/Adafruit_Python_CharLCD

Kauj Ruam 3: Siv cov lus txib hauv qab no los hloov kab npe, kom nkag mus rau hauv cov phiaj xwm ntawv uas peb nyuam qhuav rub tawm. Cov kab hais kom ua yog muab hauv qab no

cd Adafruit_Python_CharLCD

Kauj Ruam 4: Sab hauv cov npe yuav muaj cov ntaub ntawv hu ua setup.py, peb yuav tsum nruab nws, txhawm rau nruab lub tsev qiv ntawv. Siv cov cai hauv qab no los teeb tsa lub tsev qiv ntawv

sudo python setup.py nruab

Kauj Ruam 3: Txhim Kho Adafruit DHT11 Library ntawm Raspberry Pi:

Lub tsev qiv ntawv DHT11 muab los ntawm Adafruit tuaj yeem siv rau DHT11, DHT22 thiab lwm yam ib lub xov tooj ntsuas kub ib yam nkaus. Cov txheej txheem txhawm rau txhim kho DHT11 lub tsev qiv ntawv kuj zoo ib yam ua raws li kev teeb tsa lub tsev qiv ntawv LCD. Tsuas yog kab uas yuav hloov pauv yog qhov txuas ntawm GitHub nplooj ntawv uas DHT lub tsev qiv ntawv tau txais kev cawmdim.

Nkag mus rau plaub kab lus kab ib los ntawm ib qho ntawm lub davhlau ya nyob twg los nruab DHT lub tsev qiv ntawv

git clone

cd Adafruit_Python_DHT

sudo apt-tau nruab tsim-qhov tseem ceeb nab hab sej-dev

sudo python setup.py nruab

Kauj Ruam 4: Daim duab Circuit Court

Daim duab Circuit Court
Daim duab Circuit Court
Daim duab Circuit Court
Daim duab Circuit Court

DHT11 Module los hauv 3 tus pin, Txuas Vcc rau 5V ntawm tus pi, txuas tus pin hauv av rau txhua tus pin hauv av ntawm tus pi thiab txuas cov ntaub ntawv tus pin rau koj xaiv GPIO tus pin ntawm tus pi, hauv qhov kev qhia no peb siv GPIO 17 uas yog tus lej tus lej 11 ntawm tus pi.

NCO TSEG: DHT11 los hauv Module lossis hom sensor, ib qho uas qhia hauv cov duab hauv qab no yog hom ntsuas uas muaj 4 tus pin, tus tiv thaiv tau txuas nrog ntawm cov ntaub ntawv tus pin thiab Vcc, yog tias koj siv hom qauv nrog tsuas yog 3 pins, tsis tas yuav muaj tus tiv thaiv.

Siv daim duab hauv qab no rau pinout ntawm raspberry pi pins.

Kauj ruam 5:

Duab
Duab
Duab
Duab

Hauv qab no yog tag nrho cov schematic rau kev txuas. Txij li lub LCD yuav siv ob lub 5V muaj nyob ntawm tus pi, peb tuaj yeem siv daim ntawv qhia zaub mov sib faib 5V ntawm LCD thiab DHT11 Module. Cov pins LCD yuav txuas nrog pi hauv qhov kev txiav txim hauv qab no. Nco ntsoov tias tus pin 7, 8, 9 thiab 10 ntawm LCD yuav tsis siv

Kauj Ruam 6:

Cov lej tag nrho rau kev nyeem Cov Ntaub Ntawv thiab tso tawm ntawm lub LCD tau qhia hauv qab no

los ntawm lub sijhawm ntshuam pw ntshuam ntshuam Adafruit_DHT los ntawm Adafruit_CharLCD ntshuam Adafruit_CharLCD sensor = Adafruit_DHT. DHT11 tus pin = 17 av noo, kub = Adafruit_DHT.read_retry (sensor, tus pin) lcd = Adafruit_CharLCD (rs = 26, en = 19, d4 = 13, d5 = 6, d6 = 5, d7 = 11, cols = 16, kab = 2) #DISPLAY A STATIC TEXT lcd.clear () yog cov av noo tsis muaj thiab qhov kub tsis yog Tsis muaj: luam tawm ('Temp = {0: 0.1f}*C Vaum = {1: 0.1f}%'. Format (kub, av noo)) lcd.message (' Temp = {0: 0.1f}*C / nHumidity = {1: 0.1f}%'. Format (kub, av noo))) lwm qhov: luam tawm ('Ua tsis tau tejyam nyeem. Sim dua!') lcd.message ('Ua tsis tau ntawv nyeem. Sim dua!')

Pom zoo: