Sensirion sht11
Rsadeika
Posts: 3,837
There was some work done quite a few months ago on the Sensirion sht11 library, I thought that I would try to bring this up to date. In the program below I made this adjustment to sht11.c too suit my real temp readings:
I am also thinking that at some point it may be interesting to also do a C++ version, just to see if in some cases it is more beneficial to use C or C++.
Ray
float sht11_degF(void) { float soT = (float) sht11_tempRaw(); //float sTf = (((float) soT) * 0.018)-39.322; float sTf = (((float) soT) * 0.018) - 44.922; // Adjusted to match real temp. return sTf; }The program below is a very basic program, it just prints out all the values to the terminal screen. The next thing that I would like to do is create a CMM/XMMC library of sht11.c and sht11.h, but I have no idea as to where to start or how it is done. The important part is that I have a sht11 library that can be used in either CMM mode or XMMC mode, and maybe some of the other XMM modes, in case I ever want to add the Parallax memory module to my Activity Board or the PropBOE board.
I am also thinking that at some point it may be interesting to also do a C++ version, just to see if in some cases it is more beneficial to use C or C++.
Ray
Comments
Thanks for posting this. Have been working with this sensor but in spin. Want get it working with Xbee also to set up a small wireless sensor network that could be expanded with other sensors.
Ray
Ray
I would love to see how to do the Xbee in C. Any advice?
The reason that I am bringing the subject up is, I found that I was getting a different temp reading from two different sources. To be specific, the sht11 readings were about six degrees higher than the readings from a digital thermometer that I was using. Now, I am not saying that the Parallax product is bad, all I am saying is that I am getting different data readings. In the program that is in the OP, I had made a software adjustment for the F degree reading, which when I ran for about an hour the temp readings from both sources were comparable. So, it is not the equipment, but an adjustment that was necessary. The only problem that I can see is, is this just an occurrence for the module that I have, or does this occur with all the other modules also. I do have another sht11 module which I used with a Spin centric project, and if I remember correctly(IIRC), that module also had to be adjusted. But once adjusted the data readings are very consistent.
@KMyers, if you used the program as downloaded, with the data adjustment in tact, what sort of temp readings were you getting? How close are they to the real temp at the reading site? Maybe you should reset the adjustment back to the original state and do some readings to see if in fact that you are getting a different reading from the real temp.
Ray
Dont have an activity bot so I ignored the section on that. Will have to investigate that and do all the tortorials instead of shooting in the dark so to speak. Not much of a programer but pretty good at electronics esp RF testing and measurements.
Please keep the info coming!
I did some testing today on my second sht11 module, which I set up on a PropBOE board. Using the same program settings, the second module had a different reading than the other module, so I am trying to see if I can get a fix on something that will work for both modules and only be maybe a degree apart. Actually the changes or fudge factor should be made to C degree code, because that affects the other readings like F degree. Now I hope Andy sees this thread and joins in just for an explanation as to how he came up with this: I guess specifically the number data like 0.01 and 39.636, seems to be very precise values.
I remember seeing, in the Spin code, something about activating or turning on a heater, or something like that, which I do not see in this code. I wonder if that has something to do with improving accuracy and precision of the readings?
Ray
I have my spin version running alongside each other running to 2 putty terminals. The C version is more accurate now then my spin version by over 10 degrees. Just dont know what to think it wasnt that far off before. Must be something I did wrong.
I agree the fudge factor should be in the cent reading.
On page page 8 - 9, in the Sensirion sht11 data sheet they have all the conversion data needed to come up with the temperature readings. The other important thing that was noted, the Sensirion module does not have a membrane that covers the sensing element. How important that is, not sure yet. Now I have to spend some more quality time with the data sheet.
The way Andy has the program set up, is that you have to manipulate each data output, Centigrade reading have there own data, as does Fahrenheit, and the others. This is getting somewhat more complicated than I thought, maybe a calibration program will be necessary? More to come...
Ray
Like wise I will re read the data sheet and take a good nap afterwards. One of the benefits of being old and retired.
I think that Andy, at some point, will be releasing an official Parallax sht11 CMM library, which will work for most of the people that decide to use it. Just an early warning, each memory mode has to have a specific library for the mode that they will be using. As I mentioned earlier, jazzed has some very good instructions as to how that is done.
Ray
Also I use a 4.7k res not the 10k they recomend. Nor do I use the bypass cap.
Not sure what you are referring to in terms of delay, in the data sheet it mentions that there is a computational delay which has to be handled in your program, if that is what you are talking about.
Now that I have decided how I am going to use sht11.c/sht11.h, I am now working out a program structure for the next Sensirion project. Definitely going to have an XBee component, use of the SD card, use of the volts program, and probably will be using the XMMC mode for this. This will probably change somewhat after I get the outline on paper.
Ray
Perhaps noise? Time to pull out the scope and look at signals on both systems. Will look forward to seeing what you come up with. Going to start the tutorials this week so I can follow along and understand better.
The delay I was talking about was on the start of the sensor before any reading was attempted.
Ray
I am in the process of expanding the sht11 program, making it a mobile device that will be able to use a time stamp for the logged data. I am not ready to start a thread in the Projects forum with this yet. I will be getting the CO module at some point, has anybody written any C drivers for that module?
Ray
I retired and still going to meeting and Dr appointments. Dont know how I had time to work 35 years...