TCS34725 RGB Color Sensor
Moderators: grovkillen, Stuntteam, TD-er
-
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
TCS34725 RGB Color Sensor
I'm waiting for my TCS34725 sensor to arrive. I also have the older model TCS3200 which is not yet supported. When asking google about information regarding color sensors I came upon this project which I find very cool. It essentially report back a color instead of only RGB values. Could be a feature to consider for the plugin?
Extra links:
Wiki article for TCS34725
Data sheet fo TCS3200
PS. The cost of TCS3200 is about 30%-50% of the price for TCS34725. It might be worth to have a plugin for the older chip as well?
TCS3200 vs. TCS34725 in regards of price.
Extra links:
Wiki article for TCS34725
Data sheet fo TCS3200
PS. The cost of TCS3200 is about 30%-50% of the price for TCS34725. It might be worth to have a plugin for the older chip as well?
TCS3200 vs. TCS34725 in regards of price.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



-
- Normal user
- Posts: 118
- Joined: 28 Feb 2017, 07:57
- Location: Austria
Re: TCS34725 RGB Color Sensor
the rgb values are colors
... RED, GREEN, BLUE values, we can only give back numbers from plugins currently so no textual description...
about supporting the old sensor: i wrote the plugin for the TCS34725, and i do not have, nor will i buy an old sensor, because it lacks the i2c interface and the interrupt feature of the new one...
and after a quick look on the old sensor: it has a "complicate" interface:

about supporting the old sensor: i wrote the plugin for the TCS34725, and i do not have, nor will i buy an old sensor, because it lacks the i2c interface and the interrupt feature of the new one...
and after a quick look on the old sensor: it has a "complicate" interface:
...not sure if this would work with the esp8266.The output is a square wave (50% duty cycle) with frequency directly proportional to light intensity (irradiance).
-
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
Re: TCS34725 RGB Color Sensor
Great job on the plugin. Thanks!



Basic RGB colors and their names.

"Silver" is the odd one here as it is based on 1.5 module of 128. I wouldn't add that to the color scheme. But the rest is based on 0,1,2 module of 128 which I find good.
Last edited by grovkillen on 04 May 2017, 08:16, edited 1 time in total.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



-
- Normal user
- Posts: 118
- Joined: 28 Feb 2017, 07:57
- Location: Austria
Re: TCS34725 RGB Color Sensor
implementing the formula and colors would be no problem, but as i said before, plugins can not give back strings (text), they can only give back numeric values, thats a limitiation of the current code, changing this would require major changes in code... another problem is that a plugin currently can only give back 4 values, and even new the sensor does have more than 4 values:
r,g,b, Color temperatur in K, c (clear light value) ...the last one is omitted in the current plugin and is only given via serial logging
r,g,b, Color temperatur in K, c (clear light value) ...the last one is omitted in the current plugin and is only given via serial logging
-
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
Re: TCS34725 RGB Color Sensor
Aha, I did not know that. I will try to create a formula using rules then. Thanks for the support! 

ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



-
- Normal user
- Posts: 118
- Joined: 28 Feb 2017, 07:57
- Location: Austria
Re: TCS34725 RGB Color Sensor
if you get the rules working, plz report back or even better document them on the. wiki
-
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
Re: TCS34725 RGB Color Sensor
Will do!

ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



-
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
Re: TCS34725 RGB Color Sensor
Ok, so I have now experimented the whole day with this and it takes some time to trim it to give good results. I have these settings:


And this rule on rule page 1 (the definitions takes up almost an entire rule page by it self..)
On rule page 2 I have all the definitions defined... some not defined (I just added the "332" for white as well since that is close to white. More "close to" colors need to be added.)
Most readings work just fine and I suspect by tweaking the settings a bit more the results would be even better. All my "calibration" and readings are done at a distance of approx 10mm. Please observe this as a proof of concept. I hope this will further evolve into a plugin which will spit out the 1..15 (silver excluded) given by this page:



And this rule on rule page 1 (the definitions takes up almost an entire rule page by it self..)
Code: Select all
On System#Boot do //When the ESP boots, do
timerSet,1,30 //Set Timer 1 for the next event in 30 seconds
endon
On Rules#Timer=1 do //When Timer1 expires, do
timerSet,1,30 //Resets the Timer 1 for another 30 seconds
Event colorEvent //Start analyzing the color
endon
Code: Select all
On colorEvent do
TaskValueSet,2,1,3
if [Color#Red]<192
TaskValueSet,2,1,2
endif
if [Color#Red]<64
TaskValueSet,2,1,1
endif
TaskValueSet,2,2,3
if [Color#Green]<192
TaskValueSet,2,2,2
endif
if [Color#Green]<64
TaskValueSet,2,2,1
endif
TaskValueSet,2,3,3
if [Color#Blue]<192
TaskValueSet,2,3,2
endif
if [Color#Blue]<64
TaskValueSet,2,3,1
endif
//Get color
TaskValueSet,2,4,[ColorDump#Red][ColorDump#Green][ColorDump#Blue]
if [ColorDump#Found]=111
TaskValueSet,3,1,1 //1=black
endif
if [ColorDump#Found]=333
TaskValueSet,3,1,2 //2=white
endif
if [ColorDump#Found]=332
TaskValueSet,3,1,2 //2=white (same as above!)
endif
if [ColorDump#Found]=311
TaskValueSet,3,1,3 //3=red
endif
if [ColorDump#Found]=211
TaskValueSet,3,1,4 //4=maroon
endif
if [ColorDump#Found]=131
TaskValueSet,3,1,5 //5=lime
endif
if [ColorDump#Found]=121
TaskValueSet,3,1,6 //6=green
endif
if [ColorDump#Found]=113
TaskValueSet,3,1,7 //7=blue
endif
if [ColorDump#Found]=112
TaskValueSet,3,1,8 //8=navy
endif
if [ColorDump#Found]=331
TaskValueSet,3,1,9 //9=yellow
endif
if [ColorDump#Found]=133
TaskValueSet,3,1,10 //10=cyan
endif
if [ColorDump#Found]=313
TaskValueSet,3,1,11 //11=magenta
endif
if [ColorDump#Found]=222
TaskValueSet,3,1,12 //12=gray
endif
if [ColorDump#Found]=221
TaskValueSet,3,1,13 //13=olive
endif
if [ColorDump#Found]=212
TaskValueSet,3,1,14 //14=purple
endif
if [ColorDump#Found]=122
TaskValueSet,3,1,15 //15=teal
endif
endon

ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



-
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
Re: TCS34725 RGB Color Sensor
Any thought on the rules? I suggest you add the 1..15 colors as a possible option besides the RGB values.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



Who is online
Users browsing this forum: Anthropic Claude Bot [bot] and 17 guests