MBed os library for Honeywel HPMA
particle matter sensor
by dhrmaes
Description
The Honeywell HPM Series Particulate Matter Sensor is a laser-based sensor which detects and counts particles using light scattering.
This library is made for Mbed Os 6. Although it would most likely work just fine in Mbed Os 5.
All the functions of the sensor are included in this library.
- Start measurement
- Stop measurement
- Read
- Enable autosend
- Disable autosend
The sensor communicates exclusively over UART, which is why the constructor takes 3 arguments:
- TX pin
- RX pin
- Baudrate, (default: 9600)
The showed screenshot is just a test version preview, the final look of the software will be better.
Developer team:
- WesDeb
- DhrMaes
Example code
1. | 2. | 3. | 4. | 5. | 6. | 7. | 8. | 9. | 10.| 11.| 12.| 13.| 14.| 15.| 16.| 17.|
#include "mbed.h" #include "HPMA.h" HPMA Sensor(PTC15, PTC14); int main() { Sensor.stop_autosend(); Sensor.start_measurement(); thread_sleep_for(6000); HPMAPDU* result = new HPMAPDU(); for(int i = 0; i < 6; i++) { result = Sensor.read(); printf("PM 2.5: %d µg/m3, PM 10: %d µg/m3\n", result->PM25, result->PM25); thread_sleep_for(3000); } Sensor.stop_measurement(); }