Cov txheej txheem:

WS2812-B LED Nrog ATMEGA328 UNO V3.0 R3 Board: 11 Kauj Ruam
WS2812-B LED Nrog ATMEGA328 UNO V3.0 R3 Board: 11 Kauj Ruam

Video: WS2812-B LED Nrog ATMEGA328 UNO V3.0 R3 Board: 11 Kauj Ruam

Video: WS2812-B LED Nrog ATMEGA328 UNO V3.0 R3 Board: 11 Kauj Ruam
Video: DIY Pixel Light Addressable 5050 RGB Circle 5V WS2812B LED Ring 2024, Kaum ib hlis
Anonim
WS2812-B LED Nrog ATMEGA328 UNO V3.0 R3 Board
WS2812-B LED Nrog ATMEGA328 UNO V3.0 R3 Board

Nqe lus piav qhia

Txoj haujlwm no suav nrog ICStation WS2812-B Programmable Colorful LED Board nrog ATMEGA328 UNO V3.0 R3 Board Sib Xws Arduino UNO R3 los tsim kev pom kev. Dab tsi ntxiv, yog tias koj muaj "Disco" ntsiab lus tog, koj yuav nyiam nws. Cia kuv qhia koj yuav ua li cas ua ib yam ntawm cov no.

Kauj Ruam 1: Qhov Yuav Tsum Tau:

Qhov Yuav Tsum Tau
Qhov Yuav Tsum Tau

· Arduino UNO (lossis pawg thawj coj saib tau) · 4 x WS2812-B Programmable Colorful LED Board

· 330 ohm resistor

· 4700 uF 16V Electrolytic Capacitor

· Daim ntawv qhia zaub mov

· Poj niam rau Txiv neej Jumper xov hlau

· Breadboard Jumper xov hlau

· 2.1mm DC Qhov (Socket) nrog Cov Ntsia Hlau

· 5V 4A Plugpack fais fab mov

Nco tseg: kev txhawb nqa txoj haujlwm no siv cov roj teeb tuaj yeem ua tau, tab sis tsis pom zoo, thiab ua tiav ntawm koj tus kheej txoj kev pheej hmoo.

Koj tseem yuav xav tau Disco Ball Cake uas koj yuav tsum tau ua (lossis yuav). Kuv tus poj niam tau ua qhov no. Thiab raws li koj yuav pom sai sai, ncuav mog qab zib sab hauv yog Paj yeeb, vim nws yog ncuav mog qab zib strawberry.

Arduino Libraries thiab IDE Koj tuaj yeem tau txais Arduino IDE los ntawm no: https://www.arduino.cc/en/Main/Software Kuv tau siv version 1.6.4, uas yog tej zaum txoj hauv kev tsis dhau … tab sis ua haujlwm tau zoo txawm li cas los xij.

Koj tuaj yeem tau txais cov ntaub ntawv hais txog yuav siv lub tsev qiv ntawv FastLED li cas ntawm no: https://fastled.io/ Thiab koj tuaj yeem rub tawm nws los ntawm no: FastLED Library Kuv tau siv version 3.0.3, uas kuj tseem yog hnub qub.

Kauj Ruam 2: ARDUINO CODE:

Kauj Ruam 3: ARDUINO CODE DESCRIPTION:

· FastLED Library: Koj yuav tsum paub tseeb tias koj tau rub tawm thiab teeb tsa lub tsev qiv ntawv FastLED rau hauv koj li Arduino IDE. Lub tsev qiv ntawv suav nrog hauv daim duab no txwv tsis pub FastLED cov haujlwm yuav tsis ua haujlwm.

· Qhov "NUM_LEDS" sib txawv: qhia rau Arduino muaj pes tsawg LEDS siv. Hauv qhov no, peb muaj 4 lub nplhaib LED, nrog txhua lub nplhaib LED muaj 16 LEDs, thiab yog li ntawd tag nrho ntawm 64 LEDs. Yog tias koj txhais tus lej qis dua, piv txwv li 16, tom qab ntawd daim duab kos tsuas yog ua kom pom cov LED ntawm thawj lub nplhaib LED.

· Qhov "DATA_PIN" sib txawv: qhia rau Arduino uas Digital Pin siv los xa cov ntaub ntawv mus rau lub nplhaib LED. Hauv qhov no, Kuv tab tom siv Digital Pin 9.

· Lwm qhov kev hloov pauv: Kuv muaj ob peb lwm qhov kev hloov pauv uas tau siv rau LED randomization thiab tswj cov xim. Hawj txawm yog xim ntawm LED. Los ntawm kev nce cov xim sib txawv, koj tuaj yeem tau txais LEDs mus rau hauv cov qauv zoo li zaj sawv. Qhov "hue" sib txawv yog "byte", uas txhais tau tias nws tsuas yog nce mus txog tus nqi siab tshaj ntawm 255, ua ntej nws dhia rov qab mus rau xoom.

Txoj Cai Pib Ua Ntej: Yog tias koj muaj lub nplhaib LED sib txawv rau ib qho hauv qhov kev qhia no, koj yuav tsum tau hloov kho tus lej pib ua ntej. Lub nplhaib LED no muaj WS2812-B chipset (raws li ICStation lub vev xaib), thiab yog li kab no:

· FastLED.addLeds (leds, NUM_LEDS); Yuav qhia rau FastLED lub tsev qiv ntawv uas siv cov chipset (NEOPIXEL), tus pin siv rau kev xa cov ntaub ntawv (DATA_PIN), LED teeb kom raug tswj (leds), thiab tus lej ntawm LEDs kom raug tswj (NUM_LEDS). · Hauv " voj () ": ntu ntu ntawm cov cai: qhov sib txawv" hue "tau nce ntxiv los tsim cov zaj sawv, thiab xaiv ib qho LED raug xaiv siv FastLED's random8 () muaj nuj nqi.

· Kev ua haujlwm random8 (x): yuav xaiv tus lej los ntawm 0 txog x.

· Qhov randomSeed () muaj nuj nqi: yog muaj los pab "randomise randomise" tus lej. Qhov no tau pab los ntawm kev nyeem qhov tsis sib xws ntawm cov floating analogPin (A0). Nws tsis tas yuav yog analogPin 0, nws tuaj yeem yog yam tsis siv tus lej analog.

· Leds [rnd].setHSV (hue, 255, 255): Cov kab no teeb tsa lub teeb pom kev zoo kom muaj qhov hue sib npaug rau "hue" sib txawv, saturation sib npaug rau 255, thiab ci sib npaug rau 255. Saturation sib npaug rau xoom yuav ua rau LED ci dawb. Brightness ntawm xoom yeej tseem zoo tig LED OFF.

· FastLED.show (): Tsis muaj kev hloov pauv ntawm lub cev yuav ua rau lub ntsej muag LED lub ntsej muag kom txog thaum cov lus xa los ntawm Arduino mus rau Digital input pin ntawm lub nplhaib LED. Cov lus no tau xa mus thaum koj hu rau FastLED.show (); muaj nuj nqi Qhov no qhia rau LED rings txhawm rau hloov kho lawv cov zaub nrog cov ntaub ntawv muaj nyob hauv cov khoom coj (leds). Yog li yog tias koj teeb tsa txhua lub LEDs kom qhib, lub rooj tsavxwm yuav tsis teeb lub LEDs kom txog thaum FastLED.show (); muaj nuj nqi hu ua. Qhov no yog qhov tseem ceeb kom paub - tshwj xeeb tshaj yog thaum sim tsim koj tus kheej ntu LED.

· Qhov ncua (50) kab: yuav teeb lub sijhawm nruab nrab ntawm qhov muag pom rau 50 milliseconds. Koj tuaj yeem hloov qhov kev ncua kom nce lossis txo tus lej ntawm qhov muag ib pliag.

· Cov leds .fadeToBlackBy (180) muaj nuj nqi: qhov tseem ceeb ploj ntawm LEDS los ntawm 180 units. Koj tuaj yeem nce lossis txo tus lej no kom ua tiav qhov xav tau nrawm nrawm. Ceeb toom txawm li cas los xij, yog tias koj tsis nco qab hu lub luag haujlwm no lossis yog tias koj tsis ua kom cov LEDs puas txaus, tom qab ntawv koj tuaj yeem xaus nrog TXHUA LEDs tig rau, uas tuaj yeem ua rau koj lub Arduino pawg thawj coj saib tsis tau - piv txwv li nyob ntawm seb muaj pes tsawg tus LED rings koj muaj, thiab koj tau xaiv li cas los txhawb lawv.

Kauj Ruam 4: Lub Ncuav Qab Zib

Lub Ncuav Qab Zib
Lub Ncuav Qab Zib

· Swb 1 - Phaj Phaj: Nws yog ib qho tseem ceeb los tsim lub hauv paus phaj nrog txhua yam khoom siv hluav taws xob uas haum thiab ua haujlwm ua ntej ua ntej koj muab lub ncuav mog qab zib tso rau nws. Sim ua kom haum cov xov hlau/kab hluav taws xob LEDs thiab cov kab hluav taws xob nyob hauv qab phaj thaum muaj Cov Ncuav Qab Zib ontop yog daim ntawv qhia rau kev puas tsuaj. Yog li npaj lub hauv paus phaj ua ntej, thiab tom qab ntawd txav mus rau lub ncuav qab zib ua ib feem tom qab.

· Xaub 2 - Ci Ncuav Qab Zib: Koj yuav xav tau ob peb lub ncuav qab zib hauv lub lauj kaub los ua ob sab ntawm lub npas. Koj yuav tsum ua lub ncuav mog qab zib uas hnyav kom tiv taus qhov hnyav tag nrho ntawm lub ncuav mog qab zib, icing thiab fondant, thiab kom tswj tau nws lub cev. Thaum txias thiab txias, koj tuaj yeem tso lawv ontop ntawm ib leeg los ua ib tus kheej. Lawv tau tuav ua ke los ntawm txheej txheej ntawm icing ntawm lawv.

· Swb 3 - Fondant Icing: Fondant icing yuav tsum tau muab dov tawm ntawm qhov tshwj xeeb uas tsis yog lo lev. Peb pom tias ntxiv cov hmoov me ntsis pab txo cov nplaum. Muaj cov menyuam tshwj xeeb uas ua kom ntseeg tau tias tuab ntawm fondant zoo ib yam thoob plaws. Tom qab ntawd koj yuav tsum txiav lawv mus rau hauv daim me me (kwv yees li 1 cm plaub fab ua haujlwm zoo rau peb). Cov plaub fab tom qab ntawd tau pleev xim Silver nrog qhov tshwj xeeb/noj tau nyiaj fondant ci. Koj yuav tsum tau siv ob peb lub tsho loj, thiab tso nws kom qhuav ntawm cov tsho loj.

· Swb 4 - Iced Cake on Base: Lub ncuav mog qab zib tuaj yeem khov tau lossis tawm ntawm lub hauv paus phaj … tej zaum yuav zoo dua los ua nws tawm ntawm lub hauv paus phaj. Tab sis yog tias koj txiav txim siab ua nws ntawm lub hauv paus phaj, koj yuav tsum tau tiv thaiv LEDs los ntawm kev khov icing uas yuav poob los ntawm lub ncuav mog qab zib (hauv tus txheej txheem). Thaum lub ncuav mog qab zib tau khov tag nrho (nrog icing/te), koj yuav tsum tso lub ncuav mog qab zib rau hauv txoj haujlwm tseem ceeb ntawm lub rooj tsavxwm. Tej zaum yuav muaj caij nyoog uas lub ncuav qab zib tuaj yeem swb los ntawm lub hauv paus … yog li ua qhov koj yuav tsum tau ua kom nws nyob twj ywm.

· Slides 5-7 - Muab Fondant Squares: Thaum lub icing tseem mos, tom qab ntawd koj yuav tsum tau nrawm, txheej txheem thiab tsis nkees tso cov fondant squares hauv kab rov tav qauv ib puag ncig lub ncuav mog qab zib. Ua haujlwm koj txoj kev mus rau sab qaum teb thiab sab qab teb ntawm tus ncuav mog qab zib ua ib kab ib zaug. Koj tuaj yeem txiav lub voj voog fondant rau sab qaum teb ntawm lub ncuav mog qab zib. Hauv swb 7, koj yuav pom lub qhov nyob saum lub ncuav mog qab zib. Qhov no tau ua kom txias lub raj mis yas sab hauv, uas yuav siv tom qab tuav cov khoom dai kom zoo nkauj nyob rau sab saum toj ntawm lub ncuav mog qab zib. Ua qhov no ua ntej tso lub voj voog fondant rau saum lub ncuav mog qab zib.

· Swb 8 - Ntxiv Glitter: Tom qab tso tag nrho cov fondant squares rau lub ncuav mog qab zib, nws muaj peev xwm ua tau tias qee qhov Silver glaze tej zaum yuav tau muab tshem tawm ntawm qee lub xwmfab. Qhov no yog qhov koj rov hla nws dua nrog ob peb lub tsho tiv no ntawm cov xim ci, thiab ntawm lub tsho tiv no zaum kawg, ua ntej nws qhuav, koj tuaj yeem nchuav qee qhov ci ci tuaj yeem pom thoob plaws lub ncuav mog qab zib kom muab ci ntxiv.

· Xaub 9 - Cov khoom kawg: Cov kauj ruam kawg yog ntxiv qee cov hlau nplaum thiab qee qhov kev dai kom zoo rau saum lub ncuav mog qab zib. Thawb cov xov hlau hla lub hau fondant ntawm tus ncej qaum teb rau hauv lub canister sab hauv. Qhov no yuav tuav cov xov hlau nyob hauv qhov chaw yam tsis tau rhuav tshem tag nrho koj txoj haujlwm nyuaj.

· WS2812-B chipset: Lub nplhaib LED no siv WS2812-B chipset, thiab muaj 4 tus pin tawm (GND, 5V, Din, Dout)

· Lub zog: Txhawm rau ua kom lub zog no, koj yuav tsum muab 5V thiab txog li 1A tam sim no

· Teeb liab: Txhawm rau tswj lub nplhaib LED, koj yuav tsum xa cov cim rau nws ntawm Digital Input pin (Din).

Koj tuaj yeem txuas lwm lub nplhaib LED rau qhov no los ntawm kev siv Digital Output pin (Dout)

Kauj Ruam 5: Phau Ntawv Qhia Siv Lub Hwj Chim

Phau Ntawv Qhia Siv Fais Fab
Phau Ntawv Qhia Siv Fais Fab

· Txoj Cai Dav Dav: Txhua tus tib neeg LED ntawm lub nplhaib tuaj yeem xa lub teeb liab, Ntsuab thiab Xiav. Qhov sib xyaw ntawm cov xim no tuaj yeem ua lwm yam xim. Lub teeb dawb tau ua los ntawm tag nrho peb ntawm cov xim no tib lub sijhawm. Txhua tus neeg xim yuav kos kwv yees li 20mA ntawm qhov tam sim no thaum pom cov xim ntawm qhov ci tshaj plaws. Thaum ci dawb ntawm qhov ci tshaj plaws, ib qho LED yuav kos kwv yees li 60mA.

· Lub zog sib zog: Yog tias txhua tus LED tuaj yeem kos txog 60mA thiab muaj 16 LEDs ntawm ib lub nplhaib LED, tom qab ntawd 16x60mA = 960mA rau ib lub nplhaib LED. Yuav kom muaj kev nyab xeeb, thiab ua lej kom yooj yim dua, koj yuav tsum paub tseeb tias koj muab tam sim no txaus kom haum rau 1A rau ib lub nplhaib LED. Yog li 4 LED rings yuav xav tau 5V 4A fais fab mov yog tias koj xav kom tau txais kev ua haujlwm tag nrho ntawm cov qauv.

Kauj Ruam 6: Fritzing Daim Duab

Fritzing Daim duab
Fritzing Daim duab
Fritzing Daim duab
Fritzing Daim duab

Txuas Ib Leeg LED Nplhaib rau Arduino

· 3 xov hlau: Koj tsuas xav tau 3 xov txuas los txuas rau lub nplhaib LED. Yog tias koj tsuas yog npaj ua kom pom ob peb lub LED nyob rau ib lub sijhawm qhov no yuav tsum ua tau zoo. · Txoj kev nyab xeeb: Txoj hauv kev nyab xeeb los ua qhov no yog siv lub zog hluav taws xob sab nraud los ua lub zog Arduino thiab lub nplhaib LED.

· Electrolytic capacitor: Los ntawm kev sib txuas loj 4700 uF 16V Electrolytic capacitor nruab nrab ntawm qhov zoo thiab qhov tsis zoo ntawm cov khoom siv hluav taws xob ua, nrog cov ceg tsis zoo ntawm lub capacitor txuas rau lub davhlau ya nyob twg tsis zoo ntawm lub hwj chim, koj yuav tiv thaiv koj lub nplhaib LED los ntawm txhua qhov pib kev tawm tsam tam sim no.

Tiv thaiv tus tiv thaiv: Nws kuj tseem pom zoo tso 300-400 ohm resistor ntawm Arduino's Digital Pin 9 (D9) thiab LED Ring's Digital Input pin (Din). Qhov no tiv thaiv thawj LED los ntawm qhov muaj peev xwm nce siab

Cov xov hlau uas tsim nyog: Yog tias koj npaj yuav txuas ob peb ntawm cov hlua LED no ua ke (saib hauv qab), tom qab ntawd koj yuav zaum xav khaws cov xov hlau kom luv li sai tau thiab siv cov xov tooj cua zoo uas tuaj yeem tswj tau tam sim no tau kos los ntawm lawv.

Kauj Ruam 7: Txuas Ob Leeg LED Rings rau Arduino

Txuas Ob Leeg LED Rings rau Arduino
Txuas Ob Leeg LED Rings rau Arduino

Peb lub xov hlau ntxiv: Koj tsuas xav tau 3 lub xov hlau txuas ntxiv los txuas rau lub nplhaib LED ntxiv. Ib txoj hlua yuav tsum txuas cov Digital output (Dout) ntawm thawj lub nplhaib LED mus rau Digital Input (Din) ntawm lub nplhaib LED thib ob.

Nyob nyab xeeb: Ib zaug ntxiv, txoj hauv kev nyab xeeb los ua qhov no yog siv lub zog hluav taws xob sab nraud, lub tshuab hluav taws xob loj ntawm lub davhlau ya nyob twg, thiab 300-400 ohm resistor ntawm Arduino thiab thawj LED ntiv nplhaib tus lej nkag.

Kauj Ruam 8: Txuas FOUR LED Nplhaib rau Arduino

Txuas FOUR LED Nplhaib rau Arduino
Txuas FOUR LED Nplhaib rau Arduino

Rau caum Plaub LEDs: Koj xav tau 3 xov ntxiv rau txhua lub nplhaib LED ntxiv. 4 LED rings muab tag nrho ntawm 64 LEDs.

Saib AMPS: Thaum ci puv, qhov teeb tsa no tuaj yeem muaj peev xwm kos tau txog 4amps (lossis kwv yees li 1 amp ib lub nplhaib LED)

Cov Khoom Siv Sab Nraud qhov tseem ceeb: Nws yog qhov tseem ceeb uas yuav tsum siv lub zog hluav taws xob sab nraud los siv lub zog LEDs no thaum muaj ntau ntawm lawv. Yog tias koj tsis siv lub zog hluav taws xob sab nraud thiab koj ua rau pom qhov tsis zoo ntawm txhua lub LEDs, tom qab ntawd koj yuav ua rau lub microcontroller puas tsuaj los ntawm kev kos tam sim no ntau dhau.

Kauj Ruam 9: Cov Rooj Sib Txuas

Cov Rooj Sib Txuas
Cov Rooj Sib Txuas

Yuav ua li cas txuas ONE LED Ring rau Arduino

Kauj Ruam 10: Yuav Ua Li Cas Txuas Ob Tug LED Rings rau Arduino

Yuav Ua Li Cas Txuas Ob Tug LED Rings rau Arduino
Yuav Ua Li Cas Txuas Ob Tug LED Rings rau Arduino

Kauj Ruam 11: Xaus

Xaus
Xaus
Xaus
Xaus
Xaus
Xaus

Hauv qhov kev qhia no peb tau qhia koj yuav ua li cas los kho lub ncuav qab zib Disco Ball thiab tseem yuav siv RGB RGB rings ntawm ICStation li cas.

Plaub yam khoom txuas hauv ICStation:

www.icstation.com/icstation-atmega328-board… nyeem ntxiv

www.icstation.com/icstation-ws2812-programm…

www.icstation.com/1pcs-dupont-wire-10cm-254…

www.icstation.com/bread-board-jump-line-jum…

Ua tsaug rau peb cov phooj ywg Scott thiab nws tsev neeg tau ua qhov kev nthuav qhia zoo txog Led.

Thawj qhov ntawm cov ntsiab lus los ntawm peb tus phooj ywg Scott:

arduinobasics.blogspot.com.au/2016/06/ardui…

Yog tias koj nyiam nqe no, thov qhia rau koj cov phooj ywg.

Yog tias koj xav tias koj tuaj yeem tshuaj xyuas zoo dua, thov tawm tswv yim.

Yog tias koj muaj tswv yim ntxiv txog IC cov khoom, thov hu rau peb email: [email protected]

Pom zoo: