Badcaps.net Forum
Go Back   Badcaps Forums > General Topics > Custom Tweaks, Modifications, and Revisions
Register FAQ Calendar Search Today's Posts Mark Forums Read

 
Thread Tools Display Modes
Old 11-26-2017, 06:59 AM   #1
evilkitty
Member
 
evilkitty's Avatar
 
Join Date: Nov 2017
City & State: VA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Knowledge Seeker
Posts: 60
Default 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
evilkitty is offline   Reply With Quote
Old 11-26-2017, 07:12 PM   #2
ratdude747
Black Sheep
 
ratdude747's Avatar
 
Join Date: Nov 2008
City & State: Madison, IN
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Professional Tech
Posts: 15,337
Default 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.
__________________


(Insert witty quote here)
ratdude747 is offline   Reply With Quote
Old 11-26-2017, 08:33 PM   #3
evilkitty
Member
 
evilkitty's Avatar
 
Join Date: Nov 2017
City & State: VA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Knowledge Seeker
Posts: 60
Default 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

Last edited by evilkitty; 11-26-2017 at 08:34 PM..
evilkitty is offline   Reply With Quote
Old 11-26-2017, 09:03 PM   #4
ratdude747
Black Sheep
 
ratdude747's Avatar
 
Join Date: Nov 2008
City & State: Madison, IN
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Professional Tech
Posts: 15,337
Default 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.
ratdude747 is offline   Reply With Quote
Old 11-27-2017, 06:16 AM   #5
evilkitty
Member
 
evilkitty's Avatar
 
Join Date: Nov 2017
City & State: VA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Knowledge Seeker
Posts: 60
Default 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
evilkitty is offline   Reply With Quote
Old 11-28-2017, 10:21 AM   #6
desert-rat
Badcaps Veteran
 
Join Date: Mar 2014
City & State: Avondale AZ
My Country: USA
I'm a: Knowledge Seeker
Posts: 2,256
Default 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.
desert-rat is offline   Reply With Quote
Old 12-01-2017, 12:43 PM   #7
redwire
Badcaps Veteran
 
Join Date: Dec 2010
City & State: Alberta
My Country: Canada
Posts: 782
Default Re: Looked at new thermostats, nah I'll DIY this

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
Attached Images
File Type: jpg Honeywell bimetallic mercury thermo.jpg (71.8 KB, 10 views)
File Type: jpg Honeywell thermostat pic.jpg (194.6 KB, 10 views)

Last edited by redwire; 12-01-2017 at 01:09 PM..
redwire is offline   Reply With Quote
Old 12-02-2017, 10:03 AM   #8
evilkitty
Member
 
evilkitty's Avatar
 
Join Date: Nov 2017
City & State: VA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Knowledge Seeker
Posts: 60
Default Re: Looked at new thermostats, nah I'll DIY this

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
Attached Images
File Type: png Screenshot_2017-12-02_11-01-35.png (856.8 KB, 7 views)

Last edited by evilkitty; 12-02-2017 at 10:05 AM..
evilkitty is offline   Reply With Quote
Old 12-02-2017, 01:47 PM   #9
redwire
Badcaps Veteran
 
Join Date: Dec 2010
City & State: Alberta
My Country: Canada
Posts: 782
Default 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.
redwire is offline   Reply With Quote
Old 12-02-2017, 06:07 PM   #10
evilkitty
Member
 
evilkitty's Avatar
 
Join Date: Nov 2017
City & State: VA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Knowledge Seeker
Posts: 60
Default 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
evilkitty is offline   Reply With Quote
Old 12-04-2017, 05:45 PM   #11
Curious.George
Member
 
Join Date: Nov 2011
Posts: 81
Default Re: Looked at new thermostats, nah I'll DIY this

Quote:
Originally Posted by evilkitty View Post
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 :> ]
Curious.George is online now   Reply With Quote
Old 12-07-2017, 05:18 AM   #12
sam_sam_sam
Badcaps Veteran
 
Join Date: Jul 2011
City & State: Sunny Jacksonville FL
My Country: USA
Line Voltage: 120 Volts 60 HZ
I'm a: Knowledge Seeker
Posts: 707
Default Re: Looked at new thermostats, nah I'll DIY this

Quote:
Originally Posted by evilkitty View Post
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
__________________
9 PC LCD Monitor
6 LCD Flat Screen TV
30 Desk Top Switching Power Supply
10 Desk Top Power Supply
10 Battery Charger Switching Power Supply for Power Tool
6 18v Lithium Battery Power Boards for Tool Battery Packs
1 XBox 360 Switching Power Supply and M Board
25 Servo Drives 220/460 3 Phase
6 De-soldering Station Switching Power Supply 1 Power Supply
1 Dell Mother Board
15 Computer Power Supply
1 HP Printer Supply & Control Board * lighting finished it *


These two repairs where found with a ESR meter...> Temp at 50*F then at 90*F the ESR reading more than 10%

1 Over Head Crane Current Sensing Board
2 Hem Saw Computer Stack Board

All of these had CAPs POOF
All of the mosfet that are taken out by bad caps

Last edited by sam_sam_sam; 12-07-2017 at 05:25 AM..
sam_sam_sam is offline   Reply With Quote
Old 12-08-2017, 12:35 AM   #13
Curious.George
Member
 
Join Date: Nov 2011
Posts: 81
Default Re: Looked at new thermostats, nah I'll DIY this

Quote:
Originally Posted by redwire View Post
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"]
Curious.George is online now   Reply With Quote
Old 12-09-2017, 01:33 PM   #14
redwire
Badcaps Veteran
 
Join Date: Dec 2010
City & State: Alberta
My Country: Canada
Posts: 782
Default 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.
redwire is offline   Reply With Quote
Old 12-09-2017, 04:09 PM   #15
Curious.George
Member
 
Join Date: Nov 2011
Posts: 81
Default Re: Looked at new thermostats, nah I'll DIY this

Quote:
Originally Posted by redwire View Post
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!

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!
Curious.George is online now   Reply With Quote
Old 12-11-2017, 01:25 PM   #16
redwire
Badcaps Veteran
 
Join Date: Dec 2010
City & State: Alberta
My Country: Canada
Posts: 782
Default 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.
redwire is offline   Reply With Quote
Old 12-11-2017, 02:55 PM   #17
Curious.George
Member
 
Join Date: Nov 2011
Posts: 81
Default Re: Looked at new thermostats, nah I'll DIY this

Quote:
Originally Posted by redwire View Post
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!
Curious.George is online now   Reply With Quote
Old Yesterday, 08:54 PM   #18
evilkitty
Member
 
evilkitty's Avatar
 
Join Date: Nov 2017
City & State: VA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Knowledge Seeker
Posts: 60
Default 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
evilkitty is offline   Reply With Quote
Old Today, 12:22 AM   #19
Curious.George
Member
 
Join Date: Nov 2011
Posts: 81
Default Re: Looked at new thermostats, nah I'll DIY this

Quote:
Originally Posted by evilkitty View Post
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.

Last edited by Curious.George; Today at 12:23 AM..
Curious.George is online now   Reply With Quote
Old Today, 08:23 AM   #20
evilkitty
Member
 
evilkitty's Avatar
 
Join Date: Nov 2017
City & State: VA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Knowledge Seeker
Posts: 60
Default 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

Last edited by evilkitty; Today at 08:26 AM..
evilkitty is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Badcaps.net Technical Forums 2003 - 2017
Powered by vBulletin ®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
All times are GMT -6. The time now is 12:45 PM.

Did you find this forum helpful?