Cov txheej txheem:

ESP32 Huab Cua Chaw Nres Tsheb Solar Powered: 9 Kauj Ruam
ESP32 Huab Cua Chaw Nres Tsheb Solar Powered: 9 Kauj Ruam

Video: ESP32 Huab Cua Chaw Nres Tsheb Solar Powered: 9 Kauj Ruam

Video: ESP32 Huab Cua Chaw Nres Tsheb Solar Powered: 9 Kauj Ruam
Video: IOTA + TRUSTPAD CRYPTO EVENT AIRDROP 2022 | CLAIM IOTA 500$ COIN! 2024, Kaum ib hlis
Anonim
Image
Image
ESP32 Huab Cua Chaw Nres Tsheb Hnub Ci Tsim
ESP32 Huab Cua Chaw Nres Tsheb Hnub Ci Tsim
ESP32 Huab Cua Chaw Nres Tsheb Hnub Ci Tsim
ESP32 Huab Cua Chaw Nres Tsheb Hnub Ci Tsim

Hauv qhov kev qhia no peb tab tom tsim kom muaj WiFi qhib qhov chaw nres tsheb huab cua.

Lub hom phiaj yog tsim chaw nres tsheb Huab cua nrog yuav luag txhua qhov ua tau zoo:

  • Qhia cov xwm txheej tam sim no, sijhawm, kub, av noo, siab
  • Qhia kev kwv yees rau hnub tom ntej
  • Hloov tshiab ntawm huab cua
  • Ua hauv lub vev xaib rau kev teeb tsa thiab rov ua cov ntaub ntawv
  • Xa cov ntaub ntawv mus rau huab rau keeb kwm txheeb cais
  • Kev koom ua ke nrog Aple Home Kit lossis MQTT
  • Indepeded Accu powered nrog them rov qab lossis txuas rau lub hnub ci vaj huam sib luag

Kuv tsis tuaj yeem ntxiv ntxiv thiab tsis xav ntau ntxiv dab tsi ntxiv yuav tsum tau lossis tuaj yeem yog

Kauj Ruam 1: Yam Uas Yuav Tsum Muaj

Yam Uas Yuav Tsum Tau
Yam Uas Yuav Tsum Tau
Yam Uas Yuav Tsum Muaj
Yam Uas Yuav Tsum Muaj
Yam Uas Yuav Tsum Tau
Yam Uas Yuav Tsum Tau
  • ESP32 (Kuv tau siv dev module)
  • 2.8 "240x320 TFT LCD SPI ILI9341
  • Cov ntaub ntawv yas
  • 3x18650 ua
  • Huab cua ntsuas BME280 los ntsuas Kub, Vaum thiab Siab
  • USB lithium charger module
  • DC-DC kauj ruam UP18650
  • roj teeb tuav (3pc)
  • HC-SR505 Tsab ntawv tsa suab suab
  • 220 Om resistor
  • 2x 10 kOm resistors
  • TIP120 NPN transistor (Darlington) tuaj yeem siv lwm qhov sib xws
  • ButtonWires, hloov, laug cam …

Kauj Ruam 2: Txuas thiab teeb tsa

Kev teeb tsa thiab teeb tsa
Kev teeb tsa thiab teeb tsa
Kev teeb tsa thiab teeb tsa
Kev teeb tsa thiab teeb tsa
Kev teeb tsa thiab teeb tsa
Kev teeb tsa thiab teeb tsa
Kev teeb tsa thiab teeb tsa
Kev teeb tsa thiab teeb tsa

Thawj kauj ruam yog teeb tsa lub zog chaw nres tsheb.

Kuv tau faib cov ntaub ntawv yas ntawm ob pawg, ib qho ntawm lawv siv rau roj teeb, hloov, USB them nyiaj, thiab DC-DC tawm mus rau hauv ntu no kuv tso lub roj teeb thiab ua lub qhov rais rau qhov hloov thiab USB them nyiaj. Yuav tsum paub usb charger module heev heting yog li kuv tau siv txhuas phaj thiab tso USB them nyiaj rau qhov no siv Star 922 kua nplaum.

Cov kauj ruam thib ob yog teeb tsa cov tswj hwm ib feem.

Saib daim kab xev daim duab nws yuav tsum txuas nrog li cas

Kuv tau siv Bread board rau lub hom phiaj no nrog cov hauv qab no

  • Solder ESP32 dev board
  • Cov ntaub thaiv npog kom khaws TFT zaub
  • Solder lwm yam khoom siv hluav taws xob: BME280, tiv thaiv, khawm
  • Cov kab hluav taws xob sib txuas ntawm cov khoom siv raws li daim duab

Cov kauj ruam thib peb yog npaj txhim kho cov mov ci rau ntu thib ob ntawm cov ntaub yas. Kuv tau luam tawm ntawm kuv lub tshuab luam ntawv 3d ob kab, teeb tsa lawv rau bredboard los ntawm cov ntsia hlau thiab txiav plaub fab rau lub vijtsam zaub.

Kuv glued yas tuav txhawb rau lub cev ntawm cov ntaub ntawv yas. Tam sim no thaum cov kua nplaum qhuav, lub khob cij board tau tshem tawm los ntawm cov ntsia hlau.

Cov kauj ruam tom ntej yog:

  • Cov kab hluav taws xob txuas rau Lub Hwj Chim
  • Cov hlua txuas rau lub roj teeb qhov xwm txheej
  • Solder thiab mount motion detector

Kauj ruam kawg:

  • teeb DC-DC hloov pauv los ntawm tunning tso zis hluav taws xob 5v
  • txuas ob ntu ntawm cov chaw tswj chaw nres tsheb rau lub zog: cov xov hluav taws xob thiab kev nyeem qhov hluav taws xob

Txog qhov ntsuas lub suab thiab khawm kuv tau ua qhov ntxiv ntawm lub ntsej muag.

Kauj Ruam 3: Tshaj Tawm Firmware rau ESP32

Txog qhov haujlwm no kuv tau siv software thoob ntiaj teb, tsim los ntawm kuv tus kheej

Thov saib ib nplooj ntawv github ESPHomeController. Qhov no muaj tag nrho cov lus qhia yuav ua li cas sau thiab teeb tsa.

! Yog tias koj tsis paub nrog muab tso ua ke thiab Arduino tau saib cov kauj ruam Uploading npaj txhij firmware

Sai li koj upload firmware thawj zaug ESP32 yuav pib rau hauv kev teeb tsa hom (Hom Nkag Nkag Hom)

Koj yuav tsum teeb tsa lawv. Rau lub hom phiaj no qhib hauv ib qho cuab yeej npe ntawm muaj WiFi. Nrhiav HomeController thiab txuas rau nws. Qhov chaw raug ntes yuav tsum pib txiav. Yog tias tsis nkag rau hauv koj tus browser url: 192.168.4.1 thiab koj yuav pom lub vijtsam teeb tsa

Ua raws li kev qhia thiab teeb tsa WiFi daim ntawv pov thawj rau koj li WiFi network.

ESP yuav rov pib dua tom qab uas yog tus siv WiFi thiab yuav txuas rau koj li Wifi.

Raws li sson firt kev sib txuas tshwm sim nws yuav cia li nce Spiffs file system thiab rub tawm cov ntaub ntawv xav tau rau lub vev xaib:

  • index.html
  • filebrowse.html
  • js/bundle.min.js.gz

Rub tawm tshwm sim los ntawm https://github.com/Yurik72/ESPHomeController/tree/… nplaub tshev

Tam sim no koj tuaj yeem pom cov ntsiab lus ntawm cov vev xaib browser. rau qhov no koj yuav tsum tam sim no tus IP chaw nyob ntawm koj ESP32

Koj tuaj yeem pom nws los ntawm ib txoj hauv kev hauv qab no:

  • Siv cov chaw nres nkoj saib xyuas kom pom ESP32 cov cav
  • Siv ib qho tcp scanner los luam theej duab koj li network
  • Nias lub pob ntawm lub chaw nres tsheb huab cua thiab koj yuav pom cov ntaub ntawv xov xwm

Muab tso rau hauv xauj https://192.168.0. XX/browse thiab koj yuav pom daim ntawv teev npe ntawm koj li ESP

(192.168.0. XX yog IP chaw nyob ntawm koj lub cuab yeej

Rau qhov kho qhov kawg koj yuav tsum npaj cov ntaub ntawv teeb tsa.

Kauj ruam 4: Uploading Ready Firmware

Uploading Npaj Firmware
Uploading Npaj Firmware

Nqe lus no tshwj xeeb rau kev hnov lus uas tsis mus tsim cov khoom lag luam los ntawm koj tus kheej. Koj tsuas yog yuav tsum rub tawm "npaj" firmware

1. Donwload flash upload cov cuab yeej los ntawm nplooj ntawv no

2. Rub tawm txuas (rho tawm los ntawm cov ntawv khaws tseg) cov ntaub ntawv HomeController.bin thiab bootloader_qio_80m.bin rau koj lub hard drive

3. Start ESP32 rub tawm cov cuab yeej thiab nkag mus rau qhov muaj txiaj ntsig raws li screenshot

4. Nias pib

Kauj ruam 5: Kev teeb tsa

Ua ntej pib npaj kev teeb tsa koj xav tau:

  1. Tsim koj cov channel ntawm yam khoom thiab tseem ceeb rau koj channel. Npaj 4 daim teb thiab ua kom raug lawv npe Kub, Vaum, Siab, Siab
  2. Sau npe rau ntawm Weather.com kom tau txais koj tus lej api

Thingspeak xav tau txhawm rau upload koj cov ntaub ntawv thiab saib xyuas cov qauv thiab qhov muaj txiaj ntsig

Huab cua yog qhov tseem ceeb kom tau txais cov ntaub ntawv kwv yees.

Ok, thaum kawg koj xav tsim cov ntawv services.json nrog cov ntsiab lus hauv qab no

[{"service": "TimeController", "name": "Time", "enabled": true, "interval": 1000, "timeoffs": 7200, "dayloffs": 3600, "server": "pool.ntp.org "," ua kom pw tsaug zog ": muaj tseeb," pw tsis tsaug zog ": 1," tsaug zog lub sijhawm ": 900000," rov pib dua lub sijhawm ": 18000000}, {" pabcuam ":" BME280Controller "," name ":" BME "," enabled ": tseeb, "ncua": 900000, "i2caddr": 118, "uselegacy": muaj tseeb, "temp_corr":-3.0, "hum_corr": 10.0}, {"service": "WeatherClientController", "name": "WeatherForecast", "enabled": tseeb, "ncua": 500000, "uri": "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=50.30, 30.70 & format = json & units = m & language = en -US & apiKey = weatherapi "}, {" service ":" WeatherDisplayController "," name ":" WeatherDisplay "," enabled ": true," interval ": 500}, {" enabled ":" true "," interval ": 600000, "pin": 36, "service": "LDRController", "name": "LDR", "cvalmin": 0.0, "cvalmax": 7.2, "cfmt": "%. 2f V", "acctype": 10}, {"service": "ThingSpeakController", "name": "ThingSpeak", "enabled": tseeb, "interval": 1200000, "value": [1, 1, 1, 1, 0, 0, 0, 0], "apiKey": "yam khoom kapi "}, {" enabled ": true," interval ": 1," pin ":" "," service ":" ButtonController "," name ":" Button "," pins ": [27]}]

! Thov hloov

  • thingspeakapi nrog koj yam khoom siv api qhov tseem ceeb
  • weatherapi nrog koj tus lej huab cua api
  • geocode nrog koj qhov chaw nyob uas koj xav tau txais kev kwv yees

Tshaj li npaj cov ntaub ntawv thib ob triggers.json

[{"type": "BMEToWeatherDisplay", "source": "BME", "destination": "WeatherDisplay"}, {"type": "TimeToWeatherDisplay", "source": "Time", "destination": "WeatherDisplay "}, {" type ":" WeatherForecastToWeatherDisplay "," source ":" WeatherForecast "," destination ":" WeatherDisplay "}, {" type ":" BMEToThingSpeak "," source ":" BME "," destination ": "ThingSpeak", "t_ch": 1, "h_ch": 2, "p_ch": 3}, {"type": "ButtonToWeatherDisplay", "source": "Button", "destination": "WeatherDisplay"}, { "type": "LDRToThingSpeak", "source": "LDR", "destination": "ThingSpeak", "ch": 4}]

Ob daim ntawv yuav tsum tau hloov pauv mus rau lub hauv paus ntawm esp.

Koj tuaj yeem ua qhov no ntawm browser https://192.168.0. XX/browse, qhov twg https://192.168.0. XX yog IP chaw nyob ntawm koj lub cuab yeej

Tom qab rub tawm ESP yuav tsum rov pib dua thiab txhua yam tau ua tiav. Esp yuav qhia qhov screen kom raug raws li ntawm daim duab thiab yees duab saum toj no

Kauj Ruam 6: Hloov thiab Siv Lub Hwj Chim

Tunning thiab Kev Siv Hluav Taws Xob
Tunning thiab Kev Siv Hluav Taws Xob

Kuv tab tom siv kuv lub cuab yeej nrog kev txuas mus rau Solar Panel thiab kom ntseeg tau tias nws tuaj yeem ua haujlwm "tsis kawg"

kev siv hluav taws xob yog qhov tseem ceeb thiab tom qab ntau qhov kev sim kuv tau siv ob qhov kev dag loj

Txo kev noj ntawm bacground LED ntawm TFT screen

Raws li ntsuas nws noj 15-20 mA (ntau heev) yog li kuv tau siv cov tswv yim nrog Motion detector. Nws ua haujlwm zoo tshaj Motion detectors tuaj yeem lees paub txhua qhov kev tshawb nrhiav txog 8-10 meters thiab nce qhov hluav taws xob ntawm lub teeb liab. Qhov no yog qhib lub transistor thiab backround Led tau txais lub zog. Feem ntau lub ntsuas ntsuas khaws lub xeev no txog 10 vib nas this uas ntau dua li txaus los saib xyuas, tab sis yog tias koj txuas ntxiv txav lub teeb liab tseem siab thiab LED yog teeb pom kev zoo.

Txoj hauv kev zoo li no ua rau kuv muaj kev lag luam loj, tsis muaj kev cuam tshuam ntxiv, Kuv tsis ntsib nrog txhua qhov teeb meem kom pom kuv lub vijtsam thaum kuv xav tau

2. Txo kev siv hluav taws xob los ntawm ESP32

Thaum ESP txuas nrog WiFi, nws tas li noj hauv mg 7-10 mA, Kuv tab tom tham txog lub sijhawm tas li, tsis yog pib thiab thawj txuas. Qhov no tuaj yeem siv tau yog tias koj ib txwm pom hnub thiab sijhawm tiag tiag, nkag mus rau koj li kab ke los ntawm Apple cov khoom siv hauv tsev

Rau kuv lub hnub ci zog nyob rau lub caij ntuj no thiab nws tau sib phim ua haujlwm yam tsis muaj lub zog txuas ntxiv, Yog li kuv tau txiav txim siab ncua ESP32 ntawm hom pw tsaug zog (noj tsawg dua 1 mA). Qhov no yog Ok rau kuv, piv txwv li ESP tau pw 20 feeb, dua li sawv los, rov ua dua tshiab lub vijtsam (cov ntaub ntawv tseeb thiab kwv yees) xa cov ntaub ntawv mus rau yam khoom hais lus thiab rov qab mus pw dua.

Minuses yog:

  • Lub vijtsam huab cua qhia pom lub sijhawm qub dhau los
  • Chaw nres tsheb tsis tuaj yeem siv tau los ntawm qhov browser thiab Apple Home Kit thaum lub sijhawm pw

Nws nyob ntawm koj los txiav txim siab dab tsi yog qhov tseem ceeb dua, koj tuaj yeem yooj yim rov tsim dua qhov ntawd.

Thov saib cov ntawv services.json thiab kab

[{"service": "TimeController", "name": "Time", "enabled": true, "interval": 1000, "timeoffs": 7200, "dayloffs": 3600, "server": "pool.ntp.org "," ua kom tsaug zog ": muaj tseeb," pw tsaug zog ": 1," pw tsaug zog ": 900000," rov pib dua lub sijhawm ": 18000000}

"ua kom tsaug zog": muaj tseeb ua rau pw tsaug zog tag nrho, yog tias tso qhov tsis raug lossis tshem tawm qhov ntsuas (tsis raug yog lub neej ntawd) ESP yuav tsis tsaug zog

"sleepinterval": 900000 qhov no yog millis, lossis 15 min, txhais tau tias txhua 15 feeb ESP yuav sawv thiab ua cov neeg ua haujlwm tsis tseem ceeb

Yog li, tam sim no txhua tus tuaj yeem ua si yooj yim raws qhov xav tau

Kauj Ruam 7: Kho qhov muag

Txhawm rau txo qis kev cuam tshuam ntawm cua sov sab hauv rau BME280 ntsuas kub

Firts Kuv tau ua qee lub raj nyob ib ncig ntawm lub sensor thiab qhov. Hovewer hauv kuv hom thaum LED ib txwm raug tua thiab ESP tsaug zog tsis zoo li. Hauv lwm qhov xwm txheej BME280 lub ntsuas yuav tsum txav mus rau lwm qhov kom tsis txhob cuam tshuam nrog cua sov sab hauv. Ib qho me me cuam tshuam li cas kuv pom yog li ntawd muaj ob qhov ntsuas los them nyiaj

temp_corr :-3.0

"hum_corr": 10.0

uas yog txhais tau tias cov txiaj ntsig yuav raug ntxiv tom qab ntsuas

Qhov thib ob yog ntsuas cov roj teeb ntsuas hluav taws xob, {"enabled": "true", "interval": 600000, "pin": 36, "service": "LDRController", "name": "LDR", "cvalmin": 0.0, "cvalmax": 7.2, " cfmt ":"%. 2f V "," acctype ": 10}, "cov": 0.0

"cvalmax": 7.2

yog rau lub hom phiaj no, vim qhov ntsuas hluav taws xob tau ntsuas tom qab cov sib faib sib cais thiab sib piv nrog 3.3 V, ua si nrog cvalmax tus nqi koj tuaj yeem mus txog qhov ntsuas qhov ntsuas qhov tseeb nrog koj tus lej multimetr

Kauj Ruam 8: Ntxiv Device rau Apple Home Kit

Ntxiv Device rau Apple Home Kit
Ntxiv Device rau Apple Home Kit

Thaum kawg thaum koj lub cuab yeej ua haujlwm tau zoo nws tuaj yeem ntxiv rau Apple Home Kit thiab koj yuav pom

sensors qhov tseem ceeb ntawm Apple lub tsev tshuaj ntsuam.

Ua ntej koj xav tau lub cuab yeej rov pib dua, raws li ssoon raws li lub cuab yeej pib nws yuav tsis mus pw 20 feeb yog ntau dua li txaus

Tshaj li qhib Cov Khoom Siv Hauv Tsev ntawm koj lub cuab yeej iOS, thiab xaiv lossis tsim Tsev Tshiab1. Nias Ntxiv (+)

2. Xaiv Ntxiv cov khoom siv ntxiv.

3. Nias kuv tsis muaj Txoj Cai lossis Tsis tuaj yeem luam theej duab (ntxiv rau ntawm kev txheeb xyuas yuav raug ntxiv)

4. yog tias txhua yam ua tau zoo koj yuav tsum pom koj lub cuab yeej esp tshiab hauv cov npe (saib daim duab)

5. Xaiv cov cuab yeej thiab lees paub ntxiv yam tsis muaj daim ntawv pov thawj raug cai

6. Ntaus tus password 11111111

7. Txhua Yam! Koj yuav tsum pom cov cuab yeej ua khub ua tiav, txwv tsis pub pib ua cov txheej txheem dua.

Raws li thid teeb tsa koj yuav pom ob lub cuab yeej ntawm Apple

1. Temp sensor & Hum sensor, mus tob nws yuav tso saib qhov tseem ceeb ntawm puv npo

2. Lub teeb pom kev:) Qhov tseeb Apple muaj peev xwm qhia ligth Ambience, tab sis tsis Voltage, yog li cov roj teeb hluav taws xob tau qhia hauv Lux

Kauj Ruam 9: OTA: Tshaj Tawm Txog Huab Cua

Ua ntej pib ib qho kev hloov kho twg yog qhov zoo dua rau rov pib dua ESP32, raws li tau hais ua ntej nws yuav tsis mus pw thawj 20 feeb

Muaj ob txoj hauv kev los hloov kho tshiab

  1. Kev teeb tsa siv https://192.168.0. XX/browse koj tuaj yeem nkag mus rau koj cov ntaub ntawv kaw lus ntawm ESP thiab hloov pauv cov ntaub ntawv teeb tsa
  2. Koj tuaj yeem hloov kho firmware kom tiav. rau lub hom phiaj no ua ntej koj xav tau tsim tshiab. Nws tuaj yeem ua tiav ntawm Arduino lossis Visual Studio IDE. Tom qab ntawd ntaus hauv browser https://192.168.0. XX/ hloov tshiab, xaiv koj lub firmware thiab nias hloov tshiab. Tos kom txog thaum txheej txheem tiav thiab koj yuav tau txais lus teb OK, txwv tsis pub rov ua cov kauj ruam ntxiv

Pom zoo: