This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

How can i calibrate the leds hardware side?  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Playing around with some microcontrollers and multiplexed leds i noticed that i always need to fix the colors of each led rgb output softwareside... thats a pain...

Microcontroller's pwm output has an output of 255 different values.

By mixing a color with rgb leds you do some math... i like hsl(hsv in mc's) and convert it to rgb values.

So if i want yellow i need theoretically turn on the red and the green at 100%

rgb(255,255,0);

nope... it's not yellow...

here the lighness is not considered...the real rgb values should be less than 255 pwm. all set to 255 should return white.
the blue and the green leds are brighter.
in my code i have something like that


i use only 15% of the blue led when mixing the colors.20% of the green one.

The maximum value of pwm used is 38

38 of 255 possible values. A waste!

Those are the resistors i need to properly power the leds.

Red: 5v@2.1v-20mA = 150ohm

Green: 5v@3.2-20mA = 100ohm

Blue: 5v@3.1v-20mA = 100ohm (corrected error 2,1v vs 3.1v)

How can i calibrate the leds hardwareside?

I know i need only 15% of the emitted light comming from the blue led... what resistor should i use?

Is there some sort of calculation that allows me to set the correct resistor based maybe on the wavelength or other carachteristics contained in the datasheet?

Would a Simple LDR help to calibrate those leds?

If i find the correct resistors for a nice hue based on a lightness of 50% what would return rgb(255,255,255) ??? white or not?

What you do to get a nice visual hue on rgb leds?

this for shure would also help to solve some issues on another question i made some time ago

RGB LED:LL0548RGB: http://www.3lco.biz/attachment.php?id_attachment=2


LDR:FW300: http://www.tme.eu/en/Document/87635cc5df0a0233548b9300450c47dc/FW300.pdf
 
Saloon Keeper
Posts: 2590
327
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like the current vs. intensity curve for an LED is fairly linear, so you could start with simply reducing the current for the green and blue elements based the percentages that you have already determined.


Image from: https://www.design-reuse.com

Green: (5.0v-3.2v)/.020mA/20% => 470Ω
Blue:  (5.0v-3.1v)/.020mA/15% => 680Ω


I gave it a quick try with using those values with a RGB LED that I had on my bench and the white balance seemed pretty good.  I don't know how it may shift when you PW modulate it though.
 
Bartender
Posts: 20766
124
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the theoretical (design) world, everything can be predicted mathematically.

In the real world, that's only approximate. Different parts will behave differently even if they are the "same" part. That's due to small differences in manufacturing and materials.

It used to be somewhat of a challenge back in the pre-IC days to do things like differential amplifiers because you'd have to sort through a box of transistors until you found a pair that matched closely enough. Fortunately with IC amps, that's less of a problem, because the transistors fabricated on the same die have virtually identical properties.. However, discrete LEDs vary just as much as discrete transistors do, so if you want extreme precision you have to measure the actual devices being used on a per-circuit basis.

Also please note that "PWM" stands for Pulse Width Modulation, which is not the same thing as current or voltage control. With PWM, the LED turns full on or full off and the apparent differences in brightness as you vary the pulse width are purely psychological - unlike resistence-based lamps there's no heated filament getting brighter and dimmer as voltage is applied and removed. To get true analog dimming, you'd have to use an analog output device and the Arduino can only handle analog as an input unless you attach it to some sort of external DAC hardware.

Overall, it's easier to tune stuff like that in software rather than hardware. And software can be re-tuned for different temperature conditions and to allow for aging components. Trim pots and stuff like that can help with the hardware but the cost is a higher overall parts count.
 
Ron McLeod
Saloon Keeper
Posts: 2590
327
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The OP's issue was that if the calibration was done in software, that since the green and blue elements were so much brighter than the red, that the effective dynamic range would be reduce to just a few bits, and that calibrating on the analogue side would allow all 8 bits to be each on each colour.

I included the current vs. intensity graph to show that you can treat current vs. brightness as linear when calculating the values to use to white balance the LED elements - it was not intended to be show brightness vs. duty cycle of the PWM (although to the eye, that is fairly linear was well).
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..i am a new user here. As per my knowledge with IC amps there is less of a problem, because the transistors fabricated on the same die have virtually identical properties.Discrete LEDs vary just as much as discrete transistors do.
 
The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!