Cov txheej txheem:

Addressable Sawb LED Tub Ceev Xwm Strobo: 4 Kauj Ruam
Addressable Sawb LED Tub Ceev Xwm Strobo: 4 Kauj Ruam

Video: Addressable Sawb LED Tub Ceev Xwm Strobo: 4 Kauj Ruam

Video: Addressable Sawb LED Tub Ceev Xwm Strobo: 4 Kauj Ruam
Video: DIY 8' LED TUBE LIGHTS 2024, Kaum ib hlis
Anonim
Image
Image

Qhov Tub Ceev Xwm Strobo Teeb Bar no tau ua nrog ib tus WS2812B chaw nyob sawb LED bar (97 cm, 29 LEDS) thiab Arduino Nano.

Qhov kev daws teeb meem no tso cai ua ob peb lub teeb sib txawv nrog cov xim sib txawv uas tsis tuaj yeem ua tau nrog tus qauv Liab-Dawb-Xiav LEDs bar (raws li siv rau tub ceev xwm teeb lub teeb) lossis RGB LEDs bar.

Kuv xav kom tsis txhob siv qhov no hauv koj lub tsheb tshwj tsis yog koj tau txheeb xyuas cov cai hauv nroog thiab muaj cai raug cai/siv tau los ua li ntawd.

Kauj Ruam 1: Yuav Ua Li Cas WS2812B Sawb LEDs Ua Haujlwm

Kev Txuas Hluav Taws Xob
Kev Txuas Hluav Taws Xob

WS2812B LED sawb suav nrog hom 5050 RGB LEDs uas WS2812B LED tsav tsheb IC tau koom ua ke.

Nyob ntawm qhov siv ntawm peb tus neeg Liab, Ntsuab, thiab Xiav LEDs nws tuaj yeem sim ua xim twg peb xav tau.

Qhov zoo tshaj plaws ntawm cov LEDs no yog qhov nws tuaj yeem tswj tau txawm tias tag nrho cov kab hluav taws xob LED nrog tsuas yog ib tus pin los ntawm peb pawg thawj coj saib Arduino.

Txhua LED muaj peb qhov txuas ntawm txhua qhov kawg, ob qho rau lub zog thiab ib qho rau cov ntaub ntawv. Cov xub qhia cov ntaub ntawv ntws. Cov ntaub ntawv tso tawm cov ntaub ntawv ntawm yav dhau los LED tau txuas nrog Cov Ntaub Ntawv Tso Tawm ntawm LED tom ntej. Peb tuaj yeem txiav cov kab txaij rau txhua qhov loj me uas peb xav tau, ntxiv rau nrug LEDs siv qee cov xov hlau.

Lawv ua haujlwm ntawm 5V DC thiab txhua tus liab, Ntsuab thiab Xiav LED kos ib puag ncig 20mA, lossis qhov ntawd yog 60mA rau txhua LED ntawm qhov ci ci.

Yog tias Arduino tau siv hluav taws xob los ntawm USB, 5V tus pin tuaj yeem ua haujlwm ib puag ncig 400 mA, thiab thaum siv lub hwj chim txuas txuas, 5V tus pin tuaj yeem ua haujlwm ib puag ncig 900 mA. Yog li yog tias koj siv LEDs ntau dua thiab cov nyiaj tam sim no uas lawv yuav kos ntau tshaj qhov txwv tau hais tseg saum toj no, koj yuav tsum siv cais 5V lub hwj chim cais.

Hauv qhov xwm txheej zoo li no koj kuj yuav tsum txuas ob kab hauv av ob leeg ib leeg.

Ib qho ntxiv nws tau pom zoo kom siv tus tiv thaiv ib puag ncig ntawm 330 Ohms nruab nrab ntawm Arduino thiab LED cov ntaub ntawv xov tooj tus pin txhawm rau txhawm rau txo cov suab nrov ntawm kab ntawd, ntxiv rau lub peev xwm ntawm ib puag ncig 100uF hla 5V thiab Hauv av kom du tawm lub zog siv..

Kauj Ruam 2: Kev Txuas Hluav Taws Xob

Cov phiaj xwm txuas mus txuas rau Arduino nano mus rau WS2812B qhov chaw nyob sawb LED bar yog yooj yim heev.

Tus qauv yuav tsum muaj cov xov hlau lossis tus pin header soldered rau nws, Kuv siv tus pin header rau kev sim tab sis rau qhov haujlwm tiag tiag koj yuav tsum txiav txim siab soldering cov xov hlau.

WS2812B cov kab lus hais tau coj tau muaj 3 daim kab xev ntawm txhua sab.

+5V (xaim liab hauv txoj haujlwm) mus rau +5V ntawm Arduino;

GND (xaim dub hauv txoj haujlwm) mus rau GND ntawm Arduino;

DIN (cov xaim ntsuab hauv cov phiaj xwm) mus rau Arduino PIN 5 (rau cov ntaub ntawv) hla 330 Ohm resistor.

Kauj ruam 3: Teeb Code

Kuv siv Arduino IDE nrog FAST LED Library

Ua ntej peb yuav tsum suav nrog FastLED lub tsev qiv ntawv, txheeb tus pin uas LED cov ntaub ntawv txuas tau txuas nrog, txheeb tus lej ntawm LEDs, ntxiv rau txhais cov kab ntawm hom CRGB.

Hom no muaj cov LEDs, nrog peb ib-byte cov tswv cuab cov ntaub ntawv rau txhua ntawm peb qhov liab, Ntsuab thiab Xiav xim.

Hauv kev teeb tsa ntu peb tsuas yog xav tau pib ua FastLED nrog cov ntsuas tsis tau teev tseg saum toj no. Tam sim no nws yog lub voj loj peb tuaj yeem tswj hwm peb cov LEDs yam peb xav tau. Siv CRGB ua haujlwm peb tuaj yeem teeb ib qho LED rau ib qho xim twg siv peb qhov ntsuas ntawm Liab, Ntsuab thiab Xiav xim. Txhawm rau ua kom qhov kev hloov pauv tshwm sim ntawm LEDs peb yuav tsum hu lub luag haujlwm FastLED.show ().

Lub tsev qiv ntawv FastLED nta ntau lwm yam haujlwm uas tuaj yeem siv rau kev ua kom pom cov duab zoo nkauj thiab pom kev zoo, yog li nws tsuas yog nyob ntawm koj lub tswv yim kom ua rau koj qhov project tom ntej ci.

Kuv tus lej suav nrog ntau yam qauv LED sib txawv uas tsis tuaj yeem ua tau nrog tus qauv RGB LED bar.

Cov qauv tuaj yeem hloov kho lossis rov hais dua hauv qhov tsis muaj dab tsi voj () ntu raws li ib ntu nkaus xwb.

Kauj Ruam 4: Lus Cim Kawg

Kuv tus lej sau los ntawm kev hloov pauv ntawm txhua tus qauv los muab koj lub hauv paus pib hloov kho cov cai kom tau raws li qhov koj xav tau.

Code hauv kuv GitHub

Pom zoo: