Help with programming the TCS230-DB
raejj
Posts: 14
Hi,
For my capstone project, I decided to use the TCS230-DB color sensor. The color sensor will identify the colors my client inserts into the interactive wall panel I am designing. Depending on the color of the air hockey puck, different musical patterns will be played. Due to my background in programming, I plan to have just three colors: red, green, and blue. The code I have so far is given as an attachment. The value for red is high since it was the color when I purchased the air hockey puck. I spray painted the blue and green pucks, resulting in poor results. The scan for red is R 031 G 000 B 003. The scan for blue is R 000 G 000 B 003, and the scan for green is R 001 G 000 B 003.
I have looked at the datasheet for the color sensor and read the article Color Me Tickled from Jon Williams. He has several subroutines with white balance and calibrating colors. I can follow the code and understand what he is doing, but I do not want to copy it. Rather than having a comparison between known and scanned color values, I wanted to just scan a color and depending on the highest value (red, green or blue), output a musical pattern.
Why does the green puck not register green?
Is there a simpler way to identify colors and still retain the precision?
Any suggestions would be greatly appreciated.
For my capstone project, I decided to use the TCS230-DB color sensor. The color sensor will identify the colors my client inserts into the interactive wall panel I am designing. Depending on the color of the air hockey puck, different musical patterns will be played. Due to my background in programming, I plan to have just three colors: red, green, and blue. The code I have so far is given as an attachment. The value for red is high since it was the color when I purchased the air hockey puck. I spray painted the blue and green pucks, resulting in poor results. The scan for red is R 031 G 000 B 003. The scan for blue is R 000 G 000 B 003, and the scan for green is R 001 G 000 B 003.
I have looked at the datasheet for the color sensor and read the article Color Me Tickled from Jon Williams. He has several subroutines with white balance and calibrating colors. I can follow the code and understand what he is doing, but I do not want to copy it. Rather than having a comparison between known and scanned color values, I wanted to just scan a color and depending on the highest value (red, green or blue), output a musical pattern.
Why does the green puck not register green?
Is there a simpler way to identify colors and still retain the precision?
Any suggestions would be greatly appreciated.
doc
24K
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
-Phil
So, you think I should increase the duration greater than 15 ms. I'll have to try it.
I am getting these readings with the LEDs on, but for some reason, the LEDs flash on and immediately turn off after. I tried changing the code but it still flashes.
And how do you set the subject distance? I read the datasheet but it seems you can only adjust from the aluminum standoffs. Is that correct?
It's okay if the LED flashes, since it needs to be "on" only when it's taking a reading. It helps to limit current consumption and prolongs the LEDs' useful life. Can you list your BASIC Stamp program here, please? I just want to ascertain that the LEDs are on at the right times.
-Phil
Another thought: try using DEC instead of DEC3 in your DEBUG statement. You may be getting chopped-off leading digits. If you have a scope, you can look at the signal on ColorOutput to see if you're getting anything.
BTW: It's nice to see a properly-formatted program, like yours, presented in the forum. I wish more people would follow suit. It makes the job of those trying to help so much easier!
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 4/9/2009 12:37:35 AM GMT
and how you do the "white balance" routine?
btw, i also use TCS230 for my final project. and i can't answer why i need white balance routine done. i use jon williams code with some modification, i only read color value and not save it on EEPROM.
so i think your answer can give me enlightenment..
thanks,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
oh no..