I’m working on a project that includes a couple of SHT-31 temperature/humidity sensors; they are a great, reasonably inexpensive sensor with ± 2% accuracy, 0.1% repeatability and 0.01 % resolution for humidity and ± 0.3 ℃ accuracy, 0.06 ℃ repeatability, and 0.015 0.3 ℃ resolution. There is also a more accurate version the SHT-35. What drew me to it was the fact that it has proper I2C and two user selectable addresses.
I’ve “ported” the library over; I use quotes because all I needed to do was change the includes and add one or two type-casts from char * to uint_t* or something along those lines, I assume because of a small difference in how particle handles the Wire.H library.
There is a lot there, and I am going to go through the process of documenting it when I get the chance then share in the library manager, but I wanted to share it here first in case anyone with more experience writing documentation wanted to help. It’s pretty self-explanatory, but I figure documentation couldn’t hurt. I also will probably namespace the library to be safe.
I looked over the functions in your library and what I really like is the code to setup the Alert interrupt pin to trigger based on Temp or Humidity thresholds and if they pass the threshold you program in. That allows your microcontroller to sleep and be woken up via the Alert pin which can save a lot of power.
I just started using this sensor to control 3 x 10w high-speed cooling fans inside a high power equipment case with variable fan speeds to keep the fans running slower at lower temps to keep the sound levels down.
I don’t really understand the benefit of the temp polling speeds and repetability settings but I assume it makes a difference in accuracy somehow?
Thanks for sharing! It is valuable to me at a minimum
@RWB I’m glad it will be of some help. I added a namespace to the library and added an example with two sensors to make sure it works with both. As for the various polling speeds and repeatability I haven’t had a lot of time to read through the datasheet, I think the polling speed refers to how often the chip itself refreshes its values from the onboard sensors.
I do notice when running Pooling Mode vs. ClockStrech Mode the numbers are slightly different. Curious to get my hands on an SHT-35 to see the difference. At some point,
I’m going to write up some documentation for the library which is not my favorite activity, so that might take a while.
Probably sometime over the weekend, I will figure out how to add it to the library manager. I got an error saying to reinstall the particle CLE when I tried which didn’t resolve the issue, so I took a break.
@RWB From the datasheet
“The stated repeatability is 3 times the standard deviation (3σ) of multiple consecutive measurements at the stated repeatability and at constant ambient conditions. It
is a measure for the noise on the physical sensor output. Different measurement modes allow for high/medium/low repeatability.”
As far as I can tell high repeatability is more accurate but uses more power. As best I can tell so far (I just finished reading page 9 of the datasheet carefully), you can either do single shot mode where the CMOSens chip will idle and start a measurement when it is asked, so when you initiate a measurement it will take 4-15ms before it can reply with the results depending on the repeatability setting. If clock stretching is on it will hold SCL down during this time to prevent other devices from using the bus in the meantime.
You can also set it to periodic data acquisition mode where the CMOSens chip will automatically update it’s data at a set frequency (I haven’t gotten to that part of the datasheet).
The frequency settings are because all the devices on the same bus need the same clock frequency.
It looks like the adifruit library defines all of the various constants and then uses 0x2400 which is single shot high repeatability without clock stretching it seems.
As for the heater I haven’t gotten to that part of the data sheet but I know for a different sensor I was working with a while ago it only came into play when you expressly set it to on, I don’t remember what it’s purpose is I think it has something to do with condensation.
For what it’s worth here is the sample code from the company that makes the actual sensors I have not had a chance to read through it.
I take that as just a way to check that the unit is working? Meaning turning on the heater should increase the temp by a few degrees C if it's working? Is that how you take that?
@RWB from Si7020 datasheet, I would imagine you can use it the same way
5.5. Heater
The Si7020 contains an integrated resistive heating element that may be used to raise the temperature of the
sensor. This element can be used to test the sensor, to drive off condensation, or to implement dew-point
measurement when the Si7020 is used in conjunction with a separate temperature sensor such as another Si7020
(the heater will raise the temperature of the internal temperature sensor).
I'm designing a replacement control board for a 170 count wine cooler that I'm using as a humidor. Using a Nextion display for a touchscreen interface, and controlling the various fans, lights, and compressor in the unit.
I see why you want a super accurate humidity sensor now
I much prefer the 4D Systems displays, go with one of those if you have not bought the Nextion display yet. So much easier to get the look you want, plus their new software has some pretty cool animation widget features that Nextion does not have.
Agreed the 4d systems display looks nicer, i had already ordered a nextion display when I found them, unfortunately. I'm pretty happy with what I've got set up on the nextion display but might try out a 4d systems display at some point.
To be honest, the more accurate sensors are not needed I use the similar humidity control media to the stuff that museums use to regulate humidity for storage so I don't even really need to monitor it but the accuracy is part of the fun.
I started designing the board but will probably redesign at some point.
You did a good job on the display layout in my opinion.
The PCB looks nice also. I’ve been laying out a new PCB for a project for the last 3 days myself. What PCB software are you working with? I’m using KiCad, I’m gonna guess your using Eagle?
Thank you, I think the layout looks pretty good, I really like the concept of handling the display logic in the display and communicating with it via serial, it takes the load off of the microcontroller, it also makes coding a lot simpler, I can handle the actual control logic on the photon and then setup callbacks to react to input from the display.
Yes I did use eagle, autodesk gave me 4 years of their premium software when I was a student and it’s nice that you can now export to a 3d model really easily. I have not really played around with any other PCB layout software but I hear KICad is nice.
It’s just a personal project, I worked a while ago on a commercial product in the same space but had to put it on hold for the time being as my visa situation changed and would have been too complicated to continue without moving back to Canada, at some point I will probably get back to it. I picked up this large wine cooler for this project for really cheap because it wasn’t working, I have since fixed it but thought it would be fun to replace the control board with something i designed myself and had all of the functionality that I wanted built in. I might adapt it for a smaller unit that is commonly used as a humidor at some point if I get the time.
What are you currently working on