EE 476: Laboratory 5

Digital Thermometer with fan


You will build a digital thermometer which displays temperature on a LCD display and controls a fan with user-selectable turn-on temperature.


The LM34 temperature sensor produces a voltage output of 10 mV/degree F. Note that the connections shown in the datasheet are the bottom view of the TO92 package (see below).

You will need to perfrom an analog-to-digital conversion using the mcu to read the voltage. For optimum accuracy, you will need to amplifiy the output of the LM34 by a factor of 2 (using an LM358 opamp) before feeding it into the A/D converter. Note that the LM358 is not rail-to-rail. For a 5 volt power supply, the output range is 0 to 3.0 volts. Filtering the opamp output may lower spike noise, but the output impedance of the circuit you use to filter should be less than 10Kohms. Use the scope to decide if you need a filter. The most accurate way to use the ADC requires that you use the internal voltage reference. For each different mcu that you use, you will need to measure Aref and use the measured value in your code.

You will need to drive a fan from the mcu. Fans have motors which can cause nasty inductive spikes to wipe out the transistors in the mcu port. The circuit shown below is fairly safe. An optoisolator completely isolates the MCU from the motor. The diode placed across the motor shorts out spikes when the motor is turned off. The resistor grounding the base of the phototransistor should be set for best falltime, probably around 1Mohm. The motor capacitor should start around 0.1uf. Increase it if there is too much spike noise on the analog input, but be sure to use ceramic capacitors, not electrolytic. Electrolytic capacitors are too slow. The pinout of the 4N35 optoisolator and BUZ73 are also shown.


Write a program and construct a circuit which will

You will demo all the features above to your TA.

Your written lab report should include:

Copyright Cornell University Dec 2007