Bascom and AVR, a four LM92 temperature sensor system


My son was working a school project where the aim was to build a half-sphere with 24 lights (in groups of two) for use in a theatre. The lights are controlled with a DMX system. When he described his plans to me, I was worried about the temperature inside the half-sphere. I suggested mounting a few fans as well as making a temperature monitoring and display system. He asked me to build such a monitoring system and I agreed, thinking it would a simple job. Actually, breadboarding the system was, but eventually building the whole thing proved to be a lot of work as usual...

The system is divided into two parts: inside the half-sphere are four LM92 temperature sensors, which are connected to a small box containing an ATTiny2313 controller. This controller reads the four sensors and sends a temperature string over a low-speed RS232 cable to a display box which is close to the DMX light controllers. The display box has an ATMega32 which reads the temperature string and displays the result on a 240x128 graphics display using large digits. The ATMega32 also reads a potmeter to be used as a trip value. When one of the temperature exceeds this value, the display is repeatedly switched from normal to inverse as an alarm signal.

The sensor part.
The ATTiny2313 controller reads four LM92 temperature sensors. I used these sensors as they are a bit more accurate than the LM76 I described in the IC chapter.
The four sensors are mounted on a small PCB and connected with a short cable to the controller box:


The LM92 has two address pins, so the four sensors are set to IC adresses 00, 01, 10 and 11.
The controller schematic:


also has a Max232 to send the temperature to the display unit. The unit has an LCD to show the temperature, but it need not be connected once the half-sphere is in place.
In the sensor program , a CRC8 is calculated over the entire string sent. This is used in the display unit to check the validity of the received temperature string.

The display part.
A 240x128 graphics display with Toshiba T6963 controller is used. The ATMega32 reads the temperature string from the RS232 interface and display the temperatures using large size digits, so that the display can be read from some distance. The digits were made in the bmp format and converted to Bascom format (Tools\Graphic Converter):

Also, a drawing of the half-sphere (somewhat distorted to have more room for the display of the temperatures) is used as background:

The display is mounted in a plastic box:

and is connected to the sensor unit with a 15 meter long rs232 cable.
The display schematic:

shows the ATMega32 controller, a Max232 type interface chip, the graphics display with a CCFL converter for the backlight. The display also needs an adjustable negative voltage to set the contrast.
The display program checks the CRC8 of the received temperature string with the CRC8 included in the string itself. If the two do not match, the display shows an appropiate message. A message is also shown if no string is received for more than two seconds.

The ATMega32 is oversized for this purpose. A smaller controller such as the ATMega16 could be used instead. Note the remarks on ATMega fuse settings!

TOC