Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Color tracking
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Color tracking

by potter3366 on Fri Mar 27, 2009 7:03 am

I have little enclosure with 4 LEDs (red, green, blue, yellow) which indicate 6 status:

1: only red
2: only green
3: only blue
4: only yellow
5: red-green
6: blue-yellow

How can I track this 6 status?
a) maybe an ordinary web-cam might be more suitable (to find average color) or
b) with arduino kit and color sensor

The results must be 6 variables (for example 1,2,3,4,5,6) which I will use in my DirectX project.

Any help for a novice is greatly appreciated.

potter3366
 
Posts: 9
Joined: Thu Dec 11, 2008 3:32 pm

Re: Color tracking

by mtbf0 on Fri Mar 27, 2009 8:33 am

how about removing the leds and connecting wires from their anodes to an arduino directly to sense which are on. painfully easy to code. just remember to connect ground on the arduino to ground on the led circuit.
"i want to lead a dissipate existence, play scratchy records and enjoy my decline" - iggy pop, i need more
User avatar
mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am
Location: oakland ca

Re: Color tracking

by potter3366 on Fri Mar 27, 2009 9:09 am

Unfortunately, I can't remove LEDs :(
M.

potter3366
 
Posts: 9
Joined: Thu Dec 11, 2008 3:32 pm

Re: Color tracking

by mtbf0 on Fri Mar 27, 2009 9:53 am

can you attach wires to the board with the leds?
"i want to lead a dissipate existence, play scratchy records and enjoy my decline" - iggy pop, i need more
User avatar
mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am
Location: oakland ca

Re: Color tracking

by potter3366 on Fri Mar 27, 2009 10:04 am

No, this is a miniature enclosure which receives remote singnals...

potter3366
 
Posts: 9
Joined: Thu Dec 11, 2008 3:32 pm

Re: Color tracking

by niksun on Fri Mar 27, 2009 12:28 pm

Take a look at the range of sensors on the Lego Mindstorms NXT. One is used to detect "colors." You may be able to get ideas...
Niksun

If you thought before that science was certain--well, that is just an error on your part. -- Richard Feynman
niksun
 
Posts: 202
Joined: Sun Jul 27, 2008 9:59 pm

Re: Color tracking

by mtbf0 on Fri Mar 27, 2009 3:28 pm

potter3366 wrote:No, this is a miniature enclosure which receives remote singnals...


i suppose next you're going to tell me there's no way to interept these signals. sounds like you're dead set on color recognition.

stephen hobley uses taos color sensors in his lazer harps. think one of their chips is available from parallax, maybe even from radio shack. i got one there, but lost it before i got a chance to play with it. i think you'd have to put a diffuser over your leds.

then there's cmucam or avrcam.

the easiest thing, especially for a novice, would still be to intercept the signals going to you led enclosure.
"i want to lead a dissipate existence, play scratchy records and enjoy my decline" - iggy pop, i need more
User avatar
mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am
Location: oakland ca

Re: Color tracking

by phil.drummond on Fri Mar 27, 2009 11:17 pm

I have a really old piece of equipment that "detects" the status of a lamp inside it's self using a photo cell and a tiny telescope.
It's simply a photo cell at the end of a piece of tubing with a lens on it focused on the lamp.
You could build four of these and aim them at your four LEDs and "detect" them with a Boarduino or something. Heck, you could do it with some transistors and a quad input NAND gate.

Another method would be to receive the remote signal and post-process it to see what the instruction(s) being sent to the four LEDs are. Don't bother modifying the "target" device, just receive and "know" what the LEDs are instructed to be.

If the signals are not being transmitted over radio, then you could try measuring the intensity of each LED and each combination of LEDs to create a table of results. While we would like LEDs to all be the same brightness, they are not. AND you can expect your light measuring tool to have some selection in it's response to the different colors. By knowing how bright the emission is, you can deduce which LEDs are turned on. You could even compensate for room light if you used some sort of simple lens system.

Phil
phil.drummond
 
Posts: 125
Joined: Sun Feb 08, 2009 4:57 pm

Re: Color tracking

by potter3366 on Sat Mar 28, 2009 1:59 pm

Photocell and a tiny telescope is good idea :)
Can I buy this tubes with built-in photocells?

Thanx everybody!

potter3366
 
Posts: 9
Joined: Thu Dec 11, 2008 3:32 pm

Re: Color tracking

by mtbf0 on Sat Mar 28, 2009 3:19 pm

a photo of your enclosure would be nice. if the leds protrude from the box, just use some heat shrink to hold a cds cell up against the lens of the led. if the led shines through a hole in the enclosure cover it with the photocell. otherwise rolled up black construction paper a couple of layers thick would make a usable tube.
"i want to lead a dissipate existence, play scratchy records and enjoy my decline" - iggy pop, i need more
User avatar
mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am
Location: oakland ca

Re: Color tracking

by potter3366 on Sat Mar 28, 2009 9:33 pm

Phil drummond, can you desribe how to hook this 4 leds and integrate with quad input NAND gate...

Thanx!

potter3366
 
Posts: 9
Joined: Thu Dec 11, 2008 3:32 pm

Re: Color tracking

by phil.drummond on Sat Mar 28, 2009 10:03 pm

Ugg... ok, I'll try but the last time I used one of those was a long time ago.
First, as I looked around to find an easy solution to your problem, I realized that you really wanted a quad NAND gate, not a quad input NAND gate. Subtle difference, but important. You have four devices to monitor and you want individual "reports" as to their status. A quad input device would "melt" all four status conditions into a single output.

A transistor can be made to act like a switch by using resistors to bias it at the point where it's almost "on".
You can use a photocell as one of these resistors and when it's value changes, the transistor will conduct and be "on".
If you take the collector of the transistor and attach it to a TTL device such as a Quad NAND gate, you can "normalize" the effect of the photocell reaching a set point as a logic event.
You don't have to use a NAND gate, you can use other devices, but as I recall the Quad NAND gate was really cheap and robust.
I think the part is a SN7400.
You would need a transistor for each photocell and be able to calculate the correct bias for the transistor you choose. I haven't done that in a few years and have gotten out of the habit of designing stuff... it's gotten harder as I have gotten older.
I know this is not the answer you were looking for, sorry about that.

Phil
phil.drummond
 
Posts: 125
Joined: Sun Feb 08, 2009 4:57 pm

Re: Color tracking

by potter3366 on Sun Mar 29, 2009 11:51 am

Oh Phil, too complicated for me..
I searched all of google and found only this example but without transistor like input...

http://www.allaboutcircuits.com/vol_6/chpt_7/2.html

If someone have something similar, please send me..

Thanx!

potter3366
 
Posts: 9
Joined: Thu Dec 11, 2008 3:32 pm

Re: Color tracking

by potter3366 on Thu Apr 09, 2009 12:33 pm

I did it with 4 leds and 4 photocells with black tubes. (Arduino)
Thanx to all !

int val = 0;
int inputPin0 = 0;
int inputPin1 = 1;
int inputPin2 = 2;
int inputPin3 = 3;
void setup () {
Serial.begin(9600);
}

void loop() {
val = analogRead(inputPin0)/4;
Serial.print(val, DEC);
Serial.print(",");
val = analogRead(inputPin1)/4;
Serial.print(val, DEC);
Serial.print(",");
val = analogRead(inputPin2)/4;
Serial.print(val, DEC);
Serial.print(",");
val = analogRead(inputPin3)/4;
Serial.print(val, DEC);
Serial.println();
delay(5000);

}

potter3366
 
Posts: 9
Joined: Thu Dec 11, 2008 3:32 pm

Re: Color tracking

by phil.drummond on Fri Apr 10, 2009 5:11 pm

Nice going! Your project started-out sounding complex and you stuck with it until you found a non-complex solution to it!
In doing this, you educated all of us who were reading the thread! Thank you for posting your follow-up results. :)


Thanks!
phil.drummond
 
Posts: 125
Joined: Sun Feb 08, 2009 4:57 pm

Please be positive and constructive with your questions and comments.