Skip to content
Get started

AS7341 Spectral Color Sensor

WARNING

The as7341 platform is deprecated and will be removed in 2027.5.0. Use the AS7341 / AS7343 / TCS3448 component with type: AS7341 instead; it reads the same ten bands under counts: and also offers basic counts and derived light values. The reported counts change when you move, see Moving From as7341.

The as7341 sensor platform allows you to use your AS7341 spectral color sensor (datasheet, Adafruit) with ESPHome. The I²C Bus is required to be set up in your configuration for this sensor to work.

AS7341 Spectral Color Sensor
# Example configuration entry
sensor:
- platform: as7341
f1:
name: "415nm"
f2:
name: "445nm"
f3:
name: "480nm"
f4:
name: "515nm"
f5:
name: "555nm"
f6:
name: "590nm"
f7:
name: "630nm"
f8:
name: "680nm"
clear:
name: "Clear"
nir:
name: "NIR"
  • f1 (Optional): The reading for the 415nm channel. All options from Sensor.

  • f2 (Optional): The reading for the 445nm channel. All options from Sensor.

  • f3 (Optional): The reading for the 480nm channel. All options from Sensor.

  • f4 (Optional): The reading for the 515nm channel. All options from Sensor.

  • f5 (Optional): The reading for the 555nm channel. All options from Sensor.

  • f6 (Optional): The reading for the 590nm channel. All options from Sensor.

  • f7 (Optional): The reading for the 630nm channel. All options from Sensor.

  • f8 (Optional): The reading for the 680nm channel. All options from Sensor.

  • clear (Optional): The reading for the clear channel. All options from Sensor.

  • nir (Optional): The reading for the NIR (near-infrared) channel. All options from Sensor.

  • gain (Optional): The gain used by the device. A higher gain may be more suitable for lower-light environments. Must be one of:

    • X0.5
    • X1
    • X2
    • X4
    • X8 (default)
    • X16
    • X32
    • X64
    • X128
    • X256
    • X512
  • astep (Optional): The length of one integration step in increments of 2.78µs. Default is 599. Must be between 0 and 65534.

  • atime (Optional): The number of integration steps. Default is 29. Must be between 0 and 255.

  • All other options for I²C devices described at I²C Bus.

The integration time determines how long a channel measurement takes and depends on ATIME and ASTEP. The formula for the total integration time is:

t=(ATIME+1)×(ASTEP+1)×2.78 μst = (\text{ATIME} + 1) \times (\text{ASTEP} + 1) \times 2.78\,\mu\text{s}