Project 04 - The Green light of the multicolored led is very weak

Hello all,

I have done a research in the forum but I couldn't find posts about the Project 04; I followed the instructions in the projects book, but the green light in the multicolored led is very weak, at the point that you can notice it only if you disconnect the other two lights. Is this normal?

This is a sample of the data I get:

Mapped Sensor Values Red: 81 Green: 28 Blue: 31 Raw Sensor Values Red: 324 Green: 115 Blue: 123

Thank you very much for your help and Happy Holidays

Also, I'd like to thank the Arduino team for creating Arduino and its starter kit. If I could suggest a little thing, it would be nice to have a good binding on the projects book, since it broke during the first day of use...

I had no problems with the RGB Led supplied in the kit, however when I tried to use another RGB Led I had a similar problem with the Red light drowning out the others. After consulting several sources here's what came about,

LED's from the same manufacturer but in different batches can have varying visual results, once you have assured all your pins are connected properly you can either tweak your code to use PWM to equalize the light levels(this can get a little messy one the code end) or experiment with different resistors on the pins.

To solve my issue I first place ad 220ohm resitor on the red channel, this brought the red level to not drown the others out nut made the green drown out the blue. I then placed 220ohm resistor on the green channel, this effectivly balance the three channels in my RGB LED so I could produce white light.

The same resistor value may not work for you but experimenting will find the ones that will . If your green is not lighting up enough to be noticed start with adding a 220ohm resistor to the red and blue legs.

Also keep in mind that in this project the light of the room your in is filtered through the colored gels so the type of lighting in the room can effect the outcome. I have florescent light and got much more noticeable results with the color gels removed.

Lastly you could use a calibration routine and some funny math to first set and balance readings from the photoresistors.

Thank you, your reply has been very comprehensive. Have a nice day!

To test the RGB LED, I tweaked the code to test various RGB-Values.
You can do this by replacing the following code:

/* Now that you have a usable value, it’s time to PWM the LED. */
analogWrite(redLEDPin, redValue);
analogWrite(greenLEDPin, greenValue);
analogWrite(blueLEDPin, blueValue);


/* Now that you have a usable value, it’s time to PWM the LED.*/
analogWrite(redLEDPin, 20);
analogWrite(greenLEDPin, 250);
analogWrite(blueLEDPin, 10);

The values 20/250/10 for the RGB LED, where necessary to obtain a white light with the one I have.
I guess, this is only the starting point for an optimized code.


Once you've found out, the difference between R, G & B, you can change the following code:

/* In order to use the values from the sensor for the LED, you need to do some math. The ADC provides a 10-bit number, but analogWrite() uses 8 bits. You'll want to divide your sensor readings by 4 to keep them in range of the output. */ redValue = redSensorValue/4; greenValue = greenSensorValue/4; blueValue = blueSensorValue/4;

The divider (4) should be replaced by a new one. Let's say, you have a perfect white with 50/255/50 on your RGB LED, meaning your Red and Blue should be 5 times weaker, you would change your code in this way:

redValue = redSensorValue/20; greenValue = greenSensorValue/4; blueValue = blueSensorValue/20;

The overall output of your RGB LED is now weaker.