Cov txheej txheem:

Christmas Teeb Nrog Atmega328: 6 Cov Kauj Ruam
Christmas Teeb Nrog Atmega328: 6 Cov Kauj Ruam

Video: Christmas Teeb Nrog Atmega328: 6 Cov Kauj Ruam

Video: Christmas Teeb Nrog Atmega328: 6 Cov Kauj Ruam
Video: tuav wb lub neej kom ruaj khov - Mang Vang ft. Christina Xyooj [Official Audio] 2021-22 2024, Hlis ntuj nqeg
Anonim
Image
Image
Thaiv
Thaiv

Christmas los txog thiab nws yog lub sijhawm los pib ua qee yam txog nws. Hauv kuv qhov xwm txheej - thaum kawg ua tiav cov lus qhia txog kuv lub teeb tsob ntoo Christmas.

Lub tswv yim ntawm no yog qhov yooj yim: lob me me ntawm cov xim sib txawv LEDs, txuas lawv mus rau tus tsav tsheb LED ua ke (ua rau txhua tus tuaj yeem tswj tau), muaj kev lom zem. Qhov no tej zaum yuav txawv txawv xav txog txhua qhov thaiv xav tau, tab sis kev coj ua qhia tau tias qhov no ua haujlwm tau zoo dua li koj lub khw muag khoom tom khw teeb nrog lawv cov teeb meem nyuaj-xaim tsis muaj thiab tsis muaj kev hloov kho. Cov hlua thaiv tsis pom, LEDs tau muab zais rau hauv rab koob, txhua yam yog tswj nrog IR chaw taws teeb, menyuam yaus thiab cov neeg laus tau zoo siab.

Zoo li yooj yim, tab sis nws coj kuv qee xyoo los ua qhov no thiab ua kom nws ua haujlwm ntawm tsob ntoo tiag. Kuv tau ntsib teeb meem hauv qee qhov chaw tsis tau xav txog - xws li thaiv, piv txwv. Cov lus qhia no yog npaj los pab cov ntawm koj uas xav ua qhov qub yam tsis tas yuav dhau lub hlis ntawm kev sim-thiab-yuam kev yuav khoom ntawm cov khoom sib txawv ntawm Net.

Txoj haujlwm no tau tsom mus rau cov neeg muaj kev paub dhau los, raws li koj yuav tsum hloov kho nws rau koj cov cuab yeej kho mob. Kuv tau ua lub rooj tshwj xeeb rau qhov no ntev dhau los, koj yuav tsum tau tsim nws tus kheej. Lossis koj tuaj yeem tau txais ib qho los ntawm kuv, tab sis tseem, qee qhov kev txawj ntse yuav xav tau.

Koj yuav xav tau dab tsi:

- Pawg tswj hwm (Arduino lossis lwm yam)

- LED tsav Circuitry. Cov tsav tsheb LED pom zoo, tab sis nws muaj peev xwm ua qhov no nrog kev hloov pauv npe thiab ShiftPWM tsev qiv ntawv

- Tsawg kawg 48 LEDs ntawm cov xim sib txawv

- 30AWG xaim xaim xaim, tsawg kawg 100 meters ntawm nws

- Txhim kho kev txawj ntse thiab lub cajmeem

- Qee lub sijhawm thiab ua siab ntev

Kuv yuav muab kuv cov duab kos, tab sis koj yuav tsum hloov kho nws rau koj lub cuab yeej. Lawv tsis zoo li qhov kuv xav tau. Tab sis ntawm tsev neeg, kev ua haujlwm thiab nyiam ua haujlwm kuv yuav tsum xaiv ob tus qub. Thiab kuv xav tau tshaj tawm Cov Lus Qhia tam sim no, thaum muaj sijhawm ua ntej kev ua koob tsheej.

Kauj ruam 1: Kev thaiv kab

Image
Image
Thaiv
Thaiv

Cov xov hlau yog qhov teeb meem loj rau kuv. Nrog koj cov teeb Suav yooj yim, koj tau txais cov kab ntsuab ntsuab tsaus. Kuv cia siab tias yuav pom cov xov hlau zoo ib yam hauv internet - tsis muaj txiaj ntsig. Qhov tseeb, Kuv siv sijhawm ib xyoos sim, xaj kaum ob hom sib txawv, thiab thaum kawg nkag siab tias lawv tsis muaj teeb meem tiag.

Dab tsi yog, koj cov khoom siv tsim khoom yooj yim tau txuas nrog ua ke. Los ntawm qhov no, ob qhov teeb meem tshwm sim:

a) Cov xov hlau zoo nkauj tuab, vim lawv xav tau nqa lub zog rau txhua lub LEDs hauv koob, thiab

b) Cov xov hlau no mus los ntawm ib ceg ntawm tsob ntoo Christmas mus rau lwm qhov pom tseeb, nyob ib puag ncig rau cov ceg ntoo.

Ob qhov teeb meem no xav kom cov xov hlau sib txuas nrog tsob ntoo nplooj ntoo (fir koob). Thiab tseem tsis tau ua tiav qhov ua tiav qhov no.

Nrog qhov kuv xav hauv siab (uas yog, txhua tus LED muaj nws tus kheej thaiv, txuas nrog ua ke) yam hloov:

a) Koj tuaj yeem siv cov xov hlau nyias nyias, thiab

b) Lawv ua raws ceg ntoo LED rov qab mus rau lub qia ntawm tsob ntoo, mus deb ntawm cov neeg saib qhov pom, yog li ua kom pom tsis tau zoo.

Bingo! Koj tsis xav tau cov xim ntsuab tsaus, koj tuaj yeem muaj xim av los sib xyaw nrog cov ceg ntoo, lossis txawm tias yog cyan-ish zoo li kuv muaj, thiab nws tseem yuav pom tsis tau.

Nov yog qee yam uas kuv tau pom tiag tiag thaum lub garland nyob hauv qhov chaw. Nws ua haujlwm.

Yog li, koj xav tau qee qhov nyias nyias 30AWG xaim-qhwv cov xov hlau (zoo li no), ntsuab (uas yog xim xiav-xim me ntsis) lossis xim av.

Kauj ruam 2: LEDs

Muaj teeb tsa ntawm '10 xim LEDs 'muaj nyob hauv is taws nem. Cov xim yog: liab, txiv kab ntxwv, daj, daj-ntsuab, ntsuab, xiav, paj yeeb, ntshav, txias dawb thiab sov dawb. Ob qhov kawg yog qhov nthuav, vim koj tuaj yeem ua qee qhov nyiaj/kub cuam tshuam nrog lawv, tab sis qhov ntawd yog zaj dab neeg sib txawv. Qhov seem yim yog qhov zoo, thiab tus lej yooj yim heev, dab tsi nrog cov tsav tsheb LED muaj 16 qhov tawm. Kuv pom zoo 3mm LEDs: lawv zoo nkauj dua thaum me me txaus los nkaum hauv rab koob.

Cov neeg uas ua raws li kuv cov ramblings paub tias kuv tau mob siab rau me ntsis nrog cov spectrum, thiab koj tuaj yeem pom tias cov xim txheej tsis zoo ib yam spectrum zoo ib yam. Qhov tseem ceeb tshaj plaws yog qhov sib txawv ntawm cov xim ntsuab thiab xiav.

Zoo, ua ntej, tib neeg lub qhov muag tsis zoo ntawm kev nkag siab cov xim no; peb nyob nraum zoo dua nrog txhua yam uas muaj tsawg kawg ntawm qhov me me ntawm liab hauv nws. Qhov thib ob, yuav luag tsis muaj LEDs los txhawm rau txhawm rau qhov sib txawv. Pom zoo, muaj ib tus neeg muab khoom ntawm cyan LEDs ntawm Aliexpress, tab sis cov no yog qhov kim dua (thiab kuv pom lawv lig dhau lawm). Kuj tseem muaj pawg ntawm cov neeg dag ntxias muag LEDs ntsuab ntsuab li 'emerald' sawv daws; tsis poob rau hauv no. Kuv pom tias 10-txheej teeb tau zoo nkauj heev; LEDs tsim cov xim sib txawv uas pom tau.

Yog tias koj tswj hwm kom pom cov cyan LEDs ntawm tus nqi tsim nyog, Kuv xav qhia koj hloov cov xim ntshav nrog lawv (tso cov xim ntsuab ntawm ntsuab thiab xiav). Cov ntshav yog ntau dua li cov UV, lawv tsis ci heev tab sis tuaj yeem ua qee yam ntxim nyiam hauv qhov tsaus ntuj yog tias qee yam dawb nyob ze rau lawv. Yog li, koj tuaj yeem ua ceg sib cais ntawm koj cov khaub ncaws kom muab cov khawv koob thiab paub tsis meej.

Kauj ruam 3: Sib dhos

Los ua ke
Los ua ke
Los ua ke
Los ua ke
Los ua ke
Los ua ke

Kev siv cov LEDs rau cov xov hlau siv sijhawm; pub dawb ib hnub los ua qhov no txawm tias me me 48-LEDs garland. Koj yuav xav tau (sib nrug ntawm LEDs thiab xov hlau):

1.5 hli cua sov-ntsws tubing;

- 2.5 hli cua sov-ntsws tubing;

- Muaj ntau txoj kev daws raisin;

thiab ib rab hlau, pom tseeb.

Ntxuav qhov kawg ntawm cov xaim, qhwv nws ib puag ncig ntawm LED ceg, thov tso cov kua txiv hmab txiv ntoo tso rau, muab tshuaj tsuag. Rov ua dua zaum ob. Thawb lub 1.5mm tubing ntawm thawj cov khoom sib txuas ua ke thiab ntsws nws, rov ua dua zaum ob. Thawb lub 2.5mm tubing ntawm ob txhais ceg thiab ntsws. Kev sab hauv ntsws xav tau los tiv thaiv luv luv, sab nrauv rau qhov zoo nkauj. Tsis xav tau tuav, raws li qhov ua kom tsis sib haum yog lub teeb, fir koob yuav tuav nws zoo nkauj. (Yog tias koj tsob ntoo yog khoom cuav, koj yuav xav tau qee yam los ua LEDs lo)

Ua hauv pab pawg ntawm rau, ua raws qhov pom, tsis txhob hnov qab xyuas tias LED ua haujlwm raws li nws tuaj yeem tau txais kev puas tsuaj thaum siv cov laug, thiab nco ntsoov cim cov xaim xaim.

Raws li qhov ntev ntawm cov xov hlau, Kuv tau ua rau lawv 50 cm, thiab nws luv me ntsis txawm tias yog tsob ntoo me me uas kuv muaj. Kuv yuav tsum ncab cov xov hlau tsis txhob qhwv lawv ncig cov ceg ntoo. Rau kuv qhov kev thov zam txim, Kuv npaj ua kom 96-LEDs garland (tseem ua btw), thiab qhov no yog nws ib nrab. Hauv txhua qhov xwm txheej, tsuas yog txiav txim siab tias koj yuav xav kom cov hlau ua raws cov qia thiab tom qab ntawd ceg tawm los ntawm tus tswj hwm thiab xaiv qhov ntev raws li.

Kauj Ruam 4: Kev Txuas Txuas

Kev Txuas Txuas
Kev Txuas Txuas

Kuv siv kuv lub UltiBlink SL board uas tau pib tsim nrog txoj haujlwm no hauv siab. Tshwj tsis yog koj muaj/xaj ib qho, koj yuav tsum ua koj tus kheej. Cov qhob cij yuav tsis ua haujlwm ntawm no, yog li koj yuav tsum tau tsim thiab muab ib yam dab tsi tso rau ntawm lub rooj tsav xwm ua qauv. Cov tsav tsheb LED tau zoo dua rau txoj haujlwm no tshaj li hloov pauv cov npe (nrog ShiftPWM lub tsev qiv ntawv), raws li cov tsav tsheb tsis xav tau tus tiv thaiv rau txhua LED, yog li qhov chaw tsawg dua, tsawg dua qhov, tsis siv tshuaj ntau dua.

Nco ntsoov tias kuv siv Extension version ntawm kuv UltiBlink board, ib qho uas tsis muaj cov khoom Arduino (kom paub, microcontroller) ntawm nws nraub qaum. Kuv txuas lub microcontroller board (puag ncig BlinkeyCore) rau qhov txuas ntxiv. Qhov tseeb yog, nws tsis tau npaj ua ntej; qhov tshwj xeeb 48-LED garland tau xav tias yuav yog lub hauv paus ntawm 96-LED garland, nrog qis dua muaj MC nyob hauv nkoj. Tseem, nws ua pov thawj tias zoo li a) Kuv muaj peev xwm txuas lub rooj tsav khoom ncaj qha rau tsob ntoo nrog cov hlua roj hmab yooj yim, thiab b) Kuv muaj peev xwm tshem tau yooj yim tshem lub rooj tswj hwm kom rov qab kos duab. Kuv tsis tas yuav tsum tau zaum hauv qab tsob ntoo Christmas nrog phau ntawv sau zoo li qee qhov geeky Santa. Yog li, kuv qhia koj ua qee yam zoo sib xws, uas yog, muaj koj li Arduino/MC board tshem tawm ntawm qhov tsis sib haum.

Kuv txuas cov LEDs mus rau 48 qhov tshwm sim hauv 6 pawg ntawm 8 LEDs txhua qhov zoo li no: liab, txiv kab ntxwv, daj, bog-ntsuab, ntsuab, xiav, ntshav, paj yeeb; rov ua dua 5 zaug. Ntawd yog, tso tawm 0 = liab, tso tawm 1 = txiv kab ntxwv, tso tawm 2 = daj, thiab lwm yam. Nco ntsoov tias koj muab lawv tso rau ntawm tsob ntoo nyob rau tib qhov kev txiav txim, mus rau hauv kauv ob qho tib si nce lossis nqis. Kuv kuj tseem xav sim ua kom muaj xim zoo ib yam hauv ntau dua-lossis-tsawg kab ntsug (saum toj lossis qis dua ib leeg)-txhua qhov no yuav ua rau cov teebmeem zoo dua.

Thaum kawg, koj yuav tsum xav txog kev siv fais fab. 48 LEDs xav tau txog 1A ntawm 5V thaum lawv txhua tus nyob. Koj tuaj yeem siv lub USB them nyiaj, tab sis nws yuav tsum yog qhov zoo tiag tiag thiab sim, tsis yog qee qhov pheej yig ntawm eBay uas yuav tsum tau muab cov kua txiv txaus tab sis tsis ua (zoo li ib qho dawb ntawm kuv cov duab, kuv hloov nws tom qab). Nrog 96 LEDs Kuv npaj siab siv ob, ib qho rau txhua feem ntawm cov khaub ncaws, tsuas yog kom ntseeg tau tias txhua yam ua haujlwm raws li lub hom phiaj xav tau. Lwm txoj hauv kev tuaj yeem ua rau qhov teeb meem no nyob hauv software: yog tias koj paub tseeb tias tsis muaj ntau dua 25 LEDs nyob rau txhua lub sijhawm, koj yuav tuaj yeem ua qhov no los ntawm ib lub USB them nyiaj lossis txawm tias koj lub khoos phis tawj USB chaw nres nkoj. Kuv sketch hauv qab no tsis.

Kauj Ruam 5: IR Tswj

IR zoo nkauj heev thiab zoo nkauj los tswj cov qauv ntawm koj cov khaub ncaws. Ua tsaug, muaj lub tsev qiv ntawv IRLib zoo heev uas npog txhua qhov xav tau. Tsis tas li, tus neeg txais IR muaj kev sib txuas yooj yim heev.

Muaj ntau cov lus qhia ntawm kev siv IR kev qhia nrog Arduino, yog li kuv yuav tsis nkag mus ntau yam ntawm no. Yog tias koj tsis paub nws, tsuas yog tseg ib hmo rau kev ua tiav qhov no, nws tsis yog foob pob hluav taws kev tshawb fawb.

Qee cov ntawv los ua kom yooj yim dua yog xav tau txawm hais tias:

1 - Muaj cov txheej txheem sib txuas lus IR sib txawv, nrog Philips ib qho uas txawv tshaj plaws thiab Sony ib qho yog qhov muaj txiaj ntsig tshaj plaws thiab yooj yim rau txoj haujlwm. Feem ntau cov khoom siv pheej yig tau siv Sony ib qho ua tsaug.

2 - Yog tias koj muaj qee qhov qub qub nyob deb ntawm qhov chaw tso tsheb, kos lawv, tejzaum lawv yuav ua haujlwm tau zoo. Kuv siv los siv cov chaw deb ntawm kuv lub TV los tswj ib qho ntawm kuv qhov kev tiv thaiv Christmas, tab sis qhov ntawd tsis yog lub tswv yim zoo tshaj plaws, raws li lub teeb liab tau pom los ntawm phab ntsa, yog li nws tuaj yeem hloov cov channel lossis qee yam ntawm koj lub TV thaum koj tab tom tswj koj cov khaub ncaws. Zoo dua muaj kev mob siab rau.

3 - Nov yog kuv daim duab kuv siv los qhia cov nyees khawm ntawm cov chaw taws teeb tshiab ua haujlwm nrog Sony raws tu qauv. Nws tso cov lej rau hauv cov ntawv xov xwm tawm hauv koj mus rau qhov yooj yim luam-muab tso rau lawv. Kuv theej-muab lawv tso rau hauv cov ntawv no, uas tau suav nrog hauv daim duab kos rau lub paj ntaub (hauv qab). Muaj peev xwm ua tau cov lej rau cov chaw taws teeb dav dav (hu ua 'CarMP3' hauv qhov suav nrog) twb muaj lawm yuav ua haujlwm nrog koj ib yam nkaus.

Kauj ruam 6: Sketch

Ok, daim duab no ua haujlwm nrog lub rooj tsav xwm ntawm kuv tus qauv (48 LEDs). Nws yog qhov tsis zoo, ib yam, raws li kuv tau sau nws nrawm thiab tsis muaj sijhawm los ntxuav/tawm tswv yim nws. Tseem, koj yuav pom nws muaj txiaj ntsig; xav tias dawb los lob cov khoom xav tau tawm ntawm nws thiab ua txhua yam koj xav tau. Txoj hauv kev yooj yim tshaj plaws yuav yog hloov pauv txhua qhov xwm txheej ntawm DMdriver lub tsev qiv ntawv ua haujlwm nrog koj. Muaj peb qho hauv tag nrho: test.setPoint (int x, int y) teev cov zis #x rau Y (Y yog tus lej 16-ntsis); test.clearAll () teev tag nrho cov txiaj ntsig rau xoom thiab test.sendAll () rov ua dua cov ntaub ntawv hauv tus tsav tsheb LED (xa cov ntaub ntawv mus rau ntawd, hloov LED xeev ib txhij). Txawm tias tsis muaj chaw taws teeb, nws yuav ua haujlwm. Thaum ua tiav, txheeb xyuas ib feem dhau los ntawm Cov Lus Qhia no, qhia cov nyees khawm ntawm koj lub chaw taws teeb thiab muab cov lej rau hauv cov ntawv suav nrog.

Yog tias koj yog tus tswv zoo siab ntawm UltiBlink, koj yuav tuaj yeem sau cov duab kos tawm ntawm lub npov (koj tau txais DMdriver lub tsev qiv ntawv, txoj cai?); xav tiv tauj kuv yog tias muaj dab tsi tsis raug, koj paub qhov chaw nyob.

Hmoov zoo, muaj kev lom zem, nug cov lus nug - Kuv yuav sim teb lawv, zoo siab Christmas yav tom ntej thiab vam tias kuv yuav sau qee yam tshiab sai sai no!

Pom zoo: