[Relatively new to coding on Arduino and messing around with plugging in new components]
Hello, I am working on an air quality sensor project and I am having some trouble with the sensor values not seeming to change even if I blow smoke into them. What I am using is a Arduino Nano 33 BLE Sense board and a Grove Air Quality Sensor v1.3 directly plugged into it.
Here is my code:
#include "Air_Quality_Sensor.h"
AirQualitySensor sensor(A0);
void setup(void) {
Serial.begin(9600);
while (!Serial);
Serial.println("Waiting for sensor to initialize...");
delay(20000);
if (sensor.init()) {
Serial.println("Sensor ready.");
} else {
Serial.println("Sensor ERROR!");
}
}
void loop(void) {
int quality = sensor.slope();
int sensorValue = sensor.getValue();
Serial.print("Sensor value: ");
Serial.println(sensorValue);
if (quality == AirQualitySensor::FORCE_SIGNAL) {
Serial.println("High pollution! Force signal active.");
} else if (quality == AirQualitySensor::HIGH_POLLUTION) {
Serial.println("High pollution!");
} else if (quality == AirQualitySensor::LOW_POLLUTION) {
Serial.println("Low pollution.");
} else if (quality == AirQualitySensor::FRESH_AIR) {
Serial.println("Fresh air.");
}
int aqi = map(sensorValue, 0, 1023, 0, 500);
Serial.print("AQI: ");
Serial.println(aqi);
delay(1000);
}
The output of the code has the sensorValue never going below or above 200 by 4 values. The range is always 197-204. I have never seen it be different, even when I put bug spray or smoke in front of the sensor.
Any help would be greatly appreciated.
