Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

An issue with the SGP40 driver #129

Closed
IvanRaykov opened this issue Mar 12, 2021 · 1 comment
Closed

An issue with the SGP40 driver #129

IvanRaykov opened this issue Mar 12, 2021 · 1 comment

Comments

@IvanRaykov
Copy link

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!

@psachs
Copy link
Member

psachs commented Mar 15, 2021

Hi

The VOC algorithm should be called approx once every 1 sec (as you mention).

The blocking read function adds a measurement delay of 100ms (100_000 us) no 1 second, do you don't have to remove the delay. However what you can do to optimize the example is to reduce the delay within the main loop by around 100ms if you want to be closer to 1s per loop iteration.

However, this shouldn't have any impact on the performance of the algorithm or the VOC signal

You can find the blocking read delay here:

#define SGP40_CMD_MEASURE_RAW_DURATION_US 100000

@MBjoern MBjoern closed this as completed Mar 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants