Skip to content

Add helper method to set IAQ humidity #35

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

Merged
merged 2 commits into from
Apr 3, 2022
Merged

Conversation

benthorner
Copy link
Contributor

Most sensors only report relative humidity and temperature, so this
uses the formula in the datasheet 1 to make calibration easier.

Notes:

  • The datasheet doesn't give the origin of the formula, but it seems
    to be based on Tetens Equation (to approximate pressure).

  • The example in the datasheet is wrong: the output should be 11.48.

  • math.exp is available in MicroPython 2.

Footnotes

  1. https://sensirion.com/media/documents/984E0DD5/61644B8B/Sensirion_Gas_Sensors_Datasheet_SGP30.pdf

  2. https://docs.micropython.org/en/latest/library/math.html#math.exp

Copy link
Member

@tekktrik tekktrik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I have the sensor to test this, but in the meantime here are the changes per the CI! Thanks for submitting!

Most sensors only report relative humidity and temperature, so this
uses the formula in the datasheet [^1] to make calibration easier.

Notes:

- The datasheet doesn't give the origin of the formula, but it seems
to be based on Tetens Equation (to approximate pressure).

- The example in the datasheet is wrong: the output should be 11.48.

- math.exp is available in MicroPython [^2].

[^1]: https://sensirion.com/media/documents/984E0DD5/61644B8B/Sensirion_Gas_Sensors_Datasheet_SGP30.pdf
[^2]: https://docs.micropython.org/en/latest/library/math.html#math.exp
@benthorner
Copy link
Contributor Author

@tekktrik thanks for the speedy first look! Somehow I totally missed this repo has a CI pipeline, which I can now see is passing after fixing all the linting issues.

I was wondering whether to add a test for the new method but thought it would be too big a step for this PR, seeing as the repo doesn't have any tests currently. What do you think?

@tekktrik
Copy link
Member

Testing isn't the norm for CircuitPython libraries, but adding an example usage to a new or existing example file would be great! Would you mind doing that?

@FoamyGuy
Copy link
Contributor

Thanks for working on this @benthorner

Echoing what tekktrik mentioned. We don't have many automated tests for the libraries. But we always do like to include an example that illustrates how to use new functionality when it gets added.

If you're up for it please go ahead and add a small script inside of examples/ directory that shows the new functionality you added.

@benthorner
Copy link
Contributor Author

@tekktrik @FoamyGuy no problem: 519c908.

I thought it went best in the existing example as we're also setting baselines in there. I also double checked the example file works with the new package and my own SGP30 ✅.

@benthorner
Copy link
Contributor Author

@tekktrik @FoamyGuy any chance of this going in soon?

Copy link
Member

@tekktrik tekktrik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for following up! I think this looks great, thanks for adding the example!

@tekktrik tekktrik merged commit 3e90660 into adafruit:main Apr 3, 2022
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Apr 4, 2022
Updating https://github.com/adafruit/Adafruit_CircuitPython_SCD30 to 2.2.3 from 2.2.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_SCD30#31 from cHemingway/readme_example_sck
  > Update Black to latest.
  > Fixed readthedocs build
  > Consolidate Documentation sections of README

Updating https://github.com/adafruit/Adafruit_CircuitPython_SGP30 to 2.4.0 from 2.3.7:
  > Merge pull request adafruit/Adafruit_CircuitPython_SGP30#35 from benthorner/main
  > Update Black to latest.
  > Fixed readthedocs build
  > Consolidate Documentation sections of README

Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32S2TFT to 1.0.1 from 1.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32S2TFT#2 from tekktrik/dev/use-f-strings
  > Update Black to latest.
  > Corrected pylint version

Updating https://github.com/adafruit/Adafruit_CircuitPython_MIDI to 1.4.8 from 1.4.7:
  > Merge pull request adafruit/Adafruit_CircuitPython_MIDI#49 from deckerego/update_control_values
  > Update Black to latest.
benthorner added a commit to benthorner/snsary that referenced this pull request Apr 4, 2022
This has been exported to the underlying library [^1].

[^1]: adafruit/Adafruit_CircuitPython_SGP30#35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants