Hi there
I have found this colour sensor to be really difficult to work with.
I have been trying to code it so that it can detect a coloured card and display the colour on the screen.
If the card is pure red, then the red value is usually highest, so I can display red.
Blue and Green are less obvious and then mixed colours are even more difficult, such as orange or yellow.
Does anyone know how I might be able to turn RGB, clear and colour temperature values into something that will help me identify the colour being presented from the following list:
red, green, blue, yellow, orange, purple?
Many Thanks
have a look at this library - GitHub - ratkins/RGBConverter: An Arduino library for converting between HSL, HSV and RGB colour spaces. -
it can convert RGB color space to HSV from which the HUE component is what you are looking for.
reader - HSL and HSV - Wikipedia -
Thanks robtillaart
The library that you pointed me to on Github does not have any example files, so I did not really understand how to invoke it. However, I have used the maths on the wiki site and now have a reasonably good way of detecting colour with the Adafruit sensor. I appreciate your help.
I have found that the TCS34725 needs to be in contact with the coloured item for it to detect it correctly. That is a shame because I wanted to use the device to detect coloured card placed in front of it at a distance of about 10cm, but this will not work. As I know very little about lenses, this project is unlikely to ever work.