3

I got this color sensor last week, I've been able to get the sensor to recognize blue and red, but not green. still working on this. I use the code in the product page.

so anybody have any idea about this issue? Pretty thanks. enter image description here

Peter Bloomfield
11k9 gold badges48 silver badges87 bronze badges
asked Dec 11, 2014 at 1:12

1 Answer 1

4

Check that you've connected all the Arduino pins correctly to the sensor. In particular, make sure pin 4 on the Arduino is connected to S2 on the sensor.

It's the combination of signals on S2 and S3 which determines which colour is being detected:

S2 S3 Colour
---- ---- ------
Low Low Red
Low High Blue
High Low Clear
High High Green

If S2 is always low then you can only detect red and blue.

If the connections are definitely correct, then ensure you haven't made any code modifications which could interfere with it. You may also want to test pin 4 on your Arduino (e.g. using a multimeter) to make sure it's working properly. If necessary, you could use a different pin instead. However, you'll need to modify the #define S2 line in the code to match.

answered Dec 11, 2014 at 10:07
2
  • Wouldn't clear just be the color on the other side of the object? Or do you mean when it is out of range? Commented Dec 15, 2014 at 0:08
  • @AnnonomusPenguin That's the wording used in the datasheet. The device consists of a basic light sensor with a selectable colour filter. Clear means there's no filter, so it will simply detect the brightness of all visible light falling on it. If you apply the red filter, it mainly detects the brightness of red light, and so on. To detect the actual colour of something, you have to take three readings to get the RGB components; i.e. one with each filter applied. Commented Dec 15, 2014 at 9:51

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.