Colour sensor setups

Enquiring about how to setup either using a Pico or Pi Zero with breadboard or connectors if possible to connect with these colour sensors that are Arduino/Pi compatible?

Pimoroni BH1745 Luminance and Colour Sensor Breakout SKU: CE05768
TCS3200 Color Sensor SKU: SEN0101

Does anyone have experience on the data outputs from these devices?

Here is an example of calibrating colour sensors for:

TCS3200 /TCS230 Color Sensor SKU: SEN0101
ISL29125 Color Sensor SKU:SEN12829

Can anyone advise further on experience on setup and calibration of colour sensors that will give reasonable colour values including if VEML6040 can do the same using Pico or Zero?

1 Like

Hey Steffan,

The Pimoroni BH1745 Luminance and Colour Sensor Breakout is compatible with the Pi Zero through its I2C interface, and running its code should be straightforward after importing the Smbus library.

Regarding the Pico, this breakout is included in Pimoroni’s list of RP2040 compatible devices, and it can effectively communicate with the bh1745 repository via I2C interface. To get started, you’ll need to copy the to the Pico and import the library. Then, use the code below to create the BH1745 object, initialize the sensor, and read the color data.

from machine import Pin, I2C
import bh1745

# Define the I2C bus and device address
i2c_bus = I2C(0, scl=Pin(9), sda=Pin(8))
i2c_address = 0x38

# Initialize the BH1745 sensor
sensor = bh1745.BH1745(i2c_bus, i2c_address)

# Read the sensor data
color_data = sensor.get_rgbc_raw()

# Print the color data
print("Red: %d, Green: %d, Blue: %d, Clear: %d" % color_data)

With these steps, you should be able to use the Pimoroni BH1745 breakout sensor with either the Pi Zero or Pico microcontroller board.


1 Like