Cov txheej txheem:

Tsim Homie Devices rau IoT lossis Tsev Automation: 7 Kauj Ruam (nrog Duab)
Tsim Homie Devices rau IoT lossis Tsev Automation: 7 Kauj Ruam (nrog Duab)

Video: Tsim Homie Devices rau IoT lossis Tsev Automation: 7 Kauj Ruam (nrog Duab)

Video: Tsim Homie Devices rau IoT lossis Tsev Automation: 7 Kauj Ruam (nrog Duab)
Video: Долгожданный финал очень интересной истории ► 9 Прохождение Dying Light 2: Stay Human 2024, Hlis ntuj nqeg
Anonim
Tsim Homie Devices rau IoT lossis Tsev Automation
Tsim Homie Devices rau IoT lossis Tsev Automation

Cov lus qhia no yog ib feem ntawm kuv DIY Tsev Automation series, txheeb xyuas cov ntsiab lus tseem ceeb "Kev Npaj Ua DIY Tsev Automation System". Yog tias koj tseem tsis tau paub tias Homie yog dab tsi, saib homie-esp8266 + homie los ntawm Marvin Roger.

Muaj ntau ntau cov sensors. Kuv tab tom npog qhov tseem ceeb tshaj plaws txhawm rau muab kev nyeem ntawv rau qhov yuav tsum tau pib tsim "yam". Qhov ntawd yuav tsis yog foob pob hluav taws kev tshawb fawb tab sis qhov ntawd yuav tsum ua haujlwm tiag tiag.

Yog tias koj tsis muaj cov khoom, ua tib zoo saib kuv cov lus qhia tom ntej "Sourcing Electronic Parts From Asia".

Cia kuv ntxiv ob peb lo lus buzz: IoT, ESP8266, Homie, DHT22, DS18B20, kev siv tshuab hauv tsev.

Cov ncauj lus yuav tsum zoo nkauj tam sim no:-)

Tsis tas li, cov lus qhia tam sim no tseem muaj los ntawm kuv tus kheej nplooj ntawv:

Kauj ruam 1: Pib

Pib Pib
Pib Pib
Pib Pib
Pib Pib

Cov rooj sib tham

Cov lus qhia no siv D1 Mini clones. Cov no yog WiFi tau qhib Arduino cov tswj tau siv ESP8266 nti. Lawv xa hauv daim ntawv me me (~ 34*25mm) thiab cov av pheej yig (~ 3-4 $ rau clones).

Kuv mam li piav qhia txhua qhov tsim siv D1 Mini, lub khob cij thiab qee qhov ntsuas (s). Kuv suav nrog Daim Ntawv Ntawm Cov Khoom Siv (BOM) rau txhua tus tab sis yuav hla qhov pom tseeb xws li jumper xov hlau thiab lub thawv ntawv (mini lossis tag nrho). Kuv yuav tsom mus rau "ntu ntu".

Rau cov xov hlau/kab hauv kab duab (Fritzing + AdaFruitFritzing lub tsev qiv ntawv), Kuv siv:

  • Liab/Txiv kab ntxwv rau lub zog, feem ntau 3.3V. Qee zaum nws yuav yog 5V, ceev faj.
  • Dub rau hauv av.
  • Daj rau cov cim qhia cov ntaub ntawv digital: Cov khoom tau mus ncig thiab tuaj yeem nyeem zoo li-yog los ntawm cov chips.
  • Xiav/Ntshav rau cov cim qhia cov ntaub ntawv sib piv: Tsis muaj cov khoom ntawm no, tsuas yog qhov voltage uas yuav tsum tau ntsuas thiab suav kom nkag siab tias muaj dab tsi tshwm sim.

Homie rau ESP8266 nkoj kaum tawm tus piv txwv, qhov ntawd yog qhov uas kuv tau pib tsim cov lus qhia no.

Cov qhob cij

D1 yog tus phooj ywg zoo heev tab sis yuav txuag tau ib kab ntawm tus pin thiab nce xwb. Qhov piv txwv yuav muaj D1 ntawm sab xis thiab cov khoom nyob rau sab laug. Cov fais fab qaum thiab qis yuav siv los nqa 3.3V lossis 5V.

Nco tseg

Homie piv txwv tau tsim ua ".ino" kos duab rau Arduino IDE. Txawm li cas los xij kuv tus kheej cov cai tau tsim ua ".ccp" rau PlatformIO.

Qhov no yuav ua rau muaj qhov sib txawv me me raws li daim duab qhia yooj yim txaus los theej/muab tshuaj txhuam yam twg los xij uas koj lub cuab yeej xaiv.

Kauj Ruam 2: Kub & Vaum: DHT22 / DHT11

Kub & Vaum: DHT22 / DHT11
Kub & Vaum: DHT22 / DHT11
Kub & Vaum: DHT22 / DHT11
Kub & Vaum: DHT22 / DHT11
Kub & Vaum: DHT22 / DHT11
Kub & Vaum: DHT22 / DHT11

Tsim lub cuab yeej

DHT22 siv:

  • Ib tus lej digital los sib tham nrog tus tswj hwm, txuas rau D3
  • Ob lub xov hlau rau lub zog (3.3V lossis 5V + GND)
  • Tus pin tus lej yuav tsum tau khaws cia siab (txuas nrog lub zog), rau qhov no peb siv tus tiv thaiv ntawm cov tsheb nqaj hlau thiab cov ntaub ntawv tus pin

Code

Txoj haujlwm PlatformIO tuaj yeem rub tawm los ntawm:

Thawj Homie piv txwv nyob ntawm no (tab sis tsis siv lub ntsuas):

Rau DHT22, siv DHT lub tsev qiv ntawv sensor (ID = 19)

BOM

  • Xws li: Wemos D1 Mini
  • Kev tiv thaiv: 10KΩ
  • Sensor: (ib qho ntawm cov no)

    • DHT22: Kuv tau siv 4 tus pin zoo uas xav tau kev tiv thaiv ntxiv. Muaj 3 tus pin tus qauv thauj khoom raws li SMD uas suav nrog tus tiv thaiv.
    • DHT11: Qhov no pheej yig dua tab sis tsis raug, txheeb xyuas koj cov cai

Kauj Ruam 3: Dej Kub: DS18B20

Dej tsis kub: DS18B20
Dej tsis kub: DS18B20
Dej tsis kub: DS18B20
Dej tsis kub: DS18B20
Dej tsis kub: DS18B20
Dej tsis kub: DS18B20

Tsim lub cuab yeej DS18B20 siv:

  • Ib tus lej digital los sib tham nrog tus tswj hwm, txuas rau D3
  • Ob lub xov hlau rau lub zog (3.3V lossis 5V + GND)
  • Tus pin tus lej yuav tsum tau khaws cia siab (txuas nrog lub zog), rau qhov no peb siv tus tiv thaiv ntawm cov tsheb nqaj hlau thiab cov ntaub ntawv tus pin

DS18B20 yog 1-xaim sensor. Nws siv tsheb npav thiab zoo li ntau lub ntsuas hluav taws xob tuaj yeem siv tus lej tus lej nkaus xwb.

Nws kuj tseem tuaj yeem TSIS siv 3.3V/5V txhawm rau ua kom lub zog ntsuas, qhov no hu ua hom kab mob cab. Saib daim ntawv qhia kom ntxaws.

Code

Txoj haujlwm PlatformIO tuaj yeem rub tawm los ntawm:

Zoo li rau DHT22, thawj Homie piv txwv nyob ntawm no (tab sis tsis siv lub ntsuas):

Rau 1-Hlau npav, siv pob OneWire (ID = 1)

Rau DS18B20, siv DallasTemperature (ID = 54)

BOM

  • Xws li: Wemos D1 Mini
  • Kev tiv thaiv: 4.7KΩ
  • Sensor: DS18B20, daim duab yog ib qho tsis muaj dej
  • 3 pins ntsia hlau dav hlau kom yooj yim txuas ntawm cable mus rau lub khob cij

Kauj Ruam 4: Teeb: Photoresistor / Photocell (digital: On / off)

Lub teeb: Photoresistor / Photocell (digital: On / off)
Lub teeb: Photoresistor / Photocell (digital: On / off)
Lub teeb: Photoresistor / Photocell (digital: On / off)
Lub teeb: Photoresistor / Photocell (digital: On / off)
Lub teeb: Photoresistor / Photocell (digital: On / off)
Lub teeb: Photoresistor / Photocell (digital: On / off)

Tsim lub cuab yeej

(Thov txim, tsis muaj Fritzing tivthaiv rau cov photocell digital)

Lub photocell digital module siv:

  • Ib tus lej digital los sib tham nrog tus tswj hwm, txuas rau D3
  • Ob lub xov hlau rau lub zog (3.3V + GND)

Nws muaj peev xwm siv cov duab sib piv tab sis qhov no tsis tau teev tseg ntawm no, saib Adafruit tsab xov xwm zoo "Siv Lub Tshuab Luam Ntawv".

Nco tseg: Hauv qhov ua piv txwv no muaj lub zog ntsuas ntawm lub sensor board. Nws tau siv los teeb tsa qhov txwv ntawm "lub teeb" thiab "tsaus" qhov pom kev ib puag ncig. Thaum nyeem 1 lub teeb raug kaw, yog li nyeem 0 txhais tau tias yog lub teeb yog nyob.

Code

Txoj haujlwm PlatformIO tuaj yeem rub tawm los ntawm:

BOM

Xws li: Wemos D1 Mini

Sensor: Cov Duab Pom Zoo / Teeb Pom Kev Pom

Kauj Ruam 5: Teeb: Photoresistor / Photocell (analog)

Lub teeb: Photoresistor / Photocell (analog)
Lub teeb: Photoresistor / Photocell (analog)
Lub teeb: Photoresistor / Photocell (analog)
Lub teeb: Photoresistor / Photocell (analog)
Lub teeb: Photoresistor / Photocell (analog)
Lub teeb: Photoresistor / Photocell (analog)

Tsim lub cuab yeej

Lub photocell analog sensor ua haujlwm ua tus tiv thaiv. Nws yuav txuas ntawm cov tswv yim analog thiab 3.3V.

Ib tus tiv thaiv tau muab nruab nrab ntawm GND thiab cov ntaub ntawv tus pin los tsim qhov faib hluav taws xob. Lub hom phiaj yog los tsim kom paub ntau yam txiaj ntsig:

  • Yog tias tsis muaj lub teeb pom kev, photocell yuav thaiv VCC, yog li txuas GND rau koj cov ntaub ntawv tus lej: Tus lej yuav nyeem ze li 0.
  • Nws muaj ntau lub teeb ci ci, photocell yuav cia VCC ntws mus rau cov ntaub ntawv tus lej: Tus lej yuav nyeem yuav luag tag nrho qhov hluav taws xob thiab zoo li ze rau qhov siab tshaj (1023).

Nco tseg: Analog pins qhov tseem ceeb tau nyeem hauv 0-1023 ntau yam siv analogRead. Qhov no tsis muaj txiaj ntsig los daws nrog 1 byte qhov tseem ceeb, rau qhov Arduino daim ntawv qhia kev ua haujlwm yuav pab txo los ntawm 0-1023 mus rau (piv txwv) 0-255.

Rau kev ntsuas ntsuas ntawm min/max qhov tseem ceeb rau koj lub ntsuas, siv daim duab zoo li qhov no los ntawm Arduino.

Code

Txoj haujlwm PlatformIO tuaj yeem rub tawm los ntawm:

BOM

  • Xws li: Wemos D1 Mini
  • Sensor: Lub teeb Ntsuas Tus Kheej (LDR) / Photoresistor
  • Resistor: 1K lossis 10K, yuav tsum ntsuas raws li koj lub xov tooj

Cov neeg ua tim khawv

  • PiDome server server qhov chaws rau teeb pom kev zoo ntawm qhov chaw
  • Adafruit's "Siv Lub Photocell"
  • "Photoresistors" ntawm no ntawm cov lus qhia
  • Qee qhov vwm vwm "Cov ntawv qhia me me" yog tias koj xav tau qee qhov lej thiab kab ntawv

Kauj Ruam 6: Ntes Ntes: QRD1114

Tsim lub cuab yeej

Code

BOM

Cov neeg ua tim khawv

  • Kev Txheeb Xyuas Lub Cev: QRD1114 suav nrog cov qauv coj mus nyeem lub ntsuas thiab siv cuam tshuam rau kev nkag teb chaws teb + tsim PCB meej
  • QRD1114 Qhov Taw Qhia Ntes Hookup Qhia ntawm Sparkfun

Kauj Ruam 7: Cov Lus Kawg

Lo Lus Kawg
Lo Lus Kawg

Cov lus qhia no yog luv luv los piav qhia kev saib xyuas yooj yim.

Txhawm rau mus ntxiv peb yuav xav tau txuas txuas, IR emitter… Qhov no vam tias yuav raug them tom qab raws li lub sijhawm pub dawb tso cai rau kuv. Qhov sib txawv loj yog tias peb yuav tsis tsuas yog "nyeem" (puas muaj teeb?) Tab sis kuj "sau" (qhib lub teeb!).

Pom zoo: