You are on page 1of 13

1/20/2016

TemperatureSensorusingPICmicrocontroller

HOME

PROJECTS

GENERAL ARTICLES

TUTORIALS

PROJECT IDEAS

PROJECT SERVICES

Temperature sensor using


PIC16F877A
microcontroller
BILAL Malik
July 26, 2014
31 Comments

PIC microcontrollers

ADVERTISEMENT

Emaar
Luxury
Apartments

emaar.com/LuxuryApartments

Launch23rdJaninKarach
HarbourViewsatDubai
Creek.LearnMore.

100%Free
DataSheet
(PDF)
Siemens
SimaticParts
Page Contents [hide]
1 OBJECTIVE:

Application
FormOnline

2 Components:
3 Implementation:
4 Circuit diagram:
4.0.1 NOTE: Before making this project , I recommend you
should learn about LCD interfacing with microcontroller
especially hardware part. because I have seen many students
struggling with LCD display.
5 CODE:

OBJECTIVE:
http://microcontrollerslab.com/temperaturesensorusingpic16f877amicrocontroller/

PLEASE SUPPORT
OUR WORK
Our goal is to discover
new solutions and provide
working examples with
1/13

1/20/2016

TemperatureSensorusingPICmicrocontroller

video, pictures, code and


Temperature measurement
Digital display of temperature
used of microcontroller to measure temperature

schematics. Please
support our efforts.

used of microcontroller to Display temperature value on


LCD (liquid crystal display)

COMPONENTS:
There are many temperature sensors available in market. But
LM35 temperature sensor is used in this project. It is cheapest in
price and one can easily find it in market. There are many other
advantages of LM35 like:

It is more efficient than thermistor


It is made up of integrated circuit hence no chance of
damaging to internal circuitry.
It draws current only in micro Amperes.
Only 5 volt power supply is required for LM35 and there is no
need of extra circuitry to operate it. PIC16F877A micrcontroller

SUBSCRIBE TO
BLOG VIA EMAIL
Enter your email address
to subscribe to this blog
and receive notifications
of new posts by email.
Join 261 other subscribers
Email Address
Subscribe

is used to read temperature value. 16X2 LCD is used to display


temperature value on LCD. Code of this project written in Mikro
C compiler.

IMPLEMENTATION:

FIND US ON
FACEBOOK

LM35 temperature sensor converts temperature into its


proportional analog voltage value. LM35 is three terminal
device.Pin number one and three are for 5 volt voltage supply.
Pin two is analog voltage output with respect to temperature
value.Relation between measured temperature and analog
output voltage is:
1oC= 10m volt

MicrocontrollersLab
6,148likes

Liked

Youlikethis

Hence for every 1 degree increase in temperature there will be


a increment of 10m volt in output voltage of LM35 sensor.
PIC16F877A microcontroller is used to measure analog voltage
value. PIC16F877A microcontroller built in ADC (analog to
digital
converter)
is
used
to
measure
analog
voltage.PIC16F877A PORTA have seven built in ADC channels.
So one can inerface upto seven sensors with this
microcontroller very easily.I will post a project on green house
http://microcontrollerslab.com/temperaturesensorusingpic16f877amicrocontroller/

RELATED POSTS
Automatic
control of
street lights
2/13

1/20/2016

TemperatureSensorusingPICmicrocontroller

system.In green house system project I have used four ADC


channels to measure temperature , light, humidity and
moisture. Coming back to our digital thermometer, ADC has
been used to read analog voltage. After reading ADC value,
using voltage and temperature relationship voltage is
converted back into temperature. A conversion factor is used to
convert voltage back into temperature. All these conversion has
been done through programming. LCD is connected to PORTB
ofPIC16F877A microcontroller. I will disucss it in programming
part. LCD is used to display temperature value.

CIRCUIT DIAGRAM:
Proteus is used for simulation. Following is a circuit diagram of
Digital temperature sensor:

metal detector
robot using pic
microcontroller
Line follower
robot using
microcontroller
zero crossing
detector circuit
using pic
microcontroller
Electronic lock
using pic
microcontroller
AC Voltage
measurement
using
PIC16F877A
microcontroller

temperature sensor circuit diagram

Solar power
auto irrigation
system using

As shown in above figure both temperature sensor and LCD is


displaying same values of temperature. To ensure protection of
LM35 and microcontroller you can connect 80k ohm resistor
parallel to output of temperature sensor.

microcontroller

NOTE: BEFORE MAKING THIS PROJECT , I RECOMMEND YOU


SHOULD LEARN ABOUT LCD INTERFACING WITH
MICROCONTROLLER
ESPECIALLY
HARDWARE
PART.
BECAUSE I HAVE SEEN MANY STUDENTS STRUGGLING WITH
LCD DISPLAY.

microcontroller

Digital DC watt
meter using pic

CODE:
In programming part conversion factor is used to convert
voltage back into temperature.The conversion factor is:
http://microcontrollerslab.com/temperaturesensorusingpic16f877amicrocontroller/

3/13

1/20/2016

TemperatureSensorusingPICmicrocontroller

1 volt = 100 degree


temp = ( Output voltage *100oC/V )
Code is written in MIKRO C compiler.
//************************* LCD module
connections****************************************
//********************** written by
Bilalmalikuet@gmail.com**********************************
sbit LCD_D7 at RB2_bit;
sbit LCD_D6 at RB3_bit;
sbit LCD_D5 at RB4_bit;
sbit LCD_D4 at RB5_bit;
sbit LCD_EN at RB6_bit;
sbit LCD_RS at RB7_bit;
sbit LCD_D7_Direction at TRISB2_bit;
sbit LCD_D6_Direction at TRISB3_bit;
sbit LCD_D5_Direction at TRISB4_bit;
sbit LCD_D4_Direction at TRISB5_bit;
sbit LCD_EN_Direction at TRISB6_bit;
sbit LCD_RS_Direction at TRISB7_bit;
//************************temperature variables****************
int temp;
char temper[7];

//**************************************************************
void READ_temp(void)
{
temp = ADC_Read(0);
temp = temp * 5/1023;
temp = temp *
100;
}
void data_converstion(void)
{
inttostr(temp,temper);
}
void display1(void)
{
lcd_out(1,1,TEMPERATURE=);
lcd_out(1,13, Ltrim(temper));
http://microcontrollerslab.com/temperaturesensorusingpic16f877amicrocontroller/

4/13

1/20/2016

TemperatureSensorusingPICmicrocontroller

Lcd_Chr_Cp(0xdf);
Lcd_Chr_Cp(C);
Lcd_Chr_Cp( );
}
void main()
{
ADC_Init();
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
lcd_cmd(_LCD_CURSOR_OFF);
lcd_out(1,4,DIGITAL TEMPERATURE);
lcd_out(2,6,SENSOR);
delay_ms(1000);
Lcd_Cmd(_LCD_CLEAR); // Clear display
while(1)
{
READ_temp();
data_converstion();
display1();
}
}
If you want compete simulation and hexa file of this
project.Comment on this post.Also comment your issue I will
love to reply to your comments.
To download circuit diagram and hexa file of digital
temperature sensor comment on following link :
Temperature sensor using pic microcontroller
Keep visiting my blog for more projects.

http://microcontrollerslab.com/temperaturesensorusingpic16f877amicrocontroller/

5/13

1/20/2016

TemperatureSensorusingPICmicrocontroller

TemperatureSensor
alibaba.com/TemperatureSensor

Choosefrom2M+VerifiedSuppliers.ContactDirectly&GetLive
Quotes!

pressuresensor
MicrocontrollerProjects
LN2microdosingpump
GulAhmed
Related Posts

Digital frequency
meter using pic
microcontroller

Foot step power


generation system
using pic
microcontroller

Automatic control
of street lights

About The Author


Bilal Malik
we providing project services to students and
industry from last 2 years and working as a
freelancer. I also write technical articles related
to electrical ,electronics, embedded and power
electronics Engineering. Contact me if you need my project
services. My email address: bilalmalikuet@gmail.com

31 Comments
http://microcontrollerslab.com/temperaturesensorusingpic16f877amicrocontroller/

6/13

1/20/2016

TemperatureSensorusingPICmicrocontroller

Nndonde AUGUST 11, 2014


Great work Bilal please send complete simulation
and the hex file most preferably including proteus
sketches too
Reply

BILAL Malik AUGUST 11, 2014


post your email address in comment
to get complete project of digital
temperature sensor.
Reply

BILAL Malik OCTOBER 9, 2014


Download link is available at the end
of this post
Reply

microP OCTOBER 6, 2014


can i have a copy of the hex file and also
DNS.thank you
microPLEC@gmail.com
Reply

amir OCTOBER 9, 2014


hello ,can i have your full source code
and hex file .help me please
. my
email ameyyame@gmail.com .
Reply

BILAL Malik OCTOBER 9, 2014


I have updated this post
with downloading link of
temperature sensor.you
can download now
Reply

amir OCTOBER 10, 2014


excuse me , why i
cant compile your
coding in mikroC
http://microcontrollerslab.com/temperaturesensorusingpic16f877amicrocontroller/

7/13

1/20/2016

TemperatureSensorusingPICmicrocontroller

compiler .Its error


. Help me pls . I
need to edit your
coding .thanks
Reply

BILAL
Malik

OCTOBER 10,
2014

Use link given at the


end of this article to
download code and
simulation and there is
no error in this code I
have complied it before
upload on this post

tarik OCTOBER 11, 2014


hi malik,
thank you for this good job, i dont understand the
function Ltrim and how to display a negative
temperature
thanks a lot
Reply

siva NOVEMBER 18, 2014


is the correct code? proteus simulation is
availablre?
Reply

naqash awan DECEMBER 17, 2014


yar plz send me the full code, hex file and circuit
diagram
Reply

najib DECEMBER 21, 2014


nice work
could please send me the hexa file
Reply

Abi JANUARY 31, 2015


http://microcontrollerslab.com/temperaturesensorusingpic16f877amicrocontroller/

8/13

1/20/2016

TemperatureSensorusingPICmicrocontroller

I am doing my project on load cell, in that i want to display load


cell ouput voltage into load value,for that i am using
PIC16f877a..Anyone pls help me
Reply

kira FEBRUARY 12, 2015


very nice project please send me the related
project & its format
Reply

Sam FEBRUARY 15, 2015


Very nice project
Pls send me the complete project and hex file.
How do i open .dns file.
Thanks
Reply

BILAL Malik FEBRUARY 15, 2015


Code and circuit diagram of
temperature sensor project is
available in article

Reply

Sam FEBRUARY 16, 2015


Thanks man, i have seen it
and it is working perfectly.
Can you please assist me
on how to connect numeric
keypad and alarm
system(buzzer) so it beeps
at a particular temperature.
Thank you.
Reply

Sam FEBRUARY 16,


2015

Pls my email
address is
bentumsamuel@gmail.com
http://microcontrollerslab.com/temperaturesensorusingpic16f877amicrocontroller/

9/13

1/20/2016

TemperatureSensorusingPICmicrocontroller

Reply

rahul jkb FEBRUARY 16, 2015

i want complete coding of this project please


send me
Reply

Sam FEBRUARY 16, 2015


Please it is a build up on your already
existing project. I am having challenges
interfacing it with a buzzer to beep and
lcd at to light red at a temperature of
about 80 degree celcius.
I really appreciate your assistance.
Thank you.
Reply

Sam FEBRUARY 17, 2015


The link to the codes is :
http://www.4shared.com/get/9qt8y495ba/temperature_sensor.html
You can download with email:
bentumsamuel@gmail.com
and password: sammie.
Thanks.
Reply

ashutosh FEBRUARY 18, 2015


plz give me code and hex file of temprature
sensor using pic16f877a
Reply

BILAL Malik FEBRUARY 18, 2015


Check the link given at the end of
post for code and hexa file
Reply

Sam APRIL 13, 2015


Pls how do you include a buzzer to the project so
it sounds at a particular temperature. Thanks.
Reply

http://microcontrollerslab.com/temperaturesensorusingpic16f877amicrocontroller/

10/13

1/20/2016

TemperatureSensorusingPICmicrocontroller

Nan APRIL 25, 2015


Nice worl. Implementing it but having challenges
displaying on lcd screen. Pls help.
Reply

Nan APRIL 25, 2015


Nice work. Implementing it but having challenges
displaying on lcd screen. Pls help.
Reply

Bentum APRIL 30, 2015


Nice project, Have downloaded zip file.Please
which compiler did you use. Everything complete
except header files missing in codes. Can you
please send me the complete work with header
file. Email: bentumsamuel@gmail.com
Thanks
Reply

BILAL Malik MAY 12, 2015


I have used Mikro c pro complier

Reply

Raymond Michael JUNE 9, 2015


its a good thing to find your blog today!!
I want to do two projects;
first; i wants to measure and display room
temperature and humidity at real-time , or every
2seconds, I need one pin to be high and low at 1hr
intervals,
Also i want one pin to be high for only 5 seconds
after every 2hrs,
these are for alarms, one pin high per each
condition ,when temperature is at 34c, 36c, 38c
39c and 39.5c
in case of humidity, one pin high per each
condition , when humidity is at 50%, 60% and 70%
I want it to control my homemade incubator , I
hope you can add to a certain pins which will
control the heaters for generating temperature
and humidity default temp. is 37.8c and humidity
http://microcontrollerslab.com/temperaturesensorusingpic16f877amicrocontroller/

11/13

1/20/2016

TemperatureSensorusingPICmicrocontroller

is 65%, so any deviation from these defaults the


pins assigned will act accordingly from there it
will stabilizer the condition
is it possible to add several buttons for setting the
completed unit? if possible it will be awesome to
include. Please kindly suggest the circuit diagram
and the codes.
Let me end here with only the first .
Sorry for my bad English, I am from Africa,
Tanzania. I am waiting for you to inbox me via
nziku99@gmail.com , thanks in advance
Reply

hailegebrel nigu JUNE 14, 2015


nice work cued u like to send
me full code and hex file?
Reply

sujit SEPTEMBER 23, 2015


pls send me project with all files
Reply

Leave a Reply
Comment Text*

Name*

Email*

Website
http://microcontrollerslab.com/temperaturesensorusingpic16f877amicrocontroller/

12/13

1/20/2016

TemperatureSensorusingPICmicrocontroller

Post Comment

Notify me of follow-up comments by email.


Notify me of new posts by email.

RECENT POSTS

POPULAR POSTS

Electronic lock using pic microcontroller


HUMANOID robotic ARM using pic
microcontroller
Insulation materials used in transformers
GSM based home devices control system
MULTIPLE INPUT CHARGE CONTROLLER FOR
RENEWABLE ENERGY

Microcontrollers Lab Copyright 2016.

http://microcontrollerslab.com/temperaturesensorusingpic16f877amicrocontroller/

SUBSCR

Electronic lock using pic


microcontroller
December 23, 2015

No Comments

PAGES

Contac

privacy

Project

Sitema

Sitemap

13/13