Microcontrollers Are Great
pins. If all you need is a circuit that alternately blinks
LEDs (like for a railroad crossing sign for your model train
track), then this circuit is perfect for you. Also, it will
probably only cost you a couple of dollars and you won’t
be putting your microcontroller to sleep.
Temperature Switch
Getting temperature readings is a very common
thing for any electronic hobbyist to do. You may have
a project in which you want an alarm to sound if your
freezer rises above a certain temperature or you may
want to be able to know if something gets too hot (like
the inside of a case). This can easily be done with a
microcontroller, but you can also do the same thing with
a few conventional electronic parts.
some fancy stuff with it if you want to, but I only used one
of the comparators for my circuit.
A comparator has two inputs and one output. One of
the inputs is set as a reference voltage and the other input
is the voltage you want to compare with the reference
voltage. If the input voltage reaches the reference voltage,
it sets the output to high. For instance, let’s say that you
want to know when a particular input reaches 6 volts
or more.
In this case, you would set your comparator to non-inverting and set your reference voltage to 6 volts. Then,
when your input reaches 6 volts or more, the comparator
will set the output to high. You can now read this output
and trigger another circuit, like an alarm, LED, etc.
Putting It Together
Temperature Probe
The first thing that is necessary when trying to read
a specific temperature is a temperature probe.
Temperature probes can usually read a range anywhere
from - 50°F to over 300°F. Most of them give an output in
voltage that is linearly proportional to the temperature of
the probe. These temperature probes are already calibrated
and are guaranteed to be accurate. Some read the
temperature in Fahrenheit and others in Celsius. The one
that I chose to experiment with is the LM34DZ. It can
operate on a supply voltage from 5 to 30 volts and
measures temperatures from 32°F to 212°F and each
degree of change will alter the output by 10 mV.
The Comparator
The LM34 will output a specific voltage for each
degree of temperature. In order to detect a specific
voltage from the LM34, you need a comparator. I used
the LM339 quad comparator because it is very common
and I had one lying around, but you could use any one of
the many comparators on the market today. The LM339
actually has four comparators onboard, so you can do
You can put these two devices together and come
up with a really great temperature switch. The complete
temperature switch is shown in Figure 3. This circuit is
very simple to build and easy to use.
Once the power is supplied to this circuit, you can
read what the voltage is at the output (pin 2) on the
LM34. You can use a voltmeter to do this. Place the
positive probe from the voltmeter to pin 2 of the LM34
and place the negative probe to ground. This will give you
an output voltage that corresponds to room temperature,
providing a good reference point from which you can figure
out what the voltage will be for a given temperature. On
the LM34, each degree change in temperature will
change the output voltage by 10 mV. Use this relationship
to figure out the reference voltage that you need, based
on the reference temperature you want.
Now, you can adjust the potentiometer so that the
reference voltage on pin 4 of the LM339 equals the
reference voltage you want (which corresponds to a
specific temperature). If you need better accuracy in
adjusting the voltage, you can use a potentiometer with a
higher value. You can stop adjusting the reference voltage
once you read the level you want. If the reference voltage
is not going to change, you can replace the potentiometer
with suitable fixed resistors.
Figure 3. Temperature switch circuit.
An Example
E
l
e
c
t
r
o
n
i
c
s
NUTS & VOLTS
F
o
r
E
v
e
r
y
t
h
i
n
g
+5v
3k
10k
1
4- 3
1/4 2
5 LM339
+ 12
Vout
LM34
2 10k
out
3
10M
66
Let me give you an example of how to accomplish
this. Let’s say you want to know when it reaches 100° outside.
The first thing you do is read what the output is on the
LM34 at room temperature. Let’s say that your voltmeter
reads 2.34 volts when the temperature is 72°. Now, figure
out the difference between the two temperatures, which is
28°. Take this number and multiply it by 0.01 ( 10 mV
change for each degree of change) and you get 0.28.
Then, add this number to 2.34 and you get 2.62. This is
the voltage that your reference voltage must be set to.
Adjust the potentiometer until the output reads 2.62 volts
and then stop. Your temperature switch is ready to go.
JULY 2004