ostaquet / Arduino-MQ131-driver

Arduino driver for gas sensor MQ131 (Ozone / O3)
MIT License
65 stars 19 forks source link

some question... #12

Closed atlask1 closed 4 years ago

atlask1 commented 4 years ago

Hi, first of all , really good work!

I need to know some things and I write all points during the test of library and sensor, so I can write all-in-one! It's not a really issue, you can mark as a question..:)

  1. about calibration, you and datasheet talk about 48 hours of preheating , but in calibration function you have MQ131_DEFAULT_STABLE_CYCLE = 20, so after 20 same value read, calibration stop. So, how can I preheat sensor for 48h if I have this set? Have you tested that it's impossible that sensor return 20 stable value before 48h of cal? Or I need to unconnect analog pin to let heating go on for 48 hour?

  2. heater inside sensor need 5V and too much current for Arduino pin and you use a transistor to solve this, but why you have choose that value on the base of 337? How much Volt have you on heat pin? Should I feel hot touching the sensor?

  3. now I have a low concentration sensor in calibration from about 10 min and I have a sequence of about 10-12 same value, other 10-12 value different than before, and so on. That value is the RS, right? Is that value influenced by the heating resistor? If I don't have 5V on heating resistor, what happen?

  4. now the calibration done, I have a R0 value and TimeToHeat, but calibration time ended only after 20 minutes and time to heat is 1399 s, too much to have a sample! So I return to my question n1: there's a way to have a 'first time calibration' ? Have you think about it? Maybe a function like 'firstTimeCalibration()' or 'firstTimePreHeatCal()' where you don't consider DEFAULT_STABLE_CYCLE until 48 hours passed and you can use millis() to wait that time.

  5. now I have a sample , but with the parameters described before, so I can't consider correct result, also if it seems correct, I have 0.02 ppm and it is right if I consider about 0.04 ppm a normal value of concentration in atmosphere. I ask you(again), 48h of calibration give me less time to heat? Did you have 5V on heating pin? I'm powering Arduino with 9V but I have only 2.5V on heating pins. I have choose a 4k7 base resistor because I don't have 5k1 , but I think you want only to take transistor in saturation, right? All of this question is only to understand better, thanks!

ostaquet commented 4 years ago

Hi,

A lot of questions ;-)

1° Preheat and calibration are two different operations.

Preheating is burning the heater to remove all residues of the fabrication process. The preheating is just supply 5V on the heater for 48 hours in order to have the sensor reading to work.

Calibration process is to define the R0; meaning defining the resistance of your sensor when there is no ozone in the air. The best is to make the calibration in fresh air during a Sunday (less traffic and less pollution). The R0 will be used as basis to measure the concentration.

2° The heater needs around 5V to heat properly. According to some experiment I saw on the internet, the voltage is not critical as far as the heater is heating. I use a BC337 because I have some of them on my desk ;-). You can use any NPN transistor as far as you sature the base. On my side, I have around 4.5V (5V minus the voltage drop of the transistor). Normally, the heater should be warm after some seconds. If not, your wiring is probably problematic or you are not saturating the base of the transistor.

3° The analog value that you are reading is the resistance of the sensor (Rs). In order to measure the concentration, you need to know the resistance in fresh air (R0, coming from the calibration) and compare the delta with the Rs. After that, the ratio Rs/R0 is used to determine the effective concentration based on the datasheet. The idea is to find a formula to calculate this. You can find the Excel file in the repository to see how it was calculated for the driver (see https://github.com/ostaquet/Arduino-MQ131-driver/blob/master/datasheet/Sensitivity_curves.xlsx)

As said above, if you don’t have full 5V, it is not a problem but the heater has to be warm. If not, there is another issue.

4° The time to read could be long depending on the variability of the sensor. One solution is to be more flexible with the counting of stable value before considering as stable. In the driver, we are expecting 20 times the same value on the Rs to consider this as stable. By changing the parameter MQ131_DEFAULT_STABLE_CYCLE, you can limit the number and speed up the process (with a risk of being less accurate ;-) ).

5° It sounds like normal values if you are living in a healthy environment ;-). 48h of calibration is quite long, I guess you’re talking about the preheat time ;-). I never got 5V on the heating pin except if I push the voltage on the heater circuit at 5.6V to compensate the voltage drop in the transistor.

2.5V on heater seems very low to me. It explains probably why your timing to have a stable value is so long. The nature of the sensor is to detect burning gases that are burn with the sensor... if the heater is not so warm, it takes time ;-)

4.7Kohms or 5.1Kohms doesn’t matter if you saturate the transistor but the 2.5V on the heater seems a bit low. If you’re using a 9V battery, it is probably the problem. Try using a stable power supply unit if you’re using the battery ;-)

Hope it helps ;-)