Artglint
I recently created this room lighting project to make my paintings with ghost paint look better at night. I converted the painting into a remote using the color sensor.
Downloads
Supplies
Arduino uno R3
Jumper wires
TCS3200 color sensor
5V RGB Led strip
5V 2A Adapter
12V 1A Adapter
1k resistance x3
TIP31 Transistor x3
Insulating tape
Nano tape
Wooden frame
Making Process
#define s0 8 //Module pins wiring #define s1 9 #define s2 10 #define s3 11 #define out 12 #define LED_R 3 //LED pins, don't forget "pwm" #define LED_G 5 #define LED_B 6 int Red=0, Blue=0, Green=0; void setup() { pinMode(LED_R,OUTPUT); //pin modes pinMode(LED_G,OUTPUT); pinMode(LED_B,OUTPUT); pinMode(s0,OUTPUT); pinMode(s1,OUTPUT); pinMode(s2,OUTPUT); pinMode(s3,OUTPUT); pinMode(out,INPUT); Serial.begin(9600); //intialize the serial monitor baud rate digitalWrite(s0,HIGH); //Putting S0/S1 on HIGH/HIGH levels means the output frequency scalling is at 100% (recommended) digitalWrite(s1,HIGH); //LOW/LOW is off HIGH/LOW is 20% and LOW/HIGH is 2% } void loop() { GetColors(); //Execute the GetColors function analogWrite(LED_R,map(Red,15,60,255,0)); //analogWrite generates a PWM signal with 0-255 value (0 is 0V and 255 is 5V), LED_R is the pin where we are generating the signal, 15/60 are the min/max of the "Red" value, try measuring your own ones //e.g: if the "Red" value given by the sensor is 15 -> it will generate a pwm signal with 255 value on the LED_R pin same for 60->0, because the lower the value given by the sensor the higher is that color analogWrite(LED_G,map(Green,30,55,255,0)); analogWrite(LED_B,map(Blue,13,45,255,0)); } void GetColors() { digitalWrite(s2, LOW); //S2/S3 levels define which set of photodiodes we are using LOW/LOW is for RED LOW/HIGH is for Blue and HIGH/HIGH is for green digitalWrite(s3, LOW); Red = pulseIn(out, digitalRead(out) == HIGH ? LOW : HIGH); //here we wait until "out" go LOW, we start measuring the duration and stops when "out" is HIGH again, if you have trouble with this expression check the bottom of the code delay(20); digitalWrite(s3, HIGH); //Here we select the other color (set of photodiodes) and measure the other colors value using the same techinque Blue = pulseIn(out, digitalRead(out) == HIGH ? LOW : HIGH); delay(20); digitalWrite(s2, HIGH); Green = pulseIn(out, digitalRead(out) == HIGH ? LOW : HIGH); delay(20); }