Badcaps Forums

Badcaps Forums (https://www.badcaps.net/forum/index.php)
-   General Computer & Tech Discussion (https://www.badcaps.net/forum/forumdisplay.php?f=16)
-   -   Looked at new thermostats, nah I'll DIY this (https://www.badcaps.net/forum/showthread.php?t=66041)

evilkitty 11-26-2017 06:59 AM

Looked at new thermostats, nah I'll DIY this
 
My dad had picked up a new thermostat complaining about the old one not being sensitive enough or not being accurate, It appeared to not be able to turn the second heating coil on, maybe it only had 1 relay? Anyway i thought for that price i can do it myself, well i decided to modify it:
https://imgur.com/a/4LVnT
* That is a raspberry pi 0 v1, so no built in wifi or camera plug
at 1st i had a A+ pi in there, before the pi0 was released and i needed more space to make the front panel

there are 2 things i am not happy with and both are the power supply, that blue LED is well insanely bright (visible through the face plate) and the coil wine

I would guess i am pulling under 300ma at any given time (100ma board + wifi + a single relay)
*Programed/designed so that both relays will never have there coil powered up at the same time
*the lcd is so low power it should be under 0.025ma
at least that supply has never let me down in the few years i have used it

ratdude747 11-26-2017 07:12 PM

Re: Looked at new thermostats, nah I'll DIY this
 
Nice. Have you studied control systems before?

You might want to look up Two-Position controls for tuning in your controls. That way you can get it properly "damped", underdamped will be too slow to react, overdamped will be unstable (and will overshoot, causing unnecessary switching on/off which will wear out your relays). Two position controls aren't too bad to engineer; "two position" refers to that there are two positions in use ("on" and "off"). If you wanted to get fancy with it (which would mean slightly more complex controls engineering), you could have a mode to control the AC and heat at the same time, which would be a three-position control system. Just be glad it isn't like some modern commerical boilers which are variable output, which require a PID control system to utilize. My college had one of these installed (after the 3 year old non-variable one fried a lot due to switching on/off too much) and this was one of the things showed to me in my control theory (controls engineering) class.

Have fun with it.

evilkitty 11-26-2017 08:33 PM

Re: Looked at new thermostats, nah I'll DIY this
 
never studied them
controlling heat/cooling is not possible at the same time, the same unit does both, there is a slide switch to decide what mode the unit is in (i what i made only replaced the temp reading system)
I designed the software do support a desirable temp range, under the concept lets warm the place up a little and shut off a while; the offset value is the desirable range, so if the unit is set to cool with a Target of 75 with a offset of 5 the system will not turn on till 80 and run till 75
i also set a lag delay in the temp readings so the min time between states over a 2 seconds, and i ended up putting in a second lag if the temp changes a lot in a short period of time, so until the temp is stable it will not act; this prevents bad readings from turning the unit on, well it drops the probability of that happening to under 1%
if you can read python this can explain it better than i can with english
https://github.com/GM-Script-Writer-...bin/thermostat

the heating system at work is like you described, run 30 seconds off 30 second; rinse, wash, and repeat

ratdude747 11-26-2017 09:03 PM

Re: Looked at new thermostats, nah I'll DIY this
 
^ I thought you had replaced the entire controls, not just a temp readout. My bad there.

evilkitty 11-27-2017 06:16 AM

Re: Looked at new thermostats, nah I'll DIY this
 
moding was cheaper and easier, decided to just fix the problem component
given that slide switch has 4 positions...

I did use the old tubes as inputs so i can monitor them
putting a 9th wire in that insulation was not easy for that led that turns on after sunset
thought it was white turned out to be blue, it was salvaged from one of those silly push button keychain lights you get free here and there

If something goes very bad i can move the wires to the top jumper and use the original tubes

desert-rat 11-28-2017 10:21 AM

Re: Looked at new thermostats, nah I'll DIY this
 
Some times I have problems explaining a standard heat cool thermostat to my customers. Hate to thank explaining wifi to them.

redwire 12-01-2017 12:43 PM

Re: Looked at new thermostats, nah I'll DIY this
 
2 Attachment(s)
Where did you put the temperature sensor?

I found the heat made by a thermostat messes up operation.

Honeywell mercury-switch tube, the skinny flex wires heat up, up to 10 degrees at 0.2A. Took me long time to figure out why the temperature was never consistent. see pic

The Pi and relays can make heat too.

Another house I owned, the wall had drafts and cold air blowing through the junction box. That made the temperature move around too.

edit: added pic

evilkitty 12-02-2017 10:03 AM

Re: Looked at new thermostats, nah I'll DIY this
 
1 Attachment(s)
inside the red square there is a D18B20 sensor
I tried to keep it in a low area of the box away from other components cause heat radiates and rises

redwire 12-02-2017 01:47 PM

Re: Looked at new thermostats, nah I'll DIY this
 
OK, I couldn't see it. As long as it gets air flow, as I found relays/triacs make enough heat to cause the thing to oscillate on/off.

NEST is so expensive, $250 and I hate that it has a battery.
It would take years to maybe pay for itself and the install.

evilkitty 12-02-2017 06:07 PM

Re: Looked at new thermostats, nah I'll DIY this
 
that ic is hidden under the 9 wires going to the raspberry pi 0
there is no way you could see it from that angle

screw batteries, i got my power from mains
this is probably under $50 in parts
~1 40cm dupont wires on ebay
~10 for a pi 0 (shipped from eu; got a local micro center?)
~2 assorted resistors on ebay
~3 prototyping boards on ebay
~0.5 Common anode LCD displays on ebay
~1 pin headers
~1 2N3906 transistors on ebay (over cautious on pulling power from logic pins)
~1.5 switch
~8 wall wort
~2 relays on ebay
~0.75 face plat
~4 22 cubic inch old work box
~1.5 D18b20 sensors on ebay
scrap Ethernet wire
on hand 0.07 diodes
on hand Darlington transistors (overkill for controlling relays)
on hand leds (i got 100 for 0.10 on ebay)
time and effort on design, testing, and programing and have fun doing it

Curious.George 12-04-2017 05:45 PM

Re: Looked at new thermostats, nah I'll DIY this
 
Quote:

Originally Posted by evilkitty (Post 786574)
I designed the software do support a desirable temp range, under the concept lets warm the place up a little and shut off a while; the offset value is the desirable range, so if the unit is set to cool with a Target of 75 with a offset of 5 the system will not turn on till 80 and run till 75

You typically have a variety of such "fudge factors".

Almost always, you want a certain amount of hysteresis in the loop -- turn the heat on at X and off at X+delta so the plant doesn't get commanded back on, in short order (the temperature must fall to below X to do so).

Modern HVAC systems also have timeouts built in so the plant can't cycle back on too quickly (ACbrrr compressors don't like being commanded back on while they are still "under pressure" from the last activation; gas furnaces like to be able to vent any fumes before reengaging; etc.)

Ideally, you also want to factor in an "anticipator" to limit the amount of overshoot -- watch to see how far beyond X+delta the temperature climbs and use that, "next time", to shut off the plant before the actual temperature reaches X+delta (i.e., knowing that if you shut it off "early", it will still "coast" a bit and bring the house to your desired X+delta)

[This isn't as easy as it appears!]

In this way, you give the user (occupant) the ability to set the size of the "comfort zone" and YOU sort out how to control the plant to achieve those results!

If you add provisions for "programmability" (i.e., have the setpoint change over time so the house isn't kept warm while you're asleep, away, etc.), then you can also use your knowledge of the upcoming schedule changes to avoid unnecessarily heating the house -- when you know you'll be adjusting the setpoint lower, in short order!

[I've spent a fair bit of effort working on this problem :> ]

sam_sam_sam 12-07-2017 05:18 AM

Re: Looked at new thermostats, nah I'll DIY this
 
Quote:

Originally Posted by evilkitty (Post 786574)
I designed the software do support a desirable temp range, under the concept lets warm the place up a little and shut off a while; the offset value is the desirable range, so if the unit is set to cool with a Target of 75 with a offset of 5 the system will not turn on till 80 and run till 75

Your temp range would work better @ 3* F not 5* F

i also set a lag delay in the temp readings so the min time between states over a 2 seconds, and i ended up putting in a second lag if the temp changes a lot in a short period of time, so until the temp is stable it will not act; this prevents bad readings from turning the unit on, well it drops the probability of that happening to under 1%

Normally you would want a minimum of 3 minutes so your compressor does not short cycling which is not good for a compressor to do this

Change over on most newer air conditioning unit can be done with a minimum of one minute time out and only because if you have a air handler that has a VFD drive it has to have time to power down so it can do the next command

I do like your project at one time I thought of doing a project very similar but the time to write the program and to build the controller board I just could not find the time to do it

Curious.George 12-08-2017 12:35 AM

Re: Looked at new thermostats, nah I'll DIY this
 
Quote:

Originally Posted by redwire (Post 787444)
Honeywell mercury-switch tube, the skinny flex wires heat up, up to 10 degrees at 0.2A. Took me long time to figure out why the temperature was never consistent. see pic

The "legacy" thermostats employ a length of nichrome acting as an "anticipator" (i.e., "feed forward" term). While heat is being called for, the anticipator heats up to accelerate the thermostat's idea of the current indoor temperature. In this way, the thermostat stops calling for heat before it would, otherwise, thereby reducing overshoot (improving damping) in the control loop.

Quote:

The Pi and relays can make heat too.
Anything that dissipates power can be a source of heat. But, you can also make allowances for that in your control algorithm.

Quote:

Another house I owned, the wall had drafts and cold air blowing through the junction box. That made the temperature move around too.
You can actually use a device's self-heating as a means of sensing air flow. E.g., by knowing how much power you are intentionally dissipating in a device, you can calculate how much you expect it to heat up. By comparing this to the "actual" temperature in a device that doesn't have the same "operating constraint", you can determine how much heat is being carried away from the device -- by air in motion.

[This is a cheap way of designing "fan monitors"]

redwire 12-09-2017 01:33 PM

Re: Looked at new thermostats, nah I'll DIY this
 
The "heat anticipator" rheostat built into mercury switch thermostats, I've never seen it work. It adds positive feedback and you get an oscillator. You want PWM in your home heating ?

The intent was to model overshoot- when the furnace burner shuts off the heat exchanger and ducts still have heat so the home heats up beyond the thermostat's setpoint, until the fan shuts off.
A thermostat on old furnaces switched the gas valve (typ. 24VAC 0.28A).
Modern furnaces control board have a dummy ~1k ohm resistor load. So the anticipator rheostat doesn't work anymore. Hurrah.


OP's thermostat, I would think
it should have hysteresis, usually a +/- 1 degree.
A long average (say 1 minute) temperature to decide when to start heat/cool.
A short average (say 15 sec) to decide when to stop heating/cooling.

Curious.George 12-09-2017 04:09 PM

Re: Looked at new thermostats, nah I'll DIY this
 
Quote:

Originally Posted by redwire (Post 789170)
The "heat anticipator" rheostat built into mercury switch thermostats, I've never seen it work. It adds positive feedback and you get an oscillator. You want PWM in your home heating ?

An HVAC plant oscillates, by definition (unless you have infinite insulation). How do you consider the heat coming on, then off, then on, again? Using whatever control strategy you choose! :smile:

Quote:

The intent was to model overshoot- when the furnace burner shuts off the heat exchanger and ducts still have heat so the home heats up beyond the thermostat's setpoint, until the fan shuts off.
Not all HVAC plants have fans. Ever live with baseboard radiators? Steam heat? Radiant tile?

The anticipator plays the role of the D term in a PID controller. It aims to compensate for lag in the controlled system -- one of the toughest issues to address in any control system!

Quote:

A thermostat on old furnaces switched the gas valve (typ. 24VAC 0.28A).
Modern furnaces control board have a dummy ~1k ohm resistor load. So the anticipator rheostat doesn't work anymore. Hurrah.
Modern furnaces "run on" for a fixed time after the thermostat has finished calling for heat -- usually a minute or two (DIP switch on the controller inside the furnace). The manufacturer's intent is that this open-loop run-on can be tweeked (via that DIP switch) to flush the duct work (duct work represents transport delay -- lag!) of the remaining warm air along with move residual heat from the heat exchanger into the duct. Without pushing "cooler" air through in the process (once the warm air has been exhausted).

Our plant used to "coast" a full degree beyond the upper setpoint due to the amount of stored energy in the control system when the thermostat stopped calling for heat. This caused the temperature variation that we encountered in the house to be wider than we'd have liked.

[In general, more hysteresis -- a larger "comfort zone" -- is more efficient but less comfortable]

Quote:

OP's thermostat, I would think
it should have hysteresis, usually a +/- 1 degree.
A long average (say 1 minute) temperature to decide when to start heat/cool.
A short average (say 15 sec) to decide when to stop heating/cooling.
Ideally, a control should map onto the intuitive expectations of its user. The control system should do what it needs to do in order to facilitate that mapping, within the other constraints placed on it.

The only reason for a "1 degree" change is because a digital thermostat displays the temperature in 1 degree increments. If the thermostat turned off at "68 degrees" (when it was really 68.932 degrees) instead of when the display indicated "69 degrees", the user -- lacking those extra digits beyond the decimal point) would consider it as misbehaving -- especially as it would start calling for heat at 68 degrees, as well (68.0000) instead of 67 degrees.

Note that legacy "analog" thermostats made it difficult for a user to determine if the thermostat was cycling on/off at 68, 68.2, 67.9, 68.7, 69.5, etc. degrees so the user didn't fret over the action of the controls. As long as the indoor temperature was "about 68" he was happy.

Specifying a too narrow comfort zone for a given controlled system could lead to lots of short-cycling which can be hazardous to the equipment and wasteful ($$). Furthermore, conditions may change in the controlled environment (e.g., windy or damp days may "feel" colder and/or alter the response of the controller in a less-than-desireable way).

Anything that is software-based should be smart enough to recognize these sorts of conditions and tweek its behavior accordingly -- just like a user knows to bump the setpoint up a degree or two when it "feels colder" (even though the thermostat ensures that it ISN'T colder, indoors!)

Otherwise, you'll be hard pressed to beat the cost, ease of use (i.e., no batteries to change) and reliability of a coiled bimetal spring and mercury switch! :smile:

redwire 12-11-2017 01:25 PM

Re: Looked at new thermostats, nah I'll DIY this
 
I see you have knowledge of the control systems theory but in actual practice, my point is home thermostats perform quite poorly. PID control is doomed for home heating/cooling for many reasons. We could argue but it doesn't benefit the thread.

OP's thermostat has good use even for basic logging.
I have seen data logs of a thermostat/furnace predict maintenance problems.
A dirty flame-rod, causing sluggish ignition or false flame-out trips, a data log shows the heat taking too long to come up. You can actually forecast HVAC trouble, if your software is smart. Wouldn't it be good to know ahead of time your furnace or A/C is struggling.

Curious.George 12-11-2017 02:55 PM

Re: Looked at new thermostats, nah I'll DIY this
 
Quote:

Originally Posted by redwire (Post 789557)
I see you have knowledge of the control systems theory but in actual practice, my point is home thermostats perform quite poorly. PID control is doomed for home heating/cooling for many reasons. We could argue but it doesn't benefit the thread.

PID really only makes sense when you have finer-grained control over the "actuator" . Most home HVAC's are either on or off. Maybe you'll have some (automatic) control over blower speed...

Most plants are only crudely sized to their dwellings and the emphasis seems to be more on how quickly the "living conditions" can be changed rather than how efficiently.

The controls typically are only concerned with simple things like time of day variation -- or, perhaps, "remote" control (phone/internet). Rarely smart control -- despite the fact that the thermostat has very little to do all day long, every day long!

Quote:

OP's thermostat has good use even for basic logging.
I have seen data logs of a thermostat/furnace predict maintenance problems.
A dirty flame-rod, causing sluggish ignition or false flame-out trips, a data log shows the heat taking too long to come up. You can actually forecast HVAC trouble, if your software is smart. Wouldn't it be good to know ahead of time your furnace or A/C is struggling.
I've instrumented the HVAC, here. So, I (i.e., my controller) can "notice" ignition trouble, clogged filters, calcified pads (evap cooler), reduced cooling/heating efficiency (i.e., how much energy it requires to make a given change in indoor temperature given knowledge of outdoor conditions), etc.

But, most folks wouldn't appreciate those capabilities when making a purchase (which is when they'd have to rationalize the additional cost/complexity). It's only after the controls start offering advice that their true value can be understood and appreciated!

evilkitty 12-15-2017 08:54 PM

Re: Looked at new thermostats, nah I'll DIY this
 
I have thought about adding a log feature, but had not decided on how i wanted to store it or in what format nor how to view it i never thought of using performance to check for needed repair work, though performance will vary with weather conditions

Curious.George 12-16-2017 12:22 AM

Re: Looked at new thermostats, nah I'll DIY this
 
Quote:

Originally Posted by evilkitty (Post 790656)
I have thought about adding a log feature, but had not decided on how i wanted to store it or in what format nor how to view it i never thought of using performance to check for needed repair work, though performance will vary with weather conditions

What you store and how you store it depends on the resources (i.e., free memory) you have available. Create a circular buffer (FIFO) and push data packets into it, expecting it to fill (sooner or later). Thereafter, the oldest data will be overwritten by new data.

How often you actually read the data will determine if any data is ever lost and, if so, how much. As long as you read it often enough to prevent a complete "wrap" of the FIFO, you're all set.

Don't "format" the data prettily as you insert it into the FIFO. Making things pretty usually makes them take up more space!

Instead, just jam the "raw" data in a terse form into the buffer. Pretty it up when you extract it and present it to the user!

So, you could make a packet that is just:

(time, ONorOFF)

If the HVAC came on at 12:34 and went off at 12:46 you would have:

(1234, ON)
(1246, OFF)

Of course, ON and OFF are really just one bit. And, if you are only representing time to 1 minute precision, then you can represent 24 hours (24hrs*60min) with an 11 bit value (0..2047 will allow you to represent the times of 0..1439).

So, the above example would be:

(754, 1)
(766, 0)

two 12 bit (11+1) entries.

Whatever "thing" (PC?) presents this information to the user (graph?) can be responsible for diagnosing any performance issues.

evilkitty 12-16-2017 08:23 AM

Re: Looked at new thermostats, nah I'll DIY this
 
when i said what format i mean like a array or sqlite
[{"on":1,"t":20556,"on2":0,"n":1513434346},{"on":1, "t":19832,"on2":1,"n":1513434436}]
on2 would be the aux heating, only set if unit in heat mode, so it doubles as a mode check
maybe i should use both and only dump it to the db every 100 entries or something
maybe i should store the log data on my other rpi

Curious.George 12-16-2017 12:57 PM

Re: Looked at new thermostats, nah I'll DIY this
 
Quote:

Originally Posted by evilkitty (Post 790740)
when i said what format i mean like a array or sqlite
[{"on":1,"t":20556,"on2":0,"n":1513434346},{"on":1, "t":19832,"on2":1,"n":1513434436}]
on2 would be the aux heating, only set if unit in heat mode, so it doubles as a mode check
maybe i should use both and only dump it to the db every 100 entries or something
maybe i should store the log data on my other rpi

As I said, it depends on the resources that you have available to throw at that aspect of the problem.

If you have a live connection to <something else>, then you can bundle up all of the data that you think may be of interest and spit it out -- and forget it, thereafter.

You can use a database as a "whiteboard" through which you share information among clients. So, you can regularly feed it tuples with "current conditions" (instead of just those times when you actually "take action"). This would allow something else to extract information of interest -- like just how hot the house gets on a winter day in the absence of active heating.

That "other thing" doesn't need to be able to query the thermostat directly (and the thermostat doesn't need to be able to respond to such queries). Instead, just look at the data in the database and extract the information of interest.

The thermostat can also "fetch" its operating parameters from a particular schema. In that way, it need not have a (complex) user interface; let something else (PC?) generate the operating parameters (e.g., pretty user graphics) and stuff them in that schema in an agreed-upon format.

RJARRRPCGP 12-28-2017 12:46 AM

Re: Looked at new thermostats, nah I'll DIY this
 
Quote:

Originally Posted by evilkitty (Post 786574)

the heating system at work is like you described, run 30 seconds off 30 second; rinse, wash, and repeat

Sounds just like a POS well pump that keeps losing pressure. A house in the boonies that I was in from September 1, 2004 to March 5, 2008, used to be connected to the old well, which had a pump like that, but a brand new well was installed in the first quarter of 2008, or the forth quarter of 2007. Good riddance!

redwire 12-28-2017 05:57 PM

Re: Looked at new thermostats, nah I'll DIY this
 
I watch TV and the heat from it (240W & CCFL) causes the thermostat to think the house is warmer. The two are 10 feet apart :duh:
Watch a movie and freeze.

evilkitty 12-30-2017 07:03 PM

Re: Looked at new thermostats, nah I'll DIY this
 
Quote:

Originally Posted by redwire (Post 793122)
I watch TV and the heat from it (240W & CCFL) causes the thermostat to think the house is warmer. The two are 10 feet apart :duh:
Watch a movie and freeze.

Here are a few solutions/workarounds
  • Move thermostat
  • Move TV
  • Get LED TV
  • move temp sensor
  • sit closer to TV

10ft seems like it would be enough space...

evilkitty 02-04-2018 06:47 PM

Re: Looked at new thermostats, nah I'll DIY this
 
I made the last couple years worth of adjustments public today
https://github.com/GM-Script-Writer-..._Pi_Thermostat
images and hardware info here:
https://github.com/GM-Script-Writer-...ter/html/notes


All times are GMT -6. The time now is 04:19 PM.

Powered by vBulletin ®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.