Cov txheej txheem:

64 Pixel RGB LED Zaub - Lwm Arduino Clone: 12 Cov Kauj Ruam (nrog Duab)
64 Pixel RGB LED Zaub - Lwm Arduino Clone: 12 Cov Kauj Ruam (nrog Duab)

Video: 64 Pixel RGB LED Zaub - Lwm Arduino Clone: 12 Cov Kauj Ruam (nrog Duab)

Video: 64 Pixel RGB LED Zaub - Lwm Arduino Clone: 12 Cov Kauj Ruam (nrog Duab)
Video: Как сделать кабины PIXEL LED WS2811. Шаг за шагом учебник. HD 2024, Kaum ib hlis
Anonim
64 Pixel RGB LED Zaub - Lwm Arduino Clone
64 Pixel RGB LED Zaub - Lwm Arduino Clone
64 Pixel RGB LED Zaub - Lwm Arduino Clone
64 Pixel RGB LED Zaub - Lwm Arduino Clone
64 Pixel RGB LED Zaub - Lwm Arduino Clone
64 Pixel RGB LED Zaub - Lwm Arduino Clone

Cov zaub no yog ua raws 8x8 RGB LED Matrix. Rau kev ntsuas lub hom phiaj nws tau txuas nrog rau tus qauv Arduino board (Diecimila) siv 4 kev hloov npe. Tom qab tau txais nws los ua haujlwm Kuv pom zoo nws ntawm qhov ua tau zoo PCB. Cov ntawv teev npe ua haujlwm yog 8-ntsis dav thiab yooj yim cuam tshuam nrog SPI raws tu qauv. Pulse dav tes taws los piav tau siv los sib xyaw cov xim, ntau ntxiv tom qab ntawd. Ib feem ntawm MCU's RAM tau siv ua tus thav duab thav duab los tuav cov duab. Cov vis dis aus RAM tau txheeb xyuas los ntawm kev cuam tshuam tsis tu ncua hauv keeb kwm yav dhau, yog li tus neeg siv tuaj yeem ua lwm yam muaj txiaj ntsig zoo li tham nrog PC, nyeem cov nyees khawm thiab lub zog loj. Xav paub ntau ntxiv txog "Arduino": www.arduino.cc

Kauj Ruam 1: Pulse Width Modulation for Mixing Colors

Mem tes dav tes taws los piav rau xim
Mem tes dav tes taws los piav rau xim

Pulse width modu - YUAV UA LI CAS? Pulse dav kev hloov pauv qhov tseem ceeb yog tig lub zog pub rau lub tshuab hluav taws xob ON thiab OFF zoo nkauj sai. Lub zog siv tau tshwm sim los ntawm kev ua lej nruab nrab ntawm kev ua haujlwm plaub fab xwm yeem ua ntu ntu ntawm ib lub sijhawm. Lub sijhawm ua haujlwm nyob hauv ON txoj haujlwm ntev dua, lub zog koj tau txais ntau dua. PWM muaj qhov cuam tshuam zoo ib yam ntawm qhov ci ntawm LEDs ua dimmer ntawm AC teeb. Qhov haujlwm ua ntej yog txhawm rau tswj tus kheej qhov ci ntawm 64 RGB LEDS (= 192 ib leeg LEDs!) Hauv txoj kev pheej yig thiab yooj yim, yog li ib tus tuaj yeem tau txais tag nrho. spectrum ntawm cov xim. Qhov zoo tshaj yuav tsum tsis muaj qhov muag lossis lwm yam cuam tshuam. Qhov tsis nkag siab qhov pom ntawm qhov pom pom los ntawm tib neeg lub qhov muag yuav tsis raug coj los rau ntawm no (piv txwv li qhov sib txawv ntawm 10% thiab 20% qhov pom kev zoo li "loj dua" ntau dua li ntawm 90% thiab 100%). PWM algorithm. Hais cov cai tau muab tus nqi 7 rau qhov ci ci ntawm LED (0, 0). Ntxiv mus nws paub tias muaj qhov siab tshaj ntawm N cov theem hauv qhov ci. Txoj cai sau N loops rau txhua qhov ua tau ntawm qhov ci thiab txhua qhov tsim nyog loops los pabcuam txhua tus tib LED hauv txhua kab. Nyob rau hauv rooj plaub lub voj voos x hauv lub voj voos ci ci me dua 7, LED tau qhib. Yog tias nws loj dua 7, LED raug tua. Ua qhov no sai heev rau txhua qhov LEDs, qib ci ci thiab xim xim (RGB), txhua tus LED tuaj yeem hloov kho tus kheej kom pom cov xim uas xav tau. Measurements nrog oscilloscope tau qhia tias cov zaub refresh code siv sijhawm txog 50% CPU sijhawm. Tus so tuaj yeem siv los ua kev sib txuas lus txuas nrog lub PC, nyeem cov nyees khawm, tham nrog tus nyeem ntawv RFID, xa kuv2C cov ntaub ntawv rau lwm tus qauv…

Kauj Ruam 2: Tham nrog Hloov Npe thiab LEDs

Tham nrog Shift Cov Ntawv Sau Npe thiab LEDs
Tham nrog Shift Cov Ntawv Sau Npe thiab LEDs
Tham nrog Shift Cov Ntawv Sau Npe thiab LEDs
Tham nrog Shift Cov Ntawv Sau Npe thiab LEDs

Kev sau npe ua haujlwm yog ib lub cuab yeej uas tso cai rau thauj cov ntaub ntawv ua ntu zus thiab tso tawm ib txhij. Kev ua haujlwm tsis sib xws tseem tuaj yeem ua tau nrog cov nti tsim nyog. Muaj kev qhia zoo ntawm kev hloov pauv rau npe ntawm arduino lub vev xaib. Qhov LEDs tau tsav los ntawm 8-ntsis hloov npe ntawm hom 74HC595. Txhua qhov chaw nres nkoj tuaj yeem tsim lossis cuam tshuam txog 25mA ntawm qhov tam sim no. Tam sim no tag nrho ib nti poob los yog yuav tsum tsis pub tshaj 70mA. Cov chips no pheej yig heev, yog li tsis txhob them ntau dua li 40cents ib thooj. Raws li LEDs muaj tus yam ntxwv nthuav tawm tam sim no / cov yam ntxwv hluav taws xob, yuav tsum muaj qhov txwv tam sim no resistors. Using Ohm txoj cai: R = (V - Vf) / IR = limiting resistor, V = 5V, Vf = LED's rau pem hauv ntej voltage, Kuv = xav tau tam sim noRed LEDs muaj qhov txuas hluav taws xob txog 1.8V, xiav thiab ntsuab ntau ntawm 2.5V txog 3.5V. Siv qhov ntsuas qhov yooj yim los txiav txim qhov ntawd. Rau kev tsim cov xim kom raug ib qho yuav tsum siv qee yam rau hauv tus account: qhov pom tau zoo ntawm tib neeg lub qhov muag (liab/xiav: tsis zoo, ntsuab: zoo), kev ua haujlwm ntawm LED ntawm qee qhov nthwv dej thiab tam sim no. Hauv kev xyaum ib qho tsuas yog siv 3 lub zog ntsuas thiab kho lawv kom txog thaum LED qhia pom lub teeb dawb kom raug. Tau kawg qhov siab tshaj plaws tam sim no LED yuav tsum tsis txhob tshaj. Dab tsi tseem ceeb ntawm no yog qhov hloov pauv npe tsav tsheb kab yuav tsum muab tam sim no rau 3x8 LEDs, yog li zoo dua tsis thawb tam sim no siab dhau. Kuv tau ua tiav nrog kev txwv cov neeg tawm tsam ntawm 270Ohm rau txhua lub LEDs, tab sis qhov ntawd yog nyob ntawm kev ua ntawm LED matrix ntawm chav kawm. Qhov hloov npe tau cuam tshuam nrog SPI cov ntawv. SPI = Serial Peripheral Interface (Duab (1)). Tawm tsam qhov chaw nres nkoj ntawm lub PCs (asynchronous, tsis muaj lub moos teeb liab), SPI xav tau kab kab (SRCLK). Tom qab ntawd muaj kab teeb liab qhia rau lub cuab yeej thaum cov ntaub ntawv siv tau (nti xaiv / latch / RCLK). Thaum kawg muaj ob kab ntawv, ib qho hu ua MOSI (tus tswv tawm qhev hauv), lwm qhov yog hu ua MISO (tus tswv hauv qhev tawm). SPI tau siv los cuam tshuam cov kev sib txuas ua ke, ib yam li kuv2C. Txoj haujlwm no xav tau MOSI, SRCLK thiab RCLK. Ib qho ntxiv, cov kab pab (G) kuj tseem siv tau. Lub voj voog SPI tau pib los ntawm rub RCLK kab rau LOW (Duab (2)). MCU xa nws cov ntaub ntawv ntawm kab MOSI. Lub xeev qhov laj thawj ntawm nws yog piv txwv los ntawm kev hloov pauv ntawm qhov nce ntawm ntug ntawm SRCLK kab. Lub voj voog tau xaus los ntawm kev rub RCLK kab rov qab rau HIGH. Tam sim no cov ntaub ntawv muaj nyob ntawm cov txiaj ntsig.

Kauj ruam 3: Schematic

Schematic
Schematic
Schematic
Schematic

Duab (1) qhia tau hais tias yuav hloov pauv cov npe li cas. Lawv yog daisy-saw, yog li cov ntaub ntawv tuaj yeem hloov mus rau hauv cov saw no thiab tseem dhau los ntawm nws. Yog li ntxiv kev hloov npe ntau dua yog yooj yim.

Duab (2) qhia qhov seem ntawm cov txheej txheem nrog MCU, txuas, quartz … Cov ntawv PDF txuas nrog muaj tag nrho cov haujlwm, zoo tshaj rau luam ntawv.

Kauj ruam 4: C ++ Source Code

C ++ Source Code
C ++ Source Code
C ++ Source Code
C ++ Source Code
C ++ Source Code
C ++ Source Code

Hauv C/C ++ feem ntau ib tus yuav tsum tau ua haujlwm ua ntej coding lawv.#Suav nrog int tseem ceeb (tsis muaj dab tsi); tsis muaj dab tsi do_something (tsis muaj dab tsi); int tseem ceeb (tsis muaj dab tsi) {do_something ();} tsis muaj dab tsi do_something (tsis muaj dab tsi) {/ * tawm tswv yim */ } Arduino IDE tsis xav tau cov kauj ruam no, vim tias kev ua haujlwm ntawm cov qauv tsim tau raug txiav tawm. Yog li ntawd cov txheej txheem ua haujlwm yuav tsis tshwm nyob rau hauv cov cai pom ntawm no. Image (1): teeb tsa () functionImage (2): spi_transfer () ua haujlwm siv kho vajtse SPI ntawm ATmega168 nti (ua haujlwm nrawm dua) Duab (3): framebuffer code siv lub timer1 hla kev cuam tshuam. Pieces ntawm cov cai uas muaj me ntsis cryptic zoo rau cov pib ua piv txwv thaum (! (SPSR & (1 << SPIF))) {} siv MCU cov npe ncaj qha. Qhov piv txwv no hauv cov lus: "thaum SPIF-ntsis hauv npe SPSR tsis tau teeb tsa ua tsis muaj dab tsi". Kuv tsuas yog xav hais ntxiv tias rau cov phiaj xwm txheej txheem nws yeej tsis tsim nyog los daws cov teeb meem no kom ze rau kev kho vajtse. Cov pib tshiab yuav tsum tsis txhob ntshai los ntawm qhov no.

Kauj Ruam 5: Tiav Gadget

Tiav Gadget
Tiav Gadget
Tiav Gadget
Tiav Gadget
Tiav Gadget
Tiav Gadget

Tom qab tau daws txhua qhov teeb meem thiab tau txais txoj cai ua haujlwm, Kuv tsuas yog yuav tsum tsim PCB txheej txheem thiab xa nws mus rau lub tsev tsis zoo. Nws zoo li ntxhua khaub ncaws ntau:-) Duab (1): cov neeg tswj hwm tag nrho pawg thawj coj saib duab (2): sab xub ntiag ntawm PCB liab qab (2): sab nraum qab. Cov chaw nres nkoj no muaj cov kab ntawv RX, TX, I2C kab, digital I/O kab thiab 7 ADC kab. Qhov no yog npaj rau kev thaiv cov thaiv ntawm sab nraum qab ntawm lub rooj tsavxwm. Qhov sib nrug yog qhov tsim nyog rau kev siv perfboard (0.1in). Lub bootloader tuaj yeem nyem tau siv ICSP header (ua haujlwm nrog adafruit's USBtinyISP). Sai li qhov tau ua tiav, tsuas yog siv tus qauv FTDI USB/TTL txuas txuas lossis zoo ib yam. Kuv tseem tau ntxiv qhov pib-pib dua-lov tes taw jumper. Kuv kuj tseem tau npaj me ntsis tsab ntawv Perl (saib kuv qhov blog), uas ua rau nws pib rov pib dua nrog FTDI cov xov tooj uas feem ntau tsis ua haujlwm ntawm lub npov (RTS vs. DTR kab). Qhov no ua haujlwm ntawm Linux, tej zaum ntawm MAC. Printed Circuit boards thiab ob peb DIY KITs muaj nyob ntawm kuv qhov blog. SMD soldering xav tau! Saib PDF cov ntaub ntawv rau kev qhia tsev thiab cov peev txheej rau LED matrices.

Kauj Ruam 6: Daim Ntawv Thov: CPU Load Monitor rau Linux Siv Perl

Nov yog lub hauv paus thauj khoom hnyav nrog keeb kwm yav dhau los. Nws yog raws li Perl tsab ntawv uas sau cov kab ke "thauj nruab nrab" txhua 1s siv iostat. Cov ntaub ntawv raug khaws cia hauv ib qho array uas tau hloov pauv ntawm txhua qhov hloov tshiab. Cov ntaub ntawv tshiab tau ntxiv nyob rau sab saum toj ntawm cov npe, cov ntaub ntawv qub tshaj plaws tau raug thawb tawm. Xav paub ntau ntxiv thiab rub tawm (chaws…) muaj nyob ntawm kuv qhov blog.

Kauj Ruam 7: Daim Ntawv Thov: Tham nrog Lwm Cov Qauv Siv I²C

Daim Ntawv Thov: Tham nrog Lwm Cov Qauv Siv I²C
Daim Ntawv Thov: Tham nrog Lwm Cov Qauv Siv I²C

Qhov no tsuas yog pov thawj ntawm txoj cai thiab nyob deb tsis yog qhov yooj yim daws rau txoj haujlwm no2C tso cai rau hais ncaj qha mus txog 127 "qhev" cov laug cam. Ntawm no pawg thawj coj ntawm sab xis hauv daim vis dis aus yog "tus tswv" (uas pib ua txhua qhov kev hloov pauv), pawg laug yog tus qhev (tos cov ntaub ntawv). Kuv2C xav tau 2 kab teeb liab thiab cov kab hluav taws xob ib txwm muaj (+, -, SDA, SCL). Raws li nws yog tsheb npav, txhua lub cuab yeej txuas nrog nws ua ke.

Kauj Ruam 8: Daim ntawv thov: "Game Cube":-)

Daim ntawv thov
Daim ntawv thov

Tsuas yog qhov xav tsis thoob Qhov no ib qho kuj haum rau hauv lub thawv ntoo uas qhia ntawm nplooj ntawv qhia. Nws tau txais 5 cov nyees khawm ntawm nws nraub qaum uas yuav siv tau rau kev ua si yooj yim. THE XEEM?

Kauj Ruam 9: Tso Duab / Animations ntawm Matrix - Hack sai

Zaub Cov Duab / Duab ntawm Matrix - Hack sai
Zaub Cov Duab / Duab ntawm Matrix - Hack sai
Zaub Cov Duab / Duab ntawm Matrix - Hack sai
Zaub Cov Duab / Duab ntawm Matrix - Hack sai
Zaub Cov Duab / Duab ntawm Matrix - Hack sai
Zaub Cov Duab / Duab ntawm Matrix - Hack sai
Zaub Cov Duab / Duab ntawm Matrix - Hack sai
Zaub Cov Duab / Duab ntawm Matrix - Hack sai

Yog li nws tsuas yog tau txais 8x8 pixel thiab muaj ob peb xim muaj. Ua ntej siv qee yam xws li Gimp kom txo qis koj cov duab nyiam kom raws nraim 8x8 pixels thiab txuag nws li ".ppm" raw format (tsis ASCII). PPM yog ib qho yooj yim nyeem thiab txheej txheem hauv tsab ntawv Perl. Siv ImageMagick thiab cov cuab yeej kab hais kom ua "hloov pauv" yuav tsis ua haujlwm zoo. Upload tus lej tshiab arduino, tom qab ntawd siv Perl tsab ntawv xa mus rau tus tswj. Lub flicker tsuas yog qhov tsis sib xws ntawm LED rov ua dua tshiab thiab kuv lub koob yees duab tus ncej tus nqi. Tom qab hloov kho cov cai me ntsis, nws ua haujlwm zoo heev. Tag nrho cov duab tau hloov pauv nyob hauv cov ntawv raws li koj pom lawv. Longer cov duab tuaj yeem khaws cia rau hauv EEPROM sab nraud zoo li nws tau ua tiav hauv ntau yam hais lus pov thawj.

Kauj ruam 10: Sib tham sib tswj ntawm khaws Animations

Vim li cas cia lub microcontroller muaj kev lom zem? Arduino kev ntseeg yog txhua yam hais txog kev suav lub cev thiab kev sib cuam tshuam, yog li tsuas yog ntxiv lub hwj chim thiab siv kev tswj hwm! Siv ib qho ntawm 8 qhov sib piv rau cov hloov pauv digital cov tswv yim ua rau qhov yooj yim heev.

Kauj ruam 11: Qhia Live Video

Siv tsab ntawv Perl thiab ob peb tus qauv ua rau nws yooj yim heev los qhia quasi nyob video ntawm X11 systems. Nws tau coded ntawm linux thiab tuaj yeem ua haujlwm ntawm MACs ib yam nkaus. Nws ua haujlwm zoo li no:- tau tus nas tus cursor txoj haujlwm- ntes lub npov NxN pixel nyob ntawm tus cursor- ntsuas cov duab rau 8x8 pixel- xa nws mus rau LED board- rov hais dua

Kauj Ruam 12: Ntau Lub Teeb Yuav luag Dawb

Ntau Lub Teeb Yuav luag Dawb
Ntau Lub Teeb Yuav luag Dawb

Nrog tsuas yog ob kauj ruam qhov ci ci tuaj yeem ua tau me ntsis. Hloov 270Ω resistors nrog 169Ω sawv daws thiab piggyback lwm 74HC595 hloov npe rau IC5.

Pom zoo: