Cov txheej txheem:

Tshem Tawm lossis Rov Pib Kho Lub Computer Nrog ESP8266 Ntaus: 10 Kauj Ruam (nrog Duab)
Tshem Tawm lossis Rov Pib Kho Lub Computer Nrog ESP8266 Ntaus: 10 Kauj Ruam (nrog Duab)

Video: Tshem Tawm lossis Rov Pib Kho Lub Computer Nrog ESP8266 Ntaus: 10 Kauj Ruam (nrog Duab)

Video: Tshem Tawm lossis Rov Pib Kho Lub Computer Nrog ESP8266 Ntaus: 10 Kauj Ruam (nrog Duab)
Video: Hwm Pheej Thoj - Rov Mus Txog Vib Nais 2024, Kaum ib hlis
Anonim
Image
Image

Kom paub meej ntawm no, peb tau kaw koj lub computer, tsis yog lwm tus lub computer.

Zaj dab neeg mus zoo li no:

Ib tus phooj ywg ntawm kuv hauv Facebook xa xov rau kuv thiab hais tias nws muaj kaum ob lub khoos phis tawj siv ua lej, tab sis txhua tag kis thaum 3 teev sawv ntxov, lawv kaw. Txij li lub khoos phis tawj nyob deb 30-feeb, nws yog ib qho teeb meem loj heev uas tsav ob lub nroog dhau los (peb nyob hauv South Dakota) txhawm rau siv lub tshuab computer. Nws nug, kuv puas tuaj yeem tsim nws IoT ntaus ntawv uas yuav tso cai rau nws rov pib kho lub computer ua txhaum los ntawm kev nplij siab ntawm nws lub txaj zoo?

Tsis txhob plam qhov kev sib tw, Kuv pom zoo muab qee yam ua ke rau nws. Qhov no yog qhov project.

Siv ob qhov kev hloov pauv me me sau npe, ESP8266 ESP01, puv tes ntawm LEDs, thiab qee qhov ua haujlwm hauv tsev optoisolators, tag nrho txoj haujlwm raug nqi txog $ 5 yog tias koj yuav cov khoom los ntawm Tuam Tshoj ntawm eBay. Tej zaum $ 20 los ntawm Amazon.

Qhov no yog ib qho kev tsim ua kom yooj yim nrog ntau qhov ua kom zoo. Tsis suav kuv cov ntsia hlau ntsia thiab rov siv dua, nws coj kuv qhov zoo dua ntawm 20 teev los ua, tab sis nws tau ua tiav zoo thiab ua haujlwm tau zoo.

Cia peb pib.

Kauj Ruam 1: Pawg Thawj Coj

Pawg Thawj Coj
Pawg Thawj Coj
Pawg Thawj Coj
Pawg Thawj Coj

Ib txwm pib txhua txoj haujlwm nrog daim ntawv qhia ua zaub mov noj. Nws yog txoj hauv kev zoo tshaj los txiav txim siab yog tias koj muaj tag nrho cov khoom siv thiab ua haujlwm raws li xav tau. Txoj haujlwm no nyuaj me ntsis, yog li kuv pom zoo kom tsim nws ntawm lub khob cij ua ntej mus rau tom ntej.

Qhov koj yuav xav tau yog:

  • Ib ESP8266 ESP01 (txawm hais tias ib qho ESP8266 ntaus ntawv yuav ua haujlwm)
  • Ob qhov 8-ntsis hloov npe, Kuv siv 74HC595N
  • 16 LEDs, Kuv siv cov kaus mom dawb LEDs uas ua haujlwm ntawm 3.3V. Yog tias koj siv lwm tus, koj yuav xav tau cov neeg tawm tsam.
  • Peb 3k3-ohmpulldown resistors
  • Jumper xov hlau & lub khob cij

Koj tseem yuav xav tsim kom muaj tsawg kawg ib tus optoisolator. Kuv siv dub ntsws ntsws tubing, lub teeb ci dawb LED, 220-ohm resistor, thiab tus kws yees duab thaij duab. Solder lub 220-ohm resistor rau LED's cathode thiab tom qab ntawd kaw lub LED thiab cov duab hluav taws xob sab hauv lub ntsws ntsws sib ntsib ib leeg. Tab sis peb yuav mus rau cov ntawd hauv qib tom ntej.

Ua raws daim duab qhia kab uas tau muab rau hauv cov kauj ruam tom ntej. Kev txuas yog yooj yim heev.

Vim tias ESP8266 ua haujlwm ntawm 3.3V, xyuas kom koj lub hwj chim tsim nyog

Kauj Ruam 2: Schema Siv Will-CAD

Schema Siv Will-CAD
Schema Siv Will-CAD

Schematic yog yooj yim heev. Peb tab tom ua raws cov txheej txheem xaim ntawm 8-ntsis hloov pauv npe. Txij li thaum kuv siv ob 8-ntsis hloov npe, lawv yuav tsum tau txuas ua ke ntawm lawv 'moos' thiab 'latch' pins.

Vim tias ESP01 tsuas muaj ob tus GPIO tus pin, peb yuav tsum rov siv TX & RX raws li cov lus tso tawm, uas ua haujlwm zoo rau peb lub hom phiaj. Koj tuaj yeem siv ESP-12 lossis lwm version nrog ntau dua ob tus GPIO pins yog tias koj xav tau kev tswj hwm ntau dua. Tab sis qhov ntawd yuav ntxiv ntxiv $ 2 rau tus nqi ntawm txoj haujlwm - uas tsuas yog vwm -tham.

Peb yuav tsum khaws peb 8-ntsis hloov npe thiab ESP01 pins rub siab rau khau raj, yog li lawv tsis ua tej yam txawv lossis mus rau hauv hom haujlwm. Kuv siv peb 3k3 resistors, qhov loj dua lossis qhov txiaj ntsig me me yuav ua haujlwm ib yam. Tus nqi no tau los ntawm cov lus qhia tham txog kev siv lwm txoj koob ntawm ESP01.

ESP01 (ESP8266)

  • TX clock pin 3k3 rub
  • RX latch tus pin 3k3 rub tawm
  • 00 cov ntaub ntawv xov xwm 3k3 rub tawm
  • 02 ploj

8-Hloov Hloov Sau Npe (74HC595H)

  • VCC 3.3V
  • OE 3.3V (qhov no yog tus pin pab tau)
  • GND GND
  • CLR GND (qhov no khaws tus pin tseeb ntawm kev tshem tawm)
  • Thiab cov LEDs, cov ntawd mus rau hauv av.

Kauj Ruam 3: ESP8266 Txoj Cai

ESP8266 Txoj Cai
ESP8266 Txoj Cai

Tus lej ESP8266 yog qhov yooj yim heev. Hmoov tsis zoo, tus kws kho mob hauv Cov Lus Qhia tsis zoo siv tsis tau, yog li koj yuav xav tau txais txoj cai ncaj qha los ntawm Github.

"racks-reboot" qhov project:

github.com/bluemonkeydev/arduino-projects/…

"SensorBase" chav kawm muaj nyob ntawm no. Nws xav tau yog tias koj xav "siv" kuv tus lej:

github.com/bluemonkeydev/arduino-projects/…

Muaj ob peb yam yuav tsum nco ntsoov. Cov cai tau teev tseg zoo heev.

  1. Kuv yog tus tsim tawm tub nkeeg heev, yog li kuv muab txhua qhov rov siv tau ESP8266 code rau hauv chav kawm hu ua "SensorBase." Koj tuaj yeem pom qhov ntawd ntawm Github, ib yam, txuas saum toj no.
  2. Koj yuav tsum ntaus koj tus MQTT tus tswv lag luam lub server, lub npe siv, tus lej nkag, thiab chaw nres nkoj. Cov ntawd tuaj yeem pom me ntsis ntxiv thaum peb tsim qhov kev pabcuam CloudMQTT.
  3. Koj tsis tas yuav ua raws li kuv cov ntsiab lus syntax. Txawm li cas los xij, Kuv xav kom ua raws nws.
  4. Tsis muaj ib yam ntse txog cov cai no. Nws yog pragmatic heev.

Kauj ruam 4: Perfboard Layout

Perfboard Layout
Perfboard Layout

Txoj haujlwm no yuav raug teeb tsa ntawm lub chaw khaws ntaub ntawv me me, yog li kuv txiav txim siab tsuas yog siv lub rooj tsav tsheb perf rau qhov tsim qauv zaum kawg. Perfboard ua haujlwm zoo rau cov phiaj xwm zoo li no thiab yooj yim rau kev teeb tsa siv ib daim ntawv ntawm kab ntawv kev cai. Ntawm no koj yuav pom kuv teeb tsa. Tau kawg, koj tuaj yeem xaiv ua nws txawv.

Kuv txoj haujlwm xav tau ob daim ntawv 8-ntsis hloov pauv, yog li kuv pib nrog lawv txoj haujlwm nyob nruab nrab. Kuv paub tias kuv txuas mus rau optoisolators yuav yog poj niam yooj yim headers rau tam sim no, txawm tias qhov ntawd tsis yog qhov kev daws teeb meem zoo tshaj plaws.

Kuv nyiam LEDs, thiab qhov no xav tau kom muaj LED rau txhua qhov optoisolator Circuit Court. Kuv paub qhov kev xeem yuav yooj yim dua yog tias kuv tuaj yeem tau txais cov lus teb tam sim ncaj qha rau ntawm lub rooj tsavxwm, tab sis kuv kuj paub tias cov LEDs yuav ua rau muaj mob loj heev rau cov laug. Thiab lawv tau. Kuv tsis muaj dab tsi me dua 5mm LEDs, yog li kuv yuav tsum tso lawv tseg. Kuv qhov kev tsim kawg ua zig-zag qauv ntawm cov cathodes vim tias kuv tsis xav khiav lub anodes hla cov xov hlau hauv av. Qhov no ua pov thawj tias yog kev tsim qauv zoo. Cov xov hlau LED koom nrog saum 8-ntsis hloov pauv npe thiab khiav ntawm lub rooj tsavxwm sab saum toj nrog cov xov hlau thaiv kom yooj yim.

Txog lub zog, Kuv xav khiav nws los ntawm lub qub USB cable kom tau ncaj qha los ntawm ib lub khoos phis tawj. Qhov no yuav ua haujlwm tau zoo vim tias USB chaw nres nkoj feem ntau tau siv zog txawm tias lub khoos phis tawj raug kaw. Kuv siv LM317 linear voltage regulator los txo lub zog rau 3.3V. Tus tswj hwm 3.3V yuav tau ua haujlwm ib yam nkaus, tab sis kuv tsis muaj.

Txhawm rau zam dhau ntau txoj xov hlau hla, kuv tau khiav ob peb lub xov hlau nyob rau sab saum toj ntawm daim txiag ntoo, uas kuv sim zam. Nco ntsoov tias txoj kev hla qhov yog cov khoom siv, yog li siv cov xov hlau thaiv kom tsis txhob luv. Cov kev sib txuas uas tau ua nyob rau sab saum toj ntawm pawg thawj coj tau pom nyob hauv kab kab ntawm kuv daim duab.

Kauj Ruam 5: Cov laug cam

Cov laug cam
Cov laug cam

Kuv lub rooj muag khoom zaum kawg tau muab tawm zoo heev. Raws li qhov xav tau, LEDs nyob rau sab saum toj tau ua haujlwm ntau heev kom tau muag kom raug yam tsis muaj luv. Tom qab koj tau siv cov LEDs thiab lub taub hau, siv koj lub multimeter los txiav txim seb koj puas muaj lub luv. Nws yog qhov zoo tshaj kom paub tam sim no.

Lwm yam dua li cov LEDs, txhua yam ntxiv mus zoo zoo. Kuv yuav tsum rov ua ob peb qhov kev sib txuas, tab sis nrog qee tus neeg mob, qee qhov debugging, thiab rov kho me ntsis, txhua yam yuav ua haujlwm tau zoo.

Koj yuav pom los ntawm daim duab no uas kuv tau txuas rau tus optoisolators ib yam, uas kuv tau siv 8-xaim CAT-5 cable. Qhov laj thawj yog tias nws yog qhov pheej yig tshaj, yooj yim rau kev sib txuas, thiab tau cim zoo-ntau ntxiv txog cov optoisolators hauv cov kauj ruam tom ntej.

Kauj Ruam 6: Ua Optoisolators

Ua Optoisolators
Ua Optoisolators

Tau kawg, koj tsis tas yuav ua koj tus kheej optoisolators. Ntau yam kev lag luam muaj rau pennies ib leeg thiab yuav ua haujlwm zoo dua vim tias lawv yuav tsav lub khoos phis tawj cov kab hluav taws xob ncaj qha yam tsis muaj kev tawm tsam. Tab sis, kuv tsis muaj tus optoisolator, yog li kuv yuav tsum ua kuv li siv LED, tiv thaiv, thiab photoresistor.

Tom qab lees paub tias nyob rau hauv lub tes tsho ntawm cov hlab ntsws dub, qhov "tawm" tsis kam nrog tsawg dua kuv lub ntsuas tuaj yeem nyeem thiab "ntawm" kev tiv thaiv yog ob peb txhiab ohms, Kuv tau ua qhov kev xeem zaum kawg ntawm lub niam ntawv qub. Nws ua haujlwm zoo kawg nkaus rau kuv. Kuv xav tias qee lub khoos phis tawj yuav ntau dua lossis tsawg dua, tab sis ntawm cov niam ntawv uas kuv tau sim, qhov teeb tsa no ua haujlwm tau zoo.

Koj yuav xav siv lub teeb ci dawb tiag tiag kom tau txais lub teeb siab tshaj plaws rau hauv photoresistor. Kuv tsis tau sim ntau txoj kev xaiv, tab sis lub teeb ci dawb LED thiab 220-ohm resistor twv yuav raug hu ua haujlwm zoo.

Kauj Ruam 7: teeb tsa CloudMQTT

CloudMQTT Teeb
CloudMQTT Teeb
CloudMQTT Teeb
CloudMQTT Teeb
CloudMQTT Teeb
CloudMQTT Teeb

Ib qho kev pabcuam MQTT, lossis kev pabcuam IoT zoo li Blynk, yuav ua haujlwm, tabsis kuv xaiv siv CloudMQTT rau txoj haujlwm no. Kuv tau siv CloudeMQTT rau ntau qhov haujlwm yav dhau los, thiab txij li txoj haujlwm no yuav raug xa mus rau tus phooj ywg, nws ua rau muaj kev nkag siab los tsim tus as khauj tshiab uas tseem tuaj yeem xa mus.

Tsim CloudMQTT tus account thiab tom qab ntawd tsim qhov tshiab "piv txwv," xaiv qhov "Cute Cat" loj vim peb tsuas yog siv nws rau kev tswj hwm, tsis muaj kev nkag mus. CloudMQTT yuav muab koj lub npe server, username, password, thiab tus lej chaw nres nkoj. (Nco ntsoov tias tus lej chaw nres nkoj tsis yog tus qauv MQTT chaw nres nkoj). Hloov tag nrho cov txiaj ntsig no mus rau koj tus lej ESP8266 hauv qhov chaw sib xws, ua kom ntseeg tau tias rooj plaub raug. (tiag, luam/muab tshuaj qhov tseem ceeb)

Koj tuaj yeem siv "Websocket UI" vaj huam sib luag ntawm CloudMQTT kom pom koj lub cuab yeej sib txuas, khawm thawb, thiab, hauv qhov xwm txheej txawv txawv, uas koj tau txais qhov yuam kev, cov lus yuam kev.

Koj Yuav Tsum xav tau cov kev teeb tsa no thaum teeb tsa Android MQTT tus neeg siv khoom ib yam, yog li nco ntsoov qhov muaj txiaj ntsig yog tias koj xav tau. Vam tias, koj tus password tsis nyuab heev rau ntaus hauv koj lub xov tooj. Koj tsis tuaj yeem teeb tsa qhov ntawd hauv CloudMQTT.

Kauj Ruam 8: MQTT Android Client

MQTT Android Client
MQTT Android Client
MQTT Android Client
MQTT Android Client
MQTT Android Client
MQTT Android Client
MQTT Android Client
MQTT Android Client

Ib qho hauv Android (lossis iPhone) MQTT cov neeg siv khoom yuav ua haujlwm, tab sis kuv nyiam MQTT Dash. MQTT Dash yog ib qho yooj yim siv, teb tau zoo heev, thiab muaj txhua qhov kev xaiv uas koj xav tau.

Thaum tau teeb tsa, teeb tsa MQTT Server, sau cov neeg rau zaub mov, chaw nres nkoj, lub npe siv, thiab tus lej zais nrog koj qhov txiaj ntsig piv txwv, TSIS YOG koj cov ntaub ntawv nkag mus rau CloudMQTT. Koj tuaj yeem siv txhua tus neeg siv lub npe uas koj xav tau.

Yog tias koj ntaus txhua yam kom raug, nws yuav txuas ncaj qha rau koj li MQTT server thiab qhia koj lub vijtsam dawb vim koj tsis tau teeb tsa cov nyees khawm, ntawv, lossis xov tseem. Ntawm lub vijtsam dawb, koj pom "+" nyob rau sab xis saum toj, nyem rau nws, thiab tom qab ntawv xaiv "Xaiv/Khawm." Peb yuav ntxiv ib qho "Xaiv/Khawm" rau ib lub computer, yog li 8 lossis 16 lossis tsawg dua.

Yog tias koj tau txais qhov kev sib txuas yuam kev, koj muaj ib qho ntawm qhov tsis raug. Rov qab mus thiab tshawb xyuas ob zaug

Txhua lub khoos phis tawj yuav siv lub ncauj lus uas sib haum rau cov txiaj ntsig tau teev tseg hauv koj cov cai. Yog tias koj ua raws kuv cov lus pom zoo, lawv yuav yog "pawg/khib-01/khoos phis tawj/01". Nws yuav zoo tshaj los hloov qhov "on" thiab "off" qhov tseem ceeb kom phim peb cov cai. Hloov chaw "0" thiab "1", siv qhov tseem ceeb "ntawm" thiab "tawm," feem. Kuv kuj tseem yuav pom zoo siv QoS (1) txij li peb yuav cia siab tias yuav muaj kev lees paub los ntawm server.

Tom qab ntxiv ib qho, koj tuaj yeem nias ntev thiab siv qhov "clone" xaiv los tsim pawg, tom qab ntawd hloov lawv lub npe thiab cov ncauj lus.

Yooj yim txaus.

Kauj Ruam 9: Tau Txais Koj li ESP8266 ntawm Wifi

Tau Txais Koj ESP8266 ntawm Wifi
Tau Txais Koj ESP8266 ntawm Wifi

Siv ESP8266 Tus Thawj Tswj Wifi Tus Qauv, nws yog qhov yooj yim kom tau txais peb lub cuab yeej ntawm Wifi. Yog tias koj siv kuv chav kawm SensorBase, nws twb tau teeb tsa lawm. Yog tias tsis yog, ua raws cov lus qhia ntawm Tus Thawj Tswj Wifi's nplooj ntawv.

Tus Thawj Tswj Wifi yuav sim txuas rau koj tus SSID ntawm khau raj, uas nws tsis tuaj yeem txij li koj tsis tau hais qhia nws koj li SSID, yog li nws yuav cia li nkag mus rau hom kev nkag mus (lossis hom AP) thiab ua haujlwm yooj yim lub vev xaib nug koj li SSID & Lo lus zais. Siv koj lub xov tooj lossis lub khoos phis tawj, txuas lub network tshiab uas tsis muaj wireless txuas nrog SSID lub npe "ESP_xxxxxx," qhov twg "xxxxxx" yog qee qhov xwm txheej (tsis yog qhov tseeb). (Daim ntawv qhia tag nrho tuaj yeem pom ntawm tus Thawj Tswj Wifi page.)

Thaum txuas nrog, nqa koj lub vev xaib thiab taw tes rau 192.168.4.1, ntaus koj tus SSID & Password, thiab nyem tseg.

Tam sim no koj nyob hauv is taws nem, thiab koj lub cuab yeej IoT muaj ntu "Kuv" ua haujlwm!

Kauj Ruam 10: Kev Sib Txuas zaum kawg & Kev Xeem

Kev Sib Txuas zaum kawg & Kev Xeem
Kev Sib Txuas zaum kawg & Kev Xeem

Txhua yam ua tiav.

Txhawm rau nqes txhua yam, nrhiav koj lub khoos phis tawj lub zog khawm cable uas nws ua tau raws li lub niam ntawv. Koj yuav tsum pom ob kab ntawm lub taub hau nrog ib pawg ntawm cov xov hlau thiab cov txuas sib txuas. Feem ntau, lawv tau sau npe zoo nkauj. Unplug koj hloov thiab ntsaws rau qhov optoisolator plug. Kuv muab qee qhov "Dupont" ntsaws rau ntawm kuv, yog li lawv tau ntsaws ib yam li lub xov tooj hluav taws xob. Polarity ntawm qhov kawg no tsis muaj teeb meem tab sis xyuas kom tseeb tias koj muaj qhov sib txawv ntawm lwm qhov kawg raug - ib qho mus rau koj lub rooj tsav xwm kev cai.

Thiab nws ua haujlwm txig. Siv MQTT Dash tus thov kev pabcuam (lossis cov cuab yeej zoo sib xws), koj tuaj yeem siv lub zog ntawm koj lub khoos phis tawj nyob deb.

Nias lub khawm txheeb sib xws ntawm koj lub app, thiab thaum lub app hnov rov qab los ntawm MQTT server nrog cov lus "tawm", lub pob yuav hloov rov qab rau qhov tsis raug tshuaj xyuas.

Qhov no tau ua haujlwm ob peb lub lis piam yam tsis muaj teeb meem. Peb tau pom tias lub sijhawm ntev los rub lub khawm qis ntawm lub khoos phis tawj xav tau txuas ntxiv. Peb xaus nrog 1 puv thib ob. Tus nqi no tuaj yeem nthuav tawm raws li tus nqi tuaj yeem txiav txim siab los ntawm MQTT server, lossis koj tuaj yeem txuas tus nqi, nyob ntawm koj xav tau.

Hmoov zoo, thiab qhia rau kuv paub tias koj li kev tshwm sim zoo li cas.

Pom zoo: