View Full Version : A/C Thermostat

09-16-2007, 11:48 PM
G'day all,

While I'm in the posting mood I thought I'd post my first ever prop project (In fact, the reason I got back into electronics/micros in the first place).
It is my first ever propeller code, so be gentle :)

My servers have their own room with their own Window A/C. This has an old mechanical thermostat in it which is not as good as it could be. (actually, it's complete crap)
Turns out the compressor was on about 95% of the time and it was costing me a fortune to run.

Anyway, long story short. The addition of an SSR (Solid State Relay) in the A/C to control the compressor, an Optocoupler to verify the compressor is powered and 3 DS18S20 temp sensors...
One at the discharge point, one on the intake point and one outside to measure the temperature in the light well, and I had a reasonably functional unit.

It only uses the intake temp sensor for the thermostat functions, but the other 2 are for me to monitor what is going on via the PC.

It tracks total compressor on/off time in seconds, duty cycle in %, a 128 sample moving average of the intake temperature and it reports all this to the PC in a comma delimited string any time
the temperature or compressor state changes. All variables are adjustable via the terminal console and a timed compressor override is built in.

The thermostat communicates with the PC using a USB-serial link (this used to be a www.elexol.com USBMOD4 FTDI FIFO (as I wanted to learn how to interface those) but in the interests
of "eating ones own dogfood" it's just been converted to my USB_Serial_003 CDC-ACM uart).

The code is sparsely (read almost not) commented, so the IO is as follows

Pin 18 is the compressor on signal (inverted) from the optocoupler inside the A/C
Pin 19 is the compressor activate signal

Pin 20 is USB D-
Pin 21 is USB Enable 3.3k to D-
Pin 22 is USB D+

Pin 24 is the Discharge air DS18S20 data pin
Pin 25 is the Outside air DS18S20 data pin
Pin 26 is the Intake air DS18S20 data pin

Pins 0-11 were the USBMOD4, now spare

The DS18S20's are wired in 3 pin mode with VDD connected to +5V on the proto-board, the data lines are pulled up to 3.3v by 4.7k resistors

This little thermostat probably cost me about $50 USD by the time I bought the parts and paid the shipping, but it paid for itself in another week or two (it's been running for about 8 weeks now)

Never know.. someone might find it useful.


09-19-2007, 07:46 AM

Thanks for posting about your Propeller controlled thermostat. It looks interesting. I happen to be contemplating a similar project myself.

Do you have a schematic diagram you can share?
If not, what SSR did you use?

Thanks for posting this!

- Sparks

09-19-2007, 05:33 PM
No real schematic as such unfortunately.

The SSR came from futurlec - http://futurlec.com/Relays/SSR5A.shtml
The prop just drives it directly from a port pin (via a 100 ohm protection resistor). It's wired in parallel with the existing mechanical thermostat.

I built the whole A/C interface on Vero board observing plenty of separation between the low voltage and high voltage sides, then I used a dremel to grind off all the excess copper and provide
extra separation. After that I coated the entire copper side of the board with high voltage RTV silicon. The board is bolted inside the existing control box using cut down rawl plugs as standoffs.
It's all very rugged, but pretty hackish. Next time I have the A/C out for servicing (the dust in the air here means it has to be completely disassembled and cleaned every 6-9 months) I'll try
and remember to pull it to bits and take some photos.

The opto coupler was salvaged from an old Benq DLP projector PSU board. It's driven directly from the 240V compressor supply with a series resistor/capacitor combo.
Again, I just used a low value, very high voltage cap I had floating about. Wish I'd taken pics of the board now.. (or even written down the component values!)

The opto turns on when the compressor is on and pulls a port pin on the prop to ground (pin 19) which is pulled to +3.3V using a 10K resistor.
I did this as I've left the mechanical thermostat in circuit set to a fairly high temp as an emergency override (in case the prop circuit fails) and I wanted feedback to see if the compressor was
running when it was supposed to be.

It's all _very_ simple, but it's turned out to be incredibly flexible and very reliable.
The prop part is built from a Propeller Proto board and just hacked together.

One mistake I made was with the USB lead. I wired the USB shield and Gnd wire both to VSS, which has caused an odd problem on 1 of my 4 usb ports. Separating the shield
out and just insulating it solved that problem.

If nothing else, it taught me a bit about the flexibility of Spin.

Ken Peterson
09-24-2007, 07:33 AM
I've been thinking of making a replacement for my programmable thermostat in my home that will keep track of how often and how long the furnace / AC runs. I'd like to make it wireless and tie it into my home automation system as well. The one I have has a timer, but that's no fun! http://forums.parallax.com/images/smilies/wink.gif


The more I know, the more I know I don't know. Is this what they call Wisdom?

09-24-2007, 05:11 PM
The main reason I did that is to be able to monitor the duty cycle as I make tweaks to the control algorithms/setpoints..
I monitor the PC's using their on-board sensors and graph that via MRTG.. and I have 3 years of history there to examine, so I can tweak the settings
to get minimum duty cycle and maximum power savings while ensuring the PC's stay at the temp I want them at. (Hard disks mainly)..

In two months the energy saving has paid for the proto-board and all the parts, plus I've had a lot of fun.
I thought hobbies were supposed to *cost* money? (Well, let's not count the $$$ I've just spent on parts while debugging this damned USB stack!)