Calibrating the LED strip

When you buy a strip of white LED's, there may/ be some specification about its color on the package. Cold light, warm white or something like 6600K. On RGB LED's of course there won't be such a description, but that does not mean that all strips are equal. Due to bad quality, it is possible to get different colors on one strip, even when that's not your intention. There is a difference in power consumption between red, green and blue LED's, and I noticed a slightly different / warmer color to the end of the strip due to underpowered blue LED's. Working with regular RGB strips, you have one common line (anode or cathode) which contains the total amount of energy for all LED's. And most of the time it's just a PCB line. As you may cut the strips to fit in your light hood, you may consider using a better conductor parallel to your strip.

And for the 2812 strips, it's even worse. Both power lines (+ and ground) are equal for all LED's, so I'll advice to make a central + and ground point in your light hood, and connect all parts of strip separate. The data line cannot be passed by, as it is also responsible for the addresses of the LED's. There must be one long line from the first LED to the last one, without any serial connections in it. As this line is digital with a very low power, I have not recognized problems with that line for being too long.

When you have a little problem to get all your RGB LED's exactly the same color, I'll suggest to do the calibration with the final light hood, to correct the warmth or cold of the light and set the average color to your desired value. And off course it's also possible this way to correct deviations in color because something in the light hood is reflecting your light with a slightly different color. The only problem can be that this calibration program uses the serial line of the Arduino for feedback and input, so during calibration there must be a device with an Arduino EDI be connected to it.

By the way, this kind of calibration is necessary to let the Arduino convert Kelvin colors to RGB-values needed for the LED's. If you want to use the program by only entering RGB codes (which is also possible, because colors like "blue moonlight" cannot be expressed in Kelvin), calibrating is not necessary. The final program only uses the calibration data when translating Kelvin.

The calibration program:

 

Arduino Code:
  1. //LED calibration
  2. //http://www.2muchtime.org
  3. #include <Adafruit_NeoPixel.h> //<-- 2812
  4. #define PIN 6 //<-- 2812
  5. Adafruit_NeoPixel strip = Adafruit_NeoPixel(300, PIN, NEO_GRB + NEO_KHZ800); //<-- 2812
  6.  
  7. int pixels = 300;
  8. int red = 200;
  9. int green = 200;
  10. int blue = 200;
  11.  
  12. void setup() {
  13. Serial.begin(9600);
  14. strip.begin(); //<-- 2812
  15. strip.show(); //<-- 2812
  16.  
  17. Serial.println ("RGB LED calibration");
  18. Serial.println ("To change a color, send it with your serial monitor.");
  19. Serial.println ("For example, R181 changes the intensity of red to 181 (values between 0 - 255)");
  20. }
  21.  
  22. void loop() {
  23. for (int i = 0; i <= pixels; i++){
  24. strip.setPixelColor(i,strip.Color(red, green, blue)); //<-- 2812
  25. }
  26. strip.show(); //<-- 2812
  27. Serial.println ("The current color is:");
  28. Serial.println ("Red: " + String(red) );
  29. Serial.println ("Green: " + String(green));
  30. Serial.println ("Blue: " + String(blue));
  31.  
  32. boolean waitForInput = true;
  33.  
  34. while (waitForInput) {
  35. if (Serial.available()){
  36. waitForInput = false;
  37. }
  38. }
  39.  
  40. delay(100);
  41. char c = Serial.read();
  42. int h = Serial.read() - 48;
  43. int t = Serial.read() - 48;
  44. int e = Serial.read() - 48;
  45. Serial.read();
  46. Serial.read(); //Takes the last 2 characters (\r\n) of the input out the buffer
  47.  
  48. if (c == 'R' || c == 'r'){
  49. red = (h * 100) + (t * 10) + e;
  50.  
  51. }
  52. if (c== 'G' || c == 'g'){
  53. green = (h * 100) + (t * 10) + e;
  54. }
  55. if (c == 'B' || c == 'b'){
  56. blue = (h * 100) + (t * 10) + e;
  57. }
  58. }
  59.  

 

Dwnldicon Download the Daylight simulator

 

All lines above marked with a //<--2812, are especially meant for the usage with the Adafruit Neopixel library. (It has to be installed!). If you use another way of controlling your LED's, skip that rules and replace them with code for your situation.

When the program runs, it uses the serial line to communicate. It tells you the current color, and you can pass information using the serial line to your Arduino, to change the color. All commands exist of 4 characters: you start with an R, G or B to tell which color you want to change, with thereafter a value of 3 digits! (use leading zero's! the value of 7 is typed as 007). After sending the command, you'll see the color of the light change immediately, and on your serial monitor the new values of R, G and B are shown.

Just enter values until you are satisfied with the neutral color of white, but also with the brightness. Depending on your LED's, it is possible that your amount of light is too bright. For my situation and LED's, I came to a neutral color of white with the next setting:

  • Red: 255
  • Green: 181
  • Blue: 90

 

Index of this article

Add comment


Security code
Refresh

Powered by Amazing-Templates.com 2014 - All Rights Reserved.