This project shows the temperature on a three digit 7-segment display, it measures the temperature from -9.5 to 99 degrees Celcius in 0.5 C steps, or from 0 to 210 degrees Fahrenheit in 1.0 degrees steps.
Because of the LED display the temperature is also readable in the dark. This project is available pre-assembled and tested at www.bizztronix.eu
The TCN75 from MicroChip is used to measure the temperature. The TCN75 has a 2 wire serial interface, which is a bidirectional bus with a speed up to 400Kbs. Up to eight devices of the same type can be controlled by the bus. In this case only one device is connected to the ATTiny2313 microcontroller. The 2 wire bus is also called I2C, this name is proprietery to the Philips Electronics company. I2C is a abbreviation for IC Inter Circuit. The TCN75 has also a build in programmable thermostat, which is not used in this circuit.
Schematic and layout
The ATTiny2313 is used the control the two wire serial interfacing with the TCN75 and to translate the information for showing on the three digit 7-sement display. The reading of the temperature from the DS1621 happens every 3 seconds. A ceramic resonator is used for clocking the microcontroller.
The three 7-segment displays are of the common cathode type, at each cathode the display is connected to a transistor for ampifying the current. The transistors are of the NPN type and are controlled by the ATTiny2313 microcontroller. Each segment of the display is connected to a 200 Ohm resistor to limit the current of the ATTiny2313 port. The multiplexing of the three displays is handled in the software. Each display lights up consecutively for 5ms seconds. The LED digits have a height of 14,2mm (0.56").
The circuits needs a 5V DC regulated power supply and draws about 50mA current. It can also be supplied with three 1.5 volt batteries, but then the brightness of the LED's will be less. Three D-type batteries will last for about one month.
The program is written in the BASCOM-AVR programming language. The program uses about 1Kb of the 2Kb flash memory that the ATTiny2313 has. There are two different programs that you can use, for Celsius and for Fahrenheit read out. BASCOM is a programming language for AVR-microcontrollers based on BASIC, a demo version can be downloaded for free and can be used for up to 4Kb of programming code. BASCOM has special commands for driving chips with the two wire interface. Below you can download the program code and the hex files for the Celsius and the Fahrenheit mesurement. The BASCOM program compiles the program code into the hex-file that can then be loaded into the microcontroller to make the circuit work. BASCOM has also a build-in programmer to get the hex-file into the microcontroller. If you have the STK500 you can directly program the code from BASCOM into the microcontroller. Or you can use the parallel port program cable and the Attiny2313 board and the Pony-Prog program to get the code into the microcontroller.