|
18 | 18 |
|
19 | 19 | Works with most (any?) Plantower UART or I2C interfaced PM2.5 sensor. |
20 | 20 |
|
| 21 | +* `PM2.5 Air Quality Sensor and Breadboard Adapter Kit - PMS5003 |
| 22 | + <https://www.adafruit.com/product/3686>`_ |
| 23 | +
|
| 24 | +
|
21 | 25 | **Software and Dependencies:** |
22 | 26 |
|
23 | 27 | * Adafruit CircuitPython firmware for the supported boards: |
|
33 | 37 | class PM25_UART(PM25): |
34 | 38 | """ |
35 | 39 | A driver for the PM2.5 Air quality sensor over UART |
| 40 | +
|
| 41 | + :param ~busio.UART uart: The `busio.UART` object to use. |
| 42 | + :param ~microcontroller.Pin reset_pin: Pin use to reset the sensor. |
| 43 | + Defaults to `None` |
| 44 | +
|
| 45 | +
|
| 46 | + **Quickstart: Importing and using the PMS5003 Air quality sensor** |
| 47 | +
|
| 48 | + Here is one way of importing the `PM25_UART` class so you |
| 49 | + can use it with the name ``pm25``. |
| 50 | + First you will need to import the libraries to use the sensor |
| 51 | +
|
| 52 | + .. code-block:: python |
| 53 | +
|
| 54 | + import board |
| 55 | + import busio |
| 56 | + from adafruit_pm25.uart import PM25_UART |
| 57 | +
|
| 58 | + Once this is done you can define your `busio.UART` object and define |
| 59 | + your sensor object |
| 60 | +
|
| 61 | + .. code-block:: python |
| 62 | +
|
| 63 | + uart = busio.UART(board.TX, board.RX, baudrate=9600) |
| 64 | + reset_pin = None |
| 65 | + pm25 = PM25_UART(uart, reset_pin) |
| 66 | +
|
| 67 | + Now you have access to the air quality data using the class function |
| 68 | + `adafruit_pm25.PM25.read` |
| 69 | +
|
| 70 | + .. code-block:: python |
| 71 | +
|
| 72 | + aqdata = pm25.read() |
| 73 | +
|
36 | 74 | """ |
37 | 75 |
|
38 | 76 | def __init__(self, uart, reset_pin=None): |
@@ -61,6 +99,3 @@ def _read_into_buffer(self): |
61 | 99 | if not remain or len(remain) != 31: |
62 | 100 | raise RuntimeError("Unable to read from PM2.5 (incomplete frame)") |
63 | 101 | self._buffer[1:] = remain |
64 | | - |
65 | | - |
66 | | -# print([hex(i) for i in self._buffer]) |
|
0 commit comments