In this week I built a lighting mixer, which has three color controller  (Red, Green, and Blue) to mix the color of a LED light feature. The general idea is: The box has three knobs that you can calibrate three channels the LED light color; there will be one LED indicating the amount of each color. In this case, when turn up ‘red’, the light intensity of red LED will be increased and RGB LED will be red.

  • Circuit: The circuit include two pieces, one part includes three potentiometers as analog input to mix three color, along with three LEDs to indicate the intensity of each RGB channel. The other part is the RGB LED light that takes the analog read from three potentiometers at the same time. If there is more time I would build the power button to control overall power by opening or closing the circuit.

img_4649-2

  • Housing: This is actually my very first time to build housing for micro-controller. It is a box that I designed and fabricated by laser cutting. It is a challenging process to fit everything in a compact space, that I have to replace the original board to a mini breadboard to host RGB LED light. I used a PingPong ball to house the LED light so it feels like a lighting device. For the front I laser cut three holds to place the knobs, that you can see the lighting changing and controlling at the same time.
  • Future Development: The picture below is what I intended to build, which includes a soft-pot sensor the you can change the overall light intensity of RGB LED. However I went to a wrong direction by thinking this analog read as part of RGB parameter, instead of controlling the overall LED voltage.

img_4661

  • Code: I used Arduino Uno for this project.

const int redLED = 11; // pin that the LED is attached to
const int greenLED = 10; // pin that the LED is attached to
const int blueLED = 9; // pin that the LED is attached to

const int redPin = A0; // pin that the LED is attached to
const int greenPin = A1; // pin that the LED is attached to
const int bluePin = A2; // pin that the LED is attached to

const int control = A5; // pin that the overall control is attached to

int redRGB = 3;
int greenRGB = 5;
int blueRGB = 6;

int analogR = 0; // value read from the pot
int brightR = 0; // PWM pin that the LED is on.
int analogG = 0; // value read from the pot
int brightG = 0; // PWM pin that the LED is on.
int analogB = 0; // value read from the pot
int brightB = 0; // PWM pin that the LED is on.
int analogControl = 0; // value read from the pot
// Init our Vars
int currentColorValueRed;
int currentColorValueGreen;
int currentColorValueBlue;
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
// declare the led pin as an output:
pinMode(redLED, OUTPUT);
pinMode(greenLED, OUTPUT);
pinMode(blueLED, OUTPUT);

pinMode(redRGB, OUTPUT);
pinMode(greenRGB, OUTPUT);
pinMode(blueRGB, OUTPUT);
}

void loop() {
brightR = map( analogRead(redPin), 0, 1023, 0, 255 ); //divide by 4 to fit in a byte
analogWrite(redLED, brightR); // PWM the LED with the brightness value
//Serial.println(brightR); // print the brightness value back to the serial monitor

brightG = map( analogRead(greenPin), 0, 1023, 0, 255 ); //divide by 4 to fit in a byte
analogWrite(greenLED, brightG); // PWM the LED with the brightness value
//Serial.println(brightG); // print the brightness value back to the serial monitor

brightB = map( analogRead(bluePin), 0, 1023, 0, 255 ); //divide by 4 to fit in a byte
analogWrite(blueLED, brightB); // PWM the LED with the brightness value
//Serial.println(brightB); // print the brightness value back to the serial monitor
//overall control:
analogControl = map( analogRead(control), 0, 1023, 0, 255);
//Serial.println(analogControl);
//for RGB LED:
// Read the voltage on each analog pin then scale down to 0-255 and inverting the value for common anode
currentColorValueRed = (255 – brightR);
currentColorValueGreen = (255 – brightG);
currentColorValueBlue = (255 – brightB);

// Write the color to each pin using PWM and the value gathered above
analogWrite(redRGB, currentColorValueRed);
analogWrite(greenRGB, currentColorValueGreen);
analogWrite(blueRGB, currentColorValueBlue);
}

Advertisements