Temp/Humidity Sensorhelp needed.
NWUpgrades
Posts: 292
Could someone take a look at the attached code and tell me what if anything needs to be changed to make the Sensirion temp/humidity sensor to make it work with a BS2sx,· other than the stamp directive? I have tried this with and without the resistor, and all I get is the debug showing temp and humidity are 0. Thanks if you can help.
Comments
You have,
That sets the threshold at 10.0 degrees Fahrenheit, because tF is in units of 0.1 degree. I'd guess you want tF>1000 for 100 degrees.
Note also that the program wll have to take additional steps if there is a chance that the temperature will go below zero degrees Fahrenheit.
.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
-- Remove the code section starting with the label Sensor_Demo:, up to but not including PAUSE 5000 before label Main:. This demo code is probably superfluous.
-- In the Main: routine, once things are working, you can get rid of the display of soT and soRH, and rhLin, and only display the final temperature (either F or C) and humidity.
-- Delete the entire subroutines, SHT_Write_Status and SHT_Read_Status and SHT_Soft_Reset. They are not called.
The above changes should free up quite a few bytes. It appears you are using a BS2sx, which has eight program slots available, but the current program only uses slot zero. It is a slightly more advanced technique, but you can recast the low level routines to return the temperature and humidity as a cross-slot call. That would free up even more code for your main loop. Also, cross slot calls are good for separating initialization and menu code from the main loop code.
As to the higher than expected temperature readings, I don't know. The Sensor_Demo routine turns the internal heater on for a few seconds, but then turns it back off (off is the default). You can experiment with leaving it on. Are you sure the room temperature is 67? Radiant heat sources and gradients from floor to ceiling can have quite a strong effect.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Heater_On:
DEBUG "SHT1x heater on", CR
status = %00000100 ' heater bit = On
GOSUB SHT_Write_Status
DEBUG "Waiting 2 seconds", CR
PAUSE 2000
Heater_Off:
DEBUG "SHT1x heater off", CR, CR
status = %00000000 ' heater bit = Off
GOSUB SHT_Write_Status
GOSUB SHT_Measure_Temp
DEBUG "tF...... "
DEBUG DEC (tF / 10), ".", DEC1 tF, DegSym, ClrRt, CR
GOSUB SHT_Measure_Humidity
DEBUG "rhLin... "
DEBUG DEC (rhLin / 10), ".", DEC1 rhLin, "%", ClrRt, CR, CR
PAUSE 5000
Also, The temp in my office is 67 degrees constant, verified by both the thermostat and an external thermometer. I think the issue may have to do with the sensor heater. Thanks for the help.
BS2 thread about reading multiple sensors. Some code attached is streamlined for SHT11 usage
http://forums.parallax.com/showthread.php?p=826300
My SHT11 Module thread with testing code that reads two sensors and compares for pass/fail
http://forums.parallax.com/showthread.php?p=690671
My BS2p40 based SHT11 memory stick datalogger
http://forums.parallax.com/showthread.php?p=792332
SHT11 with Propeller and uSD card
http://forums.parallax.com/showthread.php?p=843250
And of course, see the link in my signature for my SHT11 module webpage and click on the code examples link.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
WBA-TH1M Sensirion SHT11 Module
Special Olympics Polar Bear Plunge, Mar 20, 2010