Configuring FreeBSD to control HVAC
From Section6wiki
Contents |
Configuring FreeBSD to control HVAC
Why?
I recently discovered that having an efficient heating cycle, using a programmable thermostat, is quite expensive.
I was frustrated that the programmable thermostat that I wanted, because of its advanced features, would cost $150 - $250. For that price I could build a microcontroller to handle the thermostat. Then I remembered, I've got something even better that could do it; my FreeBSD server.
There isn't a reason for me to add yet another electronic device in my house since I'm already running the FreeBSD server 24/7. The FreeBSD server has a spare parallel port that is doing absolutely nothing.
Types of systems
Many residential homes have HVAC systems which include a thermostat that 'calls' for heat or air conditioning.
There are seven types of HVAC systems that are commonly used in residential homes:
24VAC
24 VAC are the most common types of thermostats used with forced air HVAC systems.
Heat Non-Heat Pump
This type if HVAC can be gas or electric and uses a blower to create 'forced' air circulation.
There are normally three wires that run from the HVAC unit to the thermostat.
| Description | Color |
| 24VAC Return | red |
| Call For Heat | white |
| Force Fan On | green |
When the white 'call for heat' line is attached to the red '24VAC return' line, the HVAC system will turn on the heating element. After the heating element reaches a critical temperature, the HVAC system then turns on the blower to cool the heating element which warms the house.
When the green 'force fan on' line is attached to the red '24VAC return' line, the HVAC system will turn on the blower. This will cause air circulation around the house but no heat will be produced.
Heat Non-Heat Pump
Heat/Cool Non-Heat Pump
Heat/Cool Single-Stage Heat Pump
Heat/Cool Multi-Stage Heat Pump
220VAC
Baseboard
These are common at most rental apartments and homes. They are cheap, inefficient, and possibly dangerous if you don't know what you are doing with 220VAC at 15 amps. These can be controlled but only with some _really_ big relays.
Millivolt
Gas
Millivolt thermostats are used with gas wall heaters. There is a thermocouple that sits just above the pilot light and creates a very small amount of current. When the circuit is closed, activated, the gas is turned on and heats the home. I'm not going to tell you how to use these because they are way too dangerous to use in general. If you have one of these, I would suggest removing it or move to a better home.
circuit interface
parallel port
Manning ppi reveals that the parallel port is the 'geek port.' It also reveals some sample source code that is used to switch a relay(s) to 'call for heat.'
To present the value 0x5a to the data port, drive STROBE low and then high again, the following code fragment can be used:
int fd;
u_int8_t val;
val = 0x5a;
ioctl(fd, PPISDATA, &val);
ioctl(fd, PPIGCTRL, &val);
val |= STROBE;
ioctl(fd, PPISCTRL, &val);
val &= ~STROBE;
ioctl(fd, PPISCTRL, &val);
Most people don't understand that you have up to 255 'devices' attached to the parallel port. The parallel port provides 8 bits of output, which can be multiplexed to switch those 255 devices.
There are two ways to switch a relay from the parallel port; directly attach the relay to an output or include some logic to create an address for the relay.
I choose to use some logic to create an address for the relay. This would make it tougher for the 'call for heat' to be accidentally activated.
I used a 74F153, 4 input multiplexer, as a "select" for the relay.
The number of address that will activate the relay can be calculated depending on how many outputs are used from the parallel port. For the 74F153 circuit, seven of eight available outputs from the parallel port are use. That leaves 2^(8-7) addresses for the relay.
1-wire
--Traitorous8 11:46, 9 Dec 2005 (PST)

