miguel5612 / MQSensorsLib

We present a unified library for MQ sensors, this library allows to read MQ signals easily from Arduino, Genuino, ESP8266, ESP-32 boards whose references are MQ2, MQ3, MQ4, MQ5, MQ6, MQ7, MQ8, MQ9, MQ131, MQ135, MQ136, MQ303A, MQ309A.
MIT License
169 stars 64 forks source link

PPM Value #71

Closed abts0212 closed 11 months ago

abts0212 commented 12 months ago

Hi, I'm using your library and it's very helpful for our project, but there are some things I need to ask. can I just take the ppm value without having to take all the values in serial.debug, because I will use the ppm value every second to be included in the air quality index (AQI) parameter. and how do I do that with the librar?.

miguel5612 commented 11 months ago

Hello!

Yes, it is possible to get the PPM value without having to print all values on the serial monitor. You can use the readSensor() method to get the PPM value directly. Here is an example of how to do it:

MQ303.update(); // Actualiza los datos, el Arduino leerá el voltaje del pin analógico

MQ303.setA(6.2144); MQ303.setB(-2.894); // Configura la ecuación para calcular la concentración de Isobutano float isobutano = MQ303.readSensor(); // El sensor leerá la concentración en PPM usando el modelo, los valores a y b establecidos anteriormente o en el setup

This isobutane value you obtained will be the one you will use for the Air Quality Index (AQI) calculation.

I hope this solves your question. If you have more questions, don't hesitate to ask.

Best regards!

Note.

Calibration tutorial there: https://jayconsystems.com/blog/understanding-a-gas-sensor