mirror of https://github.com/arendst/Tasmota.git
Support for pmsa003i (#18214)
* Initial support for PMSA003I air quality sensor. * Updated pmsa003i support to the latest dev branch * Fixed typo in esp32 configuration Removed all global variable and use the PM25_AQI_Data struct from Adafruit library Fix typo Xsns100 to Xsns104 Fix Typo XI2C_71 to XI2C_78 * Move everything in custom Struct for PMSA003I driver --------- Co-authored-by: Jean-Pierre Deschamps <info@jpdeschamps.com>
This commit is contained in:
parent
e0d67cee44
commit
5661a6798f
|
@ -143,6 +143,7 @@ Note: `minimal` variant is not listed as it shouldn't be used outside of the [up
|
|||
| USE_CHIRP | - | - / - | - | - | - | - |
|
||||
| USE_PAJ7620 | - | - / - | - | - | - | - |
|
||||
| USE_PCF8574 | - | - / - | - | - | - | - |
|
||||
| USE_PMSA003I | - | - / - | - | - | - | - |
|
||||
| | | | | | | |
|
||||
| Feature or Sensor | l | t | k | s | i | d | Remarks
|
||||
| USE_HIH6 | - | - / x | - | x | - | - |
|
||||
|
|
|
@ -199,6 +199,7 @@ In addition to @arendst the following code is mainly owned by:
|
|||
| xsns_101_hmc5883l | Andreas Achtzehn
|
||||
| xsns_102_ld2410 | @arendst
|
||||
| xsns_103_sen5x | @tyeth
|
||||
| xsns_104_pmsa003i | Jean-Pierre Deschamps
|
||||
| |
|
||||
| Libraries |
|
||||
| |
|
||||
|
|
193
I2CDEVICES.md
193
I2CDEVICES.md
|
@ -6,106 +6,106 @@ Using command ``I2cDriver`` individual drivers can be enabled or disabled at run
|
|||
## Supported I2C devices
|
||||
The following table lists the supported I2C devices
|
||||
|
||||
Index | Define | Driver | Device | Address(es) | Description
|
||||
------|---------------------|----------|----------|-------------|-----------------------------------------------
|
||||
1 | USE_PCA9685 | xdrv_15 | PCA9685 | 0x40 - 0x47 | 16-channel 12-bit pwm driver
|
||||
Index | Define | Driver | Device | Address(es) | Description
|
||||
------|---------------------|---------|----------|-------------|-----------------------------------------------
|
||||
1 | USE_PCA9685 | xdrv_15 | PCA9685 | 0x40 - 0x47 | 16-channel 12-bit pwm driver
|
||||
2 | USE_PCF8574 | xdrv_28 | PCF8574 | 0x20 - 0x26 | 8-bit I/O expander (address range overridable)
|
||||
2 | USE_PCF8574 | xdrv_28 | PCF8574A | 0x39 - 0x3F | 8-bit I/O expander (address range overridable)
|
||||
3 | USE_DISPLAY_LCD | xdsp_01 | | 0x27, 0x3F | LCD display
|
||||
4 | USE_DISPLAY_SSD1306 | xdsp_02 | SSD1306 | 0x3C - 0x3D | Oled display
|
||||
5 | USE_DISPLAY_MATRIX | xdsp_03 | HT16K33 | 0x70 - 0x77 | 8x8 led matrix
|
||||
6 | USE_DISPLAY_SH1106 | xdsp_07 | SH1106 | 0x3C - 0x3D | Oled display
|
||||
7 | USE_ADE7953 | xnrg_07 | ADE7953 | 0x38 | Energy monitor
|
||||
8 | USE_SHT | xsns_07 | SHT1X | Any | Temperature and Humidity sensor
|
||||
9 | USE_HTU | xsns_08 | HTU21 | 0x40 | Temperature and Humidity sensor
|
||||
9 | USE_HTU | xsns_08 | SI7013 | 0x40 | Temperature and Humidity sensor
|
||||
9 | USE_HTU | xsns_08 | SI7020 | 0x40 | Temperature and Humidity sensor
|
||||
9 | USE_HTU | xsns_08 | SI7021 | 0x40 | Temperature and Humidity sensor
|
||||
10 | USE_BMP | xsns_09 | BMP085 | 0x76 - 0x77 | Pressure and temperature sensor
|
||||
10 | USE_BMP | xsns_09 | BMP180 | 0x76 - 0x77 | Pressure and temperature sensor
|
||||
10 | USE_BMP | xsns_09 | BMP280 | 0x76 - 0x77 | Pressure and temperature sensor
|
||||
10 | USE_BMP | xsns_09 | BME280 | 0x76 - 0x77 | Pressure, temperature and humidity sensor
|
||||
10 | USE_BMP | xsns_09 | BME680 | 0x76 - 0x77 | Pressure, temperature, humidity and gas sensor
|
||||
11 | USE_BH1750 | xsns_10 | BH1750 | 0x23, 0x5C | Ambient light intensity sensor
|
||||
12 | USE_VEML6070 | xsns_11 | VEML6070 | 0x38 - 0x39 | Ultra violet light intensity sensor
|
||||
13 | USE_ADS1115 | xsns_12 | ADS1115 | 0x48 - 0x4B | 4-channel 16-bit A/D converter
|
||||
14 | USE_INA219 | xsns_13 | INA219 | 0x40 - 0x41, 0x44 - 0x45 | Low voltage current sensor
|
||||
15 | USE_SHT3X | xsns_14 | SHT3X | 0x44 - 0x45 | Temperature and Humidity sensor
|
||||
15 | USE_SHT3X | xsns_14 | SHT4X | 0x44 - 0x45 | Temperature and Humidity sensor
|
||||
15 | USE_SHT3X | xsns_14 | SHTCX | 0x70 | Temperature and Humidity sensor
|
||||
16 | USE_TSL2561 | xsns_16 | TSL2561 | 0x29, 0x39, 0x49 | Light intensity sensor
|
||||
17 | USE_MGS | xsns_19 | Grove | 0x04 | Multichannel gas sensor
|
||||
18 | USE_SGP30 | xsns_21 | SGP30 | 0x58 | Gas (TVOC) and air quality sensor
|
||||
19 | USE_SI1145 | xsns_24 | SI1145 | 0x60 | Ultra violet index and light sensor
|
||||
19 | USE_SI1145 | xsns_24 | SI1146 | 0x60 | Ultra violet index and light sensor
|
||||
19 | USE_SI1145 | xsns_24 | SI1147 | 0x60 | Ultra violet index and light sensor
|
||||
20 | USE_LM75AD | xsns_26 | LM75AD | 0x48 - 0x4F | Temperature sensor
|
||||
21 | USE_APDS9960 | xsns_27 | APDS9960 | 0x39 | Proximity ambient light RGB and gesture sensor
|
||||
22 | USE_MCP230xx | xsns_29 | MCP23008 | 0x20 - 0x26 | 8-bit I/O expander
|
||||
22 | USE_MCP230xx | xsns_29 | MCP23017 | 0x20 - 0x26 | 16-bit I/O expander
|
||||
23 | USE_MPR121 | xsns_30 | MPR121 | 0x5A - 0x5D | Proximity capacitive touch sensor
|
||||
24 | USE_CCS811 | xsns_31 | CCS811 | 0x5A | Gas (TVOC) and air quality sensor
|
||||
3 | USE_DISPLAY_LCD | xdsp_01 | | 0x27, 0x3F | LCD display
|
||||
4 | USE_DISPLAY_SSD1306 | xdsp_02 | SSD1306 | 0x3C - 0x3D | Oled display
|
||||
5 | USE_DISPLAY_MATRIX | xdsp_03 | HT16K33 | 0x70 - 0x77 | 8x8 led matrix
|
||||
6 | USE_DISPLAY_SH1106 | xdsp_07 | SH1106 | 0x3C - 0x3D | Oled display
|
||||
7 | USE_ADE7953 | xnrg_07 | ADE7953 | 0x38 | Energy monitor
|
||||
8 | USE_SHT | xsns_07 | SHT1X | Any | Temperature and Humidity sensor
|
||||
9 | USE_HTU | xsns_08 | HTU21 | 0x40 | Temperature and Humidity sensor
|
||||
9 | USE_HTU | xsns_08 | SI7013 | 0x40 | Temperature and Humidity sensor
|
||||
9 | USE_HTU | xsns_08 | SI7020 | 0x40 | Temperature and Humidity sensor
|
||||
9 | USE_HTU | xsns_08 | SI7021 | 0x40 | Temperature and Humidity sensor
|
||||
10 | USE_BMP | xsns_09 | BMP085 | 0x76 - 0x77 | Pressure and temperature sensor
|
||||
10 | USE_BMP | xsns_09 | BMP180 | 0x76 - 0x77 | Pressure and temperature sensor
|
||||
10 | USE_BMP | xsns_09 | BMP280 | 0x76 - 0x77 | Pressure and temperature sensor
|
||||
10 | USE_BMP | xsns_09 | BME280 | 0x76 - 0x77 | Pressure, temperature and humidity sensor
|
||||
10 | USE_BMP | xsns_09 | BME680 | 0x76 - 0x77 | Pressure, temperature, humidity and gas sensor
|
||||
11 | USE_BH1750 | xsns_10 | BH1750 | 0x23, 0x5C | Ambient light intensity sensor
|
||||
12 | USE_VEML6070 | xsns_11 | VEML6070 | 0x38 - 0x39 | Ultra violet light intensity sensor
|
||||
13 | USE_ADS1115 | xsns_12 | ADS1115 | 0x48 - 0x4B | 4-channel 16-bit A/D converter
|
||||
14 | USE_INA219 | xsns_13 | INA219 | 0x40 - 0x41, 0x44 - 0x45 | Low voltage current sensor
|
||||
15 | USE_SHT3X | xsns_14 | SHT3X | 0x44 - 0x45 | Temperature and Humidity sensor
|
||||
15 | USE_SHT3X | xsns_14 | SHT4X | 0x44 - 0x45 | Temperature and Humidity sensor
|
||||
15 | USE_SHT3X | xsns_14 | SHTCX | 0x70 | Temperature and Humidity sensor
|
||||
16 | USE_TSL2561 | xsns_16 | TSL2561 | 0x29, 0x39, 0x49 | Light intensity sensor
|
||||
17 | USE_MGS | xsns_19 | Grove | 0x04 | Multichannel gas sensor
|
||||
18 | USE_SGP30 | xsns_21 | SGP30 | 0x58 | Gas (TVOC) and air quality sensor
|
||||
19 | USE_SI1145 | xsns_24 | SI1145 | 0x60 | Ultra violet index and light sensor
|
||||
19 | USE_SI1145 | xsns_24 | SI1146 | 0x60 | Ultra violet index and light sensor
|
||||
19 | USE_SI1145 | xsns_24 | SI1147 | 0x60 | Ultra violet index and light sensor
|
||||
20 | USE_LM75AD | xsns_26 | LM75AD | 0x48 - 0x4F | Temperature sensor
|
||||
21 | USE_APDS9960 | xsns_27 | APDS9960 | 0x39 | Proximity ambient light RGB and gesture sensor
|
||||
22 | USE_MCP230xx | xsns_29 | MCP23008 | 0x20 - 0x26 | 8-bit I/O expander
|
||||
22 | USE_MCP230xx | xsns_29 | MCP23017 | 0x20 - 0x26 | 16-bit I/O expander
|
||||
23 | USE_MPR121 | xsns_30 | MPR121 | 0x5A - 0x5D | Proximity capacitive touch sensor
|
||||
24 | USE_CCS811 | xsns_31 | CCS811 | 0x5A | Gas (TVOC) and air quality sensor
|
||||
24' | USE_CCS811_V2 | xsns_31 | CCS811 | 0x5A - 0x5B | Gas (TVOC) and air quality sensor
|
||||
25 | USE_MPU6050 | xsns_32 | MPU6050 | 0x68 - 0x69 | 3-axis gyroscope and temperature sensor
|
||||
26 | USE_DS3231 | xsns_33 | DS3231 | 0x68 | Real time clock
|
||||
27 | USE_MGC3130 | xsns_36 | MGC3130 | 0x42 | Electric field sensor
|
||||
28 | USE_MAX44009 | xsns_41 | MAX44009 | 0x4A - 0x4B | Ambient light intensity sensor
|
||||
29 | USE_SCD30 | xsns_42 | SCD30 | 0x61 | CO2 sensor
|
||||
30 | USE_SPS30 | xsns_44 | SPS30 | 0x69 | Particle sensor
|
||||
31 | USE_VL53L0X | xsns_45 | VL53L0X | 0x29 | Time-of-flight (ToF) distance sensor
|
||||
32 | USE_MLX90614 | xsns_46 | MLX90614 | 0x5A | Infra red temperature sensor
|
||||
33 | USE_CHIRP | xsns_48 | CHIRP | 0x20 | Soil moisture sensor
|
||||
34 | USE_PAJ7620 | xsns_50 | PAJ7620 | 0x73 | Gesture sensor
|
||||
35 | USE_INA226 | xsns_54 | INA226 | 0x40 - 0x41, 0x44 - 0x45 | Low voltage current sensor
|
||||
36 | USE_HIH6 | xsns_55 | HIH6130 | 0x27 | Temperature and Humidity sensor
|
||||
37 | USE_24C256 | xdrv_10 | 24C256 | 0x50 | Scripter EEPROM storage
|
||||
38 | USE_DISPLAY_ILI9488 | xdsp_08 | FT6236 | 0x38 | Touch panel controller
|
||||
39 | USE_DISPLAY_RA8876 | xdsp_10 | FT5316 | 0x38 | Touch panel controller
|
||||
25 | USE_MPU6050 | xsns_32 | MPU6050 | 0x68 - 0x69 | 3-axis gyroscope and temperature sensor
|
||||
26 | USE_DS3231 | xsns_33 | DS3231 | 0x68 | Real time clock
|
||||
27 | USE_MGC3130 | xsns_36 | MGC3130 | 0x42 | Electric field sensor
|
||||
28 | USE_MAX44009 | xsns_41 | MAX44009 | 0x4A - 0x4B | Ambient light intensity sensor
|
||||
29 | USE_SCD30 | xsns_42 | SCD30 | 0x61 | CO2 sensor
|
||||
30 | USE_SPS30 | xsns_44 | SPS30 | 0x69 | Particle sensor
|
||||
31 | USE_VL53L0X | xsns_45 | VL53L0X | 0x29 | Time-of-flight (ToF) distance sensor
|
||||
32 | USE_MLX90614 | xsns_46 | MLX90614 | 0x5A | Infra red temperature sensor
|
||||
33 | USE_CHIRP | xsns_48 | CHIRP | 0x20 | Soil moisture sensor
|
||||
34 | USE_PAJ7620 | xsns_50 | PAJ7620 | 0x73 | Gesture sensor
|
||||
35 | USE_INA226 | xsns_54 | INA226 | 0x40 - 0x41, 0x44 - 0x45 | Low voltage current sensor
|
||||
36 | USE_HIH6 | xsns_55 | HIH6130 | 0x27 | Temperature and Humidity sensor
|
||||
37 | USE_24C256 | xdrv_10 | 24C256 | 0x50 | Scripter EEPROM storage
|
||||
38 | USE_DISPLAY_ILI9488 | xdsp_08 | FT6236 | 0x38 | Touch panel controller
|
||||
39 | USE_DISPLAY_RA8876 | xdsp_10 | FT5316 | 0x38 | Touch panel controller
|
||||
40 | USE_TSL2591 | xsns_57 | TSL2591 | 0x29 | Light intensity sensor
|
||||
41 | USE_DHT12 | xsns_58 | DHT12 | 0x5C | Temperature and humidity sensor
|
||||
42 | USE_DS1624 | xsns_59 | DS1621 | 0x48 - 0x4F | Temperature sensor
|
||||
42 | USE_DS1624 | xsns_59 | DS1624 | 0x48 - 0x4F | Temperature sensor
|
||||
43 | USE_AHT1x | xsns_63 | AHT10/15 | 0x38 - 0x39 | Temperature and humidity sensor
|
||||
43 | USE_AHT2x | xsns_63 | AHT20 | 0x38 | Temperature and humidity sensor
|
||||
43 | USE_AHT2x | xsns_63 | AM2301B | 0x38 | Temperature and humidity sensor
|
||||
44 | USE_WEMOS_MOTOR_V1 | xdrv_34 | | 0x2D - 0x30 | WEMOS motor shield v1.0.0 (6612FNG)
|
||||
45 | USE_HDC1080 | xsns_65 | HDC1080 | 0x40 | Temperature and Humidity sensor
|
||||
46 | USE_IAQ | xsns_66 | IAQ | 0x5a | Air quality sensor
|
||||
47 | USE_DISPLAY_SEVENSEG| xdsp_11 | HT16K33 | 0x70 - 0x77 | Seven segment LED
|
||||
48 | USE_AS3935 | xsns_67 | AS3935 | 0x03 | Franklin Lightning Sensor
|
||||
49 | USE_VEML6075 | xsns_70 | VEML6075 | 0x10 | UVA/UVB/UVINDEX Sensor
|
||||
50 | USE_VEML7700 | xsns_71 | VEML7700 | 0x10 | Ambient light intensity sensor
|
||||
51 | USE_MCP9808 | xsns_72 | MCP9808 | 0x18 - 0x1F | Temperature sensor
|
||||
52 | USE_HP303B | xsns_73 | HP303B | 0x76 - 0x77 | Pressure and temperature sensor
|
||||
53 | USE_MLX90640 | xdrv_43 | MLX90640 | 0x33 | IR array temperature sensor
|
||||
54 | USE_VL53L1X | xsns_77 | VL53L1X | 0x29 | Time-of-flight (ToF) distance sensor
|
||||
55 | USE_EZOPH | xsns_78 | EZOPH | 0x61 - 0x70 | pH sensor
|
||||
55 | USE_EZOORP | xsns_78 | EZOORP | 0x61 - 0x70 | ORP sensor
|
||||
55 | USE_EZORTD | xsns_78 | EZORTD | 0x61 - 0x70 | Temperature sensor
|
||||
55 | USE_EZOHUM | xsns_78 | EZOHUM | 0x61 - 0x70 | Humidity sensor
|
||||
55 | USE_EZOEC | xsns_78 | EZOEC | 0x61 - 0x70 | Electric conductivity sensor
|
||||
55 | USE_EZOCO2 | xsns_78 | EZOCO2 | 0x61 - 0x70 | CO2 sensor
|
||||
55 | USE_EZOO2 | xsns_78 | EZOO2 | 0x61 - 0x70 | O2 sensor
|
||||
55 | USE_EZOPRS | xsns_78 | EZOPRS | 0x61 - 0x70 | Pressure sensor
|
||||
55 | USE_EZOFLO | xsns_78 | EZOFLO | 0x61 - 0x70 | Flow meter sensor
|
||||
55 | USE_EZODO | xsns_78 | EZODO | 0x61 - 0x70 | Disolved Oxygen sensor
|
||||
55 | USE_EZORGB | xsns_78 | EZORGB | 0x61 - 0x70 | Color sensor
|
||||
55 | USE_EZOPMP | xsns_78 | EZOPMP | 0x61 - 0x70 | Peristaltic Pump
|
||||
56 | USE_SEESAW_SOIL | xsns_81 | SEESOIL | 0x36 - 0x39 | Adafruit seesaw soil moisture sensor
|
||||
57 | USE_TOF10120 | xsns_84 | TOF10120 | 0x52 | Time-of-flight (ToF) distance sensor
|
||||
58 | USE_MPU_ACCEL | xsns_85 | MPU_ACCEL| 0x68 | MPU6886/MPU9250 6-axis MotionTracking sensor from M5Stac k
|
||||
59 | USE_BM8563 | xdrv_56 | BM8563 | 0x51 | BM8563 RTC from M5Stack
|
||||
60 | USE_AM2320 | xsns_88 | AM2320 | 0x5C | Temperature and Humidity sensor
|
||||
61 | USE_T67XX | xsns_89 | T67XX | 0x15 | CO2 sensor
|
||||
62 | USE_SCD40 | xsns_92 | SCD40 | 0x62 | CO2 sensor Sensirion SCD40/SCD41
|
||||
63 | USE_HM330X | xsns_93 | HM330X | 0x40 | Particule sensor
|
||||
64 | USE_HDC2010 | xsns_94 | HDC2010 | 0x40 | Temperature and Humidity sensor
|
||||
65 | USE_ADE7880 | xnrg_23 | ADE7880 | 0x38 | Energy monitor
|
||||
66 | USE_PCF85363 | xsns_99 | PCF85363 | 0x51 | Real time clock
|
||||
67 | USE_DS3502 | xdrv_61 | DS3502 | 0x28 - 0x2B | Digital potentiometer
|
||||
68 | USE_HYT | xsns_97 | HYTxxx | 0x28 | Temperature and Humidity sensor
|
||||
69 | USE_SGP40 | xsns_98 | SGP40 | 0x59 | Gas (TVOC) and air quality
|
||||
70 | USE_LUXV30B | xsns_99 | LUXV30B | 0x4A | DFRobot SEN0390 V30B lux sensor
|
||||
41 | USE_DHT12 | xsns_58 | DHT12 | 0x5C | Temperature and humidity sensor
|
||||
42 | USE_DS1624 | xsns_59 | DS1621 | 0x48 - 0x4F | Temperature sensor
|
||||
42 | USE_DS1624 | xsns_59 | DS1624 | 0x48 - 0x4F | Temperature sensor
|
||||
43 | USE_AHT1x | xsns_63 | AHT10/15 | 0x38 - 0x39 | Temperature and humidity sensor
|
||||
43 | USE_AHT2x | xsns_63 | AHT20 | 0x38 | Temperature and humidity sensor
|
||||
43 | USE_AHT2x | xsns_63 | AM2301B | 0x38 | Temperature and humidity sensor
|
||||
44 | USE_WEMOS_MOTOR_V1 | xdrv_34 | | 0x2D - 0x30 | WEMOS motor shield v1.0.0 (6612FNG)
|
||||
45 | USE_HDC1080 | xsns_65 | HDC1080 | 0x40 | Temperature and Humidity sensor
|
||||
46 | USE_IAQ | xsns_66 | IAQ | 0x5a | Air quality sensor
|
||||
47 | USE_DISPLAY_SEVENSEG| xdsp_11 | HT16K33 | 0x70 - 0x77 | Seven segment LED
|
||||
48 | USE_AS3935 | xsns_67 | AS3935 | 0x03 | Franklin Lightning Sensor
|
||||
49 | USE_VEML6075 | xsns_70 | VEML6075 | 0x10 | UVA/UVB/UVINDEX Sensor
|
||||
50 | USE_VEML7700 | xsns_71 | VEML7700 | 0x10 | Ambient light intensity sensor
|
||||
51 | USE_MCP9808 | xsns_72 | MCP9808 | 0x18 - 0x1F | Temperature sensor
|
||||
52 | USE_HP303B | xsns_73 | HP303B | 0x76 - 0x77 | Pressure and temperature sensor
|
||||
53 | USE_MLX90640 | xdrv_43 | MLX90640 | 0x33 | IR array temperature sensor
|
||||
54 | USE_VL53L1X | xsns_77 | VL53L1X | 0x29 | Time-of-flight (ToF) distance sensor
|
||||
55 | USE_EZOPH | xsns_78 | EZOPH | 0x61 - 0x70 | pH sensor
|
||||
55 | USE_EZOORP | xsns_78 | EZOORP | 0x61 - 0x70 | ORP sensor
|
||||
55 | USE_EZORTD | xsns_78 | EZORTD | 0x61 - 0x70 | Temperature sensor
|
||||
55 | USE_EZOHUM | xsns_78 | EZOHUM | 0x61 - 0x70 | Humidity sensor
|
||||
55 | USE_EZOEC | xsns_78 | EZOEC | 0x61 - 0x70 | Electric conductivity sensor
|
||||
55 | USE_EZOCO2 | xsns_78 | EZOCO2 | 0x61 - 0x70 | CO2 sensor
|
||||
55 | USE_EZOO2 | xsns_78 | EZOO2 | 0x61 - 0x70 | O2 sensor
|
||||
55 | USE_EZOPRS | xsns_78 | EZOPRS | 0x61 - 0x70 | Pressure sensor
|
||||
55 | USE_EZOFLO | xsns_78 | EZOFLO | 0x61 - 0x70 | Flow meter sensor
|
||||
55 | USE_EZODO | xsns_78 | EZODO | 0x61 - 0x70 | Disolved Oxygen sensor
|
||||
55 | USE_EZORGB | xsns_78 | EZORGB | 0x61 - 0x70 | Color sensor
|
||||
55 | USE_EZOPMP | xsns_78 | EZOPMP | 0x61 - 0x70 | Peristaltic Pump
|
||||
56 | USE_SEESAW_SOIL | xsns_81 | SEESOIL | 0x36 - 0x39 | Adafruit seesaw soil moisture sensor
|
||||
57 | USE_TOF10120 | xsns_84 | TOF10120 | 0x52 | Time-of-flight (ToF) distance sensor
|
||||
58 | USE_MPU_ACCEL | xsns_85 | MPU_ACCEL| 0x68 | MPU6886/MPU9250 6-axis MotionTracking sensor from M5Stack
|
||||
59 | USE_BM8563 | xdrv_56 | BM8563 | 0x51 | BM8563 RTC from M5Stack
|
||||
60 | USE_AM2320 | xsns_88 | AM2320 | 0x5C | Temperature and Humidity sensor
|
||||
61 | USE_T67XX | xsns_89 | T67XX | 0x15 | CO2 sensor
|
||||
62 | USE_SCD40 | xsns_92 | SCD40 | 0x62 | CO2 sensor Sensirion SCD40/SCD41
|
||||
63 | USE_HM330X | xsns_93 | HM330X | 0x40 | Particule sensor
|
||||
64 | USE_HDC2010 | xsns_94 | HDC2010 | 0x40 | Temperature and Humidity sensor
|
||||
65 | USE_ADE7880 | xnrg_23 | ADE7880 | 0x38 | Energy monitor
|
||||
66 | USE_PCF85363 | xsns_99 | PCF85363 | 0x51 | Real time clock
|
||||
67 | USE_DS3502 | xdrv_61 | DS3502 | 0x28 - 0x2B | Digital potentiometer
|
||||
68 | USE_HYT | xsns_97 | HYTxxx | 0x28 | Temperature and Humidity sensor
|
||||
69 | USE_SGP40 | xsns_98 | SGP40 | 0x59 | Gas (TVOC) and air quality
|
||||
70 | USE_LUXV30B | xsns_99 | LUXV30B | 0x4A | DFRobot SEN0390 V30B lux sensor
|
||||
71 | USE_QMC5883L | xsns_33 | QMC5883L | 0x0D | Magnetic Field Sensor
|
||||
72 | USE_INA3221 | xsns_100 | INA3221 | 0x40-0x43 | 3-channels Voltage and Current sensor
|
||||
73 | USE_HMC5883L | xsns_101 | HMC5883L | 0x1E | 3-channels Magnetic Field Sensor
|
||||
|
@ -113,3 +113,4 @@ Index | Define | Driver | Device | Address(es) | Description
|
|||
75 | USE_PCA9632 | xdrv_64 | PCA9632 | 0x60 | 4-channel 4-bit pwm driver
|
||||
76 | USE_SEN5X | xsns_103 | SEN5X | 0x69 | Gas (VOC/NOx index) and air quality (PPM <1,<2.5,<4,<10)
|
||||
77 | USE_MCP23XXX_DRV | xdrv_67 | MCP23x17 | 0x20 - 0x26 | 16-bit I/O expander as virtual button/switch/relay
|
||||
78 | USE_PMSA003I | xsns_104 | PMSA003I | 0x12 | PM2.5 Air Quality Sensor with I2C Interface
|
|
@ -0,0 +1,11 @@
|
|||
*~
|
||||
Doxyfile*
|
||||
doxygen_sqlite3.db
|
||||
html# osx
|
||||
.DS_Store
|
||||
|
||||
# doxygen
|
||||
Doxyfile*
|
||||
doxygen_sqlite3.db
|
||||
html
|
||||
*.tmp
|
|
@ -0,0 +1,133 @@
|
|||
/*!
|
||||
* @file Adafruit_PM25AQI.cpp
|
||||
*
|
||||
* @mainpage Adafruit PM2.5 air quality sensor driver
|
||||
*
|
||||
* @section intro_sec Introduction
|
||||
*
|
||||
* This is the documentation for Adafruit's PM2.5 AQI driver for the
|
||||
* Arduino platform. It is designed specifically to work with the
|
||||
* Adafruit PM2.5 Air quality sensors: http://www.adafruit.com/products/4632
|
||||
*
|
||||
* These sensors use I2C or UART to communicate.
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
*
|
||||
* @section author Author
|
||||
* Written by Ladyada for Adafruit Industries.
|
||||
*
|
||||
* @section license License
|
||||
* BSD license, all text here must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "Adafruit_PM25AQI.h"
|
||||
|
||||
/*!
|
||||
* @brief Instantiates a new PM25AQI class
|
||||
*/
|
||||
Adafruit_PM25AQI::Adafruit_PM25AQI() {}
|
||||
|
||||
/*!
|
||||
* @brief Setups the hardware and detects a valid PMSA003I. Initializes I2C.
|
||||
* @param theWire
|
||||
* Optional pointer to I2C interface, otherwise use Wire
|
||||
* @return True if PMSA003I found on I2C, False if something went wrong!
|
||||
*/
|
||||
bool Adafruit_PM25AQI::begin_I2C(TwoWire *theWire) {
|
||||
if (!i2c_dev) {
|
||||
i2c_dev = new Adafruit_I2CDevice(PMSA003I_I2CADDR_DEFAULT, theWire);
|
||||
}
|
||||
|
||||
if (!i2c_dev->begin()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Setups the hardware and detects a valid UART PM2.5
|
||||
* @param theSerial
|
||||
* Pointer to Stream (HardwareSerial/SoftwareSerial) interface
|
||||
* @return True
|
||||
*/
|
||||
bool Adafruit_PM25AQI::begin_UART(Stream *theSerial) {
|
||||
serial_dev = theSerial;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Setups the hardware and detects a valid UART PM2.5
|
||||
* @param data
|
||||
* Pointer to PM25_AQI_Data that will be filled by read()ing
|
||||
* @return True on successful read, false if timed out or bad data
|
||||
*/
|
||||
bool Adafruit_PM25AQI::read(PM25_AQI_Data *data) {
|
||||
uint8_t buffer[32];
|
||||
uint16_t sum = 0;
|
||||
|
||||
if (!data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (i2c_dev) { // ok using i2c?
|
||||
if (!i2c_dev->read(buffer, 32)) {
|
||||
return false;
|
||||
}
|
||||
} else if (serial_dev) { // ok using uart
|
||||
if (!serial_dev->available()) {
|
||||
return false;
|
||||
}
|
||||
int skipped = 0;
|
||||
while ((skipped < 32) && (serial_dev->peek() != 0x42)) {
|
||||
serial_dev->read();
|
||||
skipped++;
|
||||
if (!serial_dev->available()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (serial_dev->peek() != 0x42) {
|
||||
serial_dev->read();
|
||||
return false;
|
||||
}
|
||||
// Now read all 32 bytes
|
||||
if (serial_dev->available() < 32) {
|
||||
return false;
|
||||
}
|
||||
serial_dev->readBytes(buffer, 32);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check that start byte is correct!
|
||||
if (buffer[0] != 0x42) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// get checksum ready
|
||||
for (uint8_t i = 0; i < 30; i++) {
|
||||
sum += buffer[i];
|
||||
}
|
||||
|
||||
// The data comes in endian'd, this solves it so it works on all platforms
|
||||
uint16_t buffer_u16[15];
|
||||
for (uint8_t i = 0; i < 15; i++) {
|
||||
buffer_u16[i] = buffer[2 + i * 2 + 1];
|
||||
buffer_u16[i] += (buffer[2 + i * 2] << 8);
|
||||
}
|
||||
|
||||
// put it into a nice struct :)
|
||||
memcpy((void *)data, (void *)buffer_u16, 30);
|
||||
|
||||
if (sum != data->checksum) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// success!
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/*!
|
||||
* @file Adafruit_PM25AQI.h
|
||||
*
|
||||
* This is the documentation for Adafruit's PM25 AQI driver for the
|
||||
* Arduino platform. It is designed specifically to work with the
|
||||
* Adafruit PM25 air quality sensors: http://www.adafruit.com/products/4632
|
||||
*
|
||||
* These sensors use I2C or UART to communicate.
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* Written by Ladyada for Adafruit Industries.
|
||||
*
|
||||
* BSD license, all text here must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ADAFRUIT_PM25AQI_H
|
||||
#define ADAFRUIT_PM25AQI_H
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <Adafruit_I2CDevice.h>
|
||||
|
||||
// the i2c address
|
||||
#define PMSA003I_I2CADDR_DEFAULT 0x12 ///< PMSA003I has only one I2C address
|
||||
|
||||
/**! Structure holding Plantower's standard packet **/
|
||||
typedef struct PMSAQIdata {
|
||||
uint16_t framelen; ///< How long this data chunk is
|
||||
uint16_t pm10_standard, ///< Standard PM1.0
|
||||
pm25_standard, ///< Standard PM2.5
|
||||
pm100_standard; ///< Standard PM10.0
|
||||
uint16_t pm10_env, ///< Environmental PM1.0
|
||||
pm25_env, ///< Environmental PM2.5
|
||||
pm100_env; ///< Environmental PM10.0
|
||||
uint16_t particles_03um, ///< 0.3um Particle Count
|
||||
particles_05um, ///< 0.5um Particle Count
|
||||
particles_10um, ///< 1.0um Particle Count
|
||||
particles_25um, ///< 2.5um Particle Count
|
||||
particles_50um, ///< 5.0um Particle Count
|
||||
particles_100um; ///< 10.0um Particle Count
|
||||
uint16_t unused; ///< Unused
|
||||
uint16_t checksum; ///< Packet checksum
|
||||
} PM25_AQI_Data;
|
||||
|
||||
/*!
|
||||
* @brief Class that stores state and functions for interacting with
|
||||
* PM2.5 Air Quality Sensor
|
||||
*/
|
||||
class Adafruit_PM25AQI {
|
||||
public:
|
||||
Adafruit_PM25AQI();
|
||||
bool begin_I2C(TwoWire *theWire = &Wire);
|
||||
bool begin_UART(Stream *theStream);
|
||||
bool read(PM25_AQI_Data *data);
|
||||
|
||||
private:
|
||||
Adafruit_I2CDevice *i2c_dev = NULL;
|
||||
Stream *serial_dev = NULL;
|
||||
uint8_t _readbuffer[32];
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,49 @@
|
|||
# Adafruit PM2.5 Air Quality sensor [![Build Status](https://github.com/adafruit/Adafruit_PM25AQI/workflows/Arduino%20Library%20CI/badge.svg)](https://github.com/adafruit/Adafruit_PM25AQI/actions)[![Documentation](https://github.com/adafruit/ci-arduino/blob/master/assets/doxygen_badge.svg)](http://adafruit.github.io/Adafruit_PM25AQI/html/index.html)
|
||||
|
||||
This is the Adafruit PM25AQI Arduino Library for Arduino
|
||||
Tested and works great with the Adafruit PM2.5 Air Quality Sensor and Breadboard Adapter Kit
|
||||
|
||||
[<img src="https://cdn-shop.adafruit.com/1200x900/3686-10.jpg" width="500px">](https://www.adafruit.com/products/3686)
|
||||
|
||||
Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!
|
||||
|
||||
# Installation
|
||||
To install, use the Arduino Library Manager and search for "Adafruit PM25 AQI" and install the library.
|
||||
|
||||
## Dependencies
|
||||
* [Adafruit BusIO](https://github.com/adafruit/Adafruit_BusIO)
|
||||
|
||||
# Contributing
|
||||
|
||||
Contributions are welcome! Please read our [Code of Conduct](https://github.com/adafruit/Adafruit_PM25AQI/blob/master/CODE_OF_CONDUCT.md>)
|
||||
before contributing to help this project stay welcoming.
|
||||
|
||||
## Documentation and doxygen
|
||||
Documentation is produced by doxygen. Contributions should include documentation for any new code added.
|
||||
|
||||
Some examples of how to use doxygen can be found in these guide pages:
|
||||
|
||||
https://learn.adafruit.com/the-well-automated-arduino-library/doxygen
|
||||
|
||||
https://learn.adafruit.com/the-well-automated-arduino-library/doxygen-tips
|
||||
|
||||
## Formatting and clang-format
|
||||
This library uses [`clang-format`](https://releases.llvm.org/download.html) to standardize the formatting of `.cpp` and `.h` files.
|
||||
Contributions should be formatted using `clang-format`:
|
||||
|
||||
The `-i` flag will make the changes to the file.
|
||||
```bash
|
||||
clang-format -i *.cpp *.h
|
||||
```
|
||||
If you prefer to make the changes yourself, running `clang-format` without the `-i` flag will print out a formatted version of the file. You can save this to a file and diff it against the original to see the changes.
|
||||
|
||||
Note that the formatting output by `clang-format` is what the automated formatting checker will expect. Any diffs from this formatting will result in a failed build until they are addressed. Using the `-i` flag is highly recommended.
|
||||
|
||||
### clang-format resources
|
||||
* [Binary builds and source available on the LLVM downloads page](https://releases.llvm.org/download.html)
|
||||
* [Documentation and IDE integration](https://clang.llvm.org/docs/ClangFormat.html)
|
||||
|
||||
## About this Driver
|
||||
Written by Ladyada for Adafruit Industries.
|
||||
BSD license, check license.txt for more information
|
||||
All text above must be included in any redistribution
|
|
@ -0,0 +1,127 @@
|
|||
# Adafruit Community Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and leaders pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, gender identity and expression, level or type of
|
||||
experience, education, socio-economic status, nationality, personal appearance,
|
||||
race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
We are committed to providing a friendly, safe and welcoming environment for
|
||||
all.
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Be kind and courteous to others
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Collaborating with other community members
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and sexual attention or advances
|
||||
* The use of inappropriate images, including in a community member's avatar
|
||||
* The use of inappropriate language, including in a community member's nickname
|
||||
* Any spamming, flaming, baiting or other attention-stealing behavior
|
||||
* Excessive or unwelcome helping; answering outside the scope of the question
|
||||
asked
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate
|
||||
|
||||
The goal of the standards and moderation guidelines outlined here is to build
|
||||
and maintain a respectful community. We ask that you don’t just aim to be
|
||||
"technically unimpeachable", but rather try to be your best self.
|
||||
|
||||
We value many things beyond technical expertise, including collaboration and
|
||||
supporting others within our community. Providing a positive experience for
|
||||
other community members can have a much more significant impact than simply
|
||||
providing the correct answer.
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project leaders are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project leaders have the right and responsibility to remove, edit, or
|
||||
reject messages, comments, commits, code, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any community member for other behaviors that they deem
|
||||
inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Moderation
|
||||
|
||||
Instances of behaviors that violate the Adafruit Community Code of Conduct
|
||||
may be reported by any member of the community. Community members are
|
||||
encouraged to report these situations, including situations they witness
|
||||
involving other community members.
|
||||
|
||||
You may report in the following ways:
|
||||
|
||||
In any situation, you may send an email to <support@adafruit.com>.
|
||||
|
||||
On the Adafruit Discord, you may send an open message from any channel
|
||||
to all Community Helpers by tagging @community helpers. You may also send an
|
||||
open message from any channel, or a direct message to @kattni#1507,
|
||||
@tannewt#4653, @Dan Halbert#1614, @cater#2442, @sommersoft#0222, or
|
||||
@Andon#8175.
|
||||
|
||||
Email and direct message reports will be kept confidential.
|
||||
|
||||
In situations on Discord where the issue is particularly egregious, possibly
|
||||
illegal, requires immediate action, or violates the Discord terms of service,
|
||||
you should also report the message directly to Discord.
|
||||
|
||||
These are the steps for upholding our community’s standards of conduct.
|
||||
|
||||
1. Any member of the community may report any situation that violates the
|
||||
Adafruit Community Code of Conduct. All reports will be reviewed and
|
||||
investigated.
|
||||
2. If the behavior is an egregious violation, the community member who
|
||||
committed the violation may be banned immediately, without warning.
|
||||
3. Otherwise, moderators will first respond to such behavior with a warning.
|
||||
4. Moderators follow a soft "three strikes" policy - the community member may
|
||||
be given another chance, if they are receptive to the warning and change their
|
||||
behavior.
|
||||
5. If the community member is unreceptive or unreasonable when warned by a
|
||||
moderator, or the warning goes unheeded, they may be banned for a first or
|
||||
second offense. Repeated offenses will result in the community member being
|
||||
banned.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct and the enforcement policies listed above apply to all
|
||||
Adafruit Community venues. This includes but is not limited to any community
|
||||
spaces (both public and private), the entire Adafruit Discord server, and
|
||||
Adafruit GitHub repositories. Examples of Adafruit Community spaces include
|
||||
but are not limited to meet-ups, audio chats on the Adafruit Discord, or
|
||||
interaction at a conference.
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. As a community
|
||||
member, you are representing our community, and are expected to behave
|
||||
accordingly.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 1.4, available at
|
||||
<https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>,
|
||||
and the [Rust Code of Conduct](https://www.rust-lang.org/en-US/conduct.html).
|
||||
|
||||
For other projects adopting the Adafruit Community Code of
|
||||
Conduct, please contact the maintainers of those projects for enforcement.
|
||||
If you wish to use this code of conduct for your own project, consider
|
||||
explicitly mentioning your moderation policy or making a copy with your
|
||||
own moderation policy so as to avoid confusion.
|
|
@ -0,0 +1,73 @@
|
|||
/* Test sketch for Adafruit PM2.5 sensor with UART or I2C */
|
||||
|
||||
#include "Adafruit_PM25AQI.h"
|
||||
|
||||
// If your PM2.5 is UART only, for UNO and others (without hardware serial)
|
||||
// we must use software serial...
|
||||
// pin #2 is IN from sensor (TX pin on sensor), leave pin #3 disconnected
|
||||
// comment these two lines if using hardware serial
|
||||
//#include <SoftwareSerial.h>
|
||||
//SoftwareSerial pmSerial(2, 3);
|
||||
|
||||
Adafruit_PM25AQI aqi = Adafruit_PM25AQI();
|
||||
|
||||
void setup() {
|
||||
// Wait for serial monitor to open
|
||||
Serial.begin(115200);
|
||||
while (!Serial) delay(10);
|
||||
|
||||
Serial.println("Adafruit PMSA003I Air Quality Sensor");
|
||||
|
||||
// Wait one second for sensor to boot up!
|
||||
delay(1000);
|
||||
|
||||
// If using serial, initialize it and set baudrate before starting!
|
||||
// Uncomment one of the following
|
||||
//Serial1.begin(9600);
|
||||
//pmSerial.begin(9600);
|
||||
|
||||
// There are 3 options for connectivity!
|
||||
if (! aqi.begin_I2C()) { // connect to the sensor over I2C
|
||||
//if (! aqi.begin_UART(&Serial1)) { // connect to the sensor over hardware serial
|
||||
//if (! aqi.begin_UART(&pmSerial)) { // connect to the sensor over software serial
|
||||
Serial.println("Could not find PM 2.5 sensor!");
|
||||
while (1) delay(10);
|
||||
}
|
||||
|
||||
Serial.println("PM25 found!");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
PM25_AQI_Data data;
|
||||
|
||||
if (! aqi.read(&data)) {
|
||||
Serial.println("Could not read from AQI");
|
||||
delay(500); // try again in a bit!
|
||||
return;
|
||||
}
|
||||
Serial.println("AQI reading success");
|
||||
|
||||
Serial.println();
|
||||
Serial.println(F("---------------------------------------"));
|
||||
Serial.println(F("Concentration Units (standard)"));
|
||||
Serial.println(F("---------------------------------------"));
|
||||
Serial.print(F("PM 1.0: ")); Serial.print(data.pm10_standard);
|
||||
Serial.print(F("\t\tPM 2.5: ")); Serial.print(data.pm25_standard);
|
||||
Serial.print(F("\t\tPM 10: ")); Serial.println(data.pm100_standard);
|
||||
Serial.println(F("Concentration Units (environmental)"));
|
||||
Serial.println(F("---------------------------------------"));
|
||||
Serial.print(F("PM 1.0: ")); Serial.print(data.pm10_env);
|
||||
Serial.print(F("\t\tPM 2.5: ")); Serial.print(data.pm25_env);
|
||||
Serial.print(F("\t\tPM 10: ")); Serial.println(data.pm100_env);
|
||||
Serial.println(F("---------------------------------------"));
|
||||
Serial.print(F("Particles > 0.3um / 0.1L air:")); Serial.println(data.particles_03um);
|
||||
Serial.print(F("Particles > 0.5um / 0.1L air:")); Serial.println(data.particles_05um);
|
||||
Serial.print(F("Particles > 1.0um / 0.1L air:")); Serial.println(data.particles_10um);
|
||||
Serial.print(F("Particles > 2.5um / 0.1L air:")); Serial.println(data.particles_25um);
|
||||
Serial.print(F("Particles > 5.0um / 0.1L air:")); Serial.println(data.particles_50um);
|
||||
Serial.print(F("Particles > 10 um / 0.1L air:")); Serial.println(data.particles_100um);
|
||||
Serial.println(F("---------------------------------------"));
|
||||
|
||||
|
||||
delay(1000);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
name=Adafruit PM25 AQI Sensor
|
||||
version=1.0.6
|
||||
author=Adafruit
|
||||
maintainer=Adafruit <info@adafruit.com>
|
||||
sentence=This is an Arduino library for the Adafruit PM2.5 Air Quality Sensor
|
||||
paragraph=This is an Arduino library for the Adafruit PM2.5 Air Quality Sensor
|
||||
category=Sensors
|
||||
url=https://github.com/adafruit/Adafruit_PM25AQI
|
||||
architectures=*
|
||||
depends=Adafruit BusIO
|
|
@ -0,0 +1,26 @@
|
|||
Software License Agreement (BSD License)
|
||||
|
||||
Copyright (c) 2012, Adafruit Industries
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -158,6 +158,7 @@
|
|||
//#define USE_DS3502 // [I2CDriver67] Enable DS3502 digital potentiometer (I2C address 0x28 - 0x2B) (+0k4 code)
|
||||
//#define USE_HYT // [I2CDriver68] Enable HYTxxx temperature and humidity sensor (I2C address 0x28) (+0k5 code)
|
||||
//#define USE_LUXV30B // [I2CDriver70] Enable RFRobot SEN0390 LuxV30b ambient light sensor (I2C address 0x4A) (+0k5 code)
|
||||
//#define USE_PMSA003I // [I2cDriver78] Enable PMSA003I Air Quality Sensor (I2C address 0x12) (+0k2 code)
|
||||
|
||||
//#define USE_RTC_CHIPS // Enable RTC chip support and NTP server - Select only one
|
||||
// #define USE_DS3231 // [I2cDriver26] Enable DS3231 RTC (I2C address 0x68) (+1k2 code)
|
||||
|
|
|
@ -430,6 +430,7 @@
|
|||
//#define USE_DS3502 // [I2CDriver67] Enable DS3502 digital potentiometer (I2C address 0x28 - 0x2B) (+0k4 code)
|
||||
//#define USE_HYT // [I2CDriver68] Enable HYTxxx temperature and humidity sensor (I2C address 0x28) (+0k5 code)
|
||||
//#define USE_LUXV30B // [I2CDriver70] Enable RFRobot SEN0390 LuxV30b ambient light sensor (I2C address 0x4A) (+0k5 code)
|
||||
//#define USE_PMSA003I // [I2cDriver78] Enable PMSA003I Air Quality Sensor (I2C address 0x12) (+0k2 code)
|
||||
|
||||
//#define USE_RTC_CHIPS // Enable RTC chip support and NTP server - Select only one
|
||||
// #define USE_DS3231 // [I2cDriver26] Enable DS3231 RTC (I2C address 0x68) (+1k2 code)
|
||||
|
@ -654,6 +655,7 @@
|
|||
//#define USE_DS3502 // [I2CDriver67] Enable DS3502 digital potentiometer (I2C address 0x28 - 0x2B) (+0k4 code)
|
||||
//#define USE_HYT // [I2CDriver68] Enable HYTxxx temperature and humidity sensor (I2C address 0x28) (+0k5 code)
|
||||
//#define USE_LUXV30B // [I2CDriver70] Enable RFRobot SEN0390 LuxV30b ambient light sensor (I2C address 0x4A) (+0k5 code)
|
||||
//#define USE_PMSA003I // [I2cDriver78] Enable PMSA003I Air Quality Sensor (I2C address 0x12) (+0k2 code)
|
||||
|
||||
//#define USE_RTC_CHIPS // Enable RTC chip support and NTP server - Select only one
|
||||
// #define USE_DS3231 // [I2cDriver26] Enable DS3231 RTC (I2C address 0x68) (+1k2 code)
|
||||
|
|
|
@ -699,6 +699,7 @@
|
|||
// #define INA3221_ADDRESS1 // allow to change the 1st address to search for INA3221 to 0x41..0x43
|
||||
// #define INA3221_MAX_COUNT // change the number of devices to search for (default 4).
|
||||
// // Both settings together allow to limit searching for INA3221 to only a subset of addresses
|
||||
// #define USE_PMSA003I // [I2cDriver78] Enable PMSA003I Air Quality Sensor (I2C address 0x12) (+0k2 code)
|
||||
|
||||
// #define USE_RTC_CHIPS // Enable RTC chip support and NTP server - Select only one
|
||||
// #define USE_DS3231 // [I2cDriver26] Enable DS3231 RTC (I2C address 0x68) (+1k2 code)
|
||||
|
|
|
@ -879,7 +879,9 @@ void ResponseAppendFeatures(void)
|
|||
#if (defined(USE_I2C) || defined(USE_SPI)) && defined(USE_MCP23XXX_DRV)
|
||||
feature9 |= 0x00020000; // xdrv_67_mcp23xxx.ino
|
||||
#endif
|
||||
// feature9 |= 0x00040000;
|
||||
#if defined(USE_I2C) && defined(USE_PMSA003I)
|
||||
feature9 |= 0x00040000; // xsns_104_pmsa003i.ino
|
||||
#endif
|
||||
// feature9 |= 0x00080000;
|
||||
|
||||
// feature9 |= 0x00100000;
|
||||
|
|
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
xsns_104_pmsa003i.ino - PMSA003I air quality sensor support for Tasmota
|
||||
|
||||
Copyright (C) 2023 Jean-Pierre Deschamps
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef USE_I2C
|
||||
#ifdef USE_PMSA003I
|
||||
/*********************************************************************************************\
|
||||
* PMSA003I - PM2.5 Air Quality Sensor with I2C Interface
|
||||
*
|
||||
* Source: Adafruit Industries
|
||||
* Adaption for TASMOTA: Jean-Pierre Deschamps
|
||||
*
|
||||
* I2C Address: 0x12
|
||||
\*********************************************************************************************/
|
||||
|
||||
#define XSNS_104 104
|
||||
#define XI2C_78 78 // See I2CDEVICES.md
|
||||
|
||||
#define PMSA003I_ADDRESS 0x12
|
||||
|
||||
#ifndef PMSA003I_WARMUP_DELAY
|
||||
#define PMSA003I_WARMUP_DELAY 30 // Ignore PMSA003I readings for XX seconds after start
|
||||
#endif
|
||||
|
||||
#include "Adafruit_PM25AQI.h"
|
||||
|
||||
struct PMSA003I {
|
||||
bool type = false;
|
||||
bool ready = false;
|
||||
uint8_t warmup_counter; // count for warmup
|
||||
PM25_AQI_Data data;
|
||||
Adafruit_PM25AQI aqi = Adafruit_PM25AQI();
|
||||
} Pmsa003i;
|
||||
|
||||
|
||||
/********************************************************************************************/
|
||||
|
||||
void pmsa003i_Init(void)
|
||||
{
|
||||
if (!I2cSetDevice(PMSA003I_ADDRESS)) {
|
||||
// AddLog(LOG_LEVEL_DEBUG, PSTR("PMSA003I: " D_JSON_I2CSCAN_NO_DEVICES_FOUND));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Pmsa003i.aqi.begin_I2C()) {
|
||||
Pmsa003i.type = true;
|
||||
Pmsa003i.warmup_counter = PMSA003I_WARMUP_DELAY;
|
||||
I2cSetActiveFound(PMSA003I_ADDRESS, "PMSA003I");
|
||||
} else {
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("PMSA003I: " "begin_I2C failed"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Pmsa003iUpdate(void)
|
||||
{
|
||||
if (Pmsa003i.warmup_counter > 0) {
|
||||
Pmsa003i.warmup_counter--;
|
||||
return;
|
||||
}
|
||||
|
||||
Pmsa003i.ready = false;
|
||||
PM25_AQI_Data data;
|
||||
if (! Pmsa003iaqi.read(&data)) { // Could not read from AQI
|
||||
return;
|
||||
}
|
||||
Pmsa003i.data = data;
|
||||
Pmsa003i.ready = true;
|
||||
}
|
||||
|
||||
#ifdef USE_WEBSERVER
|
||||
const char HTTP_SNS_PMSA003I[] PROGMEM =
|
||||
// "{s}PMSA003I " D_STANDARD_CONCENTRATION " 1 " D_UNIT_MICROMETER "{m}%d " D_UNIT_MICROGRAM_PER_CUBIC_METER "{e}"
|
||||
// "{s}PMSA003I " D_STANDARD_CONCENTRATION " 2.5 " D_UNIT_MICROMETER "{m}%d " D_UNIT_MICROGRAM_PER_CUBIC_METER "{e}"
|
||||
// "{s}PMSA003I " D_STANDARD_CONCENTRATION " 10 " D_UNIT_MICROMETER "{m}%d " D_UNIT_MICROGRAM_PER_CUBIC_METER "{e}"
|
||||
"{s}PMSA003I " D_ENVIRONMENTAL_CONCENTRATION " 1 " D_UNIT_MICROMETER "{m}%d " D_UNIT_MICROGRAM_PER_CUBIC_METER "{e}"
|
||||
"{s}PMSA003I " D_ENVIRONMENTAL_CONCENTRATION " 2.5 " D_UNIT_MICROMETER "{m}%d " D_UNIT_MICROGRAM_PER_CUBIC_METER "{e}"
|
||||
"{s}PMSA003I " D_ENVIRONMENTAL_CONCENTRATION " 10 " D_UNIT_MICROMETER "{m}%d " D_UNIT_MICROGRAM_PER_CUBIC_METER "{e}"
|
||||
"{s}PMSA003I " D_PARTICALS_BEYOND " 0.3 " D_UNIT_MICROMETER "{m}%d " D_UNIT_PARTS_PER_DECILITER "{e}"
|
||||
"{s}PMSA003I " D_PARTICALS_BEYOND " 0.5 " D_UNIT_MICROMETER "{m}%d " D_UNIT_PARTS_PER_DECILITER "{e}"
|
||||
"{s}PMSA003I " D_PARTICALS_BEYOND " 1 " D_UNIT_MICROMETER "{m}%d " D_UNIT_PARTS_PER_DECILITER "{e}"
|
||||
"{s}PMSA003I " D_PARTICALS_BEYOND " 2.5 " D_UNIT_MICROMETER "{m}%d " D_UNIT_PARTS_PER_DECILITER "{e}"
|
||||
"{s}PMSA003I " D_PARTICALS_BEYOND " 5 " D_UNIT_MICROMETER "{m}%d " D_UNIT_PARTS_PER_DECILITER "{e}"
|
||||
"{s}PMSA003I " D_PARTICALS_BEYOND " 10 " D_UNIT_MICROMETER "{m}%d " D_UNIT_PARTS_PER_DECILITER "{e}"; // {s} = <tr><th>, {m} = </th><td>, {e} = </td></tr>
|
||||
#endif
|
||||
|
||||
void Pmsa003iShow(bool json)
|
||||
{
|
||||
if (Pmsa003i.ready) {
|
||||
if (json) {
|
||||
ResponseAppend_P(PSTR(",\"PMSA003I\":{\"CF1\":%d,\"CF2.5\":%d,\"CF10\":%d,\"PM1\":%d,\"PM2.5\":%d,\"PM10\":%d,\"PB0.3\":%d,\"PB0.5\":%d,\"PB1\":%d,\"PB2.5\":%d,\"PB5\":%d,\"PB10\":%d}"),
|
||||
Pmsa003i.data.pm10_standard, Pmsa003i.data.pm25_standard, Pmsa003i.data.pm100_standard,
|
||||
Pmsa003i.data.pm10_env, Pmsa003i.data.pm25_env, Pmsa003i.data.pm100_env,
|
||||
Pmsa003i.data.particles_03um, Pmsa003i.data.particles_05um, Pmsa003i.data.particles_10um, Pmsa003i.data.particles_25um, Pmsa003i.data.particles_50um, Pmsa003i.data.particles_100um);
|
||||
ResponseJsonEnd();
|
||||
#ifdef USE_DOMOTICZ
|
||||
if (0 == TasmotaGlobal.tele_period) {
|
||||
DomoticzSensor(DZ_COUNT, Pmsa003i.data.pm10_env); // PM1
|
||||
DomoticzSensor(DZ_VOLTAGE, Pmsa003i.data.pm25_env); // PM2.5
|
||||
DomoticzSensor(DZ_CURRENT, Pmsa003i.data.pm100_env); // PM10
|
||||
}
|
||||
#endif // USE_DOMOTICZ
|
||||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
WSContentSend_PD(HTTP_SNS_PMSA003I,
|
||||
// Pmsa003i.data.pm10_standard, Pmsa003i.data.pm25_standard, Pmsa003i.data.pm100_standard,
|
||||
Pmsa003i.data.pm10_env, Pmsa003i.data.pm25_env, Pmsa003i.data.pm100_env,
|
||||
Pmsa003i.data.particles_03um, Pmsa003i.data.particles_05um, Pmsa003i.data.particles_10um, Pmsa003i.data.particles_25um, Pmsa003i.data.particles_50um, Pmsa003i.data.particles_100um);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Interface
|
||||
\*********************************************************************************************/
|
||||
|
||||
bool Xsns104(uint32_t function)
|
||||
{
|
||||
if (!I2cEnabled(XI2C_78)) { return false; }
|
||||
|
||||
bool result = false;
|
||||
|
||||
if (FUNC_INIT == function) {
|
||||
pmsa003i_Init();
|
||||
}
|
||||
else if (Pmsa003i.type) {
|
||||
switch (function) {
|
||||
case FUNC_EVERY_SECOND:
|
||||
Pmsa003iUpdate();
|
||||
break;
|
||||
case FUNC_JSON_APPEND:
|
||||
Pmsa003iShow(1);
|
||||
break;
|
||||
#ifdef USE_WEBSERVER
|
||||
case FUNC_WEB_SENSOR:
|
||||
Pmsa003iShow(0);
|
||||
break;
|
||||
#endif // USE_WEBSERVER
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // USE_PMSA003I
|
||||
#endif // USE_I2C
|
|
@ -293,7 +293,7 @@ a_features = [[
|
|||
"USE_MODBUS_ENERGY","USE_SHELLY_PRO","USE_DALI","USE_BP1658CJ",
|
||||
"USE_DINGTIAN_RELAY","USE_HMC5883L","USE_LD2410","USE_ME007",
|
||||
"USE_DISPLAY_TM1650","USE_PCA9632","USE_TUYAMCUBR","USE_SEN5X",
|
||||
"USE_BIOPDU","USE_MCP23XXX_DRV","","",
|
||||
"USE_BIOPDU","USE_MCP23XXX_DRV","USE_PMSA003I","",
|
||||
"","","","",
|
||||
"","","","",
|
||||
"","","",""
|
||||
|
|
Loading…
Reference in New Issue