Particle Matter Sensor Failing

New sensors integration, sensor boards usage...
Post Reply
cdawber
Posts: 6
Joined: Wed Apr 25, 2018 11:27 am
Company: KeyWare ltd

Particle Matter Sensor Failing

Post by cdawber » Wed Oct 02, 2019 2:51 pm

I am using the function below to gather data from a Smart Cities Pro device with the following sensors connected:
Socket A – Noise Sensor *includes IRM-30-5ST and USB link*
Socket B – CO Sensor
Socket C – SO2 Sensor
Socket D – Particle Monitor PM-X
Socket E – Temp, Pressure and Humidity Sensor
Socket F – CO2 Sensor

The PM sensor was reporting finite values on my workbench but since deploying live it has just been reporting zeros for PM1, PM2_5 and PM10. I am not sure if the sensor itself is reporting zeros or the ON() or getPM() functions are failing as we no longer have access to the USB serial port logs.

void getSensorData()
{
// Switch on BME sensor
bme.ON();

// Read enviromental variables
temperature = bme.getTemperature();
humidity = bme.getHumidity();
pressure = bme.getPressure();

// Power off the BME sensor
bme.OFF();

USB.print(F("Temp: "));
USB.printFloat(temperature, 2);
USB.print(F(" degC, Humidity: "));
USB.printFloat(humidity, 2);
USB.print(F(" %, Presusure: "));
USB.printFloat(pressure, 1);
USB.println(F(" Pa"));

// Start the sensors
bool particleSensorOkay = (PM.ON() == 1);
bool coSensorOkay = (CO.ON() == 1);
bool so2SensorOkay = (SO2.ON() == 1);
bool co2SensorOkay = (CO2.ON() == 1);

// Allow sensors 2 minutes to warm up
PWR.deepSleep("00:00:02:00", RTC_OFFSET, RTC_ALM1_MODE1, ALL_ON);

// Get a noise reading
noise.configure();

bool noiseSensorOkay = (noise.getSPLA(SLOW_MODE) == 0);

if (noiseSensorOkay == false)
{
spla = 0.0;

USB.println(F("Error reading noise sensor"));
}
else
{
spla = noise.SPLA;

USB.print(F("Sound Pressure Level with A-Weighting (SLOW): "));
USB.printFloat(spla, 2);
USB.println(F(" dBA"));
}

// Get a CO reading
if (coSensorOkay == false)
{
co = 0.0;

USB.println(F("Error starting CO sensor"));
}
else
{
co = CO.getConc(temperature);

USB.print(F("CO concentration: "));
USB.printFloat(co, 4);
USB.println(F(" ppm"));
CO.OFF();
}

// Get a SO2 reading
if (so2SensorOkay == false)
{
so2 = 0.0;

USB.println(F("Error starting SO2 sensor"));
}
else
{
so2 = SO2.getConc(temperature);

USB.print(F("SO2 concentration: "));
USB.printFloat(so2, 4);
USB.println(F(" ppm"));
SO2.OFF();
}

// Get a CO2 reading
if (co2SensorOkay == false)
{
co2 = 0.0;

USB.println(F("Error starting CO2 sensor"));
}
else
{
co2 = CO2.getConc(temperature);

USB.print(F("CO2 concentration: "));
USB.printFloat(co2, 4);
USB.println(F(" ppm"));
CO2.OFF();
}

if (particleSensorOkay == false)
{
pm1 = 0.0;
pm2_5 = 0.0;
pm10 = 0.0;

USB.println(F("Error starting particle sensor"));
}
else
{
particleSensorOkay = (PM.getPM(5000, 5000) == 1);

if (particleSensorOkay == false)
{
pm1 = 0.0;
pm2_5 = 0.0;
pm10 = 0.0;

USB.println(F("Error reading particle sensor"));
}
else
{
pm1 = PM._PM1;
pm2_5 = PM._PM2_5;
pm10 = PM._PM10;

USB.print(F("PM 1: "));
USB.printFloat(PM._PM1, 4);
USB.print(F(" ug/m3, "));
USB.print(F("PM 2.5: "));
USB.printFloat(PM._PM2_5, 4);
USB.print(F(" ug/m3, "));
USB.print(F("PM 10: "));
USB.printFloat(PM._PM10, 4);
USB.println(F(" ug/m3"));
}

PM.OFF();
}
}

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: Particle Matter Sensor Failing

Post by libelium-dev » Thu Oct 03, 2019 8:27 am

Hi,

Please try to turn ON the particle matter sensor just before reading it. The PM and NLS are read through the UART and due to the noise.configure() function is executed after PM.ON(), the UART is configured to read the NLS instead of the PM sensor.

Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest