Arduino Color Sensor
Here we will be learning how to make a color sensor. my model consists of three cardboard compartments containing an LED – one red, one blue, and one green – and an OP550B phototransistor. The LED’s shine simultaneously on a solid colored card. The phototransistors are connected to an Arduino Uno, which converts the relative amounts of measured reflected light of each color into RGB components which are used to light an RGB LED the same color as the card.
Step 1: Materials
* Red LED
* Green LED
* Blue LED
* RGB LED
* 3 phototransistors – I used OP550B’s, but others could be used.
* 6 220 ohm resistors
* 3 10k ohm resistors
* Cardboard or some other divider to separate the LED’s
* Breadboard or circuit board and soldering materials
* Arduino and usb cord
* Electrical tape
* Cards of various colors – I used index cards covered in electrical tape of different colors.
Step 2: Step 1: Create the Circuit Board
* See attached circuit diagram
* Make sure to leave enough room to superimpose the dividers – in my case a compartmentalized cardboard box – later.
Step 3: Step 2: Make the Light-Proof Box and Cards
A. Cut thin strips of cardboard just big enough to form a box enclosing the 3 LEDs and Phototransistors
B. Attach the outer box to the circuit board. I used a hot glue gun to do this, but clay or another opaque, malleable substance would be more effective for keeping light out.
C. Cut two more thin strips of cardboard the same height as the outer box, and just long enough to fit snugly inside the box.
D. Attach these inside the box to separate the three LED/transistor pairs. I taped the sides and bottom of the inner strips to the inside sides of the box with white electrical tape.
E. Cover the bottom of the circuit board with electrical tape to prevent outside light from getting through the holes in the circuit board.
F. Enclose the RGB LED in a light proof material like electrical tape to prevent it from interfering with measurements (see diagram).
G. Cover the sides of the box with electrical tape to reduce outside light interference.
H. Cut out several squares of index card big enough to cover the box. Cover each side with a single color of electrical tape.
Step 4: Step 3: Write Code
/**Runs a color sensor on the Arduino
* Start the program while showing it the white card. When the RGB LED turns off,
* switch (quickly) to the black card. After the RGB LED flashes white, it is ready.
This Post / Project can also be found using search terms:
- arduino color sensor
- Color sensor circuit
- arduino color sensor project
- rgb color sensor using arduino