PDA

View Full Version : Custom Thermostat Project: "Static" Background / Object of the Week: SHT11



WBA Consulting
07-10-2009, 03:09 AM
Some already know that I have been working on a custom thermostat project for my house for a while. It's been a low priority project, but I am trying to move it up the list. Anyhow, my plan is to have a display that shows the current readings from all the SHT11 modules scattered through the house. My original dream was to have a floorplan of the house on the display and the readings would be in each room from the corresponding sensor. After playing with the propeller for a few days, this seems much more like a plan than a dream. I downloaded the Sensirion SHT11 object from OBEX and love it. I modified the code to adjust the way it shows and which values are displayed. These modifications were really simple, so my floorplan idea is gaining my attention. So, sorry for the long intro, but here are my questions:

1) Is there an easy way to draw or display a floorplan on the screen and just update the text from the readings so that the floorplan stays on the screen? Or does the entire screen data need to be repeatedly sent?
2) Is there a better way to draw the floorplan than using pipes, underscores, dashes, etc? Use hex codes for ASCii symbols? Load a bitmap?
3) I haven't settled on a display yet, but I do have a 10" LCD with a driver board that accepts VGA and composite video. That's a little large, but if I can make the floorplan look good, I'll use it.

My last question is on the SHT11 code
4) If I have multiple SHT11 modules, how can I easily change between the sensors for the readings? In PBasic, I just manually redefine the pins. In SPIN, it is calling the SHT11 object to startup using the pins defined. Do I have to start and stop the SHT11 object for each set of readings and change the pins while it is stopped?

I am debating running over to Parallax today to pick up a hardcopy of the Propeller manual to read while on the road this weekend since I'll be in the boonies and off the grid but want to keep my mind going on this.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio

MagIO2
07-10-2009, 03:45 AM
1) Suppose you use TV_TEXT or the VGA objects. Then you can draw the floor-plan and use the set x and set y to position the 'cursor' before writing the temperature strings.

2) You can do it in the Propeller tool. The character set which comes with the propeller should allow to draw moderate floor-plans.
I think in the help menu there is a menu-entry which opens a window that shows all characters.

3) 10" is good for a big house ;o) Maybe you can add some sensors which show you the temperature outside of the house. Wind-speed .... ?

WBA Consulting
07-21-2009, 12:06 AM
MagIO2, thanks for the responses.

1) So I do not need to send the screen data continuously to the TV_Text object? I guess it would make since if the TV_Text object does that on its own.
2) I will look into the characters available and play around, good tip.
3) I was planning on eventually adding a full blown external station that would feed lots of data.


Anyone have any thoughts on question #4? I'll be jumping into the propeller book this week hunting for this specifically, but was wondering if anyone had any tips for a "Stamp'er" learning SPIN as to how objects are started/called and how to change which pins the object uses in the middle of code. Basically, I need to cycle the object through the use of 12 different pairs of IO pins to obtain readings from 12 different SHT11 modules.

Also, the SHT11 Demo Object leaves a lot open for self-discovery as far as how to properly use the object for beginners. For example:
The first line in the code that is driving an action to the SHT11 is:
"rawTemp := f.FFloat(sht.readTemperature)"
I can see a routine in the Sensirion object called "readTemperature", but where does the "SHT." come into play? I finally found it in the OBJ definitions where it links "sht" to "sensirion" and "sensirion" ins the name of the SPIN file for the object. So it seems like if you understand SPIN, this would be blatantly obvious. But for a beginnner, it's a learning curve as well. Am I asking to much for descriptions of how to use a published object? Is it, learn SPIN first, then figure out objects?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio

Timmoore
07-21-2009, 07:11 AM
I assume you are using the sensirion.spin object. The simplest way to use it for multple sensors is an array

obj
sensor[10] : "sensirion"

The code will not be duplicated, the 2 variables will be copied but since these hold the pins you need this.
Couple of comments, you need to read the sensor slowly 1 per sec or it heats up and changes reading. The reading takes a few hundred millisec so you will need to be careful reading multple sensors - it will take time.
Then
sensor.readTemperature will get temp from the i sensor where i is from 0 to 9 (in this case 10-1)
I think your sht questions is you have a line

sht : "sensirion"

this means the internal code name is sht and it uses the filename sensirion.spin for the code for that object.

WBA Consulting
07-21-2009, 08:08 AM
Timmoore, thanks for the response. The array makes perfect sense, but I am unclear on one thing. Where does the "i" variable come into play with your statement:

sensor.readTemperature will get temp from the i sensor where i is from 0 to 9 (in this case 10-1)

should it be "sensor[ i ].readTemperature"?


(edited post to put spaces around the i to prevent the forum from stealing it for italics)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio

Post Edited (WBA Consulting) : 7/28/2009 6:42:09 PM GMT

mpark
07-21-2009, 08:33 AM
It should be "sensor[ i ].readTemperature". The spaces around "i" are not necessary in Spin, but when posting here, "[ i ]" without spaces turns on italics (as you can see in the two preceding posts).

WBA Consulting
07-21-2009, 12:58 PM
That's obvious now that you pointed it out. Thanks for the tip on the forum theft of the array symbol.


Timmoore,
I forgot to mention that I am aware of the self-heating issue with the SHT11. The sensors will be read in a back to back sequence every 30 seconds. So the first sensor would be read at 1 second, the 2nd at 2 seconds,............, 12th at 12 seconds, and then a pause for 18 seconds before it starts over. Obviously the timing may be a little off from that, but you get the idea. It works out that each sensor is only read once every 30 seconds. This time will probably increase to somewhere between 2 and 6 minutes when everything is up and running.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio