100% found this document useful (1 vote)
325 views

Digital Humidity Sensor With LCD Display Using Microcontroller

electrical project
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
325 views

Digital Humidity Sensor With LCD Display Using Microcontroller

electrical project
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

1/20/2016

Digitalhumiditysensorwithlcddisplayusingmicrocontroller

HOME

PROJECTS

GENERAL ARTICLES

TUTORIALS

PROJECT IDEAS

PROJECT SERVICES

Digital humidity sensor


using PIC microcontroller
BILAL Malik
July 28, 2014
29 Comments

ADVERTISEMENT

PIC microcontrollers

Compact sensor
Rugged magnetic speed and position sensors
with IP 67/68 certification

Page Contents [hide]


1 Digital humidity sensor with LCD display using PIC microcontroller
2 Applications of humidity sensors
3 Humidity sensor selection
4 How to use HS1101 humidity sensor
5 components list
6 Circuit diagram of humidity sensor
7 Coding:

DIGITAL HUMIDITY SENSOR WITH LCD DISPLAY


USING PIC MICROCONTROLLER
Digital humidity sensor with LCD display is used to measure
relative percentage of water vapors in air. HS1101 capacitive
http://microcontrollerslab.com/digitalhumiditysensorusingpicmicrocontroller/

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

1/20/2016

Digitalhumiditysensorwithlcddisplayusingmicrocontroller

humidity sensor is interfaced with PIC16F877A microcontroller

video, pictures, code and

to measure humidity and LCD is used to display percentage


humidity in air.For humans there is certain limit for water vapors

schematics. Please
support our efforts.

presence in air. Above that limit relative humidity may cause


problems to human health.

APPLICATIONS OF HUMIDITY SENSORS


Humidity sensors have many application in industry and
domestic areas. Humidity means presence of water vapors in
air. Percentage of water vapors in air should be with in safety
limit. Otherwise It have harmful physical and chemical effects
on human beings and also in industrial products. Humidity
sensors have major applications in agriculture ,chemical, oil, gas
and medical industry. For example in agriculture industry
humidity sensor is used to measure moisture in fields. There are
also many other application of humidity sensor.You can search
them in Google.

HUMIDITY SENSOR SELECTION


When you search on Google, you will come across many
humidity sensors. All these humidity sensors have their
advantage and disadvantage. But I used capacitive HS1101
humidity sensor in this project. What is meant by capacitive
humidity sensor? All capactive senors give output in capacitive
form.They change their capacitance with respect to change in
sensing parameter like in HS1101 sensor sensing parameter is
amount of water vapors in air. The reason why I used this
humidity sensor? Because

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

FIND US ON
FACEBOOK
MicrocontrollersLab
6,145likes

It can be used for highly sensitive applications.


less cost
easy to interface with microcontroller with small extra
circuitry
No calibration is required

LikePage

Bethefirstofyourfriendstolikethis

It can be easily used for home appliances and industrial


control system.

HOW TO USE HS1101 HUMIDITY SENSOR


HS1101 is a capacitive humidity sensor, so it can be used with
555 timer circuit to generate square wave of different
frequency. I assume you know about 555 timer IC and its use.
http://microcontrollerslab.com/digitalhumiditysensorusingpicmicrocontroller/

RELATED POSTS
Digital DC watt
meter using pic

2/14

1/20/2016

Digitalhumiditysensorwithlcddisplayusingmicrocontroller

microcontroller
Bluetooth
module
interfacing with
pic
microcontrollers
Line follower
robot using
microcontroller

humidity sensor circuit with external circuitry


As shown in above figure, variable capacitor is used in place of
humidity sensor for simulation purpose. Becuase HS1101

simulation model is not available in Proteus. Above circuit is


used as a signal conditioning circuit to convert one form of
parameter to its other proportional parameter so that it can be
easily interfaced with any digital system or microcontroller. It is
not possible for any microcontroller to read change in
capacitance directly. That why above circuit is used to convert
changing capacitance of HS1101 into sqaure wave whose
frequency changed according to change in capacitance .
I have already post a tutorial on how to measure of square
wave using PIC 16F877A microcontroller. I recommend you to
go through article before going further in this project.
Square wave frequency measurement using PIC16F877A
microcontroller
Now you know we can easily measure square wave frequency
with microcontroller. But now the question is how we will
convert frequency back into relative humidity? There is a
proper relationship between humidity and frequency. Go
through data sheet of HS1101 humidity sensor to know more
about HS1101 sensor.

Green house
intelligent
control
system
Digital
Ohmmeter
circuit using pic
microcontroller
Automatic
electronic bell
for school
using pic
microcontroller
Automatic
control of
street lights
zero crossing
detector circuit
using pic
microcontroller

COMPONENTS LIST

Category,Reference,Value,OrderCode
Resistors,"R1",1732k,
Resistors,"R2",549k,
http://microcontrollerslab.com/digitalhumiditysensorusingpicmicrocontroller/

3/14

1/20/2016

Digitalhumiditysensorwithlcddisplayusingmicrocontroller

Resistors,"R3",1k,
Resistors,"R4",49.9k,
Resistors,"R44",10k,
IntegratedCircuits,"U1",NE555,
IntegratedCircuits,"U2",PIC16F877A,
Miscellaneous,"LCD1",LM016L,
Miscellaneous,"SENSOR",humiditysensorHS1101,
crystal20mhz

CIRCUIT DIAGRAM OF HUMIDITY SENSOR


Complete circuit diagram of Digital humidity sensor with LCD
display:

circuit diagram of digital humidity sensor

Simulation results using pulse generator in proteus:

http://microcontrollerslab.com/digitalhumiditysensorusingpicmicrocontroller/

4/14

1/20/2016

Digitalhumiditysensorwithlcddisplayusingmicrocontroller

As shown in above diagram humidity is shown in percentage.


27% humidity mean air contains 27% water vapors. so you can
take control actions according to your requirement. By little bit
modification in this project you can also control anything
according to change in relative humidity. let me know what is
your requirement I will be happy to provide you solution.

CODING:
Code is written in mikro c for pic:
//***************[email protected]***********
// LCD module connections
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;
// End LCD module connections
//******************************frequency meter variables*******
int value,freq,humidity;
char humid[7];
//**************************************************************
void data_converstion(void)
{
IntToStr(humidity, humid);
}
void display1(void)
{
lcd_out(1,1,Humidity = );
lcd_out(1,13, Ltrim(humid));
Lcd_Chr_Cp(%);
Lcd_Chr_Cp( );
}

http://microcontrollerslab.com/digitalhumiditysensorusingpicmicrocontroller/

5/14

1/20/2016

Digitalhumiditysensorwithlcddisplayusingmicrocontroller

void interrupt(void) // high portD


{
if(T1CON.TMR1ON==0)
{
T1CON.TMR1ON=1; // turn on the timer1
INTCON.INTF = 0; // clear the interrupt flag
}
else if(T1CON.TMR1ON==1)
{
T1CON.TMR1ON=0; // turn off the timer1
value=(TMR1H<<8)|(TMR1L);
INTCON.INTE = 0; //Enable RB0/INT external Interrupt
freq=(5018035/value);
humidity = 565 freq/13;
// freq = freq /13.18;
//freq = 100 freq;
TMR1H=0;
TMR1L=0;
INTCON.INTE = 1; //Enable RB0/INT external Interrupt
INTCON.INTF = 0; // clear the interrupt flag
//freq=0;
}
}
void main()
{
long count;
count=0;
TMR1H=0;
TMR1L=0; // intialization of timer one prescalar and internal
clock
INTCON.GIE = 1; //Enable Global Interrupt
INTCON.INTE = 1; //Enable RB0/INT external Interrupt
OPTION_REG.INTEDG = 0; //Interrupt on rising edge
ADC_Init();
Lcd_Init(); // Initialize LCD
freq=0;
Lcd_Cmd(_LCD_CLEAR); // Clear display
lcd_cmd(_LCD_CURSOR_OFF);
lcd_out(1,4,GREEN HOUSE);
lcd_out(2,6,SYSTEM);
delay_ms(1000);
Lcd_Cmd(_LCD_CLEAR); // Clear display
http://microcontrollerslab.com/digitalhumiditysensorusingpicmicrocontroller/

6/14

1/20/2016

Digitalhumiditysensorwithlcddisplayusingmicrocontroller

while(1)
{
data_converstion();
display1();
}
}

If you have any problem after reading this article, comment on


this post with your problem and if you need complete circuit
diagram, simulation and hexa file of this project, comment on
this post with your email address.
If you feel this article helps you in getting some knowledge
kindly dont forget to share it with your friends on social media.
enjoy coding

Temperature Sensor
Search Largest China Supplier Base. Verified
Global Exporters-Join Free

Related Posts

Auto intensity
control of street
lights using pic
microcontroller

Line follower robot


using
microcontroller

Digital Ohmmeter
circuit using pic
microcontroller

http://microcontrollerslab.com/digitalhumiditysensorusingpicmicrocontroller/

7/14

1/20/2016

Digitalhumiditysensorwithlcddisplayusingmicrocontroller

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: [email protected]

29 Comments
david shalom SEPTEMBER 13, 2014
i want to know how u calculate the percentage
from the frequency
thanx
Reply

BILAL Malik SEPTEMBER 18, 2014

I have used the formula which is given in


HS1101 humidity sensor data sheet. Formula is
used to convert humidity % into frequency and
vice versa
Reply

ally NOVEMBER 19, 2014

Hi!
Bilal I need your help can you help me to make
codes for count down timer, temperature and
humidity in one micro-controller I tried to do that
but there is interference one not working when all
reads at the same time please you can email me
the hex file for that.
Thanks and kind regards
Ally
Reply
http://microcontrollerslab.com/digitalhumiditysensorusingpicmicrocontroller/

8/14

1/20/2016

Digitalhumiditysensorwithlcddisplayusingmicrocontroller

reeza NOVEMBER 20, 2014


hey can u give me the full schematic and source
code for this project?
Reply

Ally NOVEMBER 22, 2014

Hi!
I downloaded the code from Bilal
Project for humidity sensor but is not
working is not giving me 27%
Please can any one give me the
formula for calculating frequency in this
circuit.
and Bilal can you tell me how you get
27%?
Thanks
Ally
Reply

Ally NOVEMBER 22, 2014

Hi Reeza!
Sorry I generate codes from different
projects and I build it in one micro
controller so please if you know to
separate codes help me.
I need to make Incubator to control
temperature,humidity and turning of
the eggs automatic so if you any one
can help me here the codes I will be
thankfully to him.
Regards
Ally
Reply

Abdullah Zohaib Kiani NOVEMBER 29, 2014


Assalamoalikum
brother what is the capacitence of hs1101 sensor
at 0% humidity and at 100% humidity??
and what is the maximum frequency generated by
555 at 100% humidity??
Reply

http://microcontrollerslab.com/digitalhumiditysensorusingpicmicrocontroller/

9/14

1/20/2016

Digitalhumiditysensorwithlcddisplayusingmicrocontroller

Raj Kumar DECEMBER 19, 2014


Dear Mr. Bilal
I would like to have the code (hex file) for humidity
controller and temperature controller.
Thanks.
Raj
Reply

ali JANUARY 5, 2015


hi
please tell me the program used for
coding
tnx
and give me the hex ofprogram
very very tnx for solving my problem
Reply

ali JANUARY 10, 2015


hi
if any one have the hex of program please send to
my mail
[email protected]
tnx all
Reply

Nur Ikhlas FEBRUARY 14, 2015


Hello there Bilal. Can you email me complete
circuit diagram, simulation and hex file of this
project? please let me know that you email-ed
me. Please. this is my email [email protected]
Reply

smwal FEBRUARY 15, 2015


hi can i use Lm331 for convert frequency to volt in
this project
Reply

smwal FEBRUARY 17, 2015


Can you write equation for humidity and
frequency because idont understand these please
Reply

http://microcontrollerslab.com/digitalhumiditysensorusingpicmicrocontroller/

10/14

1/20/2016

Digitalhumiditysensorwithlcddisplayusingmicrocontroller

akif MARCH 4, 2015


hi
if any one have the hex of program please send to
my mail
[email protected]
Reply

moheed MARCH 5, 2015


i need complete code
Reply

ion APRIL 21, 2015

Please be so kind and email me


the whole project and code
I have proteus and i would like to try it
Thank you
Reply

foxc APRIL 21, 2015


hi Bilal. im working on something like this, where i
need to get the frequency from the timer. can you
email the whole project because i would like to try
this out. thanks brother
[email protected]
Reply

BILAL Malik APRIL 21, 2015


hi code and circuit diagram is
already available in post

Reply

lam MAY 13, 2015


i need complete code of humidity use key pad
control only four key start,use,enter,program .help
me
Reply

JOBIN GEORGE MAY 21, 2015

Please email me the whole project and code


Thank you
Reply
http://microcontrollerslab.com/digitalhumiditysensorusingpicmicrocontroller/

11/14

1/20/2016

Digitalhumiditysensorwithlcddisplayusingmicrocontroller

JOBIN GEORGE MAY 21, 2015

Please email me the whole project and code


Thank you
[email protected]
Reply

omer JUNE 16, 2015

i need hex.file for humidity sensor


Reply

Sarmad JULY 28, 2015


Can you please send me the hex file of this
program
thanks!
Reply

Kalaiyarasan AUGUST 20, 2015


I am going to make water generator from air
machine so i need humidity value in air .
http://www.instructables.com/id/The-ArduinoWeather-Station-Thermostat/ you can see this
link. i think this project value is very high cost, but i
need same like as above with cheapest cost can
your provide good project with program
[email protected]
Reply

Bilal Malik AUGUST 21, 2015

you can purchase it from our shop


Reply

Romesh JANUARY 16, 2016


Do we need to ground the D0 to D3 pins in the
LCD module?if we wont do that will it work?
Reply

BILAL Malik JANUARY 17, 2016


No need

Reply

http://microcontrollerslab.com/digitalhumiditysensorusingpicmicrocontroller/

12/14

1/20/2016

Digitalhumiditysensorwithlcddisplayusingmicrocontroller

Romesh JANUARY 17, 2016


I tried this out.But it is not
displaying anything.Is
display connections are
correct?
Reply

BILAL Malik

JANUARY 17, 2016

yes it is correct.
Connect D+ with
5 volt and D- with
ground
Reply

Leave a Reply
Comment Text*

Name*

Email*

Website

Post Comment

Notify me of follow-up comments by email.


Notify me of new posts by email.

http://microcontrollerslab.com/digitalhumiditysensorusingpicmicrocontroller/

13/14

1/20/2016

Digitalhumiditysensorwithlcddisplayusingmicrocontroller

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/digitalhumiditysensorusingpicmicrocontroller/

SUBSCR

Electronic lock using pic


microcontroller
December 23, 2015

No Comments

PAGES

Contac

privacy

Project

Sitema

Sitemap

14/14

You might also like