Cov txheej txheem:

Ntsuas Av Huv Nrog Raspberry Pi 4: 4 Cov Kauj Ruam
Ntsuas Av Huv Nrog Raspberry Pi 4: 4 Cov Kauj Ruam

Video: Ntsuas Av Huv Nrog Raspberry Pi 4: 4 Cov Kauj Ruam

Video: Ntsuas Av Huv Nrog Raspberry Pi 4: 4 Cov Kauj Ruam
Video: Yasmi - Txiv Nraug Ntsuag ft. JN Vang (Music Video) 2024, Kaum ib hlis
Anonim
Ntsuas Av Huv Nrog Raspberry Pi 4
Ntsuas Av Huv Nrog Raspberry Pi 4

Koj puas paub ntau npaum li cas dej cov nroj tsuag? Los yog outpoured cov nroj tsuag thiab poob lawv. Txhawm rau daws qhov no kuv xav tias nws yuav muaj xwm txheej ntau dua yog tias peb tuaj yeem tau txais tus nqi ntawm cov dej hauv cov av txhawm rau txiav txim siab tso dej rau cov nroj tsuag kom tsim nyog. ntawm cov av thaum kawg tswj kev ntws siv Raspberry Pi.

Kho vajtse:

  1. Raspberry Pi 2/3/4
  2. Av noo noo sensor
  3. MCP 3008 IAB
  4. Cov neeg dhia

Kauj Ruam 1: Kev Sib Txuas Hauv Circuit

Kev Txuas Hluav Taws Xob
Kev Txuas Hluav Taws Xob
  • MCP3008 GND to TZS
  • MCP3008 CS to RPI 8
  • SoilMoisture GND rau GND
  • SoilMoisture VCC rau +3V
  • SoilMoisture A0 rau MCP3008 CH0
  • MCP3008 VCC rau +3V
  • MCP3008 VREF rau +3V
  • MCP3008 AGND rau GND
  • MCP3008 CLK rau RPI 11
  • MCP3008 DOUT rau RPI 9
  • MCP3008 DIN rau RPI 10

Ua txhua qhov kev sib txuas thiab txhawb nqa Raspberry Pi. Yog tias koj xav kawm paub teeb tsa Raspberry Pi xyuas seb yuav teeb tsa Raspberry Pi 4 li cas.

Kauj Ruam 2: Cov Pob Tseem Ceeb

Ua ntej koj siv txoj cai koj yuav tsum teeb tsa ob peb lub tsev qiv ntawv, yog tias koj twb muaj lub 'Adafruit_Python_MCP3008` teeb tsa ces txav mus rau kauj ruam tom ntej lossis ua raws cov lus hauv qab no txhawm rau txhim kho lawv.

pi@raspberrypi: sudo apt-tau hloov tshiab

pi@raspberrypi: sudo apt-tau nruab tsim-qhov tseem ceeb nab hab sej-dev nab nab-smbus git

pi@raspberrypi: cd ~

pi@raspberrypi: git clone

pi@raspberrypi: cd Adafruit_Python_MCP3008

pi@raspberrypi: sudo nab hab sej setup.py nruab

Yog tias koj muaj teeb meem cloning lub chaw cia khoom koj tuaj yeem rub tawm lub chaw cia khoom thiab txuas ntxiv cov kauj ruam tom qab. Yog tias koj pom qhov yuam kev rov qab thiab ua tib zoo tshawb xyuas txhua qhov lus txib yav dhau los thiab rov ua haujlwm dua.

Koj yuav tsum pom lub tsev qiv ntawv teeb tsa ua tiav thiab ua tiav nrog cov lus.

Yog tias koj xav txhim kho siv pip (Qhov no tsis xav tau yog tias koj tau ua raws cov theem saum toj no rau kev teeb tsa), qhib lub davhlau ya nyob twg ntawm Raspberry Pi thiab ua raws cov lus txib hauv qab no:

sudo apt-tau hloov tshiab

sudo apt-get install build-essential python-dev python-smbus sej-pipsudo pip install adafruit-mcp3008

Kauj Ruam 3: Txoj Cai

Txoj Cai
Txoj Cai
Txoj Cai
Txoj Cai

pi@raspberrypi: nano moist-soil.py

Thaum lub tsev qiv ntawv tau teeb tsa nws yog lub sijhawm los ua tus cai. Qhib davhlau ya nyob twg ua cov ntaub ntawv tshiab los ntawm kev ntaus "nano moist-soil.py" thiab sau cov cai hauv qab no.

ntshuam RPi. GPIO li GPIO los ntawm lub sijhawm ntshuam ntshuam ntshuam ntshuam Adafruit_MCP3008 am = Adafruit_MCP3008. MCP3008 (clk = 11, cs = 8, miso = 9, mosi = 10) av noo sensor per = moisture_value * 100 /1023 # Hloov pauv cov dej noo mus rau qhov feem pua luam tawm ("Cov ntaub ntawv sau cov dej noo yog % s feem pua" % ib) yog cov dej noo_value> = 930: luam tawm ("Tsis muaj dej, Koj puas tuaj yeem plaease dej rau kuv") elif moisture_value = 350: print ("Kuv txaus") elif moisture_value <350: print ("Tsis txhob poob dej kuv!") pw tsaug zog (1.5)

Nyem "ctrl+o" kom txuag cov ntawv thiab "ctrl+x" kom tawm.

pi@raspberrypi: nab nab moist-soil.py

Hais kom "nab hab sej moist-soil.py" khiav cov cai. Koj yuav tsum muaj peev xwm pom qhov muaj txiaj ntsig los ntawm cov av noo noo ntawm lub qhov rooj dav dav, tso cov av noo noo nyob hauv cov dej thiab hauv cov av qhuav kom nkag siab qhov sib txawv.

Kauj Ruam 4: Tutorial Video

Hurray! Circuit Court ua tiav. Yog tias koj muaj lus nug tsis txhob ua siab deb los tawm lus hauv qab no.

Zoo siab Circuiting!

Cov peev txheej:

  • GitHub chaw cia khoom.
  • Teeb Raspberry Pi 4 Los Ntawm Laptop/pc Siv Ethernet Cable (Tsis Saib Xyuas, Tsis Muaj Wi-nkaus)
  • Txhim kho MCP3008

Pom zoo: