Project 2 : Temperature Indicator



Description
-
Measures temperatures from -55°C to +125°C
-
Three LED's to indicate in what range the temparature is.
-
User definable thermostat with high and low settings
-
Output via a relay to control a heater element or a blower fan (or something else)
-
Power supply ......................4.5 to 5.5 VDC
-
Power consumption ...........15mA
This circuit uses a Dallas DS1621 temperature sensor which indicates the temparature of the device. The temperature sensor has an termal alarm output, which becomes high when the temperature of the device exceeds a user defined value. When the temperature drops below a user defined value, the alarm output becomes low. In this way any amonut of hysteresis can be programmed. The values are stored in a special register of the device that is nonvolatile. The signal of the alarm output is amplified by a BC557 PNP transistor, that drives a relay that can switch a heater element or a blower on or off. The temperature settings and readings are communicated to/from the device over a simple 2-wire serial interface. An ATMEL 90S2313 microcontroller controls the serial communication to/from the DS1621.The microcontroller also controls three LED, only one of the LED's is on when the temparature is within a certain range. The range of the temperature in which the LED's are on can be set by the user in the program code. The circuit needs to be powered by a 5V power supply, which can be obtained from a wall-wart.
Hardware
It contains only a few parts, a DS1621 temperature sensor, a attiny2313 micrcontroller,three LED's one relay and some resitors. I have made a little printed circuit board for it.
Software
The software for this projects is made with the AVR Bascom compiler
BASCOM Program Code
' *************************************************************************** ' * ' * Title : Temperature indicator ' * Version : 1.0 ' * Last Updated : 15.03.2003 ' * Target : At90s2313 ' * Author : r.meurs@planet.nl ' * Program code : BASCOM AVR ' * Hardware req. : Temperatue indicator board ' * ' * ' * Description ' * This application reads the temperature from an DS1621 temp. sensor ' * One of three LED's is on when the temperature is within a certain range. ' * ' **************************************************************************** Dim Tempmsb As Byte Dim Templsb As Byte Dim L_on As Byte Dim L_off As Byte Dim Tl As Byte Dim Th As Byte Dim Confg As Byte Dim Count As Byte Dim Slope As Byte Declare Sub Get_temp Declare Sub Write_th Declare Sub Write_tl Config Portb = Output Portb = 255 Config Sda = Portd.0 Config Scl = Portd.1 Cls Cursor Off Goto Main Sub Write_th I2cstart I2cwbyte &H90 I2cwbyte &HA1 I2cwbyte L_on I2cstop End Sub Write_th '-------------- Sub Write_tl I2cstart I2cwbyte &H90 I2cwbyte &HA2 I2cwbyte L_off I2cstop End Sub Write_tl '-------------- 'read TH I2cstart I2cwbyte &H90 I2cwbyte &HA1 I2cstop I2cstart I2cwbyte &H91 I2crbyte Th , Nack I2cstop '-------------- 'read TL I2cstart I2cwbyte &H90 I2cwbyte &HA2 I2cstop I2cstart I2cwbyte &H91 I2crbyte Tl , Nack I2cstop '-------------- 'read config I2cstart I2cwbyte &H90 I2cwbyte &HAC I2cstop I2cstart I2cwbyte &H91 I2crbyte Confg , Nack I2cstop '-------------- 'read counter I2cstart I2cwbyte &H90 I2cwbyte &HA8 I2cstop I2cstart I2cwbyte &H91 I2crbyte Count , Nack I2cstop '-------------- 'read slope I2cstart I2cwbyte &H90 I2cwbyte &HA9 I2cstop I2cstart I2cwbyte &H91 I2crbyte Slope , Nack I2cstop '-------------- Sub Get_temp: 'start convert I2cstart I2cwbyte &H90 I2cwbyte &HEE I2cstop '------------- 'read temperature I2cstart I2cwbyte &H90 I2cwbyte &HAA I2cstop I2cstart I2cwbyte &H91 I2crbyte Tempmsb , Ack I2crbyte Templsb , Nack I2cstop 'read config I2cstart I2cwbyte &H90 I2cwbyte &HAC I2cstop I2cstart I2cwbyte &H91 I2crbyte Confg , Nack I2cstop End Sub Get_temp '-------------- Main: L_on = 25 'if Temp > 25 the load will be switched on L_off = 20 'if Temp < 20 the load will be switched off Gosub Write_th Gosub Write_tl Loop: Wait 1 Gosub Get_temp Select Case Tempmsb Case Is < 21 : Portb = &B00000001 'if Temp <21 then the yellow LED is on Case 21 To 25 : Portb = &B00000010 'if Temp is between 21 and 25 then the green LED is on Case Is > 25 : Portb = &B00000100 'if Temp >25 then the red LED is on End Select Goto Loop
سلام . من اردلان هستم .25ساله . فارغ التحصيل مهندسی الکترونیک دانشگاه آزاد اسلامی واحد تهران جنوب ! عاشق الکترونیک و دنیای زیبای آن . در ضمن در زمینه موسیقی هم به آهنگ های آرش و نانسی عجرم علاقه مند هستم . با تشکر...!!!