Quantcast
Channel: temperature | Battery Guide
Viewing all articles
Browse latest Browse all 365

Interfacing PIC12F1822 with 1602 LCD and LM35 temperature sensor

$
0
0

This post shows a simple interfacing of PIC16F1822 microcontroller with 16×2 LCD and LM35 analog temperature sensor.

Interfacing PIC12F1822 with 1602 LCD and LM35 temperature sensor
The LM35 temperature sensor is a three pin device (VCC, OUT and GND) with an output voltage linearly related to Centigrade temperature. Since the LM35 output varies with dependent to the temperature we need ADC (Analog-to-Digital Converter) module to measure this voltage.
The LM35 output has linear +10mV/°C scale factor means the following:
If the output voltage =   10mV —> temperature =   1°C
If the output voltage = 100mV —> temperature = 10°C
If the output voltage = 200mV —> temperature = 20°C
If the output voltage = 370mV —> temperature = 37°C
and so on.
LM35 Futures (from datasheet):

  • Calibrated Directly in ° Celsius (Centigrade)
  • Linear + 10 mV/°C Scale Factor
  • 0.5°C Ensured Accuracy (at +25°C)
  • Rated for Full −55°C to +150°C Range
  • Suitable for Remote Applications
  • Low Cost Due to Wafer-Level Trimming
  • Operates from 4 to 30 V
  • Less than 60-μA Current Drain
  • Low Self-Heating, 0.08°C in Still Air
  • Nonlinearity Only ±¼°C Typical
  • Low Impedance Output, 0.1 Ω for 1 mA Load

The ADC module converts analog data into digital data. The PIC12F1822 MCU has a 10-bit ADC module and a built-in fixed voltage reference (FVR) which makes it a good choice for this application. With the fixed voltage reference we get approximately an exact result. Normally negative and positive references of the ADC module are VSS and VDD respectively, but VDD is not exactly equal to 5.00V and here we should use the fixed voltage reference as a positive reference of the ADC module.
The PIC12F1822 has 3 fixed voltage references: 1.024V, 2.048V and 4.096V. For example if we set the fixed voltage reference to 4.096V and the ADC module is configured so that the negative and the positive references are VSS and FVR (Fixed Voltage Reference) respectively, in this case the equivalent 10-bit digital value of 4.096 is 1023 and 3.00V is 3.00 * 1023/4.096 = 749 , and so on.
In this project I used FVR = 1.024V because the LM35 output is generally less than 1V and also it gave me better result (let’s say higher resolution). Now the ADC module works in the interval between 0 and 1.024V.

Interfacing PIC12F1822 with 1602 LCD and LM35 temperature sensor schematic
The temperature value is displayed on 1602 LCD display. This LCD is interfaced with the microcontroller using 74HC595 (74HC164 …..) shift register as what was done in this post:
Interfacing PIC12F1822 microcontroller with LCD display
Hardware Required:

  • PIC12F1822 microcontroller
  • LM35 temperature sensor  — datasheet
  • 1602 LCD screen
  • 74HC595 shift register
  • 10K ohm variable resistor
  • Breadboard
  • 5V voltage source
  • Jumper wires

Read more: Interfacing PIC12F1822 with 1602 LCD and LM35 temperature sensor 

The post Interfacing PIC12F1822 with 1602 LCD and LM35 temperature sensor appeared first on PIC Microcontroller.


Viewing all articles
Browse latest Browse all 365

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>