TCS230 Colour Sensor Module (HCMODU0069)

Modules for various types of sensors including accelerometers. gyro's, IR motion, etc
Post Reply
admin
Site Admin
Posts: 867
Joined: Sun Aug 05, 2012 4:02 pm

TCS230 Colour Sensor Module (HCMODU0069)

Post by admin » Sat Aug 23, 2014 7:17 am

IMAGE TBA

Description:
A breakout board for the TCS320 colour sensor which also includes white LEDs for reflective illumination. The TCS230 colour sensor combines configurable silicon photodiodes and a current-to-frequency converter on a single monolithic CMOS integrated circuit. The full-scale output frequency of this colour sensor can be scaled by one of three preset values via two control input pins. This TCS230 colour sensor comes with digital input and output which allows direct interface to a microcontroller or other logic circuitry.

Note: LED's are not controllable, sensor is sensitive to infra-red light.


Specification
Chip: TCS230
Input Voltage: 3V ~ 5V
Best Detection Range: 10mm
High-resolution conversion of light intensity to frequency
Programmable colour and full-scale output frequency
Communicate directly with a microcontroller
Low-profile surface mount package
PCB Size (L x W): Approx. 1.2 x 0.95 inch


Pinout
GND..........0V
OE...........Output enable (low = enable)
S0 & S1....Output frequency scaling selection inputs
S2 & S3....Colour Selection inputs
OUT.........Output frequency.
VCC.........3V ~ 5.5V supply voltage


Example Arduino Sketch:

Code: Select all

/* FILE:    Colour_Sensing_Module_Example
   DATE:    28/08/14
   VERSION: 0.1
   AUTHOR:  Andrew Davies

This is a basic example of how to use the colour sensing module (HCMODU0069).
This sketch will read the output of the sensor in the four differnt colour modes
(red, green, blue, and clear) and output the readings as a value between 0 and 255
to the serial port. This example does not attempt to adjust or calibrate the raw 
values read from the sensor.

You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute any part of 
this code. This software may not be used for the purpose of selling products
that directly compete with Hobby Components Ltd's own range of products.

PINOUT

Module    Arduino
GND       GND
OE        NA
S1        +5V
S0        GND
S3        D3
S2        D2
OUT       D4
VCC       +5V

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/

enum Colours {RED,GREEN,BLUE,CLEAR};

/* Define the pin number used to select the colour to be measured */
#define S2_PIN 2
#define S3_PIN 3

/* Define the pin used to read the output of the sensor */
#define OUT_PIN 4


void setup()
{
  Serial.begin(9600);
  pinMode(S2_PIN, OUTPUT);
  pinMode(S3_PIN, OUTPUT);
  pinMode(OUT_PIN, INPUT);
}

/* Main program */
void loop()
{
  /* Read each colour value and output to the serial port */
  Serial.print(ReadColour(RED));
  Serial.print(" : "); 
  Serial.print(ReadColour(GREEN));
  Serial.print(" : "); 
  Serial.print(ReadColour(BLUE));
  Serial.print(" : "); 
  Serial.println(ReadColour(CLEAR));
}

/* Reads a colour and returns the a value betwenn 0 and 255 */
byte ReadColour(byte Colour)
{  
  switch(Colour)
  {
    case RED:
      digitalWrite(S2_PIN, LOW);
      digitalWrite(S3_PIN, LOW);
      break;
    
    case GREEN:
      digitalWrite(S2_PIN, HIGH);
      digitalWrite(S3_PIN, HIGH);
      break;    
      
    case BLUE:
      digitalWrite(S2_PIN, LOW);
      digitalWrite(S3_PIN, HIGH);
      break;
      
    case CLEAR:
      digitalWrite(S2_PIN, HIGH);
      digitalWrite(S3_PIN, LOW);
      break; 
  }
    
  return map(pulseIn(OUT_PIN, HIGH), 30, 2500, 255, 0);
}
Datasheet:
tcs230_datasheet.pdf
You do not have the required permissions to view the files attached to this post.

Post Reply

Return to “Sensors”