QUESTIONS & ANSWERS
■ FIGURE 7
but neither will count for five
seconds using the internal clock, so
an external clock is needed (LM555
oscillator). TMR0 has a max count of
255 so the clock has to be 51 Hz to
overflow in five seconds (actually
4.999 sec.). When TMR0 overflows,
an interrupt flag is set at bit 2 of the
INTCON register (INTCON. 2).
The schematic is Figure 5 and
the PICBASIC program is Figure 6.
As usual, I can send you a
programmed PIC12F675 for $5.00;
just send your request to me in care
of Nuts & Volts.
FAN CONTROL
QI would like to automatically turn on an exhaust fan only when the outside temperature and humidity
is less than the inside temperature
and humidity. Thank you for your help.
— McLouis Robinet
AThe humidity sensor is a linear IC; a little taller than a TO-92 package. It is ensitive to light so it
should be shielded from sunlight, as
well as from rain. The temperature
sensor is a thermistor which is
nonlinear but since I am only
comparing them, the nonlinearity is
not a problem. The comparators
(Figure 7) have positive feedback to
provide hysteresis for clean switching.
When the outside temperature is low
(resistance is high), the signal to the
negative input of IC3A is high
causing the output to be low. When
the outside humidity is low, the signal
to the positive input of IC3B is low,
causing the output to be low. The
74HC02 NOR gate is also an
inverted AND. When both inputs are
low, the output is high, turning on
Q1 and energizing the relay. NV
December 2010 27