Post

Color DataPoints and Color Triggers

Store, visualize, and trigger on color sensor data with the new COLOR data type and Color trigger

Color DataPoints and Color Triggers

Color-Aware Data and Triggers

Krill now supports color as a first-class data type. If you have a color sensor (like the TCS34725) connected to your Pi via a Lambda script, you can store color readings as native COLOR DataPoints, see the actual color in the swarm view, and trigger automation when colors shift into target ranges.

The primary use case: monitoring pH indicator color in a CO2 reactor — the indicator changes color based on CO2 levels, and Krill can now detect that shift and act on it.

DataType.COLOR

When you create or edit a DataPoint, select COLOR as the data type. The snapshot value stores a packed RGB integer (the same format returned by color sensors like the TCS34725).

What changes in the UI

  • Swarm view: COLOR DataPoint icons show a colored circle reflecting the current sensor reading
  • Project dashboard: The node row displays a color swatch instead of a numeric value
  • Edit form: RGB sliders (0-255 per channel) with a live color preview swatch
  • Graphs: COLOR values are plotted as integers on the time-series graph, useful for tracking drift

How it works with sensors

A typical setup:

  1. Wire a TCS34725 color sensor to your Pi’s I2C bus
  2. Create a Lambda script that reads sensor.color and prints it
  3. Create a COLOR DataPoint to store the reading
  4. Trigger the Lambda on a CronTimer (e.g., every 30 seconds)
  5. The Lambda output (integer) flows into the DataPoint and the swarm icon updates to show the actual color

Color Trigger

The Color Trigger () fires when a COLOR DataPoint’s value falls within a configured RGB range. It works like HighThreshold and LowThreshold but operates on color channels instead of scalar values.

Configuration

The trigger editor shows three range sliders:

  • Red: min – max (0-255)
  • Green: min – max (0-255)
  • Blue: min – max (0-255)

A live color swatch shows the midpoint of your configured range so you can see at a glance what color you’re targeting. The trigger fires when all three channels of the DataPoint’s color are within their respective ranges simultaneously.

Example: pH indicator monitoring

A CO2 reactor’s pH indicator solution shifts from blue (high pH / low CO2) to yellow-green (low pH / high CO2). To detect dangerous CO2 levels:

  1. Read the indicator color with a TCS34725 sensor → COLOR DataPoint
  2. Add a Color Trigger targeting the yellow-green range: R: 150-255, G: 180-255, B: 0-80
  3. Wire an SMTP executor to send an alert email
  4. Wire a Lambda to shut off the CO2 solenoid

The trigger fires only when the indicator shifts into the target color band, giving you automated safety control based on visual chemistry.

Icon behavior

The Color Trigger icon in the swarm view is tinted to the midpoint color of its configured range. This gives you instant visual feedback on what color each trigger is watching for, without needing to open the editor.


Last verified: 2026-04-05

This post is licensed under CC BY 4.0 by Sautner Studio, LLC.