Trouble sampling output from ColorPal
ramrez
Posts: 3
Hello everyone,
I'm having difficulty sampling output from my ColorPal sensor. When I sample ambient light I get 0x334641 using a multimeter on the ColorPal sig output. When I sample black and white (for references) I get 0x303039 and 0x304139 respectively. Then when I try to determine the reference colors for black and white I get 0x000507 and 000600 respectively which are relatively close.
I'm trying to establish references (will I have to store them in EEPROM at the start of my code?) to get some color recognition.
If anyone could clarify any misunderstandings it would be GREATLY appreciated; I've been stuck on this issue for too long...
I'm having difficulty sampling output from my ColorPal sensor. When I sample ambient light I get 0x334641 using a multimeter on the ColorPal sig output. When I sample black and white (for references) I get 0x303039 and 0x304139 respectively. Then when I try to determine the reference colors for black and white I get 0x000507 and 000600 respectively which are relatively close.
I'm trying to establish references (will I have to store them in EEPROM at the start of my code?) to get some color recognition.
If anyone could clarify any misunderstandings it would be GREATLY appreciated; I've been stuck on this issue for too long...
Comments
The ColorPAL is a miniature color and light sensor which, through its RGB LED, doubles as a color generator. For sensing color, the ColorPAL uses its LED to illuminate a sample, one color component at a time, along with a broad-spectrum light-to-voltage converter to measure the light reflected back. The amount of light reflected from the sample under illumination from each red, green, and blue LED can be used to determine the sample’s color.
Sorry what I meant to say was that I'm actually using a logic analyzer to read the hex bytes sent out by the ColorPal signal line.
Its sending me the bytes at the documented baud rate of around 4800. I am using "= X s #00" followed by "= R s #02" to store on the EEPROM. Then when I run the program by powering up the Sensor, I read 0x30 x032 0x34 AND 0x30 x032 0x36 on the sig line through the Logic Analyzer. I am not sure why I get the same bytes when the LED is off and when the LED is red? I have been reading about the Ambient Light and the Black/White references but that does not make much sense from the provided documentation. Could you please clarify how to detect colors, for example to get the color Green when Green is illuminated and reflected from a Green object.
Thanks and I have been stuck on the same issues for 3 weeks. Your reply seems like a green light at the end of the tunnel. Pardon the pun.
regards,
Ramrez
The black sample measurement should give fairly low intensity readings (if no ambient light gets in to the sensor), and the white measurement should give high intensity readings.
Seems like you are having the same issue I had resolved this morning. Do not look at each reading as an RR GG BB reading, rather convert it to a 3 digit ASCII. In your case, it would be
0x024 AND 0x026 for your Ambient and Red readings. Now why are they so close, I am not sure, its probably because you are taking a reading with lots of ambient light for your RED sample. Ideally the object should be right against the sensor so no ambient light gets in like kwinn explained. I am not sure if you can detect something far away as well, unless there are tricks to do that such as Sensitivity settings etc.
Hope this helps,
Vipin
Thank you for that very helpful calibration PDF! One suggestion: be sure to stress that the multiplication by 100 or 255 has to occur before the division by the white-minus-black factor.
And please send Parallax a note to see if they will include your doc on the ColorPAL product webpage.
-Phil
Done and done.