Temperature Sensor Interfacing with 8051

Sensor Basics

Sensor is any device capable of sensing physical parameters (like temperature, pressure, proximity, etc) and then convert into electrical signals so that it can be used for processing.
So, robots have Camera, piezoelectric sensors, acoustic sensors, accelerometer, etc.

Now let’s move on to some of the fundamentals of sensors. We can measure Light, motion, temperature, magnetic fields, gravity, humidity, vibration, pressure, electrical fields, sound, and other physical aspects of the external environment can be measured using them. Of course there are different sensors for each purpose like IR sensors, proximity sensors, temperature sensors, tilt sensors, accelerometers, ultrasonic sensors, RADAR, SONAR, etc.

Every sensor in this world has three terminals:

  • Vcc – to power up the sensor
  • GND – to provide a fixed negative reference
  • Output – analog output of the sensor (in some sensors, there may be more than one output terminals)

The following block diagram demonstrates it.

temperature sensor

 

The sensor senses the physical parameters and gives a corresponding output. In most cases the output is analog.

LM35 Temperature Sensor

About LM35

LM35 is a precision centigrade temperature sensor.

  • It has three terminals – Vcc, Ground and Output – as shown in the adjoining diagram.
  • It has a sensitivity of 10mV/°C. This means that for every degree rise in temperature, the output voltage increases by 10mV.
  • In general, it gives a voltage of 0V at 0°C. Hence, say for an output of 450mV, the temperature is 45°C.

lm35

Interfacing Diagram


temperature sensor interfacing with 8051

Assembly Language Program for Interfacing


ORG 00h
ALE BIT P2.6
OE BIT P2.5
SOC BIT P2.6
EOC BIT P2.7
ADDR_A BIT P2.0
ADDR_B BIT P2.1
ADDR_C BIT P2.2
MYDATA EQU P1
MOV MYDATA,#0FFH
SETB EOC
CLR ALE
CLR SOC
CLR OE
BACK:
CLR ADDR_C
CLR ADDR_B
CLR ADDR_A
ACALL DELAY
SETB ALE
ACALL DELAY
SETB SOC
ACALL DELAY
CLR ALE
CLR SOC
HERE:JB EOC,HERE
HERE1:JNB EOC,HERE1
SETB OE
ACALL DELAY
MOV A,MYDATA
CLR OE
ACALL CONVERSION
ACALL DISPLAY
SJMP BACK

References

  • Created and developed by Prof.S.M.Wagh,SKNCOE
  • Interfacing diagram by Jayesh Gopal, Wikinote volunteer, SKNCOE
  • WikiNote Foundation

Last modified: Tuesday, 17 September 2019, 3:53 PM