Skip to content

Instantly share code, notes, and snippets.

@marw
marw / read_nova_pm_sensor.py
Last active December 11, 2023 03:40
Get reading from Nova PM Sensor SDS011 (dust sensor, air quality sensor, PM10, PM2,5)
#!/usr/bin/env python3
"""
Get reading from Nova PM Sensor SDS011
(dust sensor, air quality sensor, PM10, PM2,5)
Designed to run from cron and append CSV file.
Script tested using Python3.4 on Ubuntu 14.04.
@marw
marw / nova_sds011.py
Created June 1, 2017 21:14
Get reading from Nova PM Sensor SDS011 (dust sensor, air quality sensor, PM10, PM2,5) with sleep option
import time
import logging
try:
import serial
except ImportError:
print('Python serial library required, on Ubuntu/Debian: ' +
'apt-get install python-serial python3-serial')
raise
import time
import argparse
import multiprocessing
import random
import numpy as np
M = 250
# size ~ 0.5MB
X = np.random.randn(M, M)