-1
\$\begingroup\$

Can a color sensor detect more than one color at once WHILE distinguishing them?

For example: Say I wanted a program to activate only if both red and violet are detected at the same time. Is that possible? How could I do that?

\$\endgroup\$
4
  • 4
    \$\begingroup\$ That's called a camera. \$\endgroup\$ May 4, 2017 at 1:23
  • \$\begingroup\$ Or two color sensors? \$\endgroup\$
    – Dampmaskin
    May 4, 2017 at 1:36
  • \$\begingroup\$ You have a colour sensor (photodiode?) that's more sensitive to red, and one more sensitive to violet, and compare the results. Of course it's more complicated than that as you have to check their sensitivities to different light frequencies and do some math. \$\endgroup\$
    – Bradman175
    May 4, 2017 at 3:35
  • \$\begingroup\$ Do you need to distinguish the full visible spectrum? What are your requirements regarding accuracy? Is your sensor required to detect two colors from one area (light source) at the same time? Or could one move the sensor over two light sources and it should be able to say what wavelength each light source is? More background info would help. Please add the details to you question by clicking "edit". \$\endgroup\$ May 4, 2017 at 6:30

1 Answer 1

3
\$\begingroup\$

Think of a colour sensor as a single pixel camera. If you held up a red and blue object to this sensor it would detect both of those as a combined signal, purple. If you want to differentiate with more detail, you need more resolution.

There are tons of cheap camera modules available which you can use for various tasks. OpenCV makes extracting useful data much less of a hassle.

\$\endgroup\$
4
  • \$\begingroup\$ could you use two color sensors and then in the programming distinguish only if these to sensors detect there certain frequency would an action happen? Trying to keep it as cost efficient as possible. \$\endgroup\$
    – Jolley50
    May 4, 2017 at 1:46
  • \$\begingroup\$ @Jolley50 By frequency, do you mean wavelength of light? \$\endgroup\$
    – jonk
    May 4, 2017 at 1:47
  • \$\begingroup\$ @jonk Yes wavelength \$\endgroup\$
    – Jolley50
    May 4, 2017 at 1:57
  • \$\begingroup\$ Yes your solution could work. If your sensor outputs an analog value you could place a coloured filter over the sensor and look at the intensity of the light coming in. That's basically how colour cameras work, the sensors are inherently monochromatic. Coloured filters are laid over each sensor in a specific pattern, and the result is converted into a colour image. \$\endgroup\$ May 4, 2017 at 2:23

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.