Cov txheej txheem:

ESP8266 / Arduino RGB LED Christmas Lub Teeb Kho Kom Zoo Nkauj Qhov Rai: 5 Kauj Ruam (nrog Duab)
ESP8266 / Arduino RGB LED Christmas Lub Teeb Kho Kom Zoo Nkauj Qhov Rai: 5 Kauj Ruam (nrog Duab)

Video: ESP8266 / Arduino RGB LED Christmas Lub Teeb Kho Kom Zoo Nkauj Qhov Rai: 5 Kauj Ruam (nrog Duab)

Video: ESP8266 / Arduino RGB LED Christmas Lub Teeb Kho Kom Zoo Nkauj Qhov Rai: 5 Kauj Ruam (nrog Duab)
Video: Christmas light star with arduino 2024, Kaum ib hlis
Anonim
Image
Image
ESP8266 / Arduino RGB LED Christmas Lub Teeb Qhov Rooj Kho Kom Zoo Nkauj
ESP8266 / Arduino RGB LED Christmas Lub Teeb Qhov Rooj Kho Kom Zoo Nkauj
ESP8266 / Arduino RGB LED Christmas Lub Teeb Qhov Rooj Kho Kom Zoo Nkauj
ESP8266 / Arduino RGB LED Christmas Lub Teeb Qhov Rooj Kho Kom Zoo Nkauj

Nws yog lub sijhawm xyoo ntawd: Kaum Ob Hlis. Thiab hauv kuv cov neeg nyob ib puag ncig, txhua tus tau dai lawv lub tsev thiab lub qhov rais nrog qee qhov Christmas teeb. Lub sijhawm no, Kuv txiav txim siab tsim qee yam kev cai, tshwj xeeb, siv ESP8266 tus qauv thiab tsuas yog ob peb ntawm RGB LEDs. Koj tuaj yeem ua qhov no tib yam siv Arduino (Uno/Pro) module, tab sis nrog ESP module koj kuj tau txais nws wifi-ua haujlwm, rau kev tswj chaw taws teeb, teem sijhawm qhib/tua.

Cov khoom siv xav tau…

  • ESP8266 (NodeMCU module) lossis Arduino Uno/Pro/Pro Mini/thiab lwm yam. Cov ntawv qhia no yog rau ESP8266, tab sis nws kuj tseem siv rau lwm tus
  • Ib tus zuj zus tuaj yeem hais qhia RGB LED teeb sawb (WS2812 chips), pom zoo: 60 RGB LEDs/meter, 1 meter thooj
  • Qee cov xov hlau thiab cov laug
  • Ntev ntev micro-USB cable (nws yog USB powered)
  • Tog ntoo lossis tsuas yog ib lub thawv rau thav duab
  • Arduino IDE rau kev txhim kho software (saib cov qauv piv txwv ntawm qhov kawg ntawm kev qhia)

Qhov zoo tshaj plaws ntawm WS2812 RGB LED sawb yog qhov no, tam sim no pheej yig LED cov qauv yog tus kheej tuaj yeem hais qhia thiab raug kaw, yog li koj tsuas yog yuav tsum paub tseeb tias "cov ntaub ntawv" kab txuas los ntawm ib mus rau lwm qhov. Nws yog ib qho yooj yim tivthaiv rau tsob ntoo, vim tias tomqab txiav cov hlua LED rau hauv daim, koj tsuas yog yuav tsum tau txuas lawv nrog ib lub xaim. Lwm qhov txuas ob (+5V thiab hauv av), koj tuaj yeem txuas tau nyob txhua qhov chaw.

Txog qhov hais los ntawm tus lej, koj tuaj yeem pom tias cov chaw nyob ntawm cov pixels pib ntawm 0 (ze rau ntawm lub hauv paus ntoo) thiab mus rau 42, rau tag nrho ntawm 43 LEDs. Koj yog qhov pub dawb siv ntau dua lossis tsawg dua LEDs, tab sis tom qab ntawd koj yuav tsum hloov kho txoj cai.

Kev siv hluav taws xob rau kuv 43 teeb tsa LED yog li 360 mA max nrog cov cai tam sim no, tab sis kuv tsis tshaj tawm cov LEDs. Yog tias koj yuav qhib txhua lub LEDs, lub zog tag nrho, nws yuav muaj peev xwm siab dua 1A, yog li ceev faj!

Txoj cai tam sim no yog ib qho yooj yim, nws teeb tsa tag nrho cov LEDs rau ntsuab, thiab tom qab ntawd hloov lub pixel mus rau ib qho ntawm 6 xim palette txhua 0.5 vib nas this. Koj muaj kev ywj pheej hloov kho nws thiab sim nrog txhua tus qauv nyuaj.

Kauj Ruam 1: Txiav LED Sawb

Txiav LED Sawb
Txiav LED Sawb

Ua ntej, teeb tawm RGB LED kab txaij thiab txiav nws kom loj, los tsim tsob ntoo.

Kuv nyiam kom muaj 15 LEDs ua lub pob tw (ntsug), thiab tom qab ntawd 2 + 2, 4 + 4, 8 + 8 LEDs rau cov ceg ntoo, tab sis koj tuaj yeem muaj ntau dua lossis tsawg dua. Nco ntsoov tias tsuas yog txiav cov hlua ntawm cov tooj liab (txiav cov cim).

Kauj Ruam 2: Tsim Tus Qauv

Tsim Ncej
Tsim Ncej
Tsim Ncej
Tsim Ncej

Koj tsuas tuaj yeem siv daim ntawv los xij, tab sis kuv muaj qee (balsa) ntoo dag ib puag ncig thiab kuv xav tias nws zoo li me ntsis zoo dua, yog li kuv siv qhov ntawd. Kos tus qauv ntawm daim A4 los ntawm cov kauj ruam dhau los (qhov uas koj txiav cov LEDs), thiab txiav qee cov ntoo rau qhov loj me. Tom qab ntawd siv cov kua nplaum kub tso rau txhua qhov ua ke.

Kauj Ruam 3: Txuas cov kab xev LED rau ntawm tus ncej

Txuas cov kab xev LED mus rau tus ncej
Txuas cov kab xev LED mus rau tus ncej

Cov hlua LED muaj cov nplaum rau sab nraub qaum. Siv qhov ntawd los txuas cov kab xev rau tus ncej.

Tsis txhob muab daim kab xev (ntsug) thooj tsis tau, uas yuav tsuas yog cov kauj ruam kawg tom qab thaiv kab yuav luag txhua yam ntawm nws.

Nco tseg cov xub taw qhia ntawm kab txaij - uas yog cov lus qhia ntawm cov saw/cov ntaub ntawv! Koj yuav tsum muaj DI (cov ntaub ntawv hauv) ntawm sab xis, sab tes xis, thiab DO (cov ntaub ntawv tawm) ntawm sab laug ceg, sab laug tes. Peb xav kom muaj cov saw zoo thiab yooj yim ntawm txhua cov LEDs no. Nco tseg, lub zog (+5V, GND) yuav tsis raug kaw.

Kauj Ruam 4: Txuas Nws

Txuas Nws
Txuas Nws
Txuas Nws
Txuas Nws
Txuas Nws
Txuas Nws

Peb xav txuas cov ntaub ntawv, yog li ntawd txhais tau tias peb cov ntaub ntawv xov hlau yuav mus los ntawm ib ceg sab laug mus rau sab xis. Thiab ntawm chav kawm peb txuas tag nrho 3 cov xov hlau nyob hauv nruab nrab, qhov twg sab laug + txoj cai ceg sib ntsib.

Thaum qhov no ua tiav, peb yuav tsum xyuas kom muaj zog txhua qhov khoom, rau qhov ntawd, Kuv tau xaim dub nyob ntawm sab laug tes (ntsug) rau GND thiab nyob sab xis rau +5V.

Kauj Ruam 5: Txuas mus rau ESP8266 thiab Upload Sketch

Txuas mus rau ESP8266 thiab Tshaj Tawm Sketch
Txuas mus rau ESP8266 thiab Tshaj Tawm Sketch
Txuas mus rau ESP8266 thiab Tshaj Tawm Sketch
Txuas mus rau ESP8266 thiab Tshaj Tawm Sketch

Txuas tus pin los ntawm ESP8266:

+5V (VIN) - rau LED sawb +5V

GND - rau LED sawb GND

D7 rau LED kab txaij DataNote: yog tias koj siv Arduino Uno/Pro, tus pin no yuav txawv, tsuas yog nco ntsoov tias nws sib phim rau qhov chaws

Pib Arduino IDE, tsim/ntsaws qhov chaws (txuas nrog) hauv nws, tom qab ntawd xyuas kom tseeb tias Arduino IDE tau teeb tsa nrog cov chaw raug (qhov chaw nres nkoj, hom ntaus ntawv, nrawm), tom qab ntawd nias Compile + Upload.

Thaum nws ua tiav, cov hlua LED yuav ci thiab pib tso saib cov qauv. Koj yuav xav tau ntxiv Adafruit - Neopixel lub tsev qiv ntawv rau Arduino IDE (v1.8+). Koj kuj tseem tuaj yeem hloov kho txoj cai los tso saib cov qauv sib txawv, xav tias yuav sim.

Zoo siab heev Christmas!

Pom zoo: