# Temperature sensor controlled by LM35DZ

Hello,

I want to make a temperature sensor, that outputs actual Celsius degree on two seven segments with both common anode type.

The project flowchart can be resumed as:

1. ADC input of the temperature (as a voltage) to PORTA.0
2. Math work to convert the digital data into understandable analog (voltage value) and not forgetting numerical multiplication which is specific to LM35DZ（details）. i.e when the temperature is 13 ℃, and after branching 5VDC to the sensor input terminals, it shows on the DVM 0.13 Volts that means we have to multiply by 100 to get the accurate voltage representing the real temperature.

I have used two 7seg common anode type, and connected the segments pins to PORTB and PORTC respectively for first digit, and second digit via 220Ohm resistor.

Following is a diagram of the circuit:

Following is the BASIC codE:

``````Define CLOCK_FREQUENCY = 20
Dim x As Word

main:
WaitMs 3000
x = x * 5 / 1023
x = x * 100
conditions:
If x = 15 Then
Low PORTB.1
Low PORTB.0
Low PORTB.5
High PORTB.6
High PORTB.7
High PORTB.4
High PORTB.2
High PORTB.3
High PORTD.0
Low PORTD.1
Low PORTD.2
Low PORTD.3
High PORTD.4
Low PORTD.5
Low PORTD.6
High PORTD.7
Endif
If x > 15 And x < 16 Then
Low PORTB.1
Low PORTB.0
Low PORTB.5
High PORTB.6
High PORTB.7
High PORTB.4
High PORTB.2
High PORTB.3
High PORTD.0
Low PORTD.1
Low PORTD.2
Low PORTD.3
High PORTD.4
Low PORTD.5
Low PORTD.6
High PORTD.7
Endif
If x > 13 And x < 17 Then
Low PORTB.1
Low PORTB.0
Low PORTB.5
High PORTB.6
High PORTB.7
High PORTB.4
High PORTB.2
High PORTB.3
High PORTD.0
Low PORTD.1
Low PORTD.2
Low PORTD.3
High PORTD.4
Low PORTD.5
Low PORTD.6
High PORTD.7
Endif

Goto main

End
``````

This was a trial code, since I was sure that the temperature is no more ±10% less/bigger than 15 degrees Celsius.

For power circuits I have used an LM7805 with 0.33uF between input and GND and 0.1uF between output and GND to feed PIC, LM35DZ as well as the seven segments display but it went too hot!! so I added another 7805 to feed the LM35DZ and seven segments display while the first one stood the for PIC circuit only:

The regulator used for the PIC circuit still goes extremely hot, while the other used for sensor and displays doesn’t get hot at all.

What causes the first 7805 to get that hot, and are there any errors with the circuit?