MQSensorsLib icon indicating copy to clipboard operation
MQSensorsLib copied to clipboard

Probably Incorrect Readings

Open dirceu-jr opened this issue 2 years ago • 3 comments

I'm using MQUnifiedsensor library much like examples/MQ-135-ALL/MQ-135-ALL.ino shows.

MQ135.setA(605.18); MQ135.setB(-3.937); // Configure the equation to calculate CO concentration value
float CO = MQ135.readSensor();

MQ135.setA(77.255); MQ135.setB(-3.18); //Configure the equation to calculate Alcohol concentration value
float Alcohol = MQ135.readSensor();

// ...

But when I get near some "element" to test, like Alcohol or Aceton all the readings changes in a correlated way. See: MQ135: https://thingspeak.com/channels/2295455/ MQ3: https://thingspeak.com/channels/2295454/

The expected behavior is that when I put some Alcohol near the sensor, only Alcohol has a change in readings.

dirceu-jr avatar Oct 19 '23 20:10 dirceu-jr

Also, I could not get correct values for CO2. For any Regression Method i get very small values e.g. 1...3 Adding 400ppm correction does not help. i get 401...403 even when i blow on the sensor.

CHE77 avatar Nov 03 '23 22:11 CHE77

HI dirceu-jr, An MQ sensor is designed to detect one type of gas at a time. It is not designed to detect all the gases at the same time. When alcohol is present, you have to use the appropriate regression coefficients (a,b) for alcohol. The reading for other gases are meaningless.

berryPiTech avatar Mar 14 '24 01:03 berryPiTech

Hi CHE77,

I noticed the same behavior as you did for my MQ3 sensor testing for alcohol. Very small variation in ppm reading.

I found a solution. When I examined the sensor datasheet, the cleanAirRatio is 1, while the sketch uses cleanAirRatio = 60. Setting the cleanAirRatio = 1 in the program gives me correct readings.

You might want to check your sensor datasheet and see if your cleanAirRatio does indeed have the same value used in the program.

Here is my datasheet: https://cdn.sparkfun.com/datasheets/Sensors/Biometric/MQ-3%20ver1.3%20-%20Manual.pdf

The cleanAirRatio is the red horizontal line in figure 3.

berryPiTech avatar Mar 14 '24 01:03 berryPiTech

Closed due to clarification and resolution. As mentioned by @berryPiTech, MQ sensors are designed to detect one type of gas at a time. It's essential to use the appropriate regression coefficients (a, b) for the specific gas being measured, as readings for other gases will not be reliable. Additionally, adjusting the cleanAirRatio to match the sensor's datasheet, as highlighted by @berryPiTech, resolves the issue of incorrect values. Thank you all for your input

miguel5612 avatar Sep 05 '24 20:09 miguel5612