Cov txheej txheem:

Handcrafted Arduino-powered RGB Moodlamp: 7 Kauj Ruam
Handcrafted Arduino-powered RGB Moodlamp: 7 Kauj Ruam

Video: Handcrafted Arduino-powered RGB Moodlamp: 7 Kauj Ruam

Video: Handcrafted Arduino-powered RGB Moodlamp: 7 Kauj Ruam
Video: My handmade 8x8 RGB LED illumination by Arduino 2024, Kaum ib hlis
Anonim
Handcrafted Arduino-powered RGB Moodlamp
Handcrafted Arduino-powered RGB Moodlamp
Handcrafted Arduino-powered RGB Moodlamp
Handcrafted Arduino-powered RGB Moodlamp

Cov lus qhia no tau muab faib ua 5 ntu:- Npaj phiaj xwm kev tsim kho (Kauj Ruam 1)- Cov xim xuas tes ua (Step2+3)- Cov hluav taws xob hluav taws xob rau tsav 3W LEDs nrog ATmega8 tus tswj (Step4)- Txoj Cai (Step5)- Yuav ua li cas kom tau nws sawv ib leeg (nyem Arduino bootloader nrog PonyProg thiab hlawv cov duab kos) (Kauj Ruam 6) los sai sai no Vid: Qee Qhov Kev Xav

de.youtube.com/watch?v=apZ9NpaUG84 Pic1: Lub Moodlamp Pic2: Lub zog 3W LED

Kauj Ruam 1: Npaj Kev Tsim Kho:

Npaj Kev Tsim Kho
Npaj Kev Tsim Kho
Npaj Kev Tsim Kho
Npaj Kev Tsim Kho

Kuv nyiam ua lub tswv yim ntawm tsuas yog ib daim ntawv xwb. Ntawm thawj daim ntawv koj pom qee cov tswv yim thaum ntxov. Kuv tau xaiv qhov tsim-hauv qab txoj cai. Nplooj ntawv thib ob qhia qee cov ntsiab lus rau kev tsim kho. Ntsuas yog sim zoo li txhua lub sijhawm, tab sis ua tau zoo rau kuv;-) Kuv qhov kev xav kho vajtse yog:- Kuv puas tuaj yeem tuav cov ntaub ntawv?- Lub teeb ci dhau ntawm qhov ntxoov ntxoo? - Nws yuav tsum muaj pes tsawg tus? - Muaj pes tsawg pob qhov rooj thiab lauj kaub kuv yuav xav tau qhov yooj yim cuam tshuam? Kuv cov software xav tau: Muaj pes tsawg lub zog sib txawv uas lub teeb yuav tsum muaj? - Tsis siv neeg RGB ploj nrog hloov pauv sai - Kev hloov xim - Dawb nrog kho qhov ci ci

Kauj Ruam 2: Daim Duab Xuas Tes Ua

Xuas Tes Ua Duab Ntxoo
Xuas Tes Ua Duab Ntxoo
Xuas Tes Ua Duab Ntxoo
Xuas Tes Ua Duab Ntxoo
Xuas Tes Ua Duab Ntxoo
Xuas Tes Ua Duab Ntxoo

Sib sau cov ntaub ntawv: Qhov ntxoov ntxoo: Kuv pom 3 ko taw x 3 ko taw ntawv ntawm 30 zeb yas ntawm lub khw (Pic1-3). Siv rab riam ntse los txiav nws. Kuv khov yas siv cov ntawv xuab zeb (Pic4-6). tau txais lub tog raj kheej Kuv ntswj nws tag nrho ua ke tom qab qhov drilling qhov raug (Pic7-8). Qhov cov yas yas ntawm cov xov tooj dag txhawb. Nws zoo nkaus li zoo nkauj thiab yooj yim kom tau txais thiab tuav.. Rau qhov tsis muaj qhov ntxoov ntxoo ntau dhau los ntawm tus ncej, Kuv tsim lub tawb me me los ntawm cov pas nrig txuas nrog M8 txiv ntoo rau saum (Pic12). Thaum ua tiav kuv tau sib sau ua ke tag nrho. Cov ntsia hlau me me thiab cov txiv ntoo tau ua kom me ntsis, tab sis 30 feeb tom qab kuv tau ua tiav.

Kauj Ruam 3: Daim Duab Xuas Tes Ua

Xuas Tes Ua Duab Ntxoo
Xuas Tes Ua Duab Ntxoo
Xuas Tes Ua Duab Ntxoo
Xuas Tes Ua Duab Ntxoo
Xuas Tes Ua Duab Ntxoo
Xuas Tes Ua Duab Ntxoo

Lub hauv paus: Cov discs tau chucked hauv tshuab dhos kom nws du thiab puag ncig. Tom qab ntawd, kuv tau pleev xim nws nrog mahogany ntoo stain thiaj li ua kom cov ntoo thuv zoo. Dab tsi ntxiv?!? Kuv txiav txim siab los ua lub hauv paus siv tib yam cov yas khov ua qhov ntxoov ntxoo, thiab teeb pom kev rov qab nrog lub RGB microLED (Pic5). Qhov pob qhov rooj: Kuv tau ua lub pob los ntawm ib daim mahogany thiab cov pob qhov rooj los ntawm qhov txiav tawm ntawm cov ntoo ntoo.

Kauj Ruam 4: Cov Hluav Taws Xob Hluav Taws Xob:

Cov Hluav Taws Xob Hluav Taws Xob
Cov Hluav Taws Xob Hluav Taws Xob
Cov Hluav Taws Xob Hluav Taws Xob
Cov Hluav Taws Xob Hluav Taws Xob
Cov Hluav Taws Xob Hluav Taws Xob
Cov Hluav Taws Xob Hluav Taws Xob

Hauv thawj daim duab koj pom kuv cov duab. Thiab ntawm no yog lwm daim vis dis aus: https://de.youtube.com/watch? V = xkiYzQAYf_A & NR = 1

Kauj ruam 5: Txoj Cai:

Txoj Cai
Txoj Cai
Txoj Cai
Txoj Cai
Txoj Cai
Txoj Cai

Ntawm cov duab koj pom kuv txheej txheem nrog Arduino. Thawj zaug kuv sim ib puag ncig nrog kuv tus kheej ProtoShield, lub roj teeb pob thiab qee yam ntawm LEDs. Kuv pib nrog "Spooky Projects" thiab "BionicArduino" los ntawm TodEKurt qee lub hlis dhau los. tsuas yog qhov ua kom yuam kev ntawm nws qhov phiaj xwm phiaj xwm. "RGBMoodlight", "RGBPotMixer" thiab qee qhov txuas ntxiv mus. Three analog-in and.one digital-in as mode switch (Thanks to Ju. for the interrupt-routine:). The LEDs are connected rau D9, D10 thiab D11 uas txhawb PulseWithModulation. Yog tias koj nyiam, kuv tuaj yeem tshaj tawm cov duab, tab sis nws yog qhov tsis sib xws tiag tiag ntawm ob txoj cai zoo no. Ntawm no yog kuv tus lej thawj ntawm lub teeb. ntxov heev hauv kev sau ntawv … Tab sis yog tias koj theej nws, nws yuav tsum ua haujlwm tau zoo. Nws muaj qhov ua haujlwm zoo, xws li "PotColorMixer", "RGBfadingFunction" thiab cuam tshuam -Txhua rau lub hom- hloov pauv./* kojo Lub Rau Hli 2008

Code rau kuv "Moodlamp", raws li "dimmingLEDs" los ntawm Clay Shirky

*nejo Sep 2008

  • Txoj cai zaum kawg rau lub teeb pom kev nrog cuam tshuam-hom-hloov, analog nrawm-hu rau RGB-fading thiab RGB hloov xim.
  • Qhov ua haujlwm dimming ua haujlwm tsuas yog rau xim dawb

*nejo October 2008

  • Suab-txuas ntxiv rau lub suab paj nruag:
  • Lub condensor microphone nrog LM368 Amp me me, tus hais lus thiab RC-qis-dhau-lim
  • nrog lwm qhov kev nkag mus Kuv siv RGBPotMixer-ua haujlwm kom hloov xim los ntawm kev tau txais lub mic-teeb liab.

* * * Code rau hla-fading 3 LEDs, liab, ntsuab thiab xiav, lossis ib qho xim peb xim, siv PWM

  • Qhov kev pab cuam hla mus qeeb qeeb los ntawm liab mus rau ntsuab, ntsuab mus rau xiav, thiab xiav rau liab
  • Txoj cai debugging xav tias Arduino 0004, raws li nws siv qhov tshiab Serial.begin ()-style functions
  • thaum xub thawj "dimmingLEDs" los ntawm Clay Shirky

*

  • AnalogRead tau qhib rau Pin A0 kom hloov pauv RGB fading nrawm
  • AnalogRead tau qhib rau Pin A2 kom sib txawv xim hueRGB

* * */#suav nrog // Outputint ledPin = 13; // controlPin rau debuggingint redPin = 9; // Liab LED, txuas nrog tus lej pin 9int greenPin = 10; // Ntsuab LED, txuas nrog tus lej digital 10int bluePin = 11; // Xiav LED, txuas nrog tus lej digital 11int dimredPin = 3; // Pins rau qhov sib txawv dimming tus nqi, txuas nrog lub transistor tsav tsheb dimgreenPin = 5; int dimbluePin = 6; // Inputint switchPin = 2; // hloov tau txuas nrog tus pin D2int val = 0; // sib txawv rau kev nyeem tus pin statusint buttonState; // sib txawv los tuav lub khawm stateint buttonPresses = 0; // 3 nias mus! Int potPin0 = 0; // Lub lauj kaub rau kho qhov ncua ntawm kev ploj hauv Moodlamp; int potPin2 = 2; // Potentiometer tso tawm rau hloov hueRGB colorint potVal = 0; // Hloov pauv kom khaws cov tswv yim los ntawm lub zog potentiometerint maxVal = 0; // tus nqi kom txuag tau qhov dimming qhov cuam tshuam yog 255, yog tias tsis muaj lauj kaub txuas nrog dimPin = 4; // lauj kaub txuas nrog A4 kom dim qhov ci ntsa iab // Qhov program hloov pauv mus rau redVal = 255; // Variables khaws cov txiaj ntsig xa mus rau pinsint greenVal = 1; // Thawj qhov tseem ceeb yog Liab puv, Ntsuab thiab Xiav offint blueVal = 1; int i = 0; // Loop counter int tos; // = 15; // 50ms (.05 thib ob) ncua; luv kom sai fadesint k = 0; // tus nqi rau kev tswj LED hauv qhov ntsais-ua haujlwm DEBUG = 0; // DEBUG txee; yog teem rau 1, yuav sau qhov tseem ceeb rov qab ntawm serialint LCD = 0; // LCD txee; yog tias teeb tsa rau 1, yuav sau qhov tseem ceeb rov qab los ntawm kev teeb tsa serialvoid () {pinMode (ledPin, OUTPUT); pinMode (redPin, OUTPUT); // teeb tsa tus pin raws li tso zis pinMode (greenPin, OUTPUT); tus pinMode (bluePin, OUTPUT); pinMode (dimredPin, OUTPUT); pinMode (dimgreenPin, OUTPUT); // teeb tsa tus pin raws li tso zis pinMode (dimbluePin, OUTPUT); pinMode (potPin2, INPUT); // pinMode (potPin0, INPUT); // pinMode (dimPin, INPUT); // pinMode (switchPin, INPUT); // Teeb tus pin hloov ua cov ntaub ntawv txuas cuam tshuam (0, isr0, RISING); yog (DEBUG) {// Yog tias peb xav pom tus lej tus lej rau kev debugging… Serial.begin (9600); //… teeb tsa cov lus sib tham ntawm 0004 style}} // Lub ntsiab programvoid voj () {yog (buttonPresses == 0) {Moodlamp (); // hu rau Moodlight muaj nuj nqi} yog (buttonPresses == 1) {RGBPotMixer (); // hu rau manuel sib xyaw ua haujlwm} yog (buttonPresses == 2) {Dawb (); // Nws yog txhua yam dawb nyob ntawm no} yog (buttonPresses == 3) {} // Moodlamp (); // RGBPotMixer (); Dawb (); Saib xyuas (); dim ();} void Monitor () {// Xa Lub Xeev mus rau tus saib xyuas yog (DEBUG) {// Yog tias peb xav nyeem cov ntawv DEBUG += 1; // Nce tus DEBUG txee yog tias (DEBUG> 10) {// Luam tawm txhua 10 loops DEBUG = 1; // Pib dua lub txee Serial.print (i); // Cov lus txib hauv 0004 style Serial.print ("\ t"); // Luam tawm tab Serial.print ("R:"); // Qhia tias qhov tso tawm yog tus nqi liab Serial.print (redVal); // Sau tus nqi liab Serial.print ("\ t"); // Luam tawm tab Serial.print ("G:"); // Rov ua dua rau ntsuab thiab xiav… Serial.print (greenVal); Serial.print ("\ t"); Serial.print ("B:"); Serial.print (blueVal); // println, kom xaus nrog kev thauj rov qab Serial.print ("\ t"); Serial.print ("dimValue:"); Serial.print (maxVal); // println, kom xaus nrog kev thauj rov qab Serial.print ("\ t"); Serial.print ("tos:"); Serial.print (tos); // sau tus nqi ntawm potPin0 rau tus saib Serial.print ("\ t"); Serial.print ("hueRGBvalue"); Serial.print (potVal); // sau tus nqi ntawm potPin0 rau tus saib Serial.print ("\ t"); Serial.print ("buttonState:"); Serial.print (buttonState); // sau tus nqi ntawm potPin0 rau tus saib Serial.print ("\ t"); Serial.print ("buttonPresses:"); Serial.println (buttonPresses); // sau tus nqi ntawm lub pob Nyem rau ntawm lub monitor}}} tsis muaj dab tsi dim () // Muaj nuj nqi rau dimming Dawb // tej zaum tom qab rau txhua hom {maxVal = analogRead (dimPin); maxVal /= 4; // Qhov sib txawv ntawm 0..1024 ntau dhau rau qhov txo qhov 0..255 tus nqi analogWrite (dimredPin, maxVal); analogWrite (dimgreenPin, maxVal); analogWrite (dimbluePin, maxVal);} tsis muaj dab tsi Moodlamp () {tos = analogRead (potPin0); // nrhiav tus nqi los ntawm potPin0; // yog tias tsis muaj Pot txuas nrog: tos 255 i += 1; // Kev suav nce ntxiv // i = i - maxVal; yog (kuv <255) // Thawj theem ntawm fades {redVal -= 1; // Liab nqes ntsuabVal += 1; Green ntsuab blueVal = 1; // Xiav qis} lwm qhov yog (i <509) // Theem thib ob ntawm ploj {redVal = 1; // Liab tsawg greenVal -= 1; Green ntsuab blueVal += 1; // Xiav xiav} lwm qhov yog (kuv <763) // Peb theem ntawm ploj {redVal += 1; // Liab li ntsuabVal = 1; // Ntsuab lo2 blueVal -= 1; // Blue down} lwm yam // Rov teeb lub txee, thiab pib qhov ploj dua {i = 1; } // peb ua "255 -redVal" hloov chaw tsuas yog "redVal" vim tias // LEDs tau txuas rau +5V hloov ntawm Gnd analogWrite (redPin, 255 - redVal); // Sau qhov txiaj ntsig tam sim no rau LED pins analogWrite (greenPin, 255 - greenVal); analogWrite (bluePin, 255 - blueVal); /* dimredVal = min (redVal - maxVal, 255); // dimming dimredVal = max (redVal - maxVal, 0); dimgreenVal = min (greenVal - maxVal, 255); dimgreenVal = max (greenVal - maxVal, 0); dimblueVal = min (blueVal - maxVal, 255); dimblueVal = max (blueVal - maxVal, 0); analogWrite (redPin, 255 - dimredVal); // Sau qhov txiaj ntsig tam sim no rau LED pins analogWrite (greenPin, 255 - dimgreenVal); analogWrite (bluePin, 255 - dimblueVal); * / tos / = 4; ncua (tos); // Ncua rau 'tos' milliseconds ua ntej rov pib lub voj} tsis muaj dab tsi RGBPotMixer () {potVal = analogRead (potPin2); // nyeem tus lej potentiometer ntawm tus lej pin potVal = potVal / 4; // hloov ntawm 0-1023 mus rau 0-255 hue_to_rgb (potVal); // kho potVal li hue thiab hloov mus rau rgb vals // "255-" yog vim peb muaj cov anode LEDs sib xws, tsis yog-cathode analogWrite (redPin, 255-redVal); // Sau qhov tseem ceeb rau LED pins analogWrite (greenPin, 255-greenVal); analogWrite (bluePin, 255-blueVal); } tsis muaj dab tsi Dawb () {analogWrite (redPin, maxVal); // Sau qhov tseem ceeb rau LED pins analogWrite (greenPin, maxVal); analogWrite (bluePin, maxVal); }/*

  • Muab qhov txawv txav hue 'h', uas yog los ntawm 0-252,
  • teeb RGB xim tus nqi kom tsim nyog.
  • Xav tias maxValimum Saturation & tus nqi siab tshaj (ci ntsa iab)
  • Ua cov lej lej dawb huv, tsis muaj qhov taw tes ntab.

*/void hue_to_rgb (byte hue) {yog (hue> 252) hue = 252; // stetback rau 252 !! nejo byte hd = hue / 42; // 36 == 252/7, 252 == H_MAX byte hi = hd % 6; // muab 0-5 byte f = hue % 42; byte fs = f * 6; hloov (nyob zoo) {rooj plaub 0: redVal = 252; ntsuabVal = fs; blueVal = 0; tawg; rooj plaub 1: redVal = 252-fs; ntsuabVal = 252; blueVal = 0; tawg; rooj plaub 2: redVal = 0; ntsuabVal = 252; blueVal = fs; tawg; rooj plaub 3: redVal = 0; greenVal = 252-fs; blueVal = 252; tawg; rooj plaub 4: redVal = fs; ntsuabVal = 0; blueVal = 252; tawg; rooj plaub 5: redVal = 252; ntsuabVal = 0; blueVal = 252-fs; tawg; }} void isr0 () {Serial.println ("\ n / n tsis muaj zog / n"); buttonState = digitalRead (switchPin); // nyeem thawj lub xeev qeebMicroseconds (100000); // yog (val! = buttonState) {// lub xeev khawm tau hloov lawm! // yog (buttonState == HIGH) {// txheeb xyuas yog tias lub pob tam sim no raug nias khawm Presses ++; //} // val = buttonState; // txuag lub xeev tshiab hauv peb qhov sib txawv yog (buttonPresses == 3) {// zur cksetzen buttonPresses = 0; }} //} Cov theem tom ntej yog transistor-tsav tsheb. Kuv siv 3 PNP transistors nrog qhov siab tshaj tam sim no ntawm 3Ampere. Tom qab tam sim no-tam sim no thiab qhov hluav taws xob tau tswj, tus LEDemitter tau ua haujlwm zoo nrog kev siv tag nrho.

Kauj Ruam 6: Tau Txais Nws Tus Kheej Nrog PonyProg-hlawv Bootloader

Tau Txais Nws Tus Kheej Nrog PonyProg-hlawv Bootloader
Tau Txais Nws Tus Kheej Nrog PonyProg-hlawv Bootloader

Yuav siv koj li chaw nres nkoj paralell li cas txhawm rau hlawv lub arduino bootloader ntawm ATmega168 lossis ATmega8 kom siv tus nqi pheej yig dawb nrog cov arduino ib puag ncig. Com sai sai no … /www.instructables.com/id/uDuino-Very-Low-Cost-Arduino-Compatible-Developme/?ALLSTEPS

Kauj Ruam 7: Yog Li Nov Yog Kuv Arduino Moodlamp

Yog li Ntawd yog Kuv Arduino Moodlamp
Yog li Ntawd yog Kuv Arduino Moodlamp

Yog tias koj nyiam nws, thov ntsuas kuv.

Pom zoo: