Question about reading multiple SHTxx sensors
LeeW
Posts: 14
Hello,
As a student I'm quite new at all of this, but I was curious as to how I would go about reading multiple (2-6) SHTxx Humidity/Temperature sensors.·I understand that you can use one SCK line for all 6 sensors and individual data lines for each, but I'm confused as to how you would handle them going to the BS2.
Programming the controller to handle·more than·2 separate sensors seems like it would be too big of a program for just simply memory reasons. I'm betting that it's not possible using PBASIC?
If anyone could point me in the right direction or offer some suggestions and help, it'd be very much appreciated.
Thanks in advance!
As a student I'm quite new at all of this, but I was curious as to how I would go about reading multiple (2-6) SHTxx Humidity/Temperature sensors.·I understand that you can use one SCK line for all 6 sensors and individual data lines for each, but I'm confused as to how you would handle them going to the BS2.
Programming the controller to handle·more than·2 separate sensors seems like it would be too big of a program for just simply memory reasons. I'm betting that it's not possible using PBASIC?
If anyone could point me in the right direction or offer some suggestions and help, it'd be very much appreciated.
Thanks in advance!
Comments
If you use successive I/O pins for the data lines, you can easily modify the sample program to read each sensor in turn, one at a time and display the data. The pin number in the I/O statements (like INPUT, LOW, HIGH, SHIFTOUT, and SHIFTIN) can be an expression. For example, if you use I/O pins 1-6 for the six sensors' data lines, you can change all the statements in the sample program and substitute "ShtData+i" for "ShtData" where "i" is a new byte variable. Near the end of the program, you'll have to change "IF (ShtData = 0) THEN EXIT" to "IF (ShtData(i) = 0) THEN EXIT". I'm not sure, but I think that will compile ... try it. You may need to replace the "ShtData PIN 1" with "ShtData CON 1".
Replace the DO / LOOP in the Main section of the program with
FOR i = 0 to 5 DO ... LOOP NEXT
and the program will read the sensors one at a time with a 1 second pause between displaying each sensor's results.
I have already thought of a couple ways to streamline the code to reduce the usage of variable space. The sample program is written for ease of use and understanding, not code efficiency. I could easily get rid of tC, soT, and soRH by streamlining the code structure. I will be working on that since I believe that the BS2 should be able to read numerous sensors and run an LCD without running out of space.
Any other suggestions on streamlining the variable usage with SHT11 sensors would be appreciated.
(note: the 005 in the filename is my revision)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio
If resolution to 0.5 %RH and to 0.5 degree in temperature is acceptable, then your structure could easily do 8 sensors.
Of course, in answer to the original post, there is not that limitation if you do not need to store the data in the BS2 RAM. It can be sent one sensor at a time to an LCD or terminal screen, or it can be logged in sequence in the eeprom or in external memory. Note that Andrew's program does not occupy anywhere near the full capacity of the BS2 eeprom.
I have a program that I use for environmental chamber testing of 8 at a time. But it uses the BS2pe, so it has the scratchpad RAM available as a data buffer, and from there it logs the data to a vDrive.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Something else I noticed in the datasheet that I did not ever before. Page 5, ss3.1 states:
Values higher than 99% RH indicate fully saturated air and must be processed and displayed as 100%2 RH.
Note 2 on the bottom of the page states:
If wetted excessively (strong condensation of water on sensor surface), sensor output signal can drop below 100%RH (even below 0%RH) in some cases, but sensor will recover completely when water droplets evaporate. Sensor is not damaged by water immersion or condensation.
The first part of that last sentence caught my eye: "Sensor is not damaged by water immersion". I wonder if that means the sensor will function properly under water if the substrate and leads are conformally coated. I think I will be coating a sensor this weekend and giving it a "filter cap free" dunk. Obviously, this won't protect the sensor element from particles in the water contaminating the sensor.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio
I think the part about "contaminating" is a crucial point. It may be relatively okay with DiH2O from pure condensation. I remember a conversation with one of the Sensirion engineers about condensation, and they indicated that a long dryout period at a high temperature might be necessary to restore the best calibration. That was a while ago, so they may have improved that now. He said that the internal heater would not be sufficient to bake it out. I think there is a document on the Sensirion web site about this.
Cloride in tap water or a host of other chemicals could I bet wreak havoc. Sulfur in agricultural chemical, PAH and metals in diesel emissions, and ocean salt spay come to mind.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Thanks for the detail on contamination, I was unaware of how critical it could be. My only current plan for an underwater SHT11 is for the annual polar bear plunge logger.
In regards to condensation and moisture, you are right on. Section 1.4 of the datasheet has the reconditioning process for when the sensor has experienced excessive moisture or solvent vapors from processing.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
WBA-TH1M Sensirion SHT11 Module
Post Edited (WBA Consulting) : 8/27/2009 12:25:24 AM GMT