Environment Monitoring with PSLab

In this post, we shall explore the working principle and output signals of particulate matter sensors, and explore how the PSLab can be used as a data acquisition device for these. Working Principle A commonly used technique employed by particulate matter sensors is to study the diffraction of light by dust particles, and estimate the concentration based on a parameter termed the ‘occupancy factor’. The following image illustrates how the most elementary particle sensors work using a photogate, and a small heating element to ensure continuous air flow by convection. Occupancy Rate Each time a dust particle of aerodynamic diameters 2.5um passes through the lit area, a phenomenon called Mie scattering which defines scattering of an electromagnetic plane wave by a homogenous sphere of diameter comparable to the wavelength of incident light, results in a photo-signal to be detected by the photosensor.  In more accurate dust sensors, a single wavelength source with a high quality factor such as a laser is used instead of LEDs which typically have broader spectra. The signal output from the photosensor is in the form of intermittent digital pulses whenever a particle is detected. The occupancy ratio can be determined by measuring the sum total of time when a positive signal was output from the sensor to the total averaging time. The readings can be taken over a fairly long amount of time such as 30 seconds in order to get a more accurate representation of the occupancy ratio. Using the Logic analyzer to capture and interpret signals The PSLab has a built-in logic analyzer that can acquire data signals up to 67 seconds long at its highest sampling rate, and this period is more than sufficient to record and interpret a dataset from a dust sensor. An inexpensive dust sensor, DSM501A was chosen for the readings, and the following results were obtained Dust sensor readings from an indoor, climate controlled environment. After the 100 second mark, the windows were opened to expose the sensor to the outdoor environment. A short averaging time has resulted in large fluctuations in the readings, and therefore it is important to maintain longer averaging times for stable measurements. Recording data with a python script instead of the app The output of the dust sensor must be connected to ID1 of the PSLab, and both devices must share a common ground which is a prerequisite for exchange of DC signals. All that is required is to start the logic analyzer in single channel mode, wait for a specified averging time, and interpret the acquired data Record_dust_sensor.py from PSL import sciencelab #import the required library import time import numpy as np I = sciencelab.connect() #Create the instance I.start_one_channel_LA(channel='ID1',channel_mode=1,trigger_mode=0) #record all level changes time.sleep(30) #Wait for 30 seconds while the PSLab gathers data from the dust sensor a,_,_,_,e =I.get_LA_initial_states() #read the status of the logic analyzer raw_data =I.fetch_long_data_from_LA(a,1) #fetch number of samples available in chan #1 I.dchans[0].load_data(e,raw_data) stamps =I.dchans[0].timestamps #Obtain a copy of the timestamps if len(stamps)>2: #If more than two timestamps are…

Continue ReadingEnvironment Monitoring with PSLab