Cov txheej txheem:

Hniav RGB Teeb Siv Arduino: 4 Cov Kauj Ruam
Hniav RGB Teeb Siv Arduino: 4 Cov Kauj Ruam

Video: Hniav RGB Teeb Siv Arduino: 4 Cov Kauj Ruam

Video: Hniav RGB Teeb Siv Arduino: 4 Cov Kauj Ruam
Video: RGB Electronic Clock Bluetooth Speaker rau lag luam khoom plig, Xov tooj Accessories Tuam Tshoj Hoob 2024, Kaum ib hlis
Anonim
Hniav RGB Teeb Siv Arduino
Hniav RGB Teeb Siv Arduino

Txij li Christmas ua ntej tsuas yog ib lub lim tiam dhau los, Kuv txiav txim siab tsim lub teeb pom kev zoo RGB yooj yim siv Arduino Nano thiab WS2812B LEDs. Peb siv qee lub ntim yas/rhawv zeb los txhim kho qhov pom kev. Cov vis dis aus no siv 5 LEDs tab sis qhov no tuaj yeem nce ntxiv kom haum rau koj cov kev xav tau. Koj tseem tuaj yeem ntxiv ntau yam qauv lossis tsim cov ntsiab lus xim raws qhov koj yuav mus.

Cov vis dis aus saum toj no tham koj txog txhua yam koj xav tau los tsim txoj haujlwm no thiab kuv xav pom nws ua ntej kom tau txais kev txheeb xyuas ntawm txhua yam ua ke li cas.

Kauj Ruam 1: Sau Cov Khoom Siv Hluav Taws Xob

Sau cov Electronics
Sau cov Electronics

Thawj qhov peb xav tau yog WS2812B RGB LEDs thiab cov no muaj nyob hauv ntau yam sib txawv. Ib qho twg yuav ua haujlwm zoo. Peb yuav siv Arduino Nano rau qhov kev tsim no, tab sis daim duab kos yuav ua haujlwm nrog yuav luag txhua pawg Arduino sib xws uas koj yuav muaj. Peb kuj xav tau qee cov hlau txuas txhua yam ua ke thiab kuv siv peb lub hauv paus, sib tw hlau rau qhov kev tsim no. Thaum kawg, peb xav tau cov yas ntim khoom uas yog cov khoom siv kom zoo nkauj xwb. Lub teeb pom kev tawm ntawm cov yas kom muab peb saib zoo.

Nov yog cov kab txuas rau cov khoom lag luam yog tias nws pab tau:

Arduino Nano:

WS2812B LEDs:

Twisted Wire:

Cov Thawv Yas:

Kauj ruam 2: Npaj & Rub Tawm Daim Duab

Npaj & Rub Tawm Sketch
Npaj & Rub Tawm Sketch
Npaj & Rub Tawm Sketch
Npaj & Rub Tawm Sketch
Npaj & Rub Tawm Sketch
Npaj & Rub Tawm Sketch
Npaj & Rub Tawm Sketch
Npaj & Rub Tawm Sketch

Peb yuav siv lub tsev qiv ntawv nrawm los tsav WS2812B LEDs tab sis koj tseem tuaj yeem siv Adafruit Neopixel lub tsev qiv ntawv yog tias qhov koj nyiam. Qhib Arduino IDE thiab ntaus "fastLED" hauv tus thawj tswj tsev qiv ntawv. Nruab ib lub tsev qiv ntawv uas pom thiab tom qab ntawd qhib qhov "DemoReel 100" piv txwv kos duab.

Peb yuav tsum hloov kho cov ntaub ntawv tus lej, tus naj npawb ntawm LEDs thiab hom LED. Kuv yuav siv tus pin 2, nrog 5 LEDs. Thov hloov kho hom LED rau WS2812B raws li pom hauv daim duab.

Tom qab ntawd, ntsaws rau hauv lub rooj tsavxwm, xaiv lub rooj tsavxwm raug thiab COM chaw nres nkoj. Thaum kawg, nyem lub pob upload thiab tos kom nws ua tiav uploading. Thaum ua tiav, txuas cov LEDs - 5V, GND thiab cov ntaub ntawv tus pin rau tus pin 2. Cov LEDs yuav tsum tso saib tus qauv tsis raug uas yog qhov qhia tias txhua yam ua haujlwm tau raws li qhov xav tau.

Kauj Ruam 3: Npaj LEDs rau Kev Tsim Kawg

Npaj LEDs rau Kev Tsim Tsa Kawg
Npaj LEDs rau Kev Tsim Tsa Kawg
Npaj LEDs rau Kev Tsim Tsa Kawg
Npaj LEDs rau Kev Tsim Tsa Kawg
Npaj LEDs rau Kev Tsim Tsa Kawg
Npaj LEDs rau Kev Tsim Tsa Kawg
Npaj LEDs rau Kev Tsim Tsa Kawg
Npaj LEDs rau Kev Tsim Tsa Kawg

Tom ntej no, peb yuav tsum txiav cov LEDs vim peb yuav siv xaim txuas ntxiv qhov ntev kawg. Thaum ua tiav, tshem cov LEDs los ntawm ib qho dej tsis tuaj yeem. Txiav cov xaim rau txhua tus LEDs thiab qhov ntev yuav nyob ntawm qhov chaw zaum kawg uas koj tau npaj rau. Kuv txiav txim siab siv tib lub xov hlau ntev rau txhua tus. Tsis tas li, txiav qee cov hlau uas yuav siv los txuas lub microcontroller rau thawj LED.

Tom qab ntawd, laum qee qhov hauv lub hau yas raws li peb yuav tau teeb tsa LEDs rau sab nrauv ntawm LED nrog lub nqaj ci ci sab hauv.

Kauj Ruam 4: Rooj Sib Tham Kawg

Los Ua Ke Kawg
Los Ua Ke Kawg
Los Ua Ke Kawg
Los Ua Ke Kawg
Los Ua Ke Kawg
Los Ua Ke Kawg

Pib los ntawm kev xaim cov xov hlau rau txhua tus LEDs. Xyuas kom koj txuas cov pins kom raug. Lub microcontroller xav tau txuas nrog DI (cov ntaub ntawv nkag) tus pin ntawm thawj LED. Tom qab ntawd, DO (cov ntaub ntawv tso tawm) tus pin xav tau txuas nrog DI tus pin ntawm LED tom ntej thiab ntxiv rau. Thaum koj tau muag tag nrho cov xov hlau, lub zog ON lub microcontroller thiab txhua lub LEDs yuav tsum pib ci nrog cov qauv tsis sib xws.

Kuv txiav txim siab siv daim kab xev ob sab los txuas cov LEDs rau sab saum toj ntawm lub hau, tab sis koj tseem tuaj yeem siv qee daim kab xev hla cov LEDs lossis qee cov kua nplaum. Nws raug nquahu kom ntxiv qee cov kab xev kapton lossis cov cua sov rau lub microcontroller board rau rwb thaiv tsev.

Thaum kawg, ntswj lwm qhov ib nrab ntawm lub khob ntim rau hauv qhov chaw thiab tso lub zog rau ntawm LEDs. Txhua lub LEDs siv li 60mA, yog li nco ntsoov tias lub zog siv hluav taws xob uas koj siv tau tuaj yeem xa lub zog xav tau. Peb tau tsim cov khoom siv fais fab yav dhau los uas tuaj yeem siv rau qhov no, yog tias xav tau.

Yog tias koj nyiam qhov kev tsim no, tom qab ntawv thov txiav txim siab tso npe rau peb YouTube channel raws li koj qhov kev txhawb nqa mus ntev hauv kev pab peb tsim cov ntsiab lus zoo li no.

YouTube:

Ua tsaug rau koj nyeem!

Pom zoo: