Furnace Blower Speed Controller
This was my first PIC project, using a PIC16F84A as a timer to replace a device I had previously built that used two time-delay relays to control a blower motor. The PIC was an ideal device for the application, allowing for better control of the blower through the various states of operation. This could not be done with the time delay relays.
A
word of caution. Furnaces are not fun appliances to fool around with,
and you don't want to goof anything up. The schematic diagram that came
with my furnace was only an outline and lacked much of the detail. If
you're not sure of what you're doing, it is best to leave it alone.
In my old gas furnace, I observed that when the heat came on, there was a delay of around a minute between the time the burner ignited and the time the blower kicked into high speed. There was a similar delay when the burner shut off, to when the blower dropped back to slow speed. This makes sense, because you don't want cold air blowing around until the system heats up, and you want to run the system on high until the air in the system cools down. You may have the fan running on low speed all the time, or just have it off when the furnace is not running. Interestingly, both of these delays were provided by a mechanical system with a temperature sensor.
Then I replaced the old furnace with a nice new one. It provided the turn on delay, but not at turn off. This was disappointing, particularly since the new furnace had a controller board, so it should have been a simple thing for them to do. My response at the time was to dig out two old time delay relays from my junk box, and wire up a contraption that would delay the blower the way I liked.
When I started working with microcontrollers, it occurred to me that one thing they do really well is waste time. It was a perfect application for my furnace blower, to replace the delay relay box, and have the unit work better too. There were circumstances under which the delay relays did not respond properly; for example when the burner comes on and you manually turn it off before the 1st delay was over, it would still kick into high speed even though the furnace was off.
This unit is connected to the furnace at two points. The first is the terminal strip where the thermostat connections go. There are several terminals marked with a single letter. As I mention in my thermostat article, the furnace is run off of a 24 VAC transformer, and the secondary leads are called "C", which is common or ground, and "R". Normally the "R" lead goes to the thermostat and is switched back to the "W" terminal for heat. I use the 24VAC at "R" to power the project through R2, D2, U1 and U2. I use the signal at "W", conditioned by R5, D3 and U3 to tell the PIC when the heat is on at the thermostat.
The second point of connection is the blower. The blower has 4 possible speed settings, determined by which one of 4 wires gets 117VAC power. In the heat setting, the furnace controller drives two of these, one when the heat is off and the other when the heat is on. What I do is disconnect these wires and bring them to pins 6 (BL-Brn) and 7 (BL-Red) of my project. Pin 5 goes to the "H" terminal on the furnace controller, which is just a source of 117VAC from the mains. So I bypass the furnace controller as far as the blower is concerned, and control it myself with RLY1. By the way, RLY1 should be a fairly robust unit, since the blower runs 117VAC at a few amps (My relay is a DPDT unit, and I put the two sides in parallel.) Q1, the 2SD313, is a general purpose NPN power transistor, chosen only because of its presence in my junkbox. Any NPN transistor capable of switching 1 amp should work here. All of the unmarked diodes are general purpose rectifiers such as 1N4003.
Now its all up to the PIC to decide which speed the blower should run at. The code in the PIC implements a state machine. State 1, the default, polls for the heat signal to come on, which is RA3 going high. State 2 introduces a 1 minute delay, as long as RA3 remains high. State 3 polls for the heat to go off (RA3 low). Then state 4 introduces another 1 minute delay.There are 4 LEDs, which are probably not necessary, that display the state of the system. LED1 is a simple "alive" LED, flashing on and off, telling me that the program is running (hopefully). LED2 (SW Heat) is on when the program senses the heat on signal at RA3. LED3 (SW Relay) indicates the state of RB0 and therefore the relay. LED4 (HW Heat) monitors the actual state of RA3.
You might wonder at this point what happens when I use A/C? Heating mode uses the slowest speed and the next to highest speed. In cooling mode, when the A/C is on, the highest fan speed is used, selected by the furnace controller.
I ran this controller for a year before it hung. I presume that
the reason was probably a power glitch. It ran fine for another while,
then hung again. So I implemented the internal watchdog timer, and in
several years now it has not failed.

Download ASM source code for the Controller