Online calculator for resistor values of RGB to obtain a certain color? - Page 1
Forum section: electronics / beginners

author: Falcon69
author_rank: Super Contributor
timestamp: March 26, 2016, 03:28:40 am
content: Anyone have a link to an online calculator that would show the resistor values needed for each color of an RGB to obtain a certain color output of said RGB? Certainly it can be calculated using Excel or something. I know a PWM is the way to go, but I don't want to implement a micro-controller for something that will never change colors. I just want to set it and be done with it.There must be something ouot there, put in Forward voltage of each LED, the Voltage in, etc. Then you can calculate the resistors needs to get the color.What if I took the resistor value needed to obtain 20mA through each LED, then based on that, and 0-255 and using the hexidecimal to get the color I want, I can calculate the percentage of resistance needed for each color?

author: sleemanj
author_rank: Super Contributor
timestamp: March 26, 2016, 04:15:02 am
content: Ignoring that different LEDs will have different characteristics meaning you probably have to tweak things for your specific leds anyway to get a good balance of colours (with regard to intensity of each die), changing the current through an LED will change it's colour slightly also.For that reason, PWM is the better idea, maintain the same instantaneous current so the colour remains the same, and adjust the PWM duty cycle of that current to adjust the amount of that colour in the overall combination.With that said, here you go, a spreadsheet I just made which just calculates resistances for 0 to 20mA through each for 255 steps...https://docs.google.com/spreadsheets/d/1Z_2JToEy1v5mtXm4NCGtIV0VkrqYtnPCRqtROACH2fE/edit?usp=sharing

author: Falcon69
author_rank: Super Contributor
timestamp: March 26, 2016, 05:10:07 am
content: sleemanjI owe you a beer if I ever get the cash to visit New Zealand. You are awesome. exactly what I was looking for.And yes, I understand PWM is the way to go, but that adds more components and for something I just want to set and leave, just changing resistors I think will work. I will be using 0603 RGB Leds. They are small, about the size of two 0603 leds side by side.I'm sure I will need to tweak these values for brightness and everything else, but this gives me a GREAT starting point.Thank You sir.This spreadsheet should be something that should be 'stickied'

author: Kilrah
author_rank: Unknown
timestamp: March 26, 2016, 06:19:58 am
content: Can't see how this could be of much use since it doesn't account for the different current-to-light output characteristic of each LED, some will need 2mA to produce X lumens, some 20mA. That would need calibration for whatever LEDs you're going to use. Don't be surprised if it's completely off.

author: Falcon69
author_rank: Super Contributor
timestamp: March 26, 2016, 06:23:17 am
content: oh, I know, but it gives me a good starting point, and yes, I know what you mean.To get the Red and Green LED (of the LEDs I have) to appear to be the same brightness, I had to run the Red with the 100ohm resistor, and the green with a 4k ohm resistor (when normally it would be about 160 for 20mA).I'll need to tweak it alot, but it is a good starting point.

author: rdl
author_rank: Super Contributor
timestamp: March 26, 2016, 11:28:01 am
content: Hehe, this is so true. I have some old Panasonic 7-segment displays that are still pretty dim at 15 mA and some new blue ones that are almost too bright to look at with only 5 mA.Quote from: blueskull on March 26, 2016, 07:54:17 am

author: XOIIO
author_rank: Super Contributor
timestamp: March 26, 2016, 11:39:46 am
content: For something that you will just leave, you can get an attiny85 for extremely cheap, it can do the PWM just fine, and you can program it using the arduino IDE and an arduino, I'm not 100% sure but I seem to recall programming them with a pro mini, could give it a try actually.They make for great little drop ins for things you don't want to spend too much on, though a pro mini itself is pretty darn cheap on ebay, the attiny will be a bit more compact.

author: tooki
author_rank: Super Contributor
timestamp: March 26, 2016, 01:44:06 pm
content: And don't forget that our eyes do not have a linear response to brightness, so you need gamma correction to shift more of the brightness levels to the lower range of the brightness scale.

author: dentaku
author_rank: Frequent Contributor
timestamp: March 26, 2016, 07:16:22 pm
content: It seems to me that the best way is just to use three pots so you can adjust it to what you think looks right then measure the value of each pot and find the nearest resistor value to those pots and use those in your final circuit.

author: Dubbie
author_rank: Unknown
timestamp: March 31, 2016, 06:17:14 pm
content: That's really the only way that is going to work. A few percent error can be perceived as a very different colour at some parts of the color gamut.Sent from my phone using Tapatalk