adafruit_as726x
¶
Driver for the AS726x spectral sensors
- Author(s): Dean Miller
Implementation Notes¶
Hardware:
- Adafruit AS7262 6-Channel Visible Light / Color Sensor Breakout (Product ID: 3779)
Software and Dependencies:
- Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
- Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
-
class
adafruit_as726x.
AS726x
¶ AS726x spectral sensor base class.
-
MODE_0
= 0¶ Continuously gather samples of violet, blue, green and yellow. Orange and red are skipped and read zero.
-
MODE_1
= 1¶ Continuously gather samples of green, yellow, orange and red. Violet and blue are skipped and read zero.
-
MODE_2
= 2¶ Continuously gather samples of all colors
-
ONE_SHOT
= 3¶ Gather a single sample of all colors and then stop
-
driver_led
¶ True when the driver LED is on. False otherwise.
-
indicator_led
¶ True when the indicator LED is on. False otherwise.
-
driver_led_current
¶ The current limit for the driver LED in milliamps. One of:
- 12.5 mA
- 25 mA
- 50 mA
- 100 mA
-
indicator_led_current
¶ The current limit for the indicator LED in milliamps. One of:
- 1 mA
- 2 mA
- 4 mA
- 8 mA
-
gain
¶ The gain for the sensor
-
integration_time
¶ The integration time in milliseconds between 2.8 and 714 ms
-
start_measurement
()¶ Begin a measurement.
This will set the device to One Shot mode and values will not change after
data_ready
untilstart_measurement()
is called again or theconversion_mode()
is changed.
-
read_channel
(channel)¶ Read an individual sensor channel
-
read_calibrated_value
(channel)¶ Read a calibrated sensor channel
-
data_ready
¶ True if the sensor has data ready to be read, False otherwise
-
temperature
¶ The temperature of the device in Celsius
-
violet
¶ Calibrated violet (450nm) value
-
blue
¶ Calibrated blue (500nm) value
-
green
¶ Calibrated green (550nm) value
-
yellow
¶ Calibrated yellow (570nm) value
-
orange
¶ Calibrated orange (600nm) value
-
red
¶ Calibrated red (650nm) value
-
raw_violet
¶ Raw violet (450nm) 16-bit value
-
raw_blue
¶ Raw blue (500nm) 16-bit value
-
raw_green
¶ Raw green (550nm) 16-bit value
-
raw_yellow
¶ Raw yellow (570nm) 16-bit value
-
raw_orange
¶ Raw orange (600nm) 16-bit value
-
raw_red
¶ Raw red (650nm) 16-bit value
-
-
class
adafruit_as726x.
AS726x_I2C
(i2c_bus, address=73)¶ AS726x spectral sensor via I2C.
Parameters: Quickstart: Importing and using the AS726x
Here is an example of using the
AS726x_I2C
class. First you will need to import the libraries to use the sensorimport board from adafruit_as726x import AS726x_I2C
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA sensor = AS726x_I2C(i2c)
Now you have access to the different color attributes
violet = sensor.violet blue = sensor.blue green = sensor.green yellow = sensor.yellow orange = sensor.orange red = sensor.red
-
class
adafruit_as726x.
AS726x_UART
(uart)¶ AS726x spectral sensor via UART.
Parameters: uart (UART) – The UART connected to the sensor Quickstart: Importing and using the AS726x
Here is an example of using the
AS726x_I2C
class. First you will need to import the libraries to use the sensorimport board from adafruit_as726x import AS726x_UART
Once this is done you can define your
board.UART
object and define your sensor objectuart = board.UART() # uses board.SCL and board.SDA sensor = AS726x_UART(uart)
Now you have access to the different color attributes
violet = sensor.violet blue = sensor.blue green = sensor.green yellow = sensor.yellow orange = sensor.orange red = sensor.red
-
read_channel
(channel)¶ Read an individual sensor channel
-
read_calibrated_value
(channel)¶ Read a calibrated sensor channel
-