Schematic and Build
Below shows the schematic diagram.of the RGB LED color mixer.The RGB LED used here has four leads, one for each color an one for the common cathode(ground). The Red LED operates on a voltage of 2 V, Green needs 3.5 V, and the Blue LED needs also 3.5 V. Each LED draws 20mA current, so the maximum current consumption is 60mA. The supply for the circuit is 5V DC. The µ-controller reads the value of the potmeters by using the three channels of the ATMega328's analog-to-digital convertor. The corresponding value is reflected to the thrtee LED's by using a eight bit PWM. Each ADV channnel converts the analog voltage output of the potentiometer into a digital value within the range of 0 to 255 which can be converted directly to the intensity level of the coresponding LED.
The circuit is simple.The RGB LED is hooked up to the PWM outputs on PORTB1, PORTB2 and PORTB3 of the ATMega328. The potentiometers are connected to the ACD channel inputs PC0- PC2.There is also a resistor between the LED's and the µ-controller to limit the current to 20mA. The circuit with the RGB LED with the current limiting resistors and the potentiometers is build on a breadboard and connected to the ATMega328 board with jumper wires.
You can buy the ATMega328 board at www.bizztronix.eu.