Coder Social home page Coder Social logo

adafruit-tcs34725-color-sensor-breakout-pcb's Introduction

Adafruit TCS34725 Color Sensor Breakout PCBs

ย 
Click to purchase from the Adafruit Shop:

We found the best color sensor on the market, the TCS34725, which has RGB and Clear light sensing elements. An IR blocking filter, integrated on-chip and localized to the color sensing photodiodes, minimizes the IR spectral component of the incoming light and allows color measurements to be made accurately. The filter means you'll get much truer color than most sensors, since humans don't see IR. The sensor also has an incredible 3,800,000:1 dynamic range with adjustable integration time and gain so it is suited for use behind darkened glass.

PCB files for the Adafruit TCS34725 Color Sensor Breakouts - Format is EagleCAD schematic and board layout

License

Adafruit invests time and resources providing this open source design, please support Adafruit and open-source hardware by purchasing products from Adafruit!

All text above must be included in any redistribution

Designed by Limor Fried/Ladyada for Adafruit Industries. Creative Commons Attribution/Share-Alike, all text above must be included in any redistribution. See license.txt for additional information.

adafruit-tcs34725-color-sensor-breakout-pcb's People

Contributors

ladyada avatar thekitty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit-tcs34725-color-sensor-breakout-pcb's Issues

Color issue with the TDS34725

Hello, I have a color issue with the TCS34725. I used the code given with it :

#include <Wire.h>

include "Adafruit_TCS34725.h"

/* Example code for the Adafruit TCS34725 breakout library */

/* Connect SCL to analog 5
Connect SDA to analog 4
Connect VDD to 3.3V DC
Connect GROUND to common ground */

/* Initialise with default values (int time = 2.4ms, gain = 1x) */
// Adafruit_TCS34725 tcs = Adafruit_TCS34725();

/* Initialise with specific int time and gain values */
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X);

void setup(void) {
Serial.begin(9600);

if (tcs.begin()) {
Serial.println("Found sensor");
} else {
Serial.println("No TCS34725 found ... check your connections");
while (1);
}

// Now we're ready to get readings!
}

void loop(void) {
uint16_t r, g, b, c, colorTemp, lux;
int Teinte;
String Couleur;
tcs.getRawData(&r, &g, &b, &c);
colorTemp = tcs.calculateColorTemperature(r, g, b);
lux = tcs.calculateLux(r, g, b);

Teinte=getTeinte(r, g, b);
Serial.print("H : "); Serial.print(Teinte, DEC); Serial.print(" ");
Serial.println("");
AfficheCouleur(Teinte);

/Serial.print("Color Temp: "); Serial.print(colorTemp, DEC); Serial.print(" K - ");
Serial.print("Lux: "); Serial.print(lux, DEC); Serial.print(" - ");
Serial.print("R: "); Serial.print(r, DEC); Serial.print(" ");
Serial.print("G: "); Serial.print(g, DEC); Serial.print(" ");
Serial.print("B: "); Serial.print(b, DEC); Serial.print(" ");
Serial.print("C: "); Serial.print(c, DEC); Serial.print(" ");
Serial.print("Teinte: "); Serial.print(Teinte, DEC); Serial.print(" ");
Serial.println(" ");
/
delay(5000);
}

float getTeinte(uint16_t pr, uint16_t pg, uint16_t pb)
{
int H;
float r= (float)pr/255;
float g= (float)pg/255;
float b= (float)pb/255;
float Cmax = Max(r, g, b);

Serial.print("r: "); Serial.print(r,2); Serial.print(" ");
Serial.print("g: "); Serial.print(g,2); Serial.print(" ");
Serial.print("b: "); Serial.print(b,2); Serial.print(" ");
Serial.print("Cmax: "); Serial.print(Cmax,2); Serial.print(" ");
float Cmin = Min(r, g, b);
Serial.print("Cmin: "); Serial.print(Cmin,2); Serial.print(" ");
float Delta = Cmax - Cmin;
Serial.print("Delta: "); Serial.print(Delta,2); Serial.print(" ");
Serial.println("");

H= getH(r, g, b, Cmax, Delta);
return H;
}

float Min(float pr, float pg, float pb)
{
if(pr<pg && pr<pb)
return pr ;
else if(pg<pb && pg<pr)
return pg ;
else
return pb ;
}

float Max(float pr, float pg, float pb)
{
if(pr>pg && pr>pb)
return pr ;
else if(pg>pb && pg>pr)
return pg ;
else
return pb ;
}

int getH(float pr, float pg, float pb, float pCmax, float pDelta)
{
int Temp;
if(pDelta==0)
return 0;
else if(pCmax==pr)
{
Temp= 60_((pg-pb)/pDelta);
Temp= Temp%6;
}
else if(pCmax==pg)
Temp= 60_(((pb-pr)/pDelta)+2);
else
Temp= 60*(((pr-pg)/pDelta)+4);
return Temp;
}

void AfficheCouleur(int pH)
{
String Couleur;
if( (pH<=15 && pH>=0))
Serial.print("Couleur: Rouge ");
else if(pH<=45 && pH>15)
Serial.print("Couleur: Orange ");
else if(pH<=75 && pH>45)
Serial.print("Couleur: Jaune ");
else if(pH<=135 && pH>75)
Serial.print("Couleur: Vert ");
if(pH<=255 && pH>135)
Serial.print("Couleur: Bleu ");
else if(pH<=345 && pH>255|| pH>345)
Serial.print("Couleur: Violet ");
Serial.println("");
Serial.println("");
}

But the pH is always below what it need to be, if I put yellow on the captor, the pH will be between 1 and 5. If I put black, the pH is green. I have this problem on 2 drivers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.