Skip to content

owainm713/TCS34725-Python-Module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TCS34725-Python-Module

Python 2.x Module for use with a TCS34725 colour sensor and the Raspberry Pi. I used an adafruit TCS34725 colour sensor breakout board.

To use this module, run your program as the root user, i.e. sudo...

The module needs smbus to be installed to use the i2c interface. The i2c interface also needs to be enabled on your Raspberry Pi.

Also included are 2 example files, one that when run will output raw colour sensor data every second and the 2nd which will try reflecting the colour sensed via pygame and a tri colour LED. The 2nd example will also make a best guess at the name of the colour being sensed and print it out. The 2nd example requires the RPi.GPIO module

The connections to the adafruit TCS34725 colour sensor break out board I used are as follows:

  • TCS34725 LED connect to Gnd to turn off
  • TCS34725 Int - not connected but could be connected any Pi GPIO and used
  • TCS34725 SDA - Pi SDA
  • TCS34725 SCL - Pi SCL
  • TCS34725 3.3V - not connected
  • TCS34725 Gnd - Pi Gnd
  • TCS34725 Vin - Pi 3.3V

The i2c address for the TCS34725 colour sensor is 0x29.

The data sheet for the TCS34725 Colour sensor can be downloaded from the adafruit website

Current functions include:

  • clear_interrupt()
  • read_CRGB()
  • read_status()
  • set_enables(pon=0, aen=0, wen=0, aien=0)
  • set_gain(gain=1)
  • set_wait_time(wtime, wlong=0)
  • set_a_time(atime)
  • set_interrupt_levels(lowTL = 0, highTL = 65535, persLevel = 0)

Releases

No releases published

Packages

No packages published

Languages