How are you doing, guys?
So this is Color Mixer Version 1, which is basically a DIY version of the commercially available RGB Box used in photography.
The commercially available "RGB box lights" is used in cinematography to set various different kinds of scenes.
If we ought to buy these lights, they are not exactly cheap and sometimes hard to find, so I thought why not make a DIY alternative using an Arduino Board with WS2812 LEDs and a few components?
The DIY version is basically an RGB controller that has three pots for changing individual colors (R, G, and B). An OLED is also attached for displaying the value in 10-bit resolution.
Material RequiredFollowing are the materials used in this built-
- RGB LED Matrix (WS2812 LEDs)
- Arduino Nano x1
- Potentiometers x3
- SSD1306 OLED DISPLAY x1
- PCB Breadboard x1 (https://www.tindie.com/products/maepa/pcb-breadboard/)
- Custom 3D Printed Part
For the light source, I'm utilizing one of my previously made projects, which was a 16x8 pixel matrix consisting of 128 LEDs.
https://www.hackster.io/Arnov_Sharma_makes/custom-16x8-ws2812-matrix-project-89778d
This project was a complete DIY guide about how to make a custom matrix, so do check that out.
The reason for using this matrix was the number of LEDs it had and the WS2812B LED. The WS2812B LEDs can be controlled by one single PWM pin, which is perfect if we want to use a small microcontroller or reduce the soldering work by a bit.
We do require a custom library that is made by Adafruit to run this matrix as well.
This matrix will be the front layer, and there will be another PCB that will be the second layer and house all the electronics.
Seeed Fusion ServiceAs for the PCBs of the matrix, they were sent to SEEED Studio for samples.
An order was placed for a white solder mask with black silkscreen, and PCBs arrived in less than a week, which was super fast.
The quality was very good considering the price, which was also pretty low.
Seeed Fusion PCB Service offers one-stop prototyping for PCB manufacture and PCB assembly and as a result, they produce superior quality PCBs and Fast Turnkey PCBA within 7 working days.
Seeed Studio Fusion PCB Assembly Service takes care of the entire fabrication process, from PCB manufacturing and parts sourcing to assembly and testing services, so you can be sure they are getting a quality product.
After gauging market interest and verifying a working prototype, Seeed Propagate Service can help you bring the product to market with professional guidance and a strong network of connections.
Breadboard SetupWe first use a breadboard to make a simple Arduino nano setup with three potentiometers connected with the analog pins of the Arduino Nano, an OLED display with the SDA and SCL pins of the Nano, and the matrix with Digital Pin 9. (we choose 9 because its PWM enabled)
This setup was made first to check if this concept works or not.
The wiring diagram is attached, which you can use for this step.
Also, the number of LEDs can be changed in the sketch; this will affect the power of the whole board. The more LEDs we use, the more power will be consumed.
I used 16 LEDs for testing and 64 LEDs for the finished product.
CODEHere's the main code that is being used, and it's a simple one.
It uses the Adafruit Neopixel Library to drive the LEDs. Three pots are declared, and their values are monitored and read, which are later displayed on the OLED screen.
The value of each potentiometer affects the LED color.
#include <Adafruit_NeoPixel.h>
#define NEOPIXELS 64
#define LEDsPin 9
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#define OLED_WIDTH 128
#define OLED_HEIGHT 64
#define OLED_ADDR 0x3C
Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT);
const int redPotPin = A0;
const int greenPotPin = A1;
const int bluePotPin = A2;
int redValue = 0;
int greenValue = 0;
int blueValue = 0;
int redPotValue = 0;
int greenPotValue = 0;
int bluePotValue = 0;
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NEOPIXELS, LEDsPin, NEO_GRB + NEO_KHZ800);
void setup() {
pinMode(LEDsPin, OUTPUT);
pinMode(redPotPin, INPUT);
pinMode(greenPotPin, INPUT);
pinMode(bluePotPin, INPUT);
display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
display.clearDisplay();
Serial.begin(9600);
}
void loop() {
display.clearDisplay();
redPotValue = analogRead(redPotPin);
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.println("RED=");
display.setCursor(50, 0);
display.println(redPotValue);
// Serial.println("RED=");
// Serial.println(redPotValue);
greenPotValue = analogRead(greenPotPin);
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 20);
display.println("GREEN=");
display.setCursor(50, 20);
display.println(greenPotValue);
// Serial.println("GREEN=");
// Serial.println(greenPotValue);
bluePotValue = analogRead(bluePotPin);
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 43);
display.println("BLUE=");
display.setCursor(50, 43);
display.println(bluePotValue);
display.display();
// Serial.println("BLUE=");
// Serial.println(bluePotValue);
delay(50);
redValue = map(redPotValue, 0, 1023, 0, 255);
greenValue = map(greenPotValue, 0, 1023, 0, 255);
blueValue = map(bluePotValue, 0, 1023, 0, 255);;
for (int i = 0; i < NEOPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(redValue, greenValue, blueValue));
pixels.show();
delay(50);
}
}
PS: Before uploading this sketch, you need to download and install these two libraries for the sketch to work.
https://github.com/adafruit/Adafruit_SSD1306
https://github.com/adafruit/Adafruit_NeoPixel
Both libraries are from Adafruit, so they are well-documented and easy to install.
PCB Breadboard EditionAfter checking the breadboard version, we recreate the whole board on a PCB breadboard. The PCB breadboard is a small project I made that is a double-sided board consisting of holes for adding components, as we add components to a breadboard to make a permanent circuit.
We use header pins and add wires on the back side with a soldering iron to make a proper circuit board that connects all the components to the Arduino board in the same pin alignment as the previous breadboard version.
The code will remain the same for this, as we are just changing the breadboard and keeping everything the same.
3D Printed HolderFor connecting the matrix with the baseboard, I modeled a simple circuit holder that holds one PCB on the bottom side and another one on the top side by using four mounting screws.
As for 3D printer settings, PLA was used with a 0.4 mm nozzle.
Layer height was set at 0.2 mm, and infill was at the usual 10%.
Final Assembly- We first solder VCC, GND, and Din Pin of Matrix with 5V, GND, and D9 of Arduino Nano.
- After this, we add the 3D Printed circuit holder for mounting both PCBs together by using four M2 screws.
- Assembly is completed.
Here's the result of this build: a working RGB light source that is completely DIY and made by using stuff that I had, so no additional parts were purchased, and the cost of this project is super low compared with the actual RGB lightbox.
As for the final version, I used 64 LEDs to increase the glow and save a bit of power, as this matrix has 128 LEDs, which we can also utilize if the code is altered a bit.
Testing and its useSo here's a practical example of using this color mixer setup.
By using this device, I was able to recreate that awesome scene from Blade Runner 2049 (Ryan Gosling's face closeup).
I used a light on the left side of my face and another light source to get a smattering of blue light on the right side, while the RGB Color Mixer was set to maximum red and a small amount of blue to create pink color.
The result was not half bad, and it was a new thing for me. I haven't captured anything like this before, and setting up things for one awesome shot was super fun.
Next VersionFor the next version, I made a few major changes.
I prepared two separate PCBs that are similar to the current setup, but both boards are different.
On the control board, I replaced the Arduino Nano with Seeed's XIAO microcontroller board and also utilized a power management IC for adding a lithium cell to this setup.
Version 1 was controlled by a USB port, which was not wire-free, so V2 is equipped with an onboard power source to make the whole setup wireless.
On the LED board, I removed the WS2812B LEDs and added regular REB LEDs with a WS2811 IC for controlling the LEDs.
Basically, all the LEDs are in parallel and make one huge pixel, so the code will work faster than before.
I plan to write an article about Version 2 as soon as I receive the PCBs for that project.
This is it for today, folks.
If you need any help regarding this project, do leave a comment.
Thanks for reading this article, and I will be back with a new project soon.
Peace.
Comments