From 0786a54d8ead431b7d267c4a63027577d48f17c5 Mon Sep 17 00:00:00 2001 From: jaseg Date: Sun, 13 May 2018 17:46:44 +0200 Subject: LED characterization article ready to proofread --- content/posts/led-characterization.rst | 138 +++++++++++++++++++++++---------- 1 file changed, 97 insertions(+), 41 deletions(-) (limited to 'content') diff --git a/content/posts/led-characterization.rst b/content/posts/led-characterization.rst index 411d156..e3c03e6 100644 --- a/content/posts/led-characterization.rst +++ b/content/posts/led-characterization.rst @@ -18,12 +18,16 @@ interesting, with up to two RGB or RGBW (red-green-blue-white) LED tapes. For am really important so you could dim it down a lot without flickering. I ended up using the same driver stage I used in the `multichannel LED driver`_ project for its great color resolution and low hardware requirements. -.. figure:: https://upload.wikimedia.org/wikipedia/commons/d/d6/RGB_color_cube.svg - :width: 100% - :alt: An illustration of the RGB color cube - - An illustration of the RGB color cube. `Picture by Maklaan - `_ (`CC BY-SA 3.0`_), from Wikimedia Commons. +.. raw:: html + +
+ An illustration of the RGB color cube. +
An illustration of the RGB color cube. + Picture by + Maklaan from Wikimedia Commons, + CC-BY-SA 3.0 +
+
To make setting colors over Wifi more intuitive I implemented support for HSV colors. RGB is fine for communication between computers, but I think HSV is easier to work with when manually inputting colors from the command line. RGB is @@ -41,13 +45,16 @@ color. `HSV`_ is an early attempt to more closely align these numbers with our p this mathematical model, mapping a color from one color space into another color space is just a coordinate transformation. -.. figure:: https://upload.wikimedia.org/wikipedia/commons/4/4e/HSV_color_solid_cylinder.png - :width: 50% - :align: center - :alt: An illustration of the HSV color space as a cylinder - - An illustration of the HSV color space as a cylinder. `Picture by SharkD - `_ (`CC BY-SA 3.0`_), from Wikimedia Commons. +.. raw:: html + +
+ An illustration of the HSV color space as a cylinder. +
An illustration of the HSV color space as a cylinder. + Picture by + SharkD from Wikimedia Commons, + CC-BY-SA 3.0 +
+
CIE 1931 XYZ is much larger than any other color space, which is why it is a good basis to express other color spaces in. In XYZ there are many coordinates that are outside of what the human eye can perceive. Below is an illustration of @@ -61,13 +68,19 @@ particular in the blues and greens we loose *a lot* of colors to sRGB. .. raw:: html - - -`mkv/h264 download `__/`webm download `__ +
+ +
Illustration of the measured sRGB color space within XYZ. The thick, white line is the spectral + locus. + + mkv/h264 download / + webm download +
+
The wrong colors I got when fading between colors were caused by this coordinate transformation being askew. Thinking over the problem, there are several sources for imperfections: @@ -107,10 +120,9 @@ their respective XYZ coordinates. If all three channels are measured in one go w magnitudes of the channels in XYZ will be accurate. To map any color to the LEDs, the color's XYZ coordinates simply have to be mapped onto the linear coordinate system -produced by these three points within XYZ. LEDs are extremely linear in their luminous flux vs. current characteristic -so this model will be adequate. The spectral integrals mapping the channels' measured responses to XYZ need only be +produced by these three points within XYZ. LEDs are mostly linear in their luminous flux vs. current characteristic so +this model will be adequate. The spectral integrals mapping the channels' measured responses to XYZ need only be calculated once and their results can be used as scaling factors thereafter. -.. FIXME Add led/current graph here Measuring the spectrum ---------------------- @@ -179,7 +191,18 @@ Pointing a camera at the spectrograph would be the obvious thing to do. This pro flaw: I wanted to acquire quantitative measurements of brightness across the spectrum. Since I don't have a precise technical datasheet specifying the spectral response of any of my cameras I can't compare the absolute brightness of different colors on their pictures. Some other sensor was needed. -.. FIXME Spectrum picture + +.. raw:: html + +
+ +
The daylight spectrum as seen using a DVD as a grating. + Picture by + Xofc from Wikimedia Commons, + CC-BY-SA 4.0 +
+
+ Measuring light intensity ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -311,7 +334,17 @@ check for when I made some mistake easy to spot in the resulting data. After one color channel is captured, the LED tape has to be manually set to the next color and the next measurement can begin. -.. FIXME raw measurement plot +.. raw:: html + +
+ A plot with three wide peaks, two large peaks on both sides and
+        one smaller one in the middle. The middle one overlaps the two on the sides. The large ones are about 2.5V in
+        amplitude. Overall, the plot is about 300 stepper steps wide with each peak being around 130 steps wide. +
A plot of the raw preamp output voltage versus stepper position. From left to right, the three peaks + are blue, green and red. Step 0 corresponds to the bottommost stepper position and the shortest wavelength. +
+
+ Data analysis ~~~~~~~~~~~~~ @@ -346,8 +379,20 @@ estimate is produced by a least-squares fit of a linear function. This fine esti sensitivity correction of all original measurements and the scale is changed from stepper motor step count to wavelength in nanometers. -.. FIXME processed spectrum plot +.. raw:: html + +
+ A plot with three wide peaks, all three of different
+        heights. The leftmost peak is highest at 6nA, the middle peak lowest at 1.6nA and the rightmost peak in between
+        at 4nA.  The middle one overlaps the two on the sides.  Overall, the plot spans about 300nm on its x axis with
+        each peak being around 100nm wide. +
A plot of the processed measurements. From left to right, the three peaks are blue, green and red. +
+
+ +.. FIXME re-do these measurements, avoiding clipping +.. FIXME re-do calibration using CCFL .. FIXME calibration for brightness imbalance due to wedge-shaped projection of spectrum Color space mapping @@ -371,14 +416,19 @@ models can be found in the `project repo`_. .. raw:: html - - -`mkv/h264 download `__/`webm download `__ - +
+ +
Illustration of the measured LED color space scaled to fit within XYZ with sRGB (light gray) for + comparison. The thick, white line is the spectral locus. + + mkv/h264 download / + webm download +
+
As you can see, the result is pretty disappointing. The LED's color space parallepiped is very narrow, which is because the blue channel is much brighter than the other two channels. An easy fix for this is to scale-up the RGB space and @@ -392,13 +442,19 @@ around with a couple of factors and settled on 2.5 as a reasonable compromise. B .. raw:: html - - -`mkv/h264 download `__/`webm download `__ +
+ +
Illustration of the measured LED color space at scale factor 2.5 within XYZ with sRGB (light gray) + for comparison. The thick, white line is the spectral locus. + + mkv/h264 download / + webm download +
+
Firmware implementation ----------------------- -- cgit