Thermometer with PIC Microcontroller

Summary of Thermometer with PIC Microcontroller


This tutorial demonstrates building a PIC microcontroller-based digital thermometer using an LM35 sensor and multiplexed seven-segment displays. The project utilizes the PIC's internal ADC to read temperature data, which is then displayed on the screen via persistence of vision techniques. Key concepts include multiplexing, ADC usage, and sensor interfacing.

Parts used in the PIC Thermometer Project:

  • PIC Microcontroller (PIC18FXXXX Series)
  • LM35 Temperature Sensor
  • Multiplexed Seven Segment Display
  • PIC Development Board
  • Expansion Board
  • HI-TECH C Compiler

In the last tutorial we learn about the multiplexing technique used with seven segment displays. We learnt how it saves i/o line by using persistence of vision. Only one digit is lit at a time, but to a human eye it is too fast to catch, so we see all four digit lit the same time. In this tutorial we will make a practical use of multiplexed seven segment displays. We will use them to show current room temperature using a LM35 temperature sensor.

Before reading further make sure you know the following concepts

Schematic for PIC Thermometer

Please note that this schematic is slightly different from our previous schematic on multiplexed seven segment display. The display select i/o pins were RA0,RA1,RA2,RA3 on that schematic. But in this schematic the display lines are RA1,RA2,RA3,RA4 this is because RA0 is used as analog input channel for LM35′s output.

PIC Thermometer using LM35

Multiplexed Seven Segment wiring

We use our PIC Development Board for making the above demo project. The PIC Development Board has all the core circuitry to sustain the MCU while the project specific part is developed on the expansion board.

Multiplexed Seven Segment Display SetupThermometer with PIC Microcontroller schematich

HI-TECH C Code for Thermometer Project

/********************************************************************

LM35 Temperature Sensor INTERFACING TEST PROGRAM

---------------------------------------------------------
Simple Program to connect with LM temperature sensor using the
internal ADC of PIC MCU.

The program displays the current environment temperature on
LED Module.

MCU: PIC18FXXXX Series from Microchip.
Compiler: HI-TECH C Compiler for PIC18 MCUs (http://www.htsoft.com/)

Copyrights 2008-2011 Avinash Gupta
eXtreme Electronics, India

For More Info visit
http://www.eXtremeElectronics.co.in

Mail: [email protected]

********************************************************************/
#include <htc.h>

#include <math.h>

#include "types.h"

#define _XTAL_FREQ 20000000ul

//Chip Settings
__CONFIG(1,0x0200);
__CONFIG(2,0X1E1F);
__CONFIG(3,0X8100);
__CONFIG(4,0X0081);
__CONFIG(5,0XC00F);

 

For more detail: Thermometer with PIC Microcontroller

Quick Solutions to Questions related to PIC Thermometer Project:

  • How does multiplexing save I/O lines?
    Multiplexing saves I/O lines by lighting only one digit at a time so fast that the human eye sees all digits lit simultaneously due to persistence of vision.
  • What is the purpose of the LM35 sensor in this project?
    The LM35 temperature sensor is used to measure the current room temperature for display on the seven-segment module.
  • Which pins are used for display select lines in this schematic?
    The display select I/O pins used in this schematic are RA1, RA2, RA3, and RA4.
  • Why is pin RA0 not used for the display?
    Pin RA0 is used as the analog input channel for the LM35 output instead of being part of the display lines.
  • Can I use this code with any PIC microcontroller?
    The program is designed for the PIC18FXXXX Series from Microchip.
  • What compiler is required for this HI-TECH C code?
    The project requires the HI-TECH C Compiler for PIC18 MCUs.
  • How is the temperature data processed?
    The program connects with the LM35 sensor using the internal ADC of the PIC MCU to process the data.
  • Where is the core circuitry located for this demo?
    The core circuitry to sustain the MCU is located on the PIC Development Board.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter