You Are Here: Home » AVR ATmega Projects » Measure negative temperature with Lm35

# Measure negative temperature with Lm35

LM35 can measure temperatures from -55deg to 150deg and we need negative supply voltage for measuring this negative temperature.

This circuit eliminates the negative voltage power supply and this project can measure the negative temperature

### Bascom Code

```\$regfile = "m16def.dat"
\$crystal = 1000000

Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.0 , Rs = Portd.1
Config Adc = Single , Prescaler = Auto , Reference = Internal

Deflcdchar 0 , 12 , 18 , 18 , 12 , 32 , 32 , 32 , 32
Deflcdchar 1 , 32 , 4 , 12 , 28 , 28 , 32 , 32 , 32
Deflcdchar 2 , 32 , 4 , 14 , 31 , 31 , 32 , 32 , 32
Deflcdchar 3 , 32 , 4 , 14 , 31 , 31 , 7 , 6 , 4
Deflcdchar 4 , 32 , 4 , 14 , 31 , 31 , 31 , 14 , 4
Deflcdchar 5 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 32

Dim A As Word
Dim B As Word
Dim C As Single
Dim D As Byte

D = 1

Cursor Off
Cls
Locate 2 , 1
Lcd "avrprojects.info"

Do

C = A - B
C = C / 4
Locate 1 , 1
Lcd "Temp =" ; C ; Chr(0) ; "c   "
Locate 1 , 16
Lcd Chr(d)
Waitms 500
Incr D
If D > 6 Then D = 1

Loop

End```

For more Detail: Measure negative temperature with Lm35