Air quality monitoring station

  • SBCs are natural platforms for all kind of monitoring stations. With the extra small form factor of the Omegas (not to mention their cuteness) I am planning to make one using them. It may take me some time to wrap all the details up in some final form so I am creating this thread to report initial steps in case somebody is tempted too.

    I intend to have at least:

    1. particulate,
    2. humidity,
    3. and temperature

    For the No 1, I eventually would like to use the Plantower PMS5003 sensor, but I have some problems to get it working (non Omega specific) so just to test the connectivity I used Nova SDS021 sensor:
    alt text
    alt text
    which I am more familiar with.
    Nova SDS021 Datasheet

    The connector layout:
    alt text

    Note that the sensor requires 5V power supply.

    I hooked up the R and T lines of the sensor directly to the UART1 serial 46 and 45 Omega pins, respectively.

    alt text
    The UART1 is represented by the /dev/ttyS1 device.

    To test the setup I used (further simplified) a python scrip found here:

    import serial
    import time
    def hexShow(argv):  
       result = ''  
       hLen = len(argv)  
       for i in xrange(hLen):  
           hvol = ord(argv[i])  
           hhex = '%02x'%hvol  
           result += hhex+' '  
    t = serial.Serial('/dev/ttyS1',9600)  
    while True:
       retstr =
       if len(retstr)==10:
           if(retstr[0]==b"\xaa" and retstr[1]==b'\xc0'):
               for i in range(6):
               if checksum%256 == ord(retstr[8]):
                   print "pm2.5:%.1f pm10 %.1f"%(pm25/10.0,pm10/10.0)

    The code requires python-serial (and python-light) to be installed.
    An example of the output

    pm2.5:14.9 pm10 15.7
    pm2.5:15.0 pm10 15.8
    pm2.5:15.1 pm10 15.9
    pm2.5:15.1 pm10 15.9
    pm2.5:15.2 pm10 16.0
    pm2.5:15.2 pm10 16.0
    pm2.5:15.3 pm10 16.1
    pm2.5:15.4 pm10 16.2
    pm2.5:238.6 pm10 578.7   <- lit on fire a piece of paper and blew the smoke towards the sensor
    pm2.5:373.1 pm10 960.4
    pm2.5:613.1 pm10 1375.7
    pm2.5:719.8 pm10 1532.1
    pm2.5:892.8 pm10 1734.9
    pm2.5:891.4 pm10 1670.3
    pm2.5:999.9 pm10 1999.9
    pm2.5:999.9 pm10 1984.0
    pm2.5:999.9 pm10 1752.8
    pm2.5:999.9 pm10 1640.8
    pm2.5:755.6 pm10 793.4
    pm2.5:709.9 pm10 745.4
    pm2.5:602.6 pm10 632.8
    pm2.5:531.7 pm10 558.3
    pm2.5:429.2 pm10 450.7
    pm2.5:436.3 pm10 458.2
    pm2.5:474.7 pm10 505.9
    pm2.5:499.1 pm10 535.4
    pm2.5:439.2 pm10 461.2
    pm2.5:421.5 pm10 442.6
    pm2.5:388.1 pm10 407.6
    pm2.5:378.9 pm10 397.9
    pm2.5:258.6 pm10 271.6
    pm2.5:175.7 pm10 184.5
    pm2.5:88.4 pm10 92.9
    pm2.5:84.0 pm10 88.3
    pm2.5:75.9 pm10 79.7
    pm2.5:71.8 pm10 75.4
    pm2.5:65.6 pm10 68.9

    So as it can be seen the whole installation and wiring are very simple and straightforward.
    The mentioned sensors are priced (Aliexpress) between USD15 and 30.

  • I am going to use the DHT11/DHT22 sensors for temperature and humidity readings. I found one thread within this forum describing how to do it, but the solution presented there is based on a python script executing the cpp compiled binary code. As far as I can see there are some python libraries to read set GPIO so I wonder why this has to be the described way.

    My understanding how it works: the sensor is triggered by setting a high level pulse on the GPIO pin. The sensor responds to this pulse returning a wave of pulses with 2 different, fixed durations corresponding to 0 and 1. The task is to decode the pulses by analyzing their width (duration) and assemble them into bytes. This obviously requires sampling the GPIO state into some sort of array. It seems the sampling rate should be with the resolution ~20us (or 50kHz). Is this sort of resolution achievable by the said python module?:

  • deleted.

  • administrators

    @Marcin-Debowski we haven't experimented with reading the DHT sensors directly using the Omega since they have their own timing sensitive protocol. Because the Omega runs Linux and is a soft real-time operating system, any one of the running processes could interrupt your code and mess up the timing of your pulses.

    We have, however, used the microcontroller on the Arduino Dock as a coprocessor to read the sensor and report the reading via serial UART to the Omega. Check out this project for details:

Log in to reply

Looks like your connection to Onion Community was lost, please wait while we try to reconnect.