Cov txheej txheem:

Yooj Yim LED Nyiaj so koobtsheej Teeb Qhia: Wizards nyob rau lub caij ntuj no - WS2812B LED Sawb Nrog FastLED thiab Arduino Tutorial: 6 Cov Kauj Ruam
Yooj Yim LED Nyiaj so koobtsheej Teeb Qhia: Wizards nyob rau lub caij ntuj no - WS2812B LED Sawb Nrog FastLED thiab Arduino Tutorial: 6 Cov Kauj Ruam

Video: Yooj Yim LED Nyiaj so koobtsheej Teeb Qhia: Wizards nyob rau lub caij ntuj no - WS2812B LED Sawb Nrog FastLED thiab Arduino Tutorial: 6 Cov Kauj Ruam

Video: Yooj Yim LED Nyiaj so koobtsheej Teeb Qhia: Wizards nyob rau lub caij ntuj no - WS2812B LED Sawb Nrog FastLED thiab Arduino Tutorial: 6 Cov Kauj Ruam
Video: DAILY TOP NEWS UPDATE - THAM XOV XWM HNUB NO 02/04/2021 2024, Kaum ib hlis
Anonim
Image
Image

Kuv tsim thiab teeb tsa lub hnub so teeb pom kev zoo kom pom nyob txhua qhov chaw. Kuv siv ib qho WS2812B coj sawb nrog lub pixel ntom ntawm 30 pixels/ meter. Txij li thaum kuv siv 5 metres, kuv muaj tag nrho 150 LEDs. Kuv khaws cov cai yooj yim kom txhua tus neeg tshiab los siv WS2812B LED strips tuaj yeem ua raws cov cai yooj yim. Qhov no kuj txhais tau tias yog tias koj siv ntau qhov sib txawv ntawm pixels, lub sijhawm yuav tawm, yog li koj yuav tsum lo rau 150 LEDs. Tsis tas li, ua kom yooj yim, lub suab paj nruag tsis tau tswj hwm los ntawm Arduino txhua. Thaum pib ntawm txoj haujlwm, muaj 3 qhov ci ntawm ntsuab thiab 1 nyem ntawm liab, tom qab ntawd lub teeb pom kev zoo pib. Txij li thaum koj yuav tsum pib lub suab paj nruag los ntawm tus kheej, cov kev pib ua ntej no yog muab rau koj pom tias thaum twg yuav pib ua suab paj nruag. Kuv tau suav nrog cov cai hauv qab no. Xav tias dawb los ntxiv rau lossis hloov cov cai no rau lub hom phiaj tsis yog lag luam.

Khoom siv

- WS2812B LED Sawb

-Ua Arduino

- Cov xov hlau

- 5V 10A Fais Fab Khoom | Yog tias koj siv ntau dua ib txoj hlua, koj yuav tsum siv lub zog loj dua. Txhua lub pixel siv 60mA, yog li 150 pixels * 60mA = 9A. Koj lub zog siv hluav taws xob yuav tsum muaj peev xwm los daws qhov no yog tias koj npaj siab siv qhov ci ci ntawm qhov dawb. Koj yuav tsum siv lub zog 5V yog tias koj siv 5V LED kab txaij thiab yog tias koj siv 12V LED kab txaij, koj yuav tsum siv lub hwj chim 12V, tab sis kuj tseem siv 12-5V hloov hluav taws xob rau 5V Arduino.

Kauj Ruam 1: Rub tawm FastLED Library

Txhais qee Qhov Hloov Pauv
Txhais qee Qhov Hloov Pauv

Yog tias koj tseem tsis tau muaj lub tsev qiv ntawv FastLED rub tawm, rub tawm qhov hloov tshiab los ntawm github.com/FastLED/FastLED/releases

Rub tawm lub tsev qiv ntawv FastLED, thiab txav nws mus rau koj lub tsev qiv ntawv qiv Arduino. TSIS TXHOB hloov lub npe ntawm daim nplaub tshev no. Hauv Arduino IDE, mus rau Sketch, suav nrog Lub Tsev Qiv Ntawv, thiab tom qab ntawd ntxiv. ZIP Library. Xaiv lub FastLED nplaub tshev.

Thaum koj lub tsev qiv ntawv tau teeb tsa, suav nrog kab #include Kab ntawv no qhia qhov haujlwm uas koj tab tom siv lub tsev qiv ntawv ntawd.

Kauj Ruam 2: Txheeb cais Qhov Tseeb Tseeb

Raws li kuv tau hais ua ntej, txhawm rau ua kom cov cai yooj yim, hloov tus lej pixels yuav hloov lub sijhawm lossis teeb pom kev zoo.

Kab #define NUM_LEDS 150 yog qhov uas koj tso tus lej pixels siv. Hauv qhov no, nws yuav yog 150.

Kab #define DATA_PIN 5 yog qhov uas koj tso tus lej digital uas koj txuas nrog cov ntaub ntawv xaim rau.

Kab #define BRIGHTNESS 255 yog qhov uas koj muab qhov ci ci los ntawm qhov ntsuas ntawm 0-255, nrog 255 yog qhov ci tshaj plaws.

Kauj Ruam 3: Tshooj Teeb ntawm Txoj Cai

Teeb Tshooj ntawm Txoj Cai
Teeb Tshooj ntawm Txoj Cai

Hauv ntu teeb tsa, muaj kev ncua sijhawm 2 vib nas this thiab kab

FastLED.addLeds (leds, NUM_LEDS).setCorrection (TypicalLEDStrip);

WS2812B qhia txog hom LED sawb uas peb siv thiab DATA_PIN yog qhov sib txawv uas peb tau hais tseg hauv ib qib dhau los. GRB yog xim xaj. Qhov no tuaj yeem sib txawv nyob ntawm seb cov hlua LED siv. Sim cov cai ib yam, thiab yog tias cov xim tsis zoo ib yam li hauv cov vis dis aus, sim hloov qhov no mus rau RGB, lossis BRG piv txwv. Koj tuaj yeem tso tus so ntawm kab no tib yam. Cov kab

FastLED.setBrightness (max_bright); set_max_power_in_volts_and_milliamps (5, 8000);

txwv lub zog siv ntawm LED sawb. Nov yog qhov ua tau zoo kawg los ntawm lub tsev qiv ntawv FastLED. Tus lej 5 yog qhov hluav taws xob uas peb siv, thiab tus lej 8000 yog qhov siab tshaj tam sim no uas cov hlua LED tuaj yeem siv hauv mA. Nws tau pom zoo kom siv tsuas yog 80% ntawm lub zog siv lub peev xwm los txuas nws lub neej. Txij li thaum kuv muaj 10A fais fab mov, 0.8*10 = 8A, lossis 8000mA.

Kauj Ruam 4: Tshooj Loop | Aka, Qhov Zoo Tshaj ntawm Txoj Cai

Tshooj Loop | Aka, Qhov Zoo Tshaj ntawm Txoj Cai
Tshooj Loop | Aka, Qhov Zoo Tshaj ntawm Txoj Cai
Tshooj Loop | Aka, Qhov Zoo Tshaj ntawm Txoj Cai
Tshooj Loop | Aka, Qhov Zoo Tshaj ntawm Txoj Cai

Tam sim no peb tau ua tiav teeb tsa txoj haujlwm rau peb tshwj xeeb LED sawb, peb tuaj yeem tau txais ib feem qhov ua rau cov kab teeb ci. Txhawm rau kom ntu no saib huv si, Kuv tau siv cov haujlwm los tswj cov kab txaij thiab ua cov teebmeem sib txawv. Daim duab saum toj no mus rau sab laug yog ib feem ntawm ntu ntu, uas ua haujlwm cov haujlwm. Daim duab ntawm sab xis yog hauv qab no thiab yog qhov uas kuv tau sau dab tsi txhua txoj haujlwm ua.

Kauj Ruam 5: Kev thaiv kab

Thaiv
Thaiv

WS2812B LED strips muaj 3 lub dav hlau ntawm txhua qhov kawg. 2 rau lub zog, thiab 1 rau cov ntaub ntawv teeb liab los ntawm peb Arduino. Cias txuas 2 lub xov hlau mus rau Arduino lub zog txuas hluav taws xob, thiab txuas 2 lub xov tooj hluav taws xob mus rau LED sawb. Koj tseem yuav tsum ntxiv 2 lub xov tooj hluav taws xob hu ua lub zog txhaj tshuaj txuas mus rau qhov kawg ntawm kab txaij vim tias qhov poob hluav taws xob tuaj yeem ua rau LEDs qis thaum kawg ntawm kab txaij yog tias koj tsis ua qhov no. Txheeb cov ntawv lo ntawm kab txaij kom pom lub davhlau ya nyob twg yog rau dab tsi. Sib tov cov polarity tuaj yeem ua rau kib kib. Tsis tas li, txuas Arduino cov xov hlau hauv av rau hauv av xaim ntawm LED sawb txhawm rau tsim kom muaj av zoo rau xa cov ntaub ntawv zoo dua. Kuv tau hais tias koj yuav tsum ntxiv cov xov hluav taws xob txhaj tshuaj, tab sis koj TSIS TXHOB ua qhov no rau cov ntaub ntawv xaim. Qhov no yog vim txhua qhov LED rov nthuav tawm cov ntaub ntawv teeb liab mus rau qhov tom ntej, yog li nco ntsoov txuas 1 cov ntaub ntawv xov hlau mus rau qhov tshwj xeeb Arduino tus pin thiab cov hlua LED. Cov hlua yuav tsum muaj lub xub me me qhia qhov kev taw qhia ntawm cov ntaub ntawv mus ncig. Xyuas kom tseeb tias muab cov ntaub ntawv teeb liab xaim thaum pib thiab tsis yog qhov kawg. Sib tov qhov no tuaj yeem ua rau kib kib.

Kauj Ruam 6: Mounting LED Sawb

Kuv tau teeb tsa kuv daim kab xev LED rau sab hauv ntawm lub qhov rais los ntawm kev yooj yim kaw nws. Txawm li cas los xij, muaj ntau txoj hauv kev uas koj tuaj yeem txhim kho koj cov hlua LED. Koj tuaj yeem siv cov txheej txheem txhuas xws li https://tinyurl.com/s2km4v3 txhawm rau muab cov kab xev sab nraum ntawm koj lub ru tsev. Yog tias koj tso koj cov hlua LED sab nraum, kuv pom zoo siv cov kab ip65 yog tias koj tab tom siv aluminium channel vim tias lawv tsis muaj dej ib nrab, thiab ntais dua 1p67, uas tej zaum yuav tsis haum rau qee txoj hauv kev. Yog tias koj npaj siab yuav nce qhov no sab nraud yam tsis muaj channel, siv cov kab IP67, uas yog cov dej tsis haum. Txhawm rau mus ib ncig ntawm lub ces kaum, xws li cov nyob rau ntawm qhov siab ntawm koj lub ru tsev, koj yuav tsum tau txiav txim siab txiav txoj hlua, thiab siv xov hlau mus ncig ib ncig ntawm lub ces kaum. Koj tuaj yeem tuaj yeem nyob deb nrog tsuas yog khoov kab txaij, tab sis ceev faj txog qhov koj khoov ntau npaum li cas vim tias nws yooj yim rau tawm ntawm LED.

Pom zoo: