Cov txheej txheem:
- Kauj Ruam 1: LEDs Xav Tau Tam Sim No Kom Txwv
- Kauj ruam 2: Ua lub teeb nyem
- Kauj Ruam 3: Internet Ntawm Yam Nrog Lub Teeb Pom Kev Zoo no?
- Kauj Ruam 4: Teeb MQTT Server
- Kauj Ruam 5: Npaj Tus Tshaj Tawm
Video: Los ntawm lub teeb nyem mus rau Tsab ntawv tsa suab Sensor nrog ESP8266 thiab MQTT: 5 Cov Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Hauv kab ntawv no, kuv yuav nthuav qhia cov khoom hauv qab no:
- LEDs xav tau kev txwv tam sim no
- yuav ua li cas thiaj ua lub teeb nyem
- ua lub teeb pom kev los ntawm lub roj teeb nqa tau, thiab ua kom lub teeb ci los ntawm ESP8266 ntawm MQTT
Daim vis dis aus yog rov ua dua thiab piav qhia luv luv ntawm qhov no ua haujlwm li cas,
Kuv tau npaj kom muaj PIR sensor suav nrog, tab sis cov ntawv qhia tau ntev dua yog li PIR sensor yuav nthuav tawm hauv ntu thib ob ntawm cov ncauj lus no
Yog li cia pib.
Kauj Ruam 1: LEDs Xav Tau Tam Sim No Kom Txwv
Rau cov pib tshiab, qhov no yog qhov xav tsis thoob li cas feem ntau tig rau lub teeb hluav taws xob lossis lub teeb ci. Tsis txhob txhawj, cov qij LED ntawm lub txee twb tau los nrog AC-rau-DC lub zog hloov pauv thiab txwv tam sim no. Tab sis yuav zoo los ua ib yam dab tsi los ntawm qhov kos.
Ib qho tseem ceeb kom tig lub LED yog qhov txwv tam sim no. Qhov no ua haujlwm li lub valve rau tam sim no kom thaum qhov hluav taws xob tau thov rau LED ua rau nws ua tus coj, tam sim no ntws los ntawm LEDs tsis tuaj yeem loj dua qhov ib txwm tswj los ntawm Circuit Court. LEDs tsis ua feem ntau tshwm sim los ntawm kev ua kom sov. Tsis muaj qhov txwv tam sim no hauv qhov chaw yog txoj hauv kev kom hlawv cov LEDs hauv ob peb feeb. Los ntawm txoj kev, kho cov LED chips, cov uas tuaj ntawm cov txheej txheem txhuas, kom lub rhaub dej kub txo cov LED nti thiab feem ntau pom zoo.
Kuv tau khawb kuv lub taub hau ntau thaum kawm qhov no ib puag ncig 2015, thiab tseem khawb kuv lub taub hau (rau qhov laj thawj sib txawv). Kuv kawm los ntawm cov ntawv qhia no thiab nws cov lus piav qhia meej txuag kuv qee qhov khaus.
Lub voj voog txuas nrog. Cov kab ntawv siab qhia qhov tseem ceeb ntawm txoj kev thauj khoom, thiab cov uas nyias nyias qhia txog kev tswj hwm lub luag haujlwm los tswj qhov tam sim no ntawm txoj kev tseem ceeb uas yog kwv yees li 150 mA. Wikipedia muaj kab lus luv luv thiab qee qhov kev hais qhia txuas nrog. Qhov kev txwv tam sim no tuaj yeem tsim nrog transistor los hloov MOSFET nrog nruab nrab tam sim no thauj khoom transistors xws li BD135, BD139.
Kauj ruam 2: Ua lub teeb nyem
Qhov xav tau:
- N-channel MOSFET (IRF540N $ 1.62/10pcs, 30N06, $.1.75/10pcs)
- NPN transistor (xws li S8085)
- 3.9 ohm - 2W resistor, tam sim no txwv tsis pub dhau 0.6/3.9 = 153mA
- 100kR (1/4W) resistor
- Lub laub-xauv hloov
- Muaj 0.5W 8mm LED, $ 3.18/100pcs ntawm no
- 18660 Lithium roj teeb. Kuv khaws ob peb ntawm lawv los ntawm lub txhab nyiaj fais fab. Lub roj teeb laptop (4, 6, 8 hlwb) ua los ntawm 18650 cell tab sis ceev faj nrog cov khoom ntawd.
- 1 nce mus txog 12V pawg thawj coj, zoo li qhov no, $ 0.56
- 1 lub roj teeb lithium zoo li qhov no, $ 0.30
Qhov sib txawv tseem ceeb rau lub Circuit Court saum toj no yog siv lub roj teeb Lithium (18660) nrog txhawb nqa lub rooj tsavxwm tsis txhob thuam-5V lub zog hloov pauv.
Daim duab kawg qhia pom lub teeb nyem kawg thiab nws tau them los ntawm ib qho micro USB qhov chaw (> 1A).
Kauj Ruam 3: Internet Ntawm Yam Nrog Lub Teeb Pom Kev Zoo no?
Kuv tsoo qhov no ua peb kauj ruam:
- Npaj tus neeg yuav khoom (qhov no)
- Teeb MQTT server (kauj ruam tom ntej)
- thiab npaj Tus Tshaj Tawm (tus tom ntej)
Qhov:
Ua ntej, yog, Kuv tau siv lo lus ntuas, aka IOTs, tab sis qhov no tuaj yeem ua ke ua ke ntawm kev siv Circuit hauv Kauj Ruam 2 nrog ESP8266 thiab tom qab ntawd tswj lub teeb ci los ntawm MQTT txoj kev.
Cov khoom rau hauv Circuit Court zoo ib yam, tshwj tsis yog:
- Hloov 12V txhawb nqa los ntawm MT3608 txhawb nqa pawg thawj coj, $ 1.92/5pcs, qhov no tuaj yeem txhawb qhov hluav taws xob ntawm 18650 roj teeb (li 3.7V) txog 28 V, txaus rau lub zog 8LEDs (hloov 3).
- Txoj haujlwm tsis thawb hauv qhov hloov pauv tau txuas nrog GPIO 1 lossis 2 hauv ESP8266 rau PWM teeb liab.
- ESP8266 01, $ 1.68 txhua. Zoo li no
- AMS1117 3.3 V, tus tswj hluav taws xob rau ESP8266, qee lub peev xwm
- USB module kom nyem ESP8266, $ 0.78/pcs zoo li qhov no
Btw. cov kev sib txuas yog rau kev yooj yim.
Soldering thiab uploading:
- Siv cov khoom sib dhos ua ke, thiab siv cov txheej txheem saum toj no. Qee qhov ua ntej 3.3 qhov hluav taws xob hluav taws xob tuaj yeem txuag koj qee lub sijhawm ($ 1.38/5pcs zoo li no). Kuv tsis meej pem kom nco tus pin thaum tig lub PCB pawg thawj coj thiab ua tiav qee qhov AMS1117 tus tswj hluav taws xob.
- Tom ntej no Ua qhov kev hloov pauv me me zoo li hauv daim duab thib peb los tuav GPIO 0 rau GND, nrawm nrawm RST Pin nrog GND tus pin kom tso ESP8266 rau hauv Flashmode.
- Rub tawm cov cai ntawm no los ntawm kuv GitHub, thiab xa cov cai rau ESP 8266 siv Arduino IDE.
Kuv tau hais qhia kab kom pom cov ncauj lus uas tus neeg siv khoom tau tso npe rau. Txhua cov lus tshaj tawm rau lub ncauj lus no yuav raug xa mus rau lwm tus neeg siv khoom (cov neeg siv khoom) rau cov ncauj lus no. EPS8266 hauv kab lus no yuav mloog JSON cov lus tshaj tawm rau lub ncauj lus thiab hais tawm yog tias tau hloov pauv hauv channel Peb
* ib zaug dhau ib zaug, Kuv xav tias kuv tuaj yeem tso lub zog rub tawm (100k) rau hauv av ntawm Gate ntawm MOSFET thaum ESP8266 tsis tau nthuav tawm. Qhov no ua haujlwm thaum tsis muaj ESP8266, tab sis nrog ESP8266, tus tiv thaiv kuj tseem rub GPIO0 lossis 2 rau GND, ua rau lawv mus rau hauv hom Flash lossis tsis khau raj (thaum GPIO2 yog LOW)). Koj yuav pom ntsuab ntsuab yog tias qhov no tshwm sim.
Kauj Ruam 4: Teeb MQTT Server
MQTT (Message Queuing Telemetry Transport) yog cov txheej txheem tsis sib xws raws li kev tshaj tawm-sau npe yuav ua. Ntaus hosting MQTT lus hauv thiab tawm hu ua tus broker. Zoo li tus tswv lag luam tiag, nws muaj kev sib pauv ntawm cov tshaj tawm (muag khoom) thiab cov neeg siv khoom (cov neeg yuav khoom). Tsis muaj nyiaj pauv cov tes. Muaj ntau ntau cov lus qhia rau qhov no.
Ntawm no yog cov recap. Raspberry Pi yog lub cuab yeej nrov tshaj plaws rau qhov no. Frist, nruab MQTT los ntawm:
sudo apt-tau nruab mosquitto mosquitto-cov neeg siv khoom
sim yog tias MQTT server ua haujlwm los ntawm qhib ob lub dav hlau ntawm Raspberry, ib hom thawj kab thiab lwm qhov rau tom ntej:
mosquitto_sub -h localhost -t "yourtopic"
mosquitto_pub -t "yourtopic" -h localost -m "hais ib yam dab tsi"
Koj yuav tsum pom qhov "hais ib yam dab tsi" qhia tawm ntawm thawj lub davhlau ya nyob twg. Vahuam! Nws ua haujlwm.
Qhov "#" tuaj yeem siv los mloog txhua lub ncauj lus, hloov "koj cov lus" los ntawm "#"
Tam sim no koj tsis xav kom ib tus tuaj yeem tshaj tawm lossis sau npe rau koj li MQTT server, koj yuav tsum teeb tus password, ua li ntawd los ntawm:
cd ~ ib
mosquitto_passwrd -c pwfile mqtt_user
mqtt_user tuaj yeem yog lwm lub npe siv uas koj nyiam, sau tus password ob zaug, thiab hloov kho cov ntaub ntawv.conf los ntawm:
sudo nano /etc/mosquitto/mosquitto.conf
ntxiv ob kab no:
allow_anonymous cuav
password_file/tsev/pi/pwfile
ces rov pib dua lub mositto los ntawm:
sudo systemctl rov pib dua Mositto
ua qhov kev xeem los ntawm suav nrog lub npe nrog tus lej zais xws li:
mosquitto_sub -h localhost -t "yourtopic" -u "mqtt_user" -P "123456"
mosquitto_pub -h localhost -t "yourtopic" -u "mqtt_user" -P "123456" -m "qhov no puas ruaj ntseg?"
Tsis tas li yog tias MQTT tsis kam txuas, sim qhov no los muab MQTT cov kev pabcuam rau tom qab ntawm Linux system los ntawm:
mosito -d
Kuv pom cov ntawv ua pov thawj no zoo rau saib. Kuv tau kawm qee yam los ntawm ob qho no hnub no.
- Adafruit:
- Stees-internet-guide.com
Kauj Ruam 5: Npaj Tus Tshaj Tawm
Txog qhov no, Kuv ua lub dashboard yooj yim los thawb cov lus rau MQTT server. Hauv kev sawv ntsug, LCD qhia Lub Sijhawm.
Qhov:
- SSD1306 Screen zaub, $ 2.41 txhua
- EPS8266 WEMOS D1 Mini, $ 2.53 txhua
- Ib tug potentiometer
- Ib tus lej 4 tus lej swb.
- ob 3mm LEDs,
- ib co resistors
Soldering:
Nov yog daim duab qhia chaw ntawm lub davhlau ya nyob twg:
Upload cov cai:
Lub npe WEMOS ESP8266 zoo siab ua haujlwm nrog. Koj tsuas xav tau micro USB, nias lub pob upload ntawm Arduino IDE nyem lub nti. Cov cai nyob ntawm no (GitHub):
Txhawm rau tshaj tawm cov lus, thawb qhov hloov kom tig ntsuab coj (thiab liab tawm), tom qab ntawv xaub tus pin thiab kho, thiab thaum kawg nias lub pob kom rov thawb cov lus mus rau MQTT server. Lub dashboard tuaj yeem tshaj tawm JSON cov lus rau 4 raws.
Ua tibzoo saib qhov tseem ceeb ntawm tus lej (screenshot). Qhov ntawd yog lub ncauj lus lub dashboard thawb cov lus rau, thiab peb cov LEDs xav ua kom pom ib yam tshiab los ntawm JSON cov lus
Qhov ntawd yog hais txog nws. Kuv vam tias cov ntawv qhia yuav pab tau.
Pom zoo:
Tsab ntawv tsa suab hnov qab teeb pom kev hauv txaj: 16 Cov Kauj Ruam (nrog Duab)
Motion Sensing Under Bed Lighting: Puas tau sim tawm ntawm lub txaj ntsiag to thaum hmo ntuj tsuas yog taug kev hla qee yam thiab tsa tag nrho lub tsev? Tsab ntawv tsa suab pom hmo teeb teeb tsa tsis xwm yeem hauv qab koj lub txaj muab lub teeb qis qis kom txaus los coj koj ib puag ncig cov LEGO uas tsis ncaj ncees
Neeg Hlau Lub Taub Hau Coj Mus Rau Lub Teeb. Los ntawm Cov Khoom Siv Rov Los thiab Rov Siv Dua: 11 Kauj Ruam
Neeg Hlau Lub Taub Hau Coj Mus Rau Lub Teeb. Los ntawm Cov Khoom Siv Rov Los thiab Siv Rov Los: Yog tias qee tus xav tsis thoob tias cov neeg hlau tuaj yeem tuaj nrog lub hnab ntim khoob, tej zaum cov lus qhia no tuaj yeem muab lus teb. Recycled stepper motors los ntawm lub tshuab luam ntawv qub, siv ping pong npas, taws tswm ciab, siv balsa, xaim los ntawm tus dai khaub ncaws qub, siv xaim xaim
Chav Tswj Nrog ESP8266 - Kub, Tsab ntawv tsa suab, Kab hlau rhuav thiab teeb pom kev zoo: 8 kauj ruam
Chav Tswj Nrog ESP8266 | Kub, Suab, Kab Hlau thiab Teeb pom kev zoo: Txoj haujlwm no suav nrog kev ua haujlwm raws li NodeMCU ESP8266 tus qauv uas cia koj tswj lub teeb ci ntawm LED Sawb thiab kab hlau rhuav ntawm koj chav, nws tseem tuaj yeem xa cov ntaub ntawv hais txog cov xwm txheej ntawm koj chav thiab qhov kub thiab txias rau huab w
Tsab ntawv tsa suab qhib lub teeb hloov nrog lub teeb Sensor: 5 Kauj Ruam
Tsab ntawv tsa suab qhib lub teeb hloov nrog lub teeb pom kev zoo: Lub suab qhib lub teeb hloov muaj ntau daim ntawv thov hauv tsev thiab hauv chaw ua haujlwm. Qhov no, txawm li cas los xij, tau ntxiv qhov zoo ntawm kev suav nrog lub teeb pom kev zoo, yog li ntawd, lub teeb no tsuas tuaj yeem ua rau thaum tsaus ntuj
Tsab ntawv tsa suab Sensor qhib LED Sawb Nrog Timer: 6 Cov Kauj Ruam (nrog Duab)
Tsab ntawv tsa suab Sensor qhib LED Sawb Nrog Timer: Nyob zoo txhua tus! Kuv zoo siab heev tau sau lwm cov ntawv qhia tam sim no. Qhov haujlwm no tau los thaum kuv raug hu los ntawm ib tus neeg qhia qhia-er (?!) (David @dducic) ob peb lub hlis dhau los thov kom qee qhov kev pab tsim. Yog li ntawm no yog qhov tseem ceeb tshwj xeeb: & q