SEN55

The SEN5x is a unique sensor module family combining the measurement of critical air quality parameters – particulate matter, VOC, NOx, humidity, and temperature in a single package.

The specific support of the host for SEN55 is as follows:

Controller

SEN55

AirQ

Micropython Example:

 1# SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
 2#
 3# SPDX-License-Identifier: MIT
 4
 5import os, sys, io
 6import M5
 7from M5 import *
 8from hardware import *
 9import time
10
11
12sen55 = None
13
14
15def setup():
16    global sen55
17
18    M5.begin()
19    Widgets.fillScreen(0xFFFFFF)
20
21    sen55 = SEN55()
22    sen55.set_power_state(True)
23    sen55.set_work_mode(1)
24    time.sleep(1)
25
26
27def loop():
28    global sen55
29    M5.update()
30    if sen55.get_data_ready_flag():
31        print(sen55.get_pm1_0())
32        print(sen55.get_pm2_5())
33        print(sen55.get_pm4_0())
34        print(sen55.get_pm10_0())
35        print(sen55.get_humidity())
36        print(sen55.get_temperature())
37        print(sen55.get_voc())
38        print(sen55.get_nox())
39    time.sleep_ms(100)
40
41
42if __name__ == "__main__":
43    try:
44        setup()
45        while True:
46            loop()
47    except (Exception, KeyboardInterrupt) as e:
48        try:
49            from utility import print_error_msg
50
51            print_error_msg(e)
52        except ImportError:
53            print("please update to latest firmware")

UIFLOW2 Example:

example.png

airq_sen55_example.m5f2

class SEN55

Constructors

class SEN55

Initialize the SEN55 sensor with I2C communication, setting the power control and ensuring the sensor is connected.

UIFLOW2:

init.png

Methods

SEN55.set_power_state(state)

Set the power state of the SEN55 sensor.

参数:

state (bool) – The desired power state, True to power on, False to power off.

UIFLOW2:

set_power_state.png

SEN55.get_power_state()

Get the current power state of the SEN55 sensor.

UIFLOW2:

get_power_state.png

SEN55.available()

Check if the SEN55 sensor is connected via I2C.

SEN55.set_work_mode(mode)

Set the measurement mode of the SEN55 sensor.

参数:

mode (int) – 1 to start measurement, 0 to stop measurement.

UIFLOW2:

set_work_mode.png

SEN55.get_sensor_data()

Get the sensor data including PM1.0, PM2.5, PM4.0, PM10.0, CO2, temperature, humidity, VOC, and NOx.

SEN55.get_data_ready_flag()

Check if the sensor data is ready to be read.

UIFLOW2:

get_data_ready_flag.png

SEN55.set_temp_cmp_params(temp_offset, temp_offset_slope, time_constant)

Set the temperature compensation parameters for the sensor.

参数:
  • temp_offset (int) – The temperature offset in the sensor's compensation algorithm.

  • temp_offset_slope (int) – The temperature offset slope in the sensor's compensation algorithm.

  • time_constant (int) – The time constant for the temperature compensation.

SEN55.get_temp_cmp_params()

Get the current temperature compensation parameters.

SEN55.set_warm_start_param(mode)

Set the warm start parameter for the sensor.

参数:

mode (bool) – True to enable warm start, False to disable it.

SEN55.get_warm_start_param()

Get the current warm start parameter.

SEN55.set_voc_algo_tuning_params(voc_index_offset, voc_offset_hours, voc_gain_houes, gate_max_duration_min, std_initial, gain_factor)

Set the VOC algorithm tuning parameters, including index offset, time offsets, and gain factors.

参数:
  • voc_index_offset (int) – The VOC index offset, default is 100.

  • voc_offset_hours (int) – The VOC offset in hours, default is 12 hours.

  • voc_gain_houes (int) – The VOC gain in hours, default is 12 hours.

  • gate_max_duration_min (int) – Maximum gate duration in minutes, default is 180 minutes.

  • std_initial (int) – The initial standard deviation, default is 50.

  • gain_factor (int) – The gain factor for VOC, default is 230.

SEN55.get_voc_algo_tuning_params()

Get the current VOC algorithm tuning parameters.

返回:

A tuple of VOC tuning parameters: index offset, offset hours, gain hours, max gate duration, initial standard deviation, and gain factor.

SEN55.set_nox_algo_tuning_params(nox_index_offset, nox_offset_hours, nox_gain_houes, gate_max_duration_min, gain_factor)

Set the NOx algorithm tuning parameters, including index offset, time offsets, and gain factors. The standard deviation estimate is fixed at 50 for NOx.

参数:
  • nox_index_offset (int) – The offset value for the NOx index.

  • nox_offset_hours (int) – The time offset in hours for the NOx algorithm.

  • nox_gain_houes (int) – The gain factor in hours for the NOx algorithm.

  • gate_max_duration_min (int) – The maximum gate duration in minutes.

  • gain_factor (int) – The gain factor for the NOx algorithm.

SEN55.get_nox_algo_tuning_params()

Get the current NOx algorithm tuning parameters.

返回:

A tuple of NOx tuning parameters: index offset, offset hours, gain hours, max gate duration, and gain factor.

SEN55.set_rht_acceleration_mode(mode)

Set the RHT acceleration mode, which affects how quickly the device accelerates during measurement.

参数:

mode (int) – The acceleration mode to set: 0 for low, 1 for high, or 2 for medium.

SEN55.get_rht_acceleration_mode()

Get the current RHT acceleration mode. This parameter can be changed in any state of the device, but it is applied only the next time starting a measurement. The parameter needs to be set before a new measurement is started.

返回:

The current acceleration mode: 0 for low, 1 for high, or 2 for medium.

SEN55.get_voc_algo_state() bytes

Get the current VOC algorithm state.

返回:

The VOC algorithm state in bytes.

SEN55.set_voc_algo_state(state)

Set the VOC algorithm state.

参数:

state (bytes) – The VOC algorithm state to set, represented as bytes.

SEN55.set_start_fan_cleaning()

Start the fan cleaning process to remove contaminants from the sensor.

SEN55.get_auto_cleaning_interval() tuple

Get the current auto cleaning interval.

返回:

A tuple of the cleaning interval parameters.

SEN55.set_auto_cleaning_interval(interval)

Set the auto cleaning interval.

参数:

interval (tuple) – A tuple representing the new auto cleaning interval.

SEN55.get_device_status() bytes

Get the current device status.

返回:

The device status in bytes.

SEN55.clear_device_status()

Clear the device status, resetting any error flags or states.

SEN55.get_serial_number() str

Get the unique serial number of the sensor.

返回:

The serial number of the sensor as a string.

SEN55.get_product_name() str

Get the product name of the sensor.

返回:

The product name of the sensor as a string.

SEN55.send_cmd(cmd, value, is_bytes)

Send a command to the sensor.

参数:
  • cmd (int) – The command to send, represented as a 2-byte value.

  • value – Optional value to include with the command.

  • is_bytes (bool) – A flag to indicate if the value is in bytes format.

SEN55.read_response(nbytes) bytes

Read the response from the sensor.

返回:

The response data as bytes.

参数:

nbytes (int) – The number of bytes to read from the sensor.

SEN55.get_pm1_0() float

Get the PM1.0 concentration value in micrograms per cubic meter (µg/m³).

返回:

PM1.0 concentration in µg/m³.

UIFLOW2:

get_pm1_0.png

SEN55.get_pm2_5() float

Get the PM2.5 concentration value in micrograms per cubic meter (µg/m³).

返回:

PM2.5 concentration in µg/m³.

UIFLOW2:

get_pm2_5.png

SEN55.get_pm4_0() float

Get the PM4.0 concentration value in micrograms per cubic meter (µg/m³).

返回:

PM4.0 concentration in µg/m³.

UIFLOW2:

get_pm4_0.png

SEN55.get_pm10_0() float

Get the PM10.0 concentration value in micrograms per cubic meter (µg/m³).

返回:

PM10.0 concentration in µg/m³.

UIFLOW2:

get_pm10_0.png

SEN55.get_humidity() float

Get the humidity value in percentage (%).

返回:

Humidity in percentage.

UIFLOW2:

get_humidity.png

SEN55.get_temperature() float

Get the temperature value in degrees Celsius (°C).

返回:

Temperature in °C.

UIFLOW2:

get_temperature.png

SEN55.get_voc() float

Get the Volatile Organic Compound (VOC) concentration value in parts per billion (ppb).

返回:

VOC concentration in ppb.

UIFLOW2:

get_voc.png

SEN55.get_nox() float

Get the Nitrogen Oxide (NOx) concentration value in parts per billion (ppb).

返回:

NOx concentration in ppb.

UIFLOW2:

get_nox.png