-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MH-Z19 should disable ABC mode (Auto Base Calibration) upon init #466
Comments
The default is correct (ABC left on) because the assumption that the user is intelligent and does correct calibration is a wrong one. However, a setting could be added to the sensor that allows ABC to be disabled upon poweron. As for applying calibration based on PPM values == 400 for X time, I have tried that and it does not yield any accurate results because it depends on an accurate outdoor-air calibration after power-on, which is an assumption one can almost never make. |
And FWIW, if you open your windows daily to ventilate the room with the sensor, the results are reasonably accurate, but for an absolutely accurate sensor you will need to look at other options :) |
I don't think I understand your explanation. You could detect the amount of ventilation by looking at the RAW value. If that stays the same for a while and is near the lowest RAW value seen in the last couple of weeks (perhaps the last few resets), you can perform the re-zero process automatically and ignoring it when no good ventilation is detected. Such behavior will also make it impossible to run a demand based ventilation scheme. |
We cannot assume that the user will calibrate manually. If we do assume that, and we disable ABC by default, and the user powers on the sensor in a room with PPM levels of, say, 1000 - the sensor will show 400 for any real PPM between 400 and ~1000. Forever. That's not an acceptable default setting IMHO. You're essentially asking to re-implement a smarter ABC but I do not think there is any ABC smart enough to handle PPM fluctuations. If by RAW value you mean the U value - how this value is composed is entirely unknown and I have not found any meaningful way to use it as an indicator to when calibration is to be triggered. Same for the PPM value; sometimes PPM drops < 400 and therefore using an If you look at the above graph, you see where each autocalibration happens. Most ABC events happen when CO2 PPM is already reported at a low point (~400), but even in the cases where ABC happens on a higher PPM count, it does not directly affect the current CO2 PPM reported value. So the ABC isn't doing as bad a job as you are outlining here. All things considered, I suggest adding a feature to disable ABC at sensor powerup but leaving ABC enabled by default (which means ESPEasy does nothing with the sensor by default, unless an ABC Disable option is selected). |
Adding an ABC disabled option would already be a nice work around. I think my misunderstanding of your previous answer is about when to disable the ABC. And indeed, there are a lot of unknowns about the undocumented features of this sensor, which may affect a "more intelligent self-made ABC", but that was more of a separate feature-request. |
I am assuming the sensor boot procedure (when U == 15000) does an initial calibration. I think we wouldn't be able to post anything untl after sensor completes bootup anyway, but haven't tested. If it does, then probably not a good idea to mess with it during bootup stage. By the way, if you want to disable ABC at poweron and test your 400ppm self calibration, enable the rules engine and add this:
Entirely untested, probably needs fixing :) |
I added the ABC disable setting, but apparently I cannot push the commit. (and thus create a pull request) In short, the default setting is the current behavior. The setting will be updated on the sensor when:
External commands to set the ABC enable/disable will not affect the stored device settings. |
@TD-er fork this repo to your github account, create branch, add commit to that branch, create PR in github |
As discussed in letscontrolit#466. The default setting is the current behavior. When changing the setting, it will be applied as soon as there is a stable reading.
@infernix That did the trick :) |
* [MH-Z19] Add 'ABC disable' option to web config As discussed in #466. The default setting is the current behavior. When changing the setting, it will be applied as soon as there is a stable reading. * [MH-Z19] Read settings first before determine must apply flag.
This is now merged (#472) and issue can be closed. |
thanks @Grovkillen |
As discussed in letscontrolit#466. The default setting is the current behavior. When changing the setting, it will be applied as soon as there is a stable reading.
* [MH-Z19] Add 'ABC disable' option to web config As discussed in letscontrolit#466. The default setting is the current behavior. When changing the setting, it will be applied as soon as there is a stable reading. * [MH-Z19] Read settings first before determine must apply flag.
great to find this thread! for me it's kinda crucial to be sure the sensor does not re-calibrate or does anything else i don't know of during the course of several experiments. can someone help me on "how" to disable the ABC, and also on how to check if it's disabled? also i might want to measure co2 values below 400ppm, as due to a plant cover the chamber might be slowly getting depleted from co2 from the photosynthesis. i am not using an ESP, but working with a teensy. some notes here: |
I think the MH-Z19 is hard coded to minimum ppm of 400. They are designed for offices which have a daily purge during nights and weekends. Thus the 24h ABC. |
hmmm.... hard coded, means it's still hackable for my own use. i am sending this comand: but how to read if ABC is disabled? and i can only set the ABC disabled after the boot of the sensor is complete? |
thx. somehow the "s" and "u" values are not being returned.... send command is: i am using "SoftwareSerial mySerial(9, 10); // RX, TX" on my teensy. |
The 'S' and 'U' are not present on the "B" version of the sensor. |
Hi, Sorry to hijack this thread, but can anyone explain what I should think of this? (I have the B version) When I first started reading values, the first day I got values around 1000-1100ppm indoors constantly, which dropped to around 900 when I left the window open for a while. The second day it jumped to around 600, presumably because of calibration, where it has been at since then (3-4 days ago), dropping to around 400 at night and going up to 700 when I'm near it (on my desk) and don't ventilate. But now I don't know what values I should trust, were the initial readings wrong because it had not calibrated yet? Or are these calibrated values just wrong? Again, sorry to ask it here, but it seemed like the only place where it was discussed. |
You can also ask it on the Forum, or in another issue. But I will read any issue that's being updated, so this should work too ;) You have to make sure it is used in a room which is ventilated every now and then and depending on the version of the sensor it should be in 400 ppm concentration every 24h of operation.
If all the above applies, you can trust the values which are at 400 ppm every day and not suddenly reach that point, but get lower in a curve. Just as an example I took a part of one of the CO2 sensors samples of last week. |
Hey, is there a easy way to check if the ABC got disabled? I am using a MHZ14a and i am not sure if this command And if I understood it correctly, I have to send this command on every boot up, because the sensor will no save the setting? I am also thinking about an ABC with a longer cycle, maybe up to one week. Is there a way to send the sensor the new base value? thx. |
The MH-Z19 sensor has ABC enabled from factory, or at least two of my sensors now have their baseline messed up because the ABC mode was not disabled.
The automatic base calibration will set the lowest measured internal RAW value in the last 24h as new reference point at 400 ppm.
This means the base line will make a big jump when being used in a not well ventilated room for more than 24h. And when opening a door or window after such a recalibration, the measured value will hardly change and stay at 400ppm for hours.
This can be seen in the graphs of two of my sensors (N.B. Domoticz was not recording between 6am and 9am this morning, when one sensor did its recalibration)
So in my opinion, the ABC mode should be disabled at init of the sensor.
A nice feature would be to trigger a recalibration when the sensor is clearly off with its calibration.
Perhaps when the measured value is 400ppm for longer than a few samples (not taking initialisation into account) or when the measured value is limiting itself to a lowest value for a number of samples (e.g. minimum value of something like 475 ppm for hours without peaking inbetween)
In the 1st example, the actual value measured is lower than 400ppm which the sensor will not output.
This is very likely to happen when ABC was performed in a not well ventilated room.
Another nice feature would be to add a command to show the lowest RAW value and the set zero level as calibration. This could be JSON-formatted output, or even in the webinterface (not sure where/how).
I am running ESP easy v2.0.0-dev11 and the sensors used were never used for longer than a few minutes at a time and never written anything to them before being used with ESP easy. So internal sensor settings were as factory default as can be.
In order to reproduce the behavior, one has to run the sensor for more than a day continuously, without restarts.
To reset the sensor, the sensor has to be placed outside (in the dark, no IR radiation) for a while and apply the URL http:///control?cmd=mhzcalibratezero without anyone being near the sensor producing CO2.
The text was updated successfully, but these errors were encountered: