EE 476: Laboratory 5

Talking 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. When a button is pushed the temperature is spoken as digits.


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 produce an analog output in the form of a PWM signal which will be filtered using a simple RC circuit to low pass filter the analog signal. Use a big enough resistor so that you don't load the port pin, and small enough to be below the input resistance of the TV audio input (30 kohm). You should set the RC time constant to about 10 times the period of the PWM. The output of the lowpass filter will go to the audio input of the TV. The PWM signal will be spoken digits taken from a compressed flash table. See the speech synthesis and comression page for more details, the table and example code. The software you need to use is in the DPCM section of the page. Use the timer0 fast PWM mode with the prescalar set to 8 to produce about 7812 samples/sec. You can reduce the PWM sample noise by setting the PWM to full speed 62,500/second, turning off the PWM interrupt, then using another timer to update the PWM output compare register at 7812/second.

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 UniversityDec 2006