DIY WiFi Programmable Thermostat
Re: DIY WiFi Programmable Thermostat
Before I start modifying things, time to do some measurements. For now I think taking temperature of the ambient air and floor in 2 spots (normally heated zone, and normally unheated zone). And also outside.
From that I can get some data on how the in floor hydronics is working now. Too bad I didn't start earlier, as tonight is going to be pretty cold.
I have a bag of LM19CIZ parts, temperature sensors (analog) and 3 ARMstamps. Just going to take readings every 6 minutes or so for a few days, write the data to Flash, and then dump it CSV style for an Excel spreadsheet.
From that I can get some data on how the in floor hydronics is working now. Too bad I didn't start earlier, as tonight is going to be pretty cold.
I have a bag of LM19CIZ parts, temperature sensors (analog) and 3 ARMstamps. Just going to take readings every 6 minutes or so for a few days, write the data to Flash, and then dump it CSV style for an Excel spreadsheet.
Re: DIY WiFi Programmable Thermostat
Got the temp sensors built with LM19's. Though I would recommend using digital output sensors, I had a number of these analog ones sitting around. Used some cut up ARMweb blank PCBs and prototype ARMstamps. It's good being a pack rat.
Small PCB with 0.1uF bypass cap, 3 pin header and LM19 connected.Re: DIY WiFi Programmable Thermostat
Now have them gathering data overnight. Will check tomorrow to see how it went. The program takes temperature samples every 5 minutes, and every hour writes to Flash. When the program starts up it will dump that data to the USB serial port where I will move it into Excel for analysis.
Here is the code
Here is the code
Code: Select all
' this program captures 2 AD conversions and save the data into unused Flash
' unused flash is &Hffffffff
' on startup it dumps the data -- and restarts sampling
function dosample
dim ad6,ad7,i
ad6=0 ' take 8 readdings and average
ad7=0
for i=1 to 8
ad6 += ad(6)
ad7 += ad(7)
next
ad6 = ad6 >>(6+3) ' avg 8 samples and right justify
ad7 = ad7 >>(6+3) ' ditto
return (ad6 << 16) + ad7
end function
dim tempSamples(1023) ' a block of Flash is 4K
#define SAMPLE_DELAY 300000 ' 5 minute delay
main:
x=ad(6) ' switch to AD mode and ignore this data
x=ad(7) ' ditto
flashStart = &H5000
sampleStart = 0
#if 0 ' run this to init during testing
for i=0 to 1023
tempSamples(i) = &HFFFFFFFF
next
write (flashStart, tempSamples, 4096)
print "Flash erased"
end
#endif
print "Dump data"
fread (flashStart, tempSamples, 4096)
' dump the existing data
while (tempSamples(sampleStart) <> &HFFFFFFFF)
print tempSamples(sampleStart) >> 16,",", tempSamples(sampleStart) and &HFFFF
sampleStart += 1
if sampleStart = 1024 then
flashStart += &H1000
sampleStart = 0
fread (flashStart, tempSamples, 4096)
endif
loop
print "quick test of ADs"
for i=1 to 10 ' use this for testing
print dosample>>16, dosample and &Hffff
next
print "sampling will begin in ";SAMPLE_DELAY/1000;" seconds"
wait(SAMPLE_DELAY)
' and restart sampling -- starting where the data left off
while (1)
for i=1 to 12
x = dosample
print hex (x)
wait(SAMPLE_DELAY)
tempSamples(sampleStart) = x
sampleStart += 1
if sampleStart = 1024 then
write (flashStart, tempSamples, 4096)
flashStart += &H1000
sampleStart = 0
fread (flashStart, tempSamples, 4096)
endif
next
write (flashStart, tempSamples, 4096) ' every hour record the data
loop
Re: DIY WiFi Programmable Thermostat
Well I was trying to infer from the temperature measurements the efficiency of heat and heat loss in the house. Also one of my experiments is to combine 3 zones in the tile area of the house which is an open area, and see if switching them all on with heat demand keeps the house more comfortable and saves energy.
Instead I need to monitor when heat is actually being requested/delivered and then monitor how fast temps change.
The heating controller runs almost completely on 24VAC with LED indicators each on its own diode rectifier. No GND in the whole thing. So I need some opto-isolators so I can measure what is going on there. Off to Digikey...
Instead I need to monitor when heat is actually being requested/delivered and then monitor how fast temps change.
The heating controller runs almost completely on 24VAC with LED indicators each on its own diode rectifier. No GND in the whole thing. So I need some opto-isolators so I can measure what is going on there. Off to Digikey...
Re: DIY WiFi Programmable Thermostat
Well have my opto-isolated heat zone management system running. And temp monitors running in dining room, living room and outside. I'll check back in a couple days to make sure it is collecting data correctly.
Here is a pic of the heat zone monitor The picture of the heat zone monitor was taken before I plugged in a small USB power supply.
Here is a pic of the heat zone monitor The picture of the heat zone monitor was taken before I plugged in a small USB power supply.
Re: DIY WiFi Programmable Thermostat
So lots of data to look at. Over the last 2 1/2 weeks I measured 3 different heating configurations. So below is a set of graphs of the data, with highlights explained after. The top diagram show when heat is being demanded by the thermostats, and the bottom is the relative temperature of the living room. Seems like the temperature measure is off by 5 degrees, not sure, why, and may have to chase that down, but in the final DIY thermostat digital temp sensors will be used.
First was 3 separate heat zones downstairs. As I suspected the 3 thermostat interacted with each other in bad ways. In example "A" the living room was demanding heat and it came on, but the temp of the room only increased 1 degree, but that was probably enough to hold off the other thermostats. On average it looks like the house cools down at about 1 to 1.5 degrees per hour. During the A zone, temperature increased only a degree in almost 15 hours. The heater is not keeping up.
Next I shorted the kitchen and living room thermostat together. Even before I saw the data the house seemed more comfortable in the morning. So next look at the real data. There would be little contribution from the North bedrooms, as at the opposite end of the house, in fact it probably robs heat from the downstairs. With the 2 zones tied together the living room heated at about 1 degree per hour or more. House cooling rates seem about the same.
Final configuration, which I will keep combines all 3 zones downstairs. In area C temperature increases of 1.5 degrees per hour. So as hydronic heat is so slow, heat demand should be quicker (the thermostats delay 10-15 minutes it seems). And since it is so slow overshoot or bang bang situations won't be an issue.
First was 3 separate heat zones downstairs. As I suspected the 3 thermostat interacted with each other in bad ways. In example "A" the living room was demanding heat and it came on, but the temp of the room only increased 1 degree, but that was probably enough to hold off the other thermostats. On average it looks like the house cools down at about 1 to 1.5 degrees per hour. During the A zone, temperature increased only a degree in almost 15 hours. The heater is not keeping up.
Next I shorted the kitchen and living room thermostat together. Even before I saw the data the house seemed more comfortable in the morning. So next look at the real data. There would be little contribution from the North bedrooms, as at the opposite end of the house, in fact it probably robs heat from the downstairs. With the 2 zones tied together the living room heated at about 1 degree per hour or more. House cooling rates seem about the same.
Final configuration, which I will keep combines all 3 zones downstairs. In area C temperature increases of 1.5 degrees per hour. So as hydronic heat is so slow, heat demand should be quicker (the thermostats delay 10-15 minutes it seems). And since it is so slow overshoot or bang bang situations won't be an issue.
Re: DIY WiFi Programmable Thermostat
I was also measuring outside temperatures, but between snow and rain, and a bug in the original program, I only captured a couple days of data. The sensor finally died in the last storm. I replaced it and will protect it from the weather better, it is under a covered patio on the lee side of the house.
Now that I can measure the master bedroom, I was curious to see if it ever even demanded heat, and one cold night it did. We do keep that room cool for better sleeping.
While we can't do a 5 degree night time setback, maybe a couple degrees might be OK, and raise the temperature request about 4 AM so we're not freezing around 6. The cats might hate it.
Now that I can measure the master bedroom, I was curious to see if it ever even demanded heat, and one cold night it did. We do keep that room cool for better sleeping.
While we can't do a 5 degree night time setback, maybe a couple degrees might be OK, and raise the temperature request about 4 AM so we're not freezing around 6. The cats might hate it.
Re: DIY WiFi Programmable Thermostat
And here is the temperature recording program. Rather than 0 it now loads the data array with &HFFFFFFFF and erases the next Flash sector when it is required.
Code: Select all
' this program captures 2 AD conversions and save the data into unused Flash
' unused flash is &Hffffffff
' on startup it dumps the data -- and restarts sampling
function dosample
dim ad6,ad7,i
ad6=0 ' take 8 readdings and average
ad7=0
for i=1 to 8
ad6 += ad(6)
ad7 += ad(7)
next
ad6 = ad6 >>(6+3) ' avg 8 samples and right justify
ad7 = ad7 >>(6+3) ' ditto
return (ad6 << 16) + ad7
end function
dim tempSamples(1023) ' a block of Flash is 4K
sub fillFFFF
dim i
for i=0 to 1023
tempSamples(i) = &HFFFFFFFF
next
end sub
#define SAMPLE_DELAY 300000 ' 5 minute delay
main:
x=ad(6) ' switch to AD mode and ignore this data
x=ad(7) ' ditto
flashStart = &H5000
sampleStart = 0
#if 0 ' run this to init during testing
fillFFFF
write (flashStart, tempSamples, 4096)
write (flashStart+0x1000, tempSamples, 4096)
write (flashStart+0x2000, tempSamples, 4096)
write (flashStart+0x3000, tempSamples, 4096)
print "Flash erased"
end
#endif
print "Dump data"
fread (flashStart, tempSamples, 4096)
' dump the existing data
while (tempSamples(sampleStart) <> &HFFFFFFFF)
print tempSamples(sampleStart) >> 16,tempSamples(sampleStart) and &HFFFF
sampleStart += 1
if sampleStart = 1024 then
flashStart += &H1000
sampleStart = 0
fread (flashStart, tempSamples, 4096)
endif
loop
print "quick test of ADs"
for i=1 to 10 ' use this for testing
print dosample>>16, dosample and &Hffff
next
print "sampling will begin in ";SAMPLE_DELAY/1000;" seconds"
wait(SAMPLE_DELAY)
' and restart sampling -- starting where the data left off
while (1)
for i=1 to 12
x = dosample
print hex (x)
wait(SAMPLE_DELAY)
tempSamples(sampleStart) = x
sampleStart += 1
if sampleStart = 1024 then
write (flashStart, tempSamples, 4096)
flashStart += &H1000
sampleStart = 0
fillFFFF
write (flashStart, tempSamples, 4096) ' erase the next sector
endif
next
write (flashStart, tempSamples, 4096) ' every hour record the data
loop
Re: DIY WiFi Programmable Thermostat
Well I should try to finish this up before I turn the system off for the winter. Still taking measurements of the heating controls, and will do that via WiFi with the final setup. Made one more modification to the current control. I shorted the 3 downstairs zones together and disabled the 2 thermostats. Now I have them all shorted but re-enabled all the thermostats, so if any zone drops below 67 for some time, the heat for all three zones comes on. Seems much more comfortable and so far the heating bill is within 10% of last year.
So now working with the LCD character display. This is just a trial to learn about the interface. Already learned I may need to be able to power cycle the display as it can get out of sync, though I haven't tried all the tricks yet. Will also need to be able to turn off the backlight and will add a transistor to do that. The intention is to turn it off unless the up/down temp control is pushed.
This is a New Haven display from Digikey that has a similar form factor to the one in the original thermostat. Yes I could have reverse engineered the existing display, but for $10 I can just replace it and save a lot of time.
So now working with the LCD character display. This is just a trial to learn about the interface. Already learned I may need to be able to power cycle the display as it can get out of sync, though I haven't tried all the tricks yet. Will also need to be able to turn off the backlight and will add a transistor to do that. The intention is to turn it off unless the up/down temp control is pushed.
This is a New Haven display from Digikey that has a similar form factor to the one in the original thermostat. Yes I could have reverse engineered the existing display, but for $10 I can just replace it and save a lot of time.
Re: DIY WiFi Programmable Thermostat
I think the most challenging part of the design is the power supply. You've got 24V AC coming in, that you can draw maybe a max of 30 mA before you trigger the heater controller to demand heat. And it also has to run for many hours while heat is demanded at maybe near 0V. Though in my case I found I could maybe pull enough current to keep the voltage 3-4V and still signal for heat demand.
SO to do some testing NOT on the real heat controller. I took an old PC power supply box and a 28V transformer lying around (yes I am a pack rat), and create a crude 24V AC bench supply -- pictured below.
SO to do some testing NOT on the real heat controller. I took an old PC power supply box and a 28V transformer lying around (yes I am a pack rat), and create a crude 24V AC bench supply -- pictured below.