Unfortunately, in my house, the pump that controls the water flow and the thermostats around the house that control the fans are independent of each other. This circuit is an initial attempt to get the fans and water pump to coordinate their activity so that the house can be heated properly. The fans and water pump on the first floor are usually on at the same time since their respective thermostats are right next to each other. The upstairs is a totally different story. If the room is too cold, the fan comes on whether hot water is flowing or not. Since the pump isn't usually on, this means that the fan is just wasting electricity and blowing cold air. For now this circuit simply keeps the fan from coming on in this scenario. In future versions, I hope to add some sort of mechanism for this controller to tell the pump to turn on.
This is work in progress and dangerous because it deals with AC control. If you decide to build this, proceed at your own risk.
Step 1: Controller Circuit Board
I will repeat the warning that most people use for transformerless power supplies. They are dangerous because they are not isolated from the main. I've included a fuse and a surge protector in the circuit to help mitigate risks. The power supply design is based of several examples on the internet as well as one in a UL approved thermostat that I took apart. I used this type of power supply for space & cost reasons. It needs to be cheap and small enough to fit in the wall next to my heating fans. Proceed at your own risk.
The triac circuit is copied directly from the MOC3031M datasheet. The MOC3031M is an opto-isolator that sits between the microcontroller and the triac controlling the fan.
The microcontroller part of the circuit is a very simple. It monitors the pipe temperature using a 10k thermistor that is connected to an analog input pin. It uses a digital output pin to turn the fan on and off. The microcontroller firmware is very straight forward. It periodically measures the temperature and turns the fan on if the temperature is high enough. If the temperature drops below a certain level the fan is turned off. The code uses hysteresis to prevent the fan from turning on and off rapidly.
Step 2: Build the Enclosure
Step 3: Connect Controller to Fan
Before opening the fan's electrical box make sure that power to the fan is turned off. Go to the house's main power box and turning off the breaker that sends electricity to the thermostat.
Now that the power is off, add the black wire from the controller to the wire nut that connects the thermostat & fan black wires together. Next unscrew the wire nut for the white wires. Connect the white wire from the thermostat to the red wire from the controller. Connect the white wire from the fan to the yellow wire from the controller. Make sure all the connections are secure and then place the wires back in the box and replace the metal plate before restoring the power.
You can now test the circuit by turning the thermostat to a temperature that would normally cause the fan to come on. You should hear the thermostat's relay trigger to turn the fan on. If hot water is flowing through the pipe then the fan should come on. If the pipe is cold because no water is flowing then the fan should not come on. Turn the water pump on and off to verify that the fan turns on and off at the proper time. The fan will not turn off as soon as water stops pumping because the warm water in the pipe will stay warm for quite a while after it has stopped moving. The fan being on will cool the water though and the fan will eventually turn off.