adafruit_as7341

CircuitPython library for use with the Adafruit AS7341 breakout

  • Author(s): Bryan Siepert

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_as7341.AS7341(i2c_bus, address=57)

Library for the AS7341 Sensor

Parameters:
  • i2c_bus (I2C) – The I2C bus the device is connected to
  • address (int) – The I2C device address. Defaults to 0x39

Quickstart: Importing and using the device

Here is an example of using the AS7341. First you will need to import the libraries to use the sensor

import board
from adafruit_as7341 import AS7341

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()  # uses board.SCL and board.SDA
sensor = AS7341(i2c)

Now you have access to the different channels

channel_415nm = channel_415nm
channel_445nm = channel_445nm
channel_480nm = channel_480nm
channel_515nm = channel_515nm
channel_555nm = channel_555nm
channel_590nm = channel_590nm
channel_630nm = channel_630nm
channel_680nm = channel_680nm
all_channels

The current readings for all six ADC channels

astep

The integration time step size in 2.78 microsecond increments

atime

The integration time step count. Total integration time will be (ATIME + 1) * (ASTEP + 1) * 2.78µS

channel_415nm

The current reading for the 415nm band

channel_445nm

The current reading for the 445nm band

channel_480nm

The current reading for the 480nm band

channel_515nm

The current reading for the 515nm band

channel_555nm

The current reading for the 555nm band

channel_590nm

The current reading for the 590nm band

channel_630nm

The current reading for the 630nm band

channel_680nm

The current reading for the 680nm band

channel_clear

The current reading for the clear sensor

channel_nir

The current reading for the NIR (near-IR) sensor

flicker_detected

The flicker frequency detected in Hertz

flicker_detection_enabled

The flicker detection status of the sensor. True if the sensor is configured to detect flickers. Currently only 1000Hz and 1200Hz flicker detection is supported

gain

The ADC gain multiplier. Must be a valid adafruit_as7341.Gain()

initialize()

Configure the sensors with the default settings