GithubHelp home page GithubHelp logo

sensirion / embedded-sgp Goto Github PK

View Code? Open in Web Editor NEW
56.0 13.0 33.0 1.35 MB

Embedded SGP Drivers for Sensirion Gas Sensors - Download the Zip Package from the Release Page

Home Page: https://github.com/Sensirion/embedded-sgp/releases

License: BSD 3-Clause "New" or "Revised" License

Makefile 6.50% C 70.70% PHP 5.34% NASL 3.30% C++ 14.16%
driver i2c sensirion sensor tvoc co2 sgp30 sgpc3 svm30 sgp40 arduino raspberry-pi raspberrypi sgp4x sensirion-embedded-driver embedded

embedded-sgp's Introduction

embedded-sgp CircleCI GitHub license

This repository contains the embedded driver sources for Sensirion's SGP product line.

Download the Latest Driver Release

Download the latest ready-to-use driver bundle from the releases page

We strongly recommend to use the driver from the release bundle instead of cloning the repository.

Note: If you use the SVM40 module (which contains an SGP40) please check out https://github.com/Sensirion/embedded-svm40.

Note: If you are using SGP40 or SGP41 sensor, please check out the following repositories:

Clone this repository

git clone --recursive https://github.com/Sensirion/embedded-sgp.git

Repository content

  • embedded-common - Submodule repository for common embedded driver stuff
  • embedded-sht - Submodule repository for SHT drivers
  • sgp40 - SPG40 driver
  • sgp40_voc_index - Driver for a SGP40 and SHTC3 combo with a VOC algorithm.
  • sgp30 - SGP30 driver
  • sgpc3 - SGPC3 driver
  • svm30 - Driver for the SVM30 module consisting of a SPG30 and an SHTC3 sensor.
  • sgpc3_with_shtc1 - Driver for a SGPC3 and SHTC1 sensor combo.
  • sgp-common - Common code for all SGP drivers.

Collecting resources

make release

This will create a release folder with the necessary driver files in it, including a Makefile. That way, you have just ONE folder with all the sources ready to build your driver for your platform.

Files to adjust (from embedded-common)

You only need to touch the following files:

  • sensirion_arch_config.h (architecture specifics, you need to specify the integer sizes)

and depending on your i2c implementation one of the following:

  • sensirion_hw_i2c_implementation.c (functions for hardware i2c communication if your platform supports that)
  • sensirion_sw_i2c_implementation.c (functions for software i2c communication via GPIOs)

Building the driver

  1. Step into your desired directory (e.g.: release/sgp30)
  2. Adjust sensirion_arch_config.h if you don't have the <stdint.h> header file available
  3. Implement necessary functions in one of the *_implementation.c files
  4. make

Please check the embedded-common repository for further information and sample implementations.


embedded-sgp's People

Contributors

abrauchli avatar bittailor avatar bradaspencer avatar chjaeggi avatar getpastthemonkey avatar jhahn96 avatar mbjoern avatar psachs avatar rnestler avatar zifzaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

embedded-sgp's Issues

SVM30 on Arduino

Hi,

I know this is a Issues category, but can you please point me into a right direction to implement the SVM30 on Arduino ?

Thank You.

Request: Arduino example for SVM30

I'm fairly new at coding but I did try and implement your example usage code into my Arduino code but it didn't seem to work for me. I included all the required Libraries and made changes as list in the instructions but there is no reading on the serial monitor.

Errors can be tossed when compiling with LLVM

Small issue... when compiling the VOC algorithm code with LLVM and -Werror -Wparentheses-equality errors will be tossed for lines that look like this:

if ((params->m_Mean_Variance_Estimator___Initialized == false)) {

to quiet LLVM these need to be (at the very least the extra parens need to be removed)

if (!params->m_Mean_Variance_Estimator___Initialized) {

There are two such lines in sensirion_voc_algorithm.c one around line 599 and another around 776. Since my interest was only in the VOC algorithm itself, an exhaustive search though the code for other instances of this was not done. This change should, in no way, effect how the code operates.

Do not just pull latest version of embedded-sht

Currently we just check out the latest version of embedded-sht during the build. Optimally we would use tagged versions of embedded-sht for tags and an up to date version on master.

We could either include embedded-sht as a submodule for this or adjust the build scripts to checkout specific tags when building.

An issue with the SGP40 driver

Hello,
according to the datasheet, VOC index calculation algorithm should be fed with data every 1 sec,
In the example usage files, both on the standalone SGP40 and the SGP40_voc_index drivers there is a delay of 1 sec in the main infinite loop (while(1)) and in the blocking read function. This adds additional 1 sec delay to the VOC algorithm process.
Please advise - is this the correct behavior - to feed the VOC algorithm every 2 sec or we need to remove one of the delays, probably the one in the infinite loop.
Thank you for your attention!

Sampling interval

Hi,

We would like to use the sensor in extremly low power environment. And we were wondering if it is possible to change the VocAlgorithm_SAMPLING_INTERVAL definition to something like 5 minutes and then call this algorithm in the specified interval or would it negatively impact the output values?

If not, is there any other way to run the sensor efficiently with 5min or longer intervals?

No fluctuation of VOC index

I am testing the VOC algorithm combine with SGP40 sensor and SHT3x for temperature and humidity.

Communication with the SGP40 works fine I get the raw value periodically (with temperature and humidity compensation).
The returned value are within 63800 and 64500 range.

When I give the raw value to the VOC algorithm, the VOC index gently ramps up at start up from 0 to 100 but remains at 100 for all the tests (even after two hours with the SGP40 raw value fluctuating).

Any idea?

Initial blackout period

Hi, I couldn't find about the first blackout periode recommendations. Is it possible to start with a for loop to initialize the voc index algoritm, so it can start up quicker?

At this moment i measure until index = 90 or max 200 measurement points with 50 ms delay, to switch after that initial period to a 2 minute measurement loop.

VOC algorithm implementation questions

Hello,

after reading "SGP40 – VOC Index for Experts" I still have open questions regarding the VOC algorithm.
The sampling interval in the example code (here and here) and application note is always 1 second.
However, the application I am aiming towards calls for longer sampling intervals (because of power savings).

Looking at the comments in the code I am left with the following questions:

  1. Are there restrictions on how long the sampling period can be while in the learning phase?
  2. Does the sampling period have any effects on device-to-device variations?
  3. Are there any other possible caveats/pitfalls one should be aware of from application development point-of-view?

Any help would be greatly appreciated.

VOC algorithm SGP40 on 8-bit MCU issues

Hi,
I'm testing a library for SGP40 and I spent lot of time debuging, why the voc algorithm working on PC but not working on 8-bit MCU (Michrochip PIC18).

The issue is in file
function : static fix16_t fix16_mul(fix16_t inArg0, fix16_t inArg1)
when is at least one parameter negative, than the multiply overflow and returns unexpected result.
I make quick fix and in the algorithm I'm working only with positive numbers
->1. chceck if the result should be positive or negative
->2. both of arguments make positive (abs() )
->3. if result should be negative, return -ret_val;

VOC algorithm SGP40 on 8-bit MCU (Microchip PIC18) failed

I use MPLAB X DE and XC8 as platform in my project.
The project is a 8-bit MCU application(Microchip PIC18) which employs SGP40+SHT35 to get VOC Index.

Since I have got raw VOC data through my firmware, I just call “VocAlgorithm_init()” and “VocAlgorithm_process()” to calculate VOC-Index.

After power on , VOC-Index=0 is as expected in 45 seconds. But after then, VOC-Index = 500 no change.

Below are portions of my codes:

Unsigned int voc_raw_data
int32_t voc_index
int32_t voc_raw_data
int32_t local_voc_index

VocAlgorithmParams voc_algorithm_params;

// Initialize VOC Engine
VocAlgorithm_init(&voc_algorithm_params);

lp:

//get SRAW
get_voc_raw_data(); // voc_raw_data =29011, for example

//for calculation of VOC index/TVOC
VocAlgorithm_process(&voc_algorithm_params, voc_raw_data, &local_voc_index);

waiting_for_1s();

voc_index= local_voc_index

goto lp;

I am aware that Jieihusak raised an issue #124 on GitHub ---”VOC algorithm SGP40 on 8-bit MCU issues #124” on Dec 14,2020,

I debugged and found the same issue in my application. Followed Jieihusak's instruction, I tried but failed.

Please fix the issue if apply.
Thanks

Problem with SHT40 on dev board SVM40 using either Arduino or Particle

Hi, I recently received the SVM40 dev board and I am facing a problem from the sensor init function. I have tried either on Arduino nano (with the arduino IDE) or Particle Argon (with vs code) and the result is the same : error -11.
As far as what I found, this error seems to be related to the SHT40. But I can't say if it is due to communication, wiring, etc...
I followed the wiring configurations:
Red cable = VDD
Black cable = GND
Green cable = SDA
Yellow cable = SCL
Does anyone got the same issue ?

Question in regards to SGP30 Humidity Compensation

Hi

I'm not sure this is the right place to ask questions, but I did not find another one.

My question is regard to the SGP30 Humidity Compensation (Set_humidity command).

In the example usage the Humidity Compensation is set after measuring the IAQ values just before sleeping for 1 second:

err = sgp_measure_iaq_blocking_read(&tvoc_ppb, &co2_eq_ppm);
if (err == STATUS_OK) {
/* printf("tVOC Concentration: %dppb\n", tvoc_ppb);
* printf("CO2eq Concentration: %dppm\n", co2_eq_ppm);
*/
} else {
/* printf("error reading IAQ values\n"); */
}
/*
* IMPLEMENT: get absolute humidity to enable humidity compensation
* u32 ah = get_absolute_humidity(); // absolute humidity in mg/m^3
* sgp_set_absolute_humidity(ah);
*/

Intuitively I would have done it before measuring. What is the reason to do it afterwards or does it not matter when the Humidity Compensation is set?

Thanks and regards

Request to copy some code

I am developing a SGP40 driver for esphome.
https://esphome.io/

I would like to use your algorithm in your library but including the files might interfere with esphome's license as well as our automated linting/building doesn't like your formats/naming convention.

Is there an issue with me copying the function/pieces of code that I need out of your library into my own source? There are a few of us who would love to incorporate this into esphome. Im just being sensitive to licenses.

sht_get_configured_sht_address definition missing for Linux userspace driver

Hi, I'm trying to compile the driver for the Linux User Space.
However, I've ran into an issue about the sht_get_configured_sht_address() function in the hw i2c implementation.
It's not defined in any place. What should I do? Hard-code the device address (for instance, for the SGP30 should be 0x58 right?)? Or I'm missing something?

SGP40 VOC algorithm

Hello,

I know in the datasheet say sampling rate for VOC algorithm should be 1Hz. In the code I don't see any constraint to increase this to few seconds, and turn off the heater in the meantime. Or that would render the VOC index unusable?

PS: I am trying to build battery enabled device, and just looking for ways to increase battery life.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.