All Projects → fu-hsi → PMS

fu-hsi / PMS

Licence: MIT license
Arduino library for Plantower PMS x003 family sensors.

Programming Languages

C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to PMS

DustViewerSharp
UART-USB based dust sensor viewer(and also logging) program by C#
Stars: ✭ 38 (-66.67%)
Mutual labels:  air-quality, pm10, dust, pms5003, pms7003
PMserial
Arduino library for PM sensors with serial interface
Stars: ✭ 41 (-64.04%)
Mutual labels:  air-quality, pm10, pms5003, pms7003
M5Stack-Air-Quality-ESPHome
ESPHome configuration for M5Stack's PM2.5 Air Quality Kit with the PMSA003 particulate matter sensor and the SHT20 temperature and humidity sensor
Stars: ✭ 19 (-83.33%)
Mutual labels:  air-quality, pm10
pm-home-station
Indoor use particulate matter sensor on USB or Bluetooth
Stars: ✭ 31 (-72.81%)
Mutual labels:  air-quality, pms7003
openair
国家空气质量数据获取库,包含完整的API,不再信任地方检测站
Stars: ✭ 85 (-25.44%)
Mutual labels:  air-quality, pm10
ESPHome-Air-Quality-Monitor
ESPHome configuration for a DIY indoor air quality monitor for CO₂ concentration, PM2.5 and PM10 concentrations, and temperature, humidity and pressure
Stars: ✭ 42 (-63.16%)
Mutual labels:  air-quality, pm10
SmartHome
esp8266 IoT to mqtt bridge. Eastron SDM220, SDM230, SDM630 modbus; AZ7798; SenseAir s8; BME280; HDC1080; Plantower PMS5003, PMS7003, PMSA003
Stars: ✭ 50 (-56.14%)
Mutual labels:  pms5003, pms7003
gis4wrf
QGIS toolkit 🧰 for pre- and post-processing 🔨, visualizing 🔍, and running simulations 💻 in the Weather Research and Forecasting (WRF) model 🌀
Stars: ✭ 137 (+20.18%)
Mutual labels:  air-quality
pyawair
a very simple python class to access the (private) awair api
Stars: ✭ 24 (-78.95%)
Mutual labels:  air-quality
rpi-enviro-mqtt
Send air quality data from a Pimoroni RPi Enviro+ over MQTT
Stars: ✭ 30 (-73.68%)
Mutual labels:  air-quality
bsec bme680 linux
Read the BME680 sensor with the BSEC library on Linux (e.g. Raspberry Pi)
Stars: ✭ 78 (-31.58%)
Mutual labels:  air-quality
rdefra
rdefra: Interact with the UK AIR Pollution Database from DEFRA
Stars: ✭ 14 (-87.72%)
Mutual labels:  air-quality
aircitizen
main repo of the aircitizen project
Stars: ✭ 18 (-84.21%)
Mutual labels:  air-quality
air-visual-card
A Lovelace card showing air quality data from airvisual.com. Requires the AirVisual component.
Stars: ✭ 70 (-38.6%)
Mutual labels:  air-quality
SmogWatch
watchOS app for checking air pollution levels, created for my blog post series
Stars: ✭ 34 (-70.18%)
Mutual labels:  air-quality
s5p-tools
Python scripts to download and preprocess air pollution concentration level data aquired from the Sentinel-5P mission
Stars: ✭ 49 (-57.02%)
Mutual labels:  air-quality
Airrohr-kit
A complete kit for building a Air Quality meter for the Luftdaten.info project
Stars: ✭ 26 (-77.19%)
Mutual labels:  air-quality
luftdatenpumpe
Process live and historical data from luftdaten.info, IRCELINE and OpenAQ. Filter by station-id, sensor-id and sensor-type, apply reverse geocoding, store into timeseries and RDBMS databases, publish to MQTT, output as JSON or visualize in Grafana.
Stars: ✭ 22 (-80.7%)
Mutual labels:  air-quality
Klimerko
☁ DIY Air Quality Measuring Device
Stars: ✭ 69 (-39.47%)
Mutual labels:  air-quality
elixir bme680
An Elixir library to interface with the BME680 (and BME280) environmental sensor
Stars: ✭ 19 (-83.33%)
Mutual labels:  air-quality

PMS Library

Arduino library for Plantower PMS sensors. Supports PMS x003 sensors (1003, 3003, 5003, 6003, 7003).

Installation

Just use Arduino Library Manager and search "PMS Library" in Sensors category.

Main assumptions

  • easy as possible,
  • minimal memory consumption,
  • non-blocking functions,
  • supporting a wide range of PMS sensors from Plantower,
  • supporting additional modes e.g.: sleeping, passive, active (depends on the sensor model).

As a data source you can use any object that implements the Stream class, such as Wire, Serial, EthernetClient, e.t.c.

Basic example

Read in active mode.

Default mode is active after power up. In this mode sensor would send serial data to the host automatically. The active mode is divided into two sub-modes: stable mode and fast mode. If the concentration change is small the sensor would run at stable mode with the real interval of 2.3s. And if the change is big the sensor would be changed to fast mode automatically with the interval of 200~800ms, the higher of the concentration, the shorter of the interval.

#include "PMS.h"

PMS pms(Serial);
PMS::DATA data;

void setup()
{
  Serial.begin(9600);   // GPIO1, GPIO3 (TX/RX pin on ESP-12E Development Board)
  Serial1.begin(9600);  // GPIO2 (D4 pin on ESP-12E Development Board)
}

void loop()
{
  if (pms.read(data))
  {
    Serial1.print("PM 1.0 (ug/m3): ");
    Serial1.println(data.PM_AE_UG_1_0);

    Serial1.print("PM 2.5 (ug/m3): ");
    Serial1.println(data.PM_AE_UG_2_5);

    Serial1.print("PM 10.0 (ug/m3): ");
    Serial1.println(data.PM_AE_UG_10_0);

    Serial1.println();
  }

  // Do other stuff...
}

Output

PM 1.0 (ug/m3): 13
PM 2.5 (ug/m3): 18
PM 10.0 (ug/m3): 23

PM 1.0 (ug/m3): 12
PM 2.5 (ug/m3): 19
PM 10.0 (ug/m3): 24

...

Advanced example

Read in passive mode but not the best way (see additional remarks).

#include "PMS.h"

PMS pms(Serial);
PMS::DATA data;

void setup()
{
  Serial.begin(9600);   // GPIO1, GPIO3 (TX/RX pin on ESP-12E Development Board)
  Serial1.begin(9600);  // GPIO2 (D4 pin on ESP-12E Development Board)
  pms.passiveMode();    // Switch to passive mode
}

void loop()
{
  Serial1.println("Waking up, wait 30 seconds for stable readings...");
  pms.wakeUp();
  delay(30000);

  Serial1.println("Send read request...");
  pms.requestRead();

  Serial1.println("Reading data...");
  if (pms.readUntil(data))
  {
    Serial1.print("PM 1.0 (ug/m3): ");
    Serial1.println(data.PM_AE_UG_1_0);

    Serial1.print("PM 2.5 (ug/m3): ");
    Serial1.println(data.PM_AE_UG_2_5);

    Serial1.print("PM 10.0 (ug/m3): ");
    Serial1.println(data.PM_AE_UG_10_0);
  }
  else
  {
    Serial1.println("No data.");
  }

  Serial1.println("Going to sleep for 60 seconds.");
  pms.sleep();
  delay(60000);
}

Output

Waking up, wait 30 seconds for stable readings...
Send read request...
Reading data...
PM 1.0 (ug/m3): 13
PM 2.5 (ug/m3): 18
PM 10.0 (ug/m3): 23
Going to sleep for 60 seconds.
Waking up, wait 30 seconds for stable readings...
Send read request...
Reading data...
PM 1.0 (ug/m3): 12
PM 2.5 (ug/m3): 19
PM 10.0 (ug/m3): 24
Going to sleep for 60 seconds.

...

Additional remarks

Tested with PMS 7003 and ESP-12E Development Board. All Plantower PMS sensors uses the same protocol (let me know if you have any problems).

Please consider, that delay() function in examples is a blocking function.
Try to avoid such a solution if your project requires it (see Expert.ino example in examples directory).

For more accurate measurements, you can read several samples (in passive or active mode) and calculate the average.

Stable data should be got at least 30 seconds after the sensor wakeup from the sleep mode because of the fan's performance.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].