Cov txheej txheem:
- Kauj Ruam 1: Sau tag nrho cov ntaub ntawv xav tau
- Kauj ruam 2: Txuas lub Circuit Court
- Kauj ruam 3: Upload Code
- Kauj Ruam 4: Xeem thiab Xeem thiab Teeb Meem
Video: Tsis siv neeg IoT Hallway Hmo Teeb Nrog ESP8266: 4 Cov Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Kuv pib qhov haujlwm no tau tshoov siab los ntawm lub teeb ntaiv los ntawm lwm txoj haujlwm qhia. Qhov sib txawv yog lub hlwb ntawm kev siv hluav taws xob siv ESP8266, uas txhais tau tias nws yuav los ua IoT ntaus ntawv.
Qhov kuv xav hauv siab yog kom muaj teeb pom kev tsaus ntuj rau cov menyuam yaus, thaum lawv tawm mus ntawm lawv chav, nws pom txoj hauv kev mus rau chav dej. Txog qhov no kuv siv ESP8266 txhawm rau txheeb xyuas qhov txav los ntawm PIR sensor. Kuv siv 2 PIR sensors, ib qho ntawm txhua qhov kawg rau kev rov qab los. Muab hais tias ESP8266 yog IoT muaj peev xwm, tom qab ntawd kuv tseem tuaj yeem siv qhov no txhawm rau txheeb xyuas seb puas muaj kev txav mus los ntawm txoj kev hauv tsev los ntawm kev tshaj tawm MQTT cov lus rau Tus Pab Tsev.
Kauj Ruam 1: Sau tag nrho cov ntaub ntawv xav tau
Rau qhov haujlwm no kuv tab tom siv cov ntaub ntawv hauv qab no:
SIB 8266
- PIR sensor
- 330 Ohm resistor uas ua raws li qhov txwv tam sim no
- 5 V addressable LED Sawb (WS2812B)
- Cov kab hluav taws xob los teeb lub tsev
Kauj ruam 2: Txuas lub Circuit Court
Peb yog qhov tseem ceeb txuas rau LED kab ntawv Cov ntaub ntawv kab rau tus pin D2 lossis ESP8266 ntawm 330 Ohm resistor kom txwv qhov tam sim no. Nco ntsoov ESP8266 lub zog ua haujlwm yog 3.3V.
PIR sensors tau txuas nrog Pin D5 thiab D6, ib qho rau sab laug sensor thiab ib qho rau sab xis. Tsis txhob hnov qab txuas lub zog rau PIR thiab LED sawb rau 3.3V hauv qhov no.
Kauj ruam 3: Upload Code
Txhawm rau ua haujlwm koj yuav xav tau lub tsev qiv ntawv hauv qab no:
- "FastLed" lub tsev qiv ntawv los ntawm Daniel Garcia, hauv qhov piv txwv no kuv muaj version 3.3.3 teeb tsa
-Lib Time
- ESP8266Wifi
- ESP8266WebServer
- ArduinoOTA Cov
Yog tias koj tseem tsis tau teeb tsa lawv koj tuaj yeem teeb tsa lawv los ntawm "Cuab Yeej-> Tswj Tsev Qiv Ntawv" hauv Arduino interface.
Hauv kab lus hauv qab no ntawm cov cai
#define FASTLED_ESP8266_D1_PIN_ORDER#suav nrog "FastLED.h" FASTLED_USING_NAMESPACE
#define NUM_LEDS 30
#define LEDS_PER_STAIR 2 // Cov Leds ntawm ib tus ntaiv. Tseem tsis tau hloov pauv - tsuas yog pom #define BRIGHTNESS 120 // 0 … 255 (siv hauv fade7) #define PIN_LED 04 // LED Cov lej tus lej (GPIO4) D2 #define PIN_PIR_DOWN 14 // PIR Downstairs Pin (GPI14) D5 #define PIN_PIR_UP 12 // PIR Upstairs Pin (GPI12) D6
Koj tuaj yeem teeb tsa Tus lej ntawm LED hauv koj daim kab xev LED, tseem txuas ntawm LEDStrip yog tias koj txiav txim siab txuas nws mus rau tus lej sib txawv thiab tseem yog PIR sensor tus pin yog tias koj txiav txim siab txuas nws mus rau tus lej sib txawv ntawm MCU.
Cov teeb tsa saum toj no nyob hauv "ledsettings.h" cov ntaub ntawv.
Koj tuaj yeem rub tawm tag nrho cov cai los ntawm qhov txuas hauv qab no.
Thaum koj muaj peev xwm sau cov cai ua tiav koj tuaj yeem xa nws mus rau ESP8266.
Kauj Ruam 4: Xeem thiab Xeem thiab Teeb Meem
Yog tias txhua yam mus tau zoo, koj yuav tsum muaj Lub Teeb Pom Kev Ua Haujlwm uas koj tuaj yeem txaus siab rau. Thaum koj txhawb lub zog hluav taws xob thawj zaug, LED Sawb yuav ci nrog qee cov zaj sawv sib tshooj. Tom qab ntawd lub peev xwm ESP8266 yuav ua lub luag haujlwm nkag (AP) tso cai rau koj teeb tsa WiFi txuas.
Yog tias koj siv tus lej uas kuv muaj koj yuav tsum tuaj yeem pom "ESP-HallLight" ua qhov nkag mus. Rau kev nyab xeeb Kuv tau tso tus lej tiv thaiv rau AP. Tus password tsis raug yog "arduino" koj tuaj yeem hloov qhov no hauv cov ntaub ntawv settings.h, hauv ntu hauv qab no.
#define CLOCK_NAME "ESP-HallLight"
#define WIFI_AP_NAME CLOCK_NAME #define WIFI_APPSK "arduino" // default AP password
Thaum txuas tau zoo siv lub xov tooj ntawm tes lossis lub laptop ntawm WiFi, koj yuav tsum muaj peev xwm taw koj tus browser mus rau 192.168.4.1, koj yuav tsum pom lub vijtsam teeb tsa raws li pom hauv daim duab saum toj no. Tam sim no koj tuaj yeem nkag mus rau koj li WiFi chaw thiab ib zaug nkag ESP8266 yuav rov pib dua thiab sim txuas rau koj li WiFi. Yog tias nws muaj peev xwm txuas tau zoo koj yuav tsis pom qhov "ESP-HallLight" nkag mus ntxiv.
Yog tias koj tseem txuas nrog Arduino interface koj tuaj yeem saib xyuas qhov no los ntawm kev saib ua ntu zus.
Nco tseg: Koj tsis tas yuav teeb tsa WiFi rau lub ntsuas hluav taws xob kom ua haujlwm, nws yuav tsum ua haujlwm tom qab ob peb feeb thaum lub teeb pib pib.
Txhawm rau sim koj tuaj yeem sim taug kev los ntawm ib sab lossis tuav koj txhais tes, lub teeb yuav tsum ci tom qab kev taw qhia ntawm kev mus ncig, yog tias nws ua qhov tsis sib xws, tom qab ntawd koj yuav tsum tau hloov pauv sab laug thiab sab xis hauv qhov chaws.
Thaum lub sijhawm kuv tsim thawj zaug kuv yuam kev txuas qhov tsis raug ntawm LED sawb, uas ua rau tsis muaj ib qho ntawm LEDs teeb pom kev.
Kuv vam tias koj txaus siab rau qhov kev tsim no, yog tias qhov no muaj txiaj ntsig, thov pov npav rau qhov kev sib tw. Yog tias koj muaj lus nug tsis txhob ua siab deb sau ntawv rau kuv, thiab kuv yuav teb nws sai li sai tau.
Qee qhov tom qab xav yuav ntxiv cov yam ntxwv ntxiv xws li:
- Muaj qhov cuam tshuam los tig LEDs ntawm nws tus kheej ntawm lub ntsuas, zoo ib yam li kuv tshaj tawm yav dhau los hais txog WiFi tswj LED Sawb lossis LED Sawb Cov xwm txheej qhia.
- Ntxiv qhov tshwj xeeb ntxiv rau tshaj tawm MQTT cov lus rau Tsev Pabcuam zoo ib yam li cov ntawv hauv qab no.
Pom zoo:
DIY Tsis Siv Neeg Tsab Ntawv Pom Zoo Lub Teeb LED Hmo Hmo Teeb: 6 Cov Kauj Ruam (nrog Duab)
DIY Tsis Siv Neeg Motion Sensing Bed LED Hmo Hmo Hmo: Nyob Zoo, Cov Menyuam Zoo Siab Tos Txais Tos Lwm Cov Lus Qhia uas yuav ib txwm pab koj hauv koj lub neej niaj hnub thiab ntxiv kev yooj yim kom ua rau koj lub neej yooj yim. Qhov no tuaj yeem yog qee zaum lub neej cawm tus neeg thaum muaj hnub nyoog laus uas yuav tsum tau tawm tsam kom nce txaj
DIY Tsis Siv Neeg Hmo Hmo Teeb: 15 Kauj Ruam (nrog Duab)
DIY Tsis Siv Neeg Hmo Teeb: Ua kom pom kev tsaus ntuj yooj yim uas tig rau hauv qhov tsaus ntuj thiab tawm hauv qhov pom kev
Yuav Ua Li Cas Kom Yooj Yim Tsis Siv Neeg Hmo Hmo Teeb Pom Kev Siv LDR: 4 Kauj Ruam
Yuav Ua Li Cas Ua Kom Yooj Yim Tsis Siv Neeg Hmo Hmo Teeb Siv LDR: Nyob zoo cov phooj ywg hnub no kuv yuav qhia koj yuav ua li cas thiaj ua lub teeb pom kev hmo ntuj tsis siv neeg yooj yim siv LDR (Lub teeb nyob ntawm tus tiv thaiv) thiab mosfet yog li ua raws thiab hauv cov kauj ruam tom ntej, koj yuav nrhiav lub teeb pom kev zoo hmo ntuj tsis siv neeg nrog rau t
Ua Tsis Siv Neeg Hmo Hmo Teeb Hloov Hloov Siv Mosfet: 6 Cov Kauj Ruam (nrog Duab)
Ua Tsis Siv Neeg Hmo Hmo Teeb Hloov Hloov Siv Mosfet: YUAV UA LI CAS YUAV UA LI CAS YUAV TSUM TAU NROG LIGHT SWITCH NROG MOSFETHello, cov phooj ywg hauv txoj haujlwm no kuv yuav qhia ib daim duab qhia yooj yim ntawm yuav ua li cas thiaj li qhib lub tshuab hluav taws xob tsis siv neeg siv ib mosfet thiab qee qhov me me uas kuv tau tswj hwm khaws los ntawm ar
Tus Hluas Nkauj Hmo Hmo Hmo Hmo: 34 Kauj Ruam (nrog Duab)
Tus Hluas Nkauj Hmo Hmo Hmo: Kuv xub tuaj nrog lub tswv yim rau Hluas Nkauj Hmo Hmo Hmo thaum kuv lwm qhov tseem ceeb qhia tias nws ntshai tsaus ntuj thiab tsis tuaj yeem pw tsis tau lub TV nyob. Ua rau muaj kev cuam tshuam yooj yim, Kuv tsis tuaj yeem tsaug zog thaum lub TV qhib. & Nb