Skip to content
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

SHT20 Temperature and Humidity Sensor #97

Merged
merged 13 commits into from
Feb 13, 2023
Merged

Conversation

rob-vaughn
Copy link
Contributor

@rob-vaughn rob-vaughn commented Nov 8, 2022

This pull request adds the Sensirion SHT20 I2C Temperature and Humidity sensor, built into a waterproof probe case, to WipperSnapper_Components.

https://www.dfrobot.com/product-1636.html

@brentru
Copy link
Member

brentru commented Nov 8, 2022

Hi @rob-vaughn - are you also planning to add an I2C Component driver to WipperSnapper (Instructions via the guide here: https://learn.adafruit.com/how-to-add-a-new-component-to-adafruit-io-wippersnapper/adding-an-i2c-component-driver)?

@rob-vaughn
Copy link
Contributor Author

rob-vaughn commented Nov 8, 2022 via email

@brentru
Copy link
Member

brentru commented Nov 8, 2022

@tyeth - any interest in supporting the SHT20 linked above?

@rob-vaughn
Copy link
Contributor Author

rob-vaughn commented Nov 8, 2022 via email

@brentru
Copy link
Member

brentru commented Nov 8, 2022

@rob-vaughn Sensors on IO are added by me (I work for Adafruit on WipperSnapper, IO, etc..) and external contributors. This repository's issues page lists ongoing sensors that we'd/users would like added to WipperSnapper. They are not in any particular order to allow people to pick them up + contribute sensors. There's no ETA. I am currently working on Features for IO/WipperSnapper (such as - NeoPixel, DotStar, PWM, Sleep Modes, UART, IR.., ) and will wrap back around to adding sensors from this list when I complete some of those tasks.

We have a guide on adding the driver code for these sensors here: https://learn.adafruit.com/how-to-add-a-new-component-to-adafruit-io-wippersnapper/adding-an-i2c-component-driver

If you get stuck at any point - submit a pull request and I'll be able to review and help triage it with you.

@tyeth is a community member who recently added a few SHTx sensor family member sensors to IO. I tagged them as I was curious if they'd be interested in adding the WipperSnapper driver code to support the SHT20.

@tyeth
Copy link
Contributor

tyeth commented Nov 8, 2022

Hiya! You're project / work sounds great, and let me say the wippersnapper thing makes it so quick and easy and exactly why I was adding all the sensors I had. Sadly I've got distracted programming on the esp32's and trying to find a job here in the UK that isn't just programming, maybe Canada's where it's at😄
I took a quick look and I couldn't see an official sensirion library, although dfrobot have one, but worth noting @brentru this next one I stumbled upon has a nice simple VPD (#71) calculation there 😉 https://github.com/u-fire/uFire_SHT20/blob/master/src/uFire_SHT20.cpp#L87

I had a quick go and it's totally untested, but if you want to try it or use as an example @rob-vaughn then you can follow the guide for developing wippersnapper, as mentioned by Brent and here's the commit's I've just made: tyeth/Adafruit_Wippersnapper_Arduino@main...add_DFRobot_SHT20

-- The guide is basically clone the repository git clone https://github.com/tyeth/Adafruit_Wippersnapper_Arduino then you'll be on git branch 'main' which is the same as adafruit repository, and then install all the libraries listed in library.properties (plus DallasTemperature library or build will fail) and then load examples\wippersnapper_demo\wippersnapper_demo.ino, pick your board in arduino (you'll need ESP32 boards added if using them) then try and build (compile) and the flash (upload) the software onto the board.
If that works then you have wippersnapper building fine, at that point change to my new branch in git with git checkout add_DFRobot_SHT20 then build the arduino file again and upload again to test the new sensor (once it's pickable in the interface, or you/I can modify the code in another branch to swap the SHT20 instead of an existing component just for testing).

It might be worth trying the basic example from the DFRobot product wiki page too.

Let us know how you get on or how much / little hand holding to offer.

@rob-vaughn
Copy link
Contributor Author

rob-vaughn commented Nov 10, 2022 via email

@brentru
Copy link
Member

brentru commented Nov 10, 2022

@rob-vaughn We do support the scd40 which has a CO2 sensor. You can add a new issue for the K30, I do not have one on-hand to add though.

@tyeth
Copy link
Contributor

tyeth commented Nov 10, 2022

Ahh don't let age rule them out, they still do the job, the DHT11/22's are seriously old (and unreliable) so worry not! I was surprised to read the SHT20's were lower power usage than the 3 series. I've got the 4's too. The second digit is 0/1/5 depending on accuracy+price.
Regarding the CO2 sensors, I just read about the K30 recently in a comparison article of a new lower-power MH-Z13, I've got a load of Winsen MH-Z19b's which come in a few flavours but same Winsen driver code and are similar in quality to the K30's. The MH-Z19s are annoyingly UART or analog or PWM. Better than those are the Sensirion SCD30/40/41's which have recently been added. This was my purchase link for recent SCD41s that seem to be produced in china for laskakit.cz and have Qwiic connectors: https://www.aliexpress.com/item/1005004494224988.html
I'd recommend getting the adafruit version, particularly if on the company dime, but I'm cheap and shipping/availability in the UK is a problem:
SCD41 - no stock https://www.adafruit.com/product/5190
SCD40 - Stocked https://www.adafruit.com/product/5187
-Edit- Just spotted the range sensitivity difference too:
image

@rob-vaughn
Copy link
Contributor Author

rob-vaughn commented Nov 10, 2022 via email

{
"displayName": "sht20",
"i2cAddresses": [ "0x40" ],
"subcomponents": [ "ambient-temp", "ambient-temp-celcius", "humidity" ]
Copy link
Member

Choose a reason for hiding this comment

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

@tyeth @rob-vaughn So, ambient-temp is in celsius. Remove ambient-temp-celcius. Use ambient-temp-fahrenheit` instead

@brentru
Copy link
Member

brentru commented Nov 18, 2022

@lorennorman I'm not sure what's going on with this Action. Could you please check the schema error on this run's step: https://github.com/adafruit/Wippersnapper_Components/actions/runs/3415453348/jobs/5858112631

@lorennorman
Copy link
Contributor

Thanks for the nudge, @brentru!

The thing failing was the filename checker: non-Adafruit staff aren't allowed to modify some of the files in this repo, in this case the **/schema.json files.

Now, you might be saying to yourself, "But we didn't modify those files in this PR?" and you'd be right, I was confused too at first. Then I realized that main has changed out from under us (big deploy this week that touched almost every file in order to add the published: boolean syntax.) Thus, the validator noticed the files in this PR were different from main.

The fix was to merge the main branch in, which I did, and those checks are now passing. The remaining validation failure is valid: ambient-temp-celsius is not a sensor type (or whatever.)

I'll improve the validator to have better messaging so that this situation is more understandable in the future, thanks all!

@rob-vaughn
Copy link
Contributor Author

rob-vaughn commented Dec 17, 2022 via email

@tyeth
Copy link
Contributor

tyeth commented Dec 17, 2022

Sure that's mentally on their list, but stick in the request @rob-vaughn ❤️ I probably want the MCP9600 which is i2c and all the types after my quick googling. Not sure if that's got qwiic connectors at adafruit yet, sure as soon as it's revised they'll hoick it up the priority list (sparkfun have one).
image

While you're at it can you update your pull request for this SHT20 component to use "ambient-temp" and "ambient-temp-faaaaarrrrenheit" or however you spell them instead of ambient-temp and ambient-temp-celcius and then the checks in this issue will pass.
image

Happy holidays all.

@rob-vaughn
Copy link
Contributor Author

rob-vaughn commented Dec 17, 2022 via email

@rob-vaughn
Copy link
Contributor Author

rob-vaughn commented Dec 17, 2022 via email

@tyeth
Copy link
Contributor

tyeth commented Dec 18, 2022

I don't know how priorities work, just that there is usually a buzz after each board gets re-spun with the qwiic connector. i.e. it often features in their Ask an Engineer as ladyada does the changes, and then once available it often appears as John Parks product of the week (up to 50% discount on tuesday evenings - max 10 items). The 3d printing brothers, Pedro and Noe Ruiz, also like to come up with some little project around the same time, which often includes a wippersnapper example.

In reality if you want it, you have a go rather than waiting on a wish and a prayer :) Most of the time Adafruit (or sparkfun etc) have already gone to the effort of making an arduino driver and example sketch so it's fairly doable if you have the time and inclination.
I think my copy and paste of a previous wippersnapper driver, then replacing with another adafruit sensor driver is probably half an hour, then a bit of back and forth with the github checks / CLang formating and can be live within the hour if your lucky, otherwise if there is feedback or issues then about 3-10days seems to be average. (If you add the component first like this pull request, then it can be approved as a in-development component, so you can test the driver you write straight away).

@rob-vaughn
Copy link
Contributor Author

rob-vaughn commented Dec 19, 2022 via email

@rob-vaughn
Copy link
Contributor Author

rob-vaughn commented Dec 19, 2022 via email

@tyeth
Copy link
Contributor

tyeth commented Dec 19, 2022

Yeah that looks very similar to the 9600, better one might imagine, and as you say with the qwiic connectors so gonna work very easily with wippersnapper.
The learn guide linked from the product page is for the MC9600 so we can fairly safely assume the 9601 is compatible (manufacturers product page or datasheets can confirm).
For my own piece of mind, after googling the specific chip they mention, the manufacturers page seems to show one datasheet and one errata document for all MCP96XX chips or at least the two we're interested in. https://www.microchip.com/en-us/product/MCP96L01

@tyeth
Copy link
Contributor

tyeth commented Feb 13, 2023

@rob-vaughn need to add one more line to the json,

  "published": false,

unless @brentru is happy to just publish straight to live (true) instead of as a Dev component first.

I've added PR #409 which adds the component officially, but you can test it as a SI7021 instead of SHT20 immediately and it should work correctly (that's all my pull-request adds)
20230213_164718

@brentru
Copy link
Member

brentru commented Feb 13, 2023

unless @brentru is happy to just publish straight to live (true) instead of as a Dev component first.

I will set it once that PR is released

@brentru brentru merged commit 34bec1d into adafruit:main Feb 13, 2023
@rob-vaughn
Copy link
Contributor Author

rob-vaughn commented Mar 23, 2023 via email

@tyeth
Copy link
Contributor

tyeth commented Mar 23, 2023

Hi Tyeth, I've been out of commission for a while. Is this live and ready to use now? Thanks!

It is! (It should also work for any compatible sensors - I think the HTU21D and something else)

@rob-vaughn
Copy link
Contributor Author

rob-vaughn commented Mar 23, 2023 via email

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.

4 participants