-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
After calibration, incorrect data #13
Comments
Assuming kolibrovochny = calibration ? you used - AGS02MA_calibrate.ino ? Has been some time ago I used the sensor but I recall no problems with it when calibrating (I use Arduino UNO) The manual does not give information about failing calibration, only this: What does uint8_t lastStatus() return? |
No. There are no communication errors. When there is no connection, I have 0 ppb sent. Let's do the collibration again now. It will take 6 minutes and I will attach the output of the port monitor to you. |
Looks OK, every 15 seconds a timestamp |
Only. When I had the sensor on the window. He fell. But I can't believe that after that it began to show exorbitant values. |
It might be possible but unlikely in my opinion. If you shake it gently do you
|
Factor 10 difference is quite large. Is that difference constant? Do you power the sensor with 3V3 or with 5V? (5V is more stable as 3V3 is the minimum for the sensor |
No. No damage. I disassembled the case. But I thought that the dust could get into a small hole. Washed it in alcohol and left to dry. I'll check it out in 6 hours and report back. Also, if possible, check your calibrate.19.04.2022, 12:58, "Rob Tillaart" ***@***.***>:
Only. When I had the sensor on the window. He fell. But I can't believe that after that it began to show exorbitant values.
It might be possible but unlikely in my opinion. If you shake it gently do you
hear loose parts on the inside
see (big) changes in the readings
(any yes would indicate hardware problems, a no is no proof of absence of damage.)
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
The calibration command in the library is exact according to the datasheet. just a thought: |
Q: did you read the other issue - #11 Can you check which version you have (I have only V17). |
So there are two important observations:
|
Could it be that due to the fact that the version of the sensor is different, the calibration has overwritten everything and now it is faulty? and do I need to program it somehow? |
In theory that could be the case, however calibration is a process the sensor does internally. I have two slightly different datasheets of the sensor and both have the same command for the calibration. You might check chapter 8 of the datasheet which mentions several pages of possible problems with the sensor. I do not know if there is a way to manually provide calibration data. There are registers in the sensor that are not documented and these might include calibration values (seems logical). No info on this. |
The sensor worked exactly out of the box. As soon as I started the calibration, the values became the same and constant and very high.Yes, he fell at me. But I disassembled it, there's nothing to break from the impact. |
After my previous experience with the device, and having no different sensor types or controlled environment to compare, I didn't touch the calibration function. But I can test it later. VoltageSome things I can say up front, I've had no noticeable issues running on the ESP32's 3.3v, or seen different values for 5v. Too constantLike @RobTillaart mentioned,
I agree, even for bad quality readings I normally see fluctuations all the time. Here's what I got in the past 24h of 1s interval raw data from one. This is indoors and it roughly corresponds to outside air quality and ventilation, but don't have means to determine accuracy properly. About alcohol
Keep in mind that the sensor responds to alcohol fumes. Since the datasheet suggests 5 minutes of "fresh air". However they define fresh (Cleanroom levels of controlled environment fresh? Outside urban air fresh?). I wouldn't try calibrating when the alcohol might still spike the readings. Here's the chart when I hold the sensor directly above an open bottle of 99,9% isopropyl alcohol. Warmup periodOne reason I can think of why you might have had this 10x reading, is warmup period. In my experience, when the sensor has been powered off for some time (a few days or more). It can take very very long for values to come down to normal. It can sometimes take multiple hours of leaving the sensor running before the reading stabilizes. For something like calibration, I would suggest you leave the sensor powered on and polling values for something like 10h or more, and then calibrate. I think the datasheet's 5 minutes is extremely optimistic. Because your values are so extreme, suspicious and constant (99,999 / 34,343). Maybe the internal readings it got were just bad due to warmup issues that the chip is running into some type of integer overflow problems. |
@Beanow It's already late. The sensor now shows nonsense all the time and the maximum values ((( But I agree with you, the values I had all night were gradually getting lower and lower. Yes. If it is not difficult, try to calibrate. But keep in mind! you can also break the sensor( |
That looks like the warmup period. When I first connected the sensor it would go from absurdly high like 30k, down fairly quick to <1000 PPB. But going down to something like ~15 PPB on a good (urban) air quality day, would take many hours. Basically in a logarithmic shape. The closer it got to realistic values, the longer it took to warm up.
Yeah. I'm fine with that. To be honest I don't trust this sensor at all. The v18 version is basically undocumented because there's no new datasheet to match the new version, the ug/m3 functionality doesn't work. The status flags don't work. I couldn't get a response from the manufacturer. Their HTTP-only website lists the old datasheet... It's another reason why I don't care too much about the calibration, I only trust it to produce relative values. For example "how much does the value change compared to itself an hour ago, if I open the windows". |
@Beanow I wanted to compare it with sgp30. That's why I decided to calibrate it. Now I don't know what to do((( |
Well you said it's late there. |
@Beanow OK. I'll put it on overnight. and then I'll try to calibrate. |
@Beanow Thanks for your comments, appreciated. |
You could also try to use it to compensate for the bad behavior when it's got the |
thinking out loudIf I would make such sensor, I would have some physics that gave me a raw value X (typically a voltage) a = the slope and that might be related to the area of the sensor (a bigger area gives typical more raw value) This is typical factory calibrated. And to prevent floating point operations all measurements are scaled up a factor F to make them integer. |
Agree, the manual version will be added to the library, but explicit for the user. bool AGS02MA::zeroCalibrationManual(uint16_t value = 0)
{
_buffer[0] = 0x00;
_buffer[1] = 0x0C;
_buffer[2] = (value >> 8);
_buffer[3] = (value & 0xFF);
_buffer[4] = _CRC8(_buffer, 4);
return _writeRegister(AGS02MA_CALIBRATION);
}
bool AGS02MA::zeroCalibration()
{
return zeroCalibrationManual(0);
} |
You mean that these are points for non-linear interpolation - different ranges, - different parameters.? |
Yeah, I think that makes sense. And we should probably add more helper functions to read it too. I'm thinking what an updated example calibration sketch would look like. And I know I would have loved if it logged the factory value before doing the first calibration, knowing now that I could have reverted the v118 for comparison. As well as what it ended up finding. |
Sounds like I have some coding to do tomorrow :) |
You guys are very cool. I'm sitting here reading all this and just giving you a standing ovation. Thank you, you are the best. |
I can set up a PR as a starting point. |
Tinytronics.nl asair-ags02ma-tvoc-gassensor |
we need
calibration sketch
interactive example (do we need this?)
|
Haha ok tomorrow it is,
One thought though, I assume this would be private? I think if people were to extensively rely on directly reading registers, they wouldn't need the library anyway and may just cherrypick I2C protocol code they need 🤷 I feel like the most useful functions are when they do the interpreting for you. Such context I think would look more like:
Edit: actually thinking about that again. Dumping the registers was super useful for reverse engineering all the stuff the datasheet doesn't tell you. If in a few weeks someone gets a hold of a mysterious and misbehaving v119... it would be useful to ask them to make dumps like these. 😄 |
Please prepare a PR - version may be bumped to 0.2.0 |
PR is up! Have a look #15 |
follow up thought about interpolation,
if I interpret these as (x,y) we have { (18, 3605) , (100,1698), (1000, 1019), (10000, 350) } == some exp(-x) function? Q: can it help convert a raw measurement to something "cooked"? |
@RobTillaart that's exactly what I have in mind for #16 For example, going with the previous interpretation of: maybe they're instead of storing floats.
Btw, would like to complete the PRs before going down the rabbit hole too much 😅. |
Or if you meant, using logic in the library to find a PPB value based on the raw data in reg x20. Perhaps that is worth splitting out from the main library. With #16 it would be possible to access the data. Adding a bunch of math to use the raw value and/or maybe an AQI score would probably add code that not everyone is interested in using. In my case, I use the PPB readings, send it over MQTT it would make just as much sense to do AQI scoring on the server. |
Agree, lets keep it simple |
Closed?( I have not waited for calibration for version 118((( |
@shojkeee If you still have problems with calibration please reopen this issue. |
So I didn't understand anything. You haven't released a new version yet. Where can I get a sketch for the calibration?? I'm completely confused. |
It takes a while before the Arduino library manager copies new versions of libraries. |
sorry. release 22 minutes ago. I missed((I just watched it a couple of hours ago, there was another version. |
No problem, I just hope it solves your problem (it should) |
Looks like 0.2.0 is available in the arduino library manager, try updating and see if the updated example sketches for calibration solve your issue. 👌 |
Yes. Thank you. I updated and calibrated everything yesterday! Thank you all. Very helpful. But I still ordered the sensor)) |
After applying the kolibrovochny sketch. My sensor started showing values in ppm like this: 12002000020
The text was updated successfully, but these errors were encountered: