Pages: [1] 2   Go Down
Author Topic: TCS3200 with Arduino Uno  (Read 1929 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
I recently bought a board with the color sensor TCS3200.
I bought it from: http://www.miniinthebox.com/nl/interfacing-tcs3200-kleur-sensor-met-avr-atmega32_p508760.html
It has the inputs S0, S1, S2, S3, E0 and the output, called Out.
What is not clear for me, what does the input E0 mean? Where do I have to connect it?

What I would like to do with the sensor:
I would like to measure the color temperature of a LED. I have at this moment 3 types of LEDs (2700K, 3000K and 4000K), and this I would like to check with the sensor the color temperature.

The color temperature I suppose I can calculate via the following formulae: http://dsp.stackexchange.com/questions/8949/how-do-i-calculate-the-color-temperature-of-the-light-source-illuminating-an-ima

To use this formula, I should get the measured RGB values from the color sensor.

Can somebody help me please with this? A start would be already a very good help.
I tried already a lot of codes from the internet to measure the RGB values, but I don't get any good result with my Arduino.

Thank you very much in advance.
Logged

Offline Offline
Sr. Member
****
Karma: 4
Posts: 329
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

...
...
What is not clear for me, what does the input E0 mean? Where do I have to connect it?

...
...
Can somebody help me please with this? A start would be already a very good help.
I tried already a lot of codes from the internet to measure the RGB values, but I don't get any good result with my Arduino.

Thank you very much in advance.
http://www.lmgtfy.com/?q=tcs3200+color+sensor+arduino+code
Logged

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1285
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I believe that that sensor is similar to a TCS230 I the way it works (could be wrong).

If it is, I have a library that may be a good starting point for you. There is also a document on how to calibrate the sensor with the library. LInk is in my signature below (code repository).
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Thank you very much for the reply. I downloaded the documents from your website and tried to do the calibration. Unfortunately this also did not work.
I got the message "Press any key" and I was blocked.

The setup I use: 1 arduino UNO board, 1 board with TCS3200 (YL-64, from the website, http://www.miniinthebox.com/nl/interfacing-tcs3200-kleur-sensor-met-avr-atmega32_p508760.html), 8 wires.

What is still not clear for me is how I have to connect the pin EO. Is this the same as OE in the many examples?

Can somebody please help me out with this?
Logged

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1285
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Make sure your serial monitor is sending newlines when you press enter. In the Arduino IDE the option is at the bottom right corner of the serial monitor.

I am pretty sure EO and OE are the same thing. It is the enable for the sensor. You should get a copy of the datasheet for the chip as this will have all the signals explained. Just remember that INPUT to the chip is OUTPUT from the Arduino.
« Last Edit: March 09, 2014, 04:48:52 pm by marco_c » Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried this.
I have selected newline next to the baudrate, which is 57600.
When I press  then enter, nothing happens.

I connected the vcc to 5V, GND to ground, S2 to digital pin 12, S3 to digital pin 13 and OUT I have connected to digital pin 8.

The S0, S1 and EO I did not connect.

What I do wrong?
Thanks in advance for the patience.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
Now I see that I had to press enter.
So  I holded the sensor before a black surface, pressed send, than I hold it before a white surface, send and then I got the message: Reading value for DATA. Press any key to start.

And then I always get: RGB is [0, 0, 0]  ...
Logged

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1285
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The S0, S1 and EO I did not connect.

This is ok as long as you are putting them either to GND or Vcc. You cannot leave them floating. What you should put them to depends on the datasheet and what you are trying to achieve. I would put S0, S1 to Vcc (full scale) and E0 to GND (enable).

You will also need to use the correct version of the TCS library object constructor (the one without S0, S1, E0 specified in the parameters).
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried it, by connecting to the gnd and also by connecting to 5V, but none of them are working. After calibration I still have the rgb [0,0,0].
I will try tomorrow again. Thanks a lot for helping.
Logged

Offline Offline
Sr. Member
****
Karma: 4
Posts: 329
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://forum.arduino.cc/index.php?topic=216765.0
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Today I tried again the sensor, but without success. Many codes that the people posted here (MANY thanks for that) and from the internet I have loaded to the arduino.

I have used the following hardware:
- Arduino Uno
- 5 wires to connect the Vcc, Gnd, S0, S1, S2,s3, E0, OUT.
- Color sensor TCS3200 YL-64.

remark: no RGB sensor present.

The color sensor I bought from http://www.miniinthebox.com/reviews/interfacing-tcs3200-colour-sensor-with-avr-atmega32-review_p508760

The description says: TCS3200 colour sensor with AVR ATMEGA32.
Is the AVR ATMEGA32 giving the problem that is does not work?

Logged

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1285
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Back to basics:
1. Does the LEDs light up when you connect the sensor?
2. Have you measured the voltages at the sensor using a multimeter to check that these are right?
3. Have you checked that the EO/OE line is LOW? The low signal enables the chip and nothing will work if this is not the case.
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I used following code:
Code:
// TCS230 sensor calibration and color readings
//
// Input and output using the Serial console.
//
#include <MD_TCS230.h>
#include <FreqCount.h>

#define BLACK_CAL 0
#define WHITE_CAL 1
#define READ_VAL 2

// Pin definitions
#define  S2_OUT  12
#define  S3_OUT  13
#define  OE_OUT   8    // LOW = ENABLED
.....

1. the 4 LEDs are lighting up when I connect.
2. It seems I have the correct voltages. Also I checked with multimeter the pin 8 and this gives 0V
3. According the code, I connect S2 to digital pin 12, S3 to pin 13, OUT to 8, Vcc to 5V and Gnd to the ground.
Based on your previous explanation I connected S0 to 5V, S1 to 5V, OE to GND.
Is it ok that I use the calibration code for TCS230 for a TCS3200?
Logged

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1285
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
#define  OE_OUT   8    // LOW = ENABLED

This says that OE is connected to 8, not OUT.

OUT needs to be connected to a special pin that depends on the FrequCount library requirements and the Arduino type you are using. The header file (or my documentation?) outlines this. The FreqCount library uses an interrupt to get very accurate timing and counts, so it needs this special pin.

Operation of the sensors is the same but I am guessing now that you are missing the frequency count from the sensor.
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Great! Marco_c, you are a great help, what I say, a fantastic help! I had toconnect out to digital pin 5.
The  calibration code works. The sensor detects when it is black [0,0,0] and white [255, 255, 255].
Now I need to define the exact code for colored objects, because now it is not totally corresponding.
Do I need to cennect the outer inputs to the digital pins instead of connecting to 5V?

And after I need to know the color temperature. Do you think I will be able to have the exact color temperature of a light? Formula for CCT I have from the internet.
From the first test I do not have a good result, I got for all lights the RGB code [255, 255, 255], so I calculate then same color temperature.
Logged

Pages: [1] 2   Go Up
Jump to: