Comments (6)
Yea, there's only that 1 command to get the baseline. There were a few times I remember the sensor would malfunction and start returning junk data, which is similar to what happens when you give it an invalid baseline. In those cases I disabled the setIAQBaseline call, and let it generate a new baseline over the next 12hrs. I never had an issue starting with no baseline, only when I'd end up sending a bad baseline to start with. The baseline does drift over time, typically decreasing by 1 or 2 every hour but a few times a day it increases by 2-20, at least mine do. By the way, the 2 sensors I have use dramatically different baselines, one is almost double the other sensor.
You only really need to call the get baseline right before you restart your device, which I do; but I also read it every hour to handle the cases where the device loses power or resets unexpectedly. I also log the value so when it goes haywire and gives bad data I can manually resume to the most recent valid baseline and not have to wait 12hrs. And by valid I mean you get normal/expected readings. This issue is rare though, maybe once a year, and I haven't seen it in awhile so maybe it was my fault.
These sensors aren't very accurate and are only really useful for relative measurements. For example I ended up getting a real CO2 sensor and both it and the SGP30 show a slowly increasing CO2 over the past few hours but the actual value is 520ish while the SGP30 is showing over 800. And that's my good SGP30 sensor. My other SGP30 sensor isn't working much anymore and it's not obvious unless you compare or test it. It's values are way off and it sometimes moves in the opposite direction to the good SGP30. So I replaced them with https://www.adafruit.com/product/4867 and https://www.adafruit.com/product/4829
from adafruit_sgp30.
You have the order wrong. If you don't have the baseline (100 isn't correct), then don't set it. It needs to run 12hrs if I remember correctly before it can give you an accurate baseline. The baseline will be changing, it's not a one-time thing; and will save you from that 12hr recalibration step. Back when I used this sensor I'd save a new baseline to my EEPROM every hour and then upon restart I'd use the set call on setup like you have done. If you don't have a way to save/persist the baseline across device restarts then don't use the setIAQBaseline and just be aware it takes 12hrs to return accurate results after start up.
Also the baseline is different from that actual values, if not saving baseline then there's no point ever calling getIAQBaseline.
from adafruit_sgp30.
Yep, agree with above.
There's a "SGP30 Driver Integration" guide that has more detail. For some reason no longer finding it on Sensirion's website. But it has this diagram which shows the general usage of get/set baseline:
from adafruit_sgp30.
You have the order wrong. If you don't have the baseline (100 isn't correct), then don't set it. It needs to run 12hrs if I remember correctly before it can give you an accurate baseline. The baseline will be changing, it's not a one-time thing; and will save you from that 12hr recalibration step. Back when I used this sensor I'd save a new baseline to my EEPROM every hour and then upon restart I'd use the set call on setup like you have done. If you don't have a way to save/persist the baseline across device restarts then don't use the setIAQBaseline and just be aware it takes 12hrs to return accurate results after start up.
Also the baseline is different from that actual values, if not saving baseline then there's no point ever calling getIAQBaseline.
Thank you for your patient answers.
About this sentence:
when I used this sensor I'd save a new baseline to my EEPROM every hour and then upon restart I'd use the set call on setup like you have done.
How do you get a dynamic baseline? Also via sgp.getIAQBaseline()
?
I took the baseline value via the sgp.getIAQBaseline()
method and saved it in EEPROM. Read EEPROM on restart and call sgp.setIAQBaseline()
to write to it.
But after that, I can't get the new baseline value, sgp.getIAQBaseline()
returns the same value as in EEPROM.
After 24 hours of operation, the values of voc and co2 deviated.
I don't know where the problem is.
from adafruit_sgp30.
Yep, agree with above.
There's a "SGP30 Driver Integration" guide that has more detail. For some reason no longer finding it on Sensirion's website. But it has this diagram which shows the general usage of get/set baseline:
Thanks, I watched this too.
If the baseline value is set by sgp.setIAQBaseline()
method during the restart, do I still need to call the get method every hour to get the new baseline value?
If not, my VOC and CO2 data are skewed after a while (24 hours).
If needed, the value returned by the get method is always the same as when it was set.
So I'm a little weird and don't know what went wrong.
from adafruit_sgp30.
Yea, there's only that 1 command to get the baseline. There were a few times I remember the sensor would malfunction and start returning junk data, which is similar to what happens when you give it an invalid baseline. In those cases I disabled the setIAQBaseline call, and let it generate a new baseline over the next 12hrs. I never had an issue starting with no baseline, only when I'd end up sending a bad baseline to start with. The baseline does drift over time, typically decreasing by 1 or 2 every hour but a few times a day it increases by 2-20, at least mine do. By the way, the 2 sensors I have use dramatically different baselines, one is almost double the other sensor.
You only really need to call the get baseline right before you restart your device, which I do; but I also read it every hour to handle the cases where the device loses power or resets unexpectedly. I also log the value so when it goes haywire and gives bad data I can manually resume to the most recent valid baseline and not have to wait 12hrs. And by valid I mean you get normal/expected readings. This issue is rare though, maybe once a year, and I haven't seen it in awhile so maybe it was my fault.
These sensors aren't very accurate and are only really useful for relative measurements. For example I ended up getting a real CO2 sensor and both it and the SGP30 show a slowly increasing CO2 over the past few hours but the actual value is 520ish while the SGP30 is showing over 800. And that's my good SGP30 sensor. My other SGP30 sensor isn't working much anymore and it's not obvious unless you compare or test it. It's values are way off and it sometimes moves in the opposite direction to the good SGP30. So I replaced them with https://www.adafruit.com/product/4867 and https://www.adafruit.com/product/4829
Thank you very much, now I understand.
from adafruit_sgp30.
Related Issues (13)
- Sensor hangs HOT 7
- Adding soft reset HOT 3
- Deep Sleep ESP HOT 3
- Unexpected I2C device at 0x00 when this sensor is plugged in HOT 1
- Add Include Guards HOT 2
- softReset HOT 2
- Setting baseline stalls sensor HOT 4
- Commenting error HOT 4
- IAQInit not required, even though docs state it is
- 'softReset()' fails to reduce power. HOT 3
- Humidity compensation HOT 2
- A library should never call begin() on a shared bus HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adafruit_sgp30.