Cov txheej txheem:

Calibrating LED Brightness: 5 Kauj Ruam
Calibrating LED Brightness: 5 Kauj Ruam

Video: Calibrating LED Brightness: 5 Kauj Ruam

Video: Calibrating LED Brightness: 5 Kauj Ruam
Video: Samsung LED brightness issue (2012 model, Series 5 32", UA-32ES5500M) 2024, Hlis ntuj nqeg
Anonim
Calibrating LED Brightness
Calibrating LED Brightness

Thaum kuv tab tom ua lub teeb pom kev zoo, Kuv pom tau tias PWM tus nqi tsis sib piv rau qhov ci ntawm LED. Hais lus yooj yim, yog tias PWM tus nqi yog ob npaug qhov ci ci tsis yog ob npaug; tshwj xeeb tshaj yog thaum PWM ze rau qhov siab tshaj plaws, txhua qhov kev hloov pauv tsis tuaj yeem lees paub los ntawm kuv lub qhov muag. Kuv xav tias nws yuav tsum yog qhov teeb meem calibration yooj yim! thiab nws yog qhov kuv tau ua qhov haujlwm no! Lub tswv yim yog los ntsuas qhov ci ntawm LED nrog qee lub cuab yeej (lub teeb pom kev zoo lossis cov duab ci) thiab nrhiav kev sib txheeb ntawm PWM tus nqi thiab qhov ci ci. Tom qab ntawd Yog tias kuv teeb qhov ci ci rau 50%, Arduino yuav suav qhov PWM sib xws thiab ua rau lub teeb pom kev zoo li qub.

Yog li ntawd, kuv xav tau lub teeb pom kev zoo thiab LED los ntsuas qhov ci ci. Siv daim npav SD, Kuv yuav khaws cov ntaub ntawv rau cov txheej txheem tom qab. Kev ua kom haum yuav ua tiav hauv Excel (lossis lwm yam haujlwm). Qhov tso tawm yuav raug siv hauv Arduino code, thiab qhov ntawd yog nws! Nws yuav tsum ua tiav ib zaug. Tom qab ntawd koj tuaj yeem siv qhov ntsuas ntsuas ntsuas ib txwm muaj!

Kauj Ruam 1: Qhov Chaw

1- WEMOS mini D1: Aliexpress 3 €

2- TSL 2561 (Luminosity sensor): Aliexpress 3 €

3- SD daim npav module: Aliexpress 1 €

4- LED

5- Tus tiv thaiv 220 ohm

6-kab

tag nrho tus nqi: 8 -10 €

Kauj ruam 2: Kev thaiv kab

Thaiv
Thaiv
Thaiv
Thaiv
Thaiv
Thaiv

Daim npav SD daim npav thiab lub teeb pom kev zoo lub xov tooj yuav tsum tsis hloov (feem ntau ntawm lawv). Led yuav tsum txuas nrog PWM tus pin.

Kauj ruam 3: Code

Code
Code

Kuv ua ke peb daim lej:

SD daim npav: siv piv txwv> SD> ReadWrite hauv Arduino IDE

TSL 2561: siv Adafruit TSL2561 Lub tsev qiv ntawv piv txwv (sensorapi); koj yuav pom nws hauv cov piv txwv, yog tias koj nruab lub tsev qiv ntawv (Kuv xav tias koj paub yuav teeb tsa lub tsev qiv ntawv hauv Arduino IDE li cas).

LED fading: siv piv txwv> Analog> fading

Cov cai, tom qab pib ua cov qauv, yuav ua rau lub teeb ploj thiab nyeem qhov ci thiab khaws nws hauv SD daim npav. txoj kev no kuv yuav sau qee cov ntaub ntawv rau kev ntsuas.

Kuv hloov txhua tus lej raws li kuv xav tau. qhov kawg code txuas nrog.

Lub teeb liab yuav tsum zoo li daim duab txuas. Hmoov tsis zoo kuv tsis nco qab thaij duab yog li kuv rov ua nws hauv excel los qhia koj tias nws yuav zoo li cas.

NCO TSEG: Kuv siv wemo mini D1 hloov ntawm Arduino. rau qee qhov laj thawj uas kuv tsis paub, PWM nyob nruab nrab ntawm 0 thiab 1023. Hauv Arduino nws yuav tsum yog ntawm 0-255. Yog tias koj xav siv cov cai rau arduino, koj yuav tsum tau saib xyuas nws (kab 90).

Kauj Ruam 4: Haum, thiab Siv

Kev tsim qauv, thiab siv tau
Kev tsim qauv, thiab siv tau
Kev tsim qauv, thiab siv tau
Kev tsim qauv, thiab siv tau

tom qab sau cov ntaub ntawv, kuv qhib cov ntawv hauv excel thiab npaj cov ntaub ntawv (saib hauv daim duab). thawj kab ntawv yog PWM tus nqi thiab tus thib ob yog lux (nyeem lub sensor, chav tsev tsis muaj teeb meem ntau). Yog li ntawd, cov phiaj lux (y-axis) vs. PWM (x-axis). Raws li koj tuaj yeem pom qhov ci ci yog linearly proportional rau PWM tus nqi. Kuv haum ib kab rau nws.

Kom haum kab ua raws li:

1- phiaj cov ntaub ntawv (ntxig> scatter phiaj) Kuv xav tias koj paub yuav ua li cas.

2- txoj cai nyem rau ntawm cov ntaub ntawv npaj tseg

3- nyem rau ntawm kab kab.

4- (hauv excel 2013) ntawm sab xis lub vaj huam sib luag tshwm tuaj. Xaiv tawm. Hauv qab xaiv "tso saib cov kab zauv ntawm kab ntawv".

Qhov kev sib txheeb sib txawv yog txawv ntawm kuv qhov kev xav. Yog li kuv xav tias yuav tsum muaj kev sib piv logarithmic ntawm kuv qhov kev nkag siab thiab qhov ci ci (qhov no yog txoj kev yooj yim tshaj plaws los rau kuv lub siab!). Yog li kuv coj txoj kab nqes ntawm qhov haum. Kev cuam tshuam tsis tseem ceeb, vim nws nyob ntawm qhov pom kev ib puag ncig teeb pom kev zoo! es tsis txhob, kuv ntxiv 1. Vim Log10 (0) tsis muaj qhov kawg. Yog li kuv xav tau kev cuam tshuam los daws qhov teeb meem. Hauv kuv qhov xwm txheej zoo li no:

y = Log10 (0.08 x +1), y yog qhov ci ntsa iab thiab x yog PWM tus nqi (0-1023)

Kuv ua qhov sib npaug rau qhov siab tshaj plaws. ces cov zis rang ib txwm nyob nruab nrab ntawm 0-100. txoj kev no kuv tuaj yeem nug arduino rau qee qhov txheeb ze qhov ci, tsis hais txog qhov siab tshaj plaws ci ntsa iab.

y = Log10 (0.08 x +1)*100/1.914

Vim tias hauv arduino kuv qhov kev nkag siab yog qhov pom kev sib txheeb, kuv yuav tsum tau teeb tsa qhov sib npaug rau x (PWM):

x = (10^(y*1.914 / 100) - 1) / 0.08

siv qhov kev ua zauv no hauv cov cai peb muaj peev xwm tau txais qhov hloov pauv ntawm qhov ncaj tawm. Yog li koj nug arduino kom pom kev ci (y) ntawm 0-100, thiab arduino suav qhov sib piv PWM tus nqi. ua li no, yog ob npaug qhov ci ntsa iab, koj qhov kev nkag siab kuj zoo ib yam.

yog tias koj xav siv nws hauv koj cov cai koj zoo dua ntxiv cov kab no:

ci ntsa iab = 50; // hauv feem pua

PWM = pow (10, brightness*1.914/100) -1) /0.0793;

analogWrite (ledpin, PWM);

NCO TSEG: qhov ua haujlwm tau tiav rau qhov siab tshaj PWM ntawm 1023 (rau Wemos mini D1). Rau Arduino PWM nyob nruab nrab ntawm 0-255. koj yuav tsum xam nws raws li.

NCO TSEG 2: Kuv ntxiv cov phiaj xwm-kab tawm los qhia tias peb qhov kev nkag siab thiab PWM tus nqi cuam tshuam li cas. koj yuav tsum tsis txhob siv nws kom haum!

Kauj Ruam 5: Xaus

calibration ua haujlwm zoo rau kuv. Thaum PWM qhov tseem ceeb loj, Kuv tuaj yeem pom qhov sib txawv. Ua ntej raws li qhov muaj txiaj ntsig loj kuv tsis tuaj yeem pom cov txiaj ntsig ntawm dimming. Yeej feem ntau ntawm cov kev hloov pauv tau ua tiav hauv qhov me me ntawm PWM. tam sim no nws tau ntsuas!

txhua LED, tshwj xeeb xim sib txawv, yuav tsum muaj nws tus kheej ntsuas ntsuas. Txawm li cas los xij kuv ntsuas qhov xiav LED thiab siv qhov ntsuas rau dawb LED thiab qhov txiaj ntsig tau txais. yog li tej zaum koj tuaj yeem siv kuv qhov ntsuas ntsuas yam tsis thab koj tus kheej !!

Pom zoo: