🐍 CircuitPython is the easiest way to program microcontrollers now celebrating over 200 boards!🐍
0

SGP30 baseline question
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

SGP30 baseline question

by GregSawin on Sun Mar 25, 2018 6:28 pm

What's the point/impact of the baseline? It's not a concept I've experienced before with sensors.

The docs say the sensor is optimized for reading once a second and that you should save and restore the baseline after a power reset. What happens if I don't? Does it just take longer for the values to normalize? How much longer? What if I only call IAQmeasure every 5sec or every 1min, what kind of impact does that have? I've run a few limited tests and haven't noticed much difference between a fresh start and one where I supply the baseline. To be fair, I'm still within the 48hr burn in period that I saw mentioned somewhere. I'm not looking for exact answers just general info and guidelines.

Thanks in advance

GregSawin
 
Posts: 14
Joined: Wed Aug 20, 2014 4:38 pm

Re: SGP30 baseline question

by GregSawin on Mon Mar 26, 2018 5:38 pm

After the 48hr burn in I did another test where I save the baseline and supply it after a reset and it appears to have broken the tVOC output. It's always zero, hours after startup. After removing the setIAQBaseline call it's now working again, though my eCO2 numbers were immediately cut in half though they were pretty high before the reset. tVOC was also pretty high before the reset as well.

GregSawin
 
Posts: 14
Joined: Wed Aug 20, 2014 4:38 pm

Re: SGP30 baseline question

by adafruit2 on Mon Mar 26, 2018 11:02 pm

essentially, these sensors have a lot of variance and drift from part to part. and the 'absolute' value of the resistance varies with humidity/temp/etc. so what you do is put the sensor in a clean, low eCO2/TVOC environment and let it hang out for a half hour, then read the baseline. that will give you the 'baseline' reading for a clean room. then save that value and re-store it on boot for that sensor only, and you wlil have a more precise reading because the sensor can compare what the resistance is when its 'clean air'

adafruit2
Site Admin
 
Posts: 19912
Joined: Fri Mar 11, 2005 7:36 pm

Re: SGP30 baseline question

by GregSawin on Tue Mar 27, 2018 7:35 pm

Thanks, any suggestions on how to build a clean environment? And is this required or mainly a tool that allows re-calibration in case I wanted increased accuracy?

One issue I've noticed with this sensor, now that I've stopped trying to set a baseline, is that the values seem to drift over time and/or are not accurate from the start. I ran the system for 12hrs indoors and at the end it was showing roughly 200 ppb TVOC and 700 ppm eCO2 which sounds reasonable based on what I read about indoor air. After resetting/power cycling the system it immediately drops to around 10 ppb TVOC and 400 ppm eCO2 (ignoring the initial null readings). There's no way the air quality changed within that 1min period and my understanding of the sensor is that the warm up time necessary to become accurate scales with how long the chip has been without power. Thus the reset shouldn't have made much of a difference. 3hrs later and it's around the same levels. I then did a second test, resetting the system while outside and left it there for 30min, the values were very similar to my prior indoor test around 10-20 TVOC and 400 eCO2. Then I brought the system inside without resetting it and the values immediately jumped to roughly 400 TVOC and 1000 eCO2 and stayed there for at least 30min.

So I'm a bit confused about how to use this sensor in a reliable and reproducible way. I know I'm not going to get absolute accuracy but I was hoping to use this sensor to detect how bad or stale the indoor air is.

GregSawin
 
Posts: 14
Joined: Wed Aug 20, 2014 4:38 pm

Re: SGP30 baseline question

by adafruit2 on Tue Mar 27, 2018 9:23 pm

beyond what we've read in the datasheet - we have no in depth knowledge. we just followed the datasheet to make the breakout and library... you could try contacting the apps engineers at sensirion? in general, these sensors are just not ultra-precise, they're all sorta similar!

adafruit2
Site Admin
 
Posts: 19912
Joined: Fri Mar 11, 2005 7:36 pm

Re: SGP30 baseline question

by GregSawin on Wed Mar 28, 2018 5:04 pm

Sounds like the clean room idea isn't necessary and not what baseline is for. According to this doc: https://www.sensirion.com/fileadmin/use ... SW_I2C.pdf
-------
If no stored baseline is available after initializing the baseline algorithm, the sensor has to run for 12 hours until the baseline
can be stored. This will ensure an optimal behavior for preceding startups. Reading out the baseline prior should be avoided
unless a valid baseline is restored first. Once the baseline is properly initialized or restored, the current baseline value should
be stored approximately once per hour. While the sensor is off, baseline values are valid for a maximum of seven days.
-------

So it's not a calibration value nor is it a static value. It's something that should be collected and saved periodically for future resets. The adafruit docs somewhat allude to this but I'd say the critical part that's missing is that it takes 12hrs to establish a baseline, and that it's a continual process, not a one-time thing.

GregSawin
 
Posts: 14
Joined: Wed Aug 20, 2014 4:38 pm

Re: SGP30 baseline question

by adafruit2 on Thu Mar 29, 2018 11:00 am

oh good find. we'll add that to the guide!

adafruit2
Site Admin
 
Posts: 19912
Joined: Fri Mar 11, 2005 7:36 pm

Re: SGP30 baseline question

by Elnuma on Tue Apr 03, 2018 4:39 am

Greg,

What you've been describing so far all sounds reasonable.
Restarting the sensor without reading back a previously stored baseline will result in the sensor trying to determine a new baseline. The adjustement algorithm will be accelerated for 12hrs which is the Maximum time required to find a new baseline.
The sensor adjusts to the best value it has been exposed to. So keeping it indoors the sensor thinks this is the best value and sets it to ~0ppb tVOC and 400ppm CO2eq. As soon as you expose the sensor to outside air it can adjust to the global H2 Background Signal. For normal Operation exposing the sensor to outside air for 10min cumulative time should be sufficient.

If you're experienced with sensors that don't have a baseline, you either won't be able to measure absolute values or you'll have to implement your own baseline algorithm.
The sensor to sensor variation of SGP30 in terms of sensitivity is very good as each of them is calibrated. But the baseline has to be determined for each sensor individually during the first Operation.

I hope this helps,
Manuel

Elnuma
 
Posts: 9
Joined: Wed Dec 20, 2017 3:33 am

Re: SGP30 baseline question

by adafruit2 on Tue Apr 03, 2018 11:52 am

Thanks Manuel, that's helpful, we've added it to the guide

adafruit2
Site Admin
 
Posts: 19912
Joined: Fri Mar 11, 2005 7:36 pm

Re: SGP30 baseline question

by GregSawin on Tue Apr 03, 2018 1:25 pm

Thanks Manuel. If I were interested in absolute values, how often would I need to take the sensor outdoors for 10min? Would that be once per 12hrs or would doing it sometime during the initial baseline be enough. Or perhaps once per 7 days considering the maker said a saved baseline is only valid that long.

GregSawin
 
Posts: 14
Joined: Wed Aug 20, 2014 4:38 pm

Re: SGP30 baseline question

by Elnuma on Wed Apr 04, 2018 2:37 am

Assuming the sensor is being used for indoor air quality, i.e. locations suitable for human beings. It should be sufficient to expose the sensor to outside air for 10min cumulative time in one week. This should be easy to achieve with opening a window or an installed ventilation device.

Elnuma
 
Posts: 9
Joined: Wed Dec 20, 2017 3:33 am

Re: SGP30 baseline question

by mguntli on Tue Jun 12, 2018 4:40 am

I have the SGP30 now running for 1.5h together with a SHT-31D.
Image

The baseline values tvoc_base and eco2_base are constantly rising, and I have exposed the sensor twice to ambient air for about 10 minutes. TVOC and CO2 values remain at their default value of 0ppb and 400ppm. Humidity compensation is enabled as well.
Image

I will let the device run for 12h, and post the results.
FYI: I have ported the Adafruit Library to the particle platform, the source code of the example above is available on GitHub: https://github.com/rumluft-project/ruml ... r-firmware
Last edited by mguntli on Wed Jun 13, 2018 2:02 am, edited 1 time in total.

mguntli
 
Posts: 9
Joined: Tue Jun 12, 2018 3:07 am

Re: SGP30 baseline question

by Elnuma on Tue Jun 12, 2018 9:17 am

Hey mguntli,

Thank you for sharing your setup, it looks promising.
At intial startup the signals typically stick to low values for around the first hour of operation. During 12 hours an accelerated algorith will try to determine the correct baseline. So the value of the basline may show more changes than usual. Once things are stabilizing and you start receiving non-zero values for the gas signals, please expose the sensor once more to outside air.

Elnuma
 
Posts: 9
Joined: Wed Dec 20, 2017 3:33 am

Re: SGP30 baseline question

by mguntli on Wed Jun 13, 2018 2:59 am

Hi Manuel

The sensor was now running for 12h, and I have exposed it a last time to ambient air before storing the baseline values.
However, the baseline values itself did not change anymore on the last "ambient air cycle".
Image

So after a power cycle and a restore of the baseline values the TVOC signal quickly "came to life" after about 30s, but ECO2 seems to be stuck at 400ppm.
Code: Select all | TOGGLE FULL SIZE
[b]Restored baseline from Wed Jun 13 08:21:21 2018: eco2_base = 36064 / tvoc_base = 37092[/b]
Temp = 23.50 °C
Humidity = 55.20 %RH
Absolute Humidity = 11644.00 mg/m^3
TVOC = 0.00 ppb
CO2 = 400.00 ppm
eco2_base = 36064
tvoc_base = 37092

Temp = 23.46 °C
Humidity = 55.55 %RH
Absolute Humidity = 11692.00 mg/m^3
TVOC = 0.00 ppb
CO2 = 400.00 ppm
eco2_base = 36064
tvoc_base = 37092

Temp = 23.58 °C
Humidity = 55.64 %RH
Absolute Humidity = 11794.00 mg/m^3
TVOC = 301.00 ppb
CO2 = 400.00 ppm
eco2_base = 36064
tvoc_base = 37091


Image

mguntli
 
Posts: 9
Joined: Tue Jun 12, 2018 3:07 am

Re: SGP30 baseline question

by Elnuma on Thu Jun 14, 2018 4:50 am

Hi Michael,

The SGP30 is meant to be operated continuously. I'm observing similar effects with CO2eq staying at 400ppm for some time after switching it on and Setting the baseline.
It may even stay there for an hour plus unless the air gets worse.

If you breath onto the sensor you should observe a signal spike well visible on CO2eq and smaller on TVOC.
Which means the value isn't locked to 400ppm.

After the initial 12hrs the basline only changes very slowly because the MOX material drift is slow as well.
I'd still say your implementation performs well and as expected.

Elnuma
 
Posts: 9
Joined: Wed Dec 20, 2017 3:33 am

Please be positive and constructive with your questions and comments.