science_jubilee.tools.AS7341#

Classes#

AS7341

A class representation of the AS7341 spectral sensor.

Module Contents#

class science_jubilee.tools.AS7341.AS7341(index, name, config)[source]#

Bases: science_jubilee.tools.Tool.Tool

A class representation of the AS7341 spectral sensor.

Parameters:

Tool (Tool) – The base tool class

lineEnding = Multiline-String[source]#
Show Value
"""

"""
baudrate = 115200[source]#
sensor_config = None[source]#
serial_port = None[source]#
load_config(config)[source]#

Loads the configuration file for the AS7341 sensor tool

find_seeed() List[serial.Serial][source]#

Find all Seeed Studio or Espressif devices connected to the system

Returns:

List of serial ports for connected Seeed devices

Return type:

List[serial.Serial]

Raises:

IOError – If no Seeed devices are found

connect_seeed(ser_port_index: int = 0) serial.Serial[source]#

Connect to a Seeed device at the specified port index

Parameters:

ser_port_index (int, optional) – Index of the serial port to connect to, defaults to 0

Returns:

Connected serial port

Return type:

serial.Serial

disconnect_seeed() bool[source]#

Disconnect from the currently connected Seeed device

Returns:

True if disconnection was successful

Return type:

bool

Send a blink command to the connected Seeed device

Parameters:

cmd (Union[int, str]) – The blink command parameter

Raises:

ToolStateError – If no serial port is connected

measure_spectrum(duty_cycle: int = 100) Dict[str, Any][source]#

Measure the spectral values from the AS7341 sensor

Parameters:

duty_cycle (int, optional) – The duty cycle for the measurement (0-100), defaults to 100

Returns:

Dictionary containing the spectral readings from different channels

Return type:

Dict[str, Any]

Raises:
get_raw_spectrum(duty_cycle: int = 100) str[source]#

Get the raw spectral data string from the AS7341 sensor

Parameters:

duty_cycle (int, optional) – The duty cycle for the measurement (0-100), defaults to 100

Returns:

Raw string output from the sensor

Return type:

str

Raises:

ToolStateError – If no serial port is connected