Hello, I have a sensor reading project with TCS34725, I have managed to measure and transform, but I don't know much about how I can do precess calculations for the color detection since it is wrong many times, some people tell me that by taking an average, others that with machinlearning, but I'm really lost.
have some idea what I should do?
I add my arduino code to them:
// Define global variables
MD_YX5300 mp3(ARDUINO_RX, ARDUINO_TX);
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_1X);
int medicion=0;
void setup()
{
Serial.begin(9600);
pinMode(3,INPUT);
mp3.begin();
if (!tcs.begin())
{
Serial.println("Error al iniciar TCS34725");
while (1) delay(1000);
}
}
void loop()
{
btn_color = digitalRead(3);
Serial.print("BTN:");
Serial.println(btn_color);
if(btn_color){
sense_color();
delay(1000);
}
delay(100);
}
void sense_color(){
uint16_t clear, red, green, blue;
tcs.setInterrupt(false);
delay(60); // Cuesta 50ms capturar el color
tcs.getRawData(&red, &green, &blue, &clear);
tcs.setInterrupt(true);
// Hacer rgb medición relativa
uint32_t sum = clear;
float r, g, b;
r = red; r /= sum;
g = green; g /= sum;
b = blue; b /= sum;
// Escalar rgb a bytes
r *= 256; g *= 256; b *= 256;
// Convertir a hue, saturation, value
double hue, saturation, value;
ColorConverter::RgbToHsv(static_cast<uint8_t>(r), static_cast<uint8_t>(g), static_cast<uint8_t>(b), hue, saturation, value);
Serial.println(++medicion);
// Mostrar nombre de color
printColorName(hue * 360,saturation, value);
Serial.println("hue: ");
Serial.println(hue * 360);
Serial.println("saturation: ");
Serial.println(saturation);
Serial.println("value: ");
Serial.println(value);
delay(1000);
}
my project is school, I want to help a friend who is blind to know the color of some things, to present it at the science fair.
I would like it to have a lower range of failure.
could you help me ?
