Cov txheej txheem:

WiFi Tswj RGB LED Sawb Nrog ESP8266: 5 Cov Kauj Ruam
WiFi Tswj RGB LED Sawb Nrog ESP8266: 5 Cov Kauj Ruam

Video: WiFi Tswj RGB LED Sawb Nrog ESP8266: 5 Cov Kauj Ruam

Video: WiFi Tswj RGB LED Sawb Nrog ESP8266: 5 Cov Kauj Ruam
Video: 20 MOMENTS YOU WOULDN'T BELIEVE IF NOT FILMED 2024, Hlis ntuj nqeg
Anonim
Image
Image
Sau tag nrho Cov Khoom Siv & Cov Cuab Yeej
Sau tag nrho Cov Khoom Siv & Cov Cuab Yeej

Lub tswv yim yog los tsim lub teeb ci LED uas tuaj yeem tswj tau los ntawm WiFi. Kuv muaj qee qhov khoom seem LED los ntawm Christmas dag ib puag ncig, yog li kuv rov ua dua qhov no rau ESP8266 uas tso cai rau LED tswj los ntawm WiFi.

ESP8266 tuaj yeem ua haujlwm li webserver, qhov no yuav raug siv los tsim Cov Chaw Taws Teeb los tswj LED Sawb. Cov kab hluav taws xob LED uas kuv muaj yog 12V, yog li kuv yuav xav tau 12 V fais fab rau qhov no, txwv tsis pub yog tias koj muaj 5V LED, koj tuaj yeem siv hluav taws xob LED sawb los ntawm tib lub zog siv hluav taws xob ESP8266 Circuit.

Kauj Ruam 1: Sau tag nrho Cov Khoom Siv & Cov Cuab Yeej

Rau qhov no koj yuav xav tau cov ntaub ntawv hauv qab no:

1 x ESP8266

3 x MOSFET IRF510

- RGB LED Sawb

- Pawg thawj coj

- Txuas Hlau

- 12 V Fais fab mov rau LED Sawb

- 5 V Hwj chim rau ESP8266

Cov hauv qab no yog cov cuab yeej uas koj yuav xav tau:

- Hlau stripper

- Soldering Hlau

- Multimeter (Cov cuab yeej siv tau rau teeb meem tua)

Kauj ruam 2: Txuas lub Circuit Court

Txuas lub Circuit Court
Txuas lub Circuit Court
Txuas lub Circuit Court
Txuas lub Circuit Court

Txuas lub Circuit Court raws li daim duab saum toj no. Peb xav tau 3 MOSFET txhawm rau txhawm rau 3 xim (RED, GREEN, BLUE) ntawm LED. Nco ntsoov tias kuv tsis siv tus kheej qhov chaw nyob LED sawb. Rau qhov ntawd koj yuav xav tau kev sib txuas sib txawv.

Siv 3 xim ntawm LED, peb tuaj yeem tsim ntau xim ntxiv. Rau lub hom phiaj kev kawm, nws yog qhov zoo uas tuaj yeem qhia cov menyuam txog qib xim thawj, thiab kev sib xyaw ua ke ua lwm yam xim.

Ib qho ntxiv uas yuav tsum nco ntsoov yog koj yuav tsum tau ua kom ntseeg tau tias GND ntawm 12 V lub zog xa khoom txuas nrog GND ntawm 5V lub zog xa khoom. Lwm txoj hauv kev yog koj tuaj yeem siv 12V lub zog xa hluav taws xob rau 5V siv 5V tus tswj hwm LM7805.

Kauj Ruam 3: Txhim Kho Txoj Cai Los Ntawm Arduino Interface

Txhim Kho Txoj Cai Los Ntawm Arduino Interface
Txhim Kho Txoj Cai Los Ntawm Arduino Interface
Txhim Kho Txoj Cai Los Ntawm Arduino Interface
Txhim Kho Txoj Cai Los Ntawm Arduino Interface

Koj tuaj yeem rub tawm cov cai uas kuv tau siv los ntawm kuv lub vev xaib hauv qhov chaw hauv qab no. Txoj cai yuav xav tau lub tsev qiv ntawv hauv qab no los khiav.

- ESP8266WiFI

ESP8266Webserver

- Arduino OTA

Thaum koj thauj cov cai hauv Arduino interface, muaj ob peb yam uas koj xav tau los teeb tsa.

1. Hloov cov hauv qab no los taw tes rau koj li wifi ssid thiab password

/* Network nqis*/const char* ssid = "yourWIFISSID"; // SSID - koj lub WiFi lub npe const char* password = "yourwifipassword"; // Lo lus zais

2. Hloov tus IP chaw nyob kom pom koj lub Router subnet, thiab nco ntsoov tias tsis muaj cov khoom siv nyob hauv tib tus IP chaw nyob.

Tus IP chaw nyob IP (192, 168, 1, 111); // IP chaw nyob zoo li qub ntawm ntaus IPAddress rooj vag (192, 168, 1, 1); // Gatway IPAddress subnet (255, 255, 255, 0); // Network npog

3. Hloov pauv OTA (Ntawm qhov hloov pauv huab cua) tus lej zais hauv Tshooj Teeb nyob ib ncig ntawm kab 62.

// OTA code ArduinoOTA.setHostname ("LEDStrip"); ArduinoOTA.setPassword ((const char *) "ledstripOTApassword"); ArduinoOTA.begin ();

Kauj Ruam 4: Tshaj Tawm Txoj Cai rau ESP8266

Tshaj Tawm Txoj Cai rau ESP8266
Tshaj Tawm Txoj Cai rau ESP8266
Tshaj Tawm Txoj Cai rau ESP8266
Tshaj Tawm Txoj Cai rau ESP8266

Thaum koj tau teeb tsa txoj cai kom haum rau koj li teeb tsa WiFi, nws yog lub sijhawm los rub cov cai rau ESP8266. Nco ntsoov tias koj xaiv qhov chaw nres nkoj raug qhov twg koj ESP8266 txuas nrog. Hauv qhov piv txwv saum toj no, Kuv muaj kuv li ntawm /dev/cu.wchusbserial14750, qhov no yuav txawv ntawm koj lub PC lossis Mac.

Tom qab ntawv xaiv Sketch-> Upload.

Tos kom txog thaum rub tawm tiav. Yog tias txhua yam mus tau zoo ESP8266 yuav tsum txuas rau koj lub router WiFi thiab muaj IP chaw nyob ntawm 192.168.1.111. Qhov no yuav txawv yog tias koj tau hloov nws hauv cov kauj ruam dhau los. Taw koj tus browser rau tus IP chaw nyob ntawd, https://192.168.1.111, koj yuav tsum pom LED tswj chaw taws teeb raws li qhia hauv daim duab.

Nyem rau ntawm cov xim kom hloov xim ntawm LED raws li koj qhov kev xav, thiab txaus siab.

Kauj Ruam 5: Kev txhim kho yav tom ntej

Tam sim no koj muaj WiFi ua haujlwm tswj tau RGB LED sawb, koj tuaj yeem ua si ib puag ncig nrog cov cai los ntxiv ntau qhov sib xyaw ua ke ntawm cov teeb disco. Qee qhov kev pom zoo ntawm kev txhim kho yav tom ntej suav nrog:

- Txuas lub Circuit Court mus rau MQTT kom koj tuaj yeem tswj hwm nws hauv internet

- Ntxiv rau kev tshawb nrhiav lub suab, kom qhib lub teeb ci rau lub teeb hmo ntuj

- Ntxiv cov cai rau hom sib txawv uas ntsais (Flash, Strobe, Fade, Smooth), cov khawm tam sim no tsis ua haujlwm.

- Hloov lub teeb xim raws Music.

Qhov ntawd yog txhua yam, Kuv vam tias koj txaus siab rau cov ntawv no. Thiab yog tias koj nyiam qhov no, koj tuaj yeem pov npav rau kuv hauv kev sib tw teeb pom kev zoo. Koj tuaj yeem mus ntsib kuv lub vev xaib rau lwm qhov haujlwm yooj yim IoT.

Koj tseem tuaj yeem tso kuv cov lus tawm tswv yim rau kev txhim kho yav tom ntej uas koj xav pom, yog li kuv tuaj yeem siv lub tswv yim no los tshaj tawm cov lus qhia tom ntej.

Pom zoo: