0

I am trying to get the TCS3472 color sensor to work with RaspberryPi, I have setup I2C succesfully and can detect the sensor with i2cdetect -y 1 which outputs

 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
ls /dev/i2* 

gives 2 devices

/dev/i2c-1 /dev/i2c-2 

If I test the connection with this.

import board import adafruit_tcs34725 i2c = board.I2C() sensor = adafruit_tcs34725.TCS34725(i2c) 

I get a runtime error

 RuntimeError: Could not find sensor, check wiring! 

The unit works with Ardiuno.

Using Python 3.9.2

Based on the CircuitPython module for the TCS34725 color sensor. It is not an original AdaFruit product but I would definitely buy one if that was the problem

2
  • 1
    Check that the code is using the correct I2C bus. Commented Feb 2, 2022 at 12:02
  • I know that many AdaFruit CircuitPython packages do not run well in Rpi. Commented Feb 2, 2022 at 14:00

1 Answer 1

0

I looked at the line producing the error in the adafruit_tcs34725.py library file and printed out the sensor ID and added it to the expected list (was 77 is 0x4D in hex)

 print(sensor_id) if sensor_id not in (0x44, 0x10, 0x4D): raise RuntimeError("Could not find sensor, check wiring!") 

Hope this helps someone save a bit of time. I am the best.

1
  • It is not ideal making changes to a library file Commented Feb 2, 2022 at 14:26

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.