0% found this document useful (0 votes)
21 views8 pages

Iotes Exp2

IOT & embedded system practical no 2 SPPU

Uploaded by

sariyajobswork
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
0% found this document useful (0 votes)
21 views8 pages

Iotes Exp2

IOT & embedded system practical no 2 SPPU

Uploaded by

sariyajobswork
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/ 8

Exp. No.

2 Raspberry-Pi / Beagle board with temperature sensor

EXPERIMENT NO. 02

TITLE: Understanding the connectivity of Raspberry-Pi /Beagle board circuit with


temperature sensor. Write an application to read the environment temperature. If
temperature crosses a threshold value, generate alerts using LEDs.

OBJECTIVES:
 To understand the concept of Temperature-Humidity sensor (DHT11)
 To interface Temperature-Humidity sensor with Raspberry Pi model
 To program the Raspberry Pi model to measure the real time Temperature and Humidity
of the Environment

PROBLEM STATEMENT: Interfacing Temperature cum Humidity sensor (DHT-11)


with Raspberry Pi board

SOFTWARE:
 Raspbian OS (IDLE)

HARDWARE MODULES:
 Raspberry Pi Board module
 Temperature-Humidity sensor (DHT11) module
 Monitor

THEORY:

 Physical quantities like Humidity, temperature, pressure etc. are monitored to get
information about the environmental conditions.
 Temperature is basically amount of heat present in environment. Humidity is the
presence of water vapors in air. The Temperature & amount of water vapor in air can
affect human comfort as well as many manufacturing processes in industries. The
presence of water vapor also influences various physical, chemical, and biological
processes.
 In our module we are using “DHT11 Temperature and Humidity Sensor”.
 The features of this sensor are, calibrated digital signal output, and high reliability and
excellent long-term stability.
MMANTC Page 1 IOT and Embedded System
Exp. No. 2 Raspberry-Pi / Beagle board with temperature sensor

 This sensor has a resistive-type humidity measurement component in which resistivity of


semiconductor material changes as per humidity in environment changes.
 This sensor also includes NTC temperature measurement component which detects the
change in temperature.
 DHT11 basically provides two outputs from single data pin semiconductor material

SAFETY PRECAUTIONS:
 Raspberry-Pi provides 3.3V and 5V VCC pins
 Raspberry-Pi operates on 3.3V.
 Various sensors and actuators operate on different voltages.
 Read datasheet of a given sensor or an actuator and then use appropriate VCC pin to
connect a sensor or an actuator.
 Ensure that signal voltage coming to the Raspberry-Pi from any sensor or actuator does
not exceed 3.3V.
 If signal/data coming to Raspberry-Pi is greater than 3.3V then use voltage level shifter
module to decrease the incoming voltage.
 The Raspberry-Pi is a costly device; hence you should show the circuit connections to
your instructor before starting your experiment.

INTERFACING DIAGRAM:

MMANTC Page 2 IOT and Embedded System


Exp. No. 2 Raspberry-Pi / Beagle board with temperature sensor

STEPS FOR ASSEMBLING CIRCUIT:


 Connect the VCC pin of Temperature & Humidity sensor (DHT11) to VCC pin of
Raspberry Pi module
 Connect the DATA pin of Temperature & Humidity sensor (DHT11) to GPIO pin 15 of
Raspberry Pi module
 Connect the GND pin of Temperature & Humidity sensor (DHT11) to GND pin of
Raspberry Pi module

PROCEDURE TO INSTALL DHT11 LIBRARY:


 Open LXTerminal of Raspberry Pi and enter the following commands.
 sudo apt-get update
 sudo apt-get install git-core
 cd ~
 git clone https://github.com/szazo/DHT11_Python.git
 cd DHT11_Python
 sudo python setup.py install

PROCEDURE
 Write the program as per the algorithm given below.
 Save program in the library folder.
 Run code using Run module.

ALGORITHM:
 Import GPIO, time and dht11 libraries
 Set all the warnings as False
 Set mode i.e. GPIO.BOARD
 Read data using GPIO pin number 7 (dhtPin)
 Write „while loop‟ for displaying Temperature and Humidity values continuously
 First Read the GPIO pin and Store the data in dhtValue Variable.
 Print the temperature value.
 Print the Humidity value.
 Give delay of 1 second

OBSERVATION:
 Observe the output on python shell as per program
 Observe the ON and OFF status of the buzzer

MMANTC Page 3 IOT and Embedded System


Exp. No. 2 Raspberry-Pi / Beagle board with temperature sensor

CONNECTING DHT11 USING RPI

TEMPERATURE SENSOR – DHT11


 The DHT11 temperature and humidity sensor is a nice little module that provides digital
temperature and humidity readings. It‟s really easy to set up, and only requires one wire
for the data signal.
 These sensors are frequently used in remote weather stations, soil monitors, and home
environment control systems. The programming is simple too, and many libraries and
example code in both Python and C already exist.
 The DHT11 contains a surface mounted NTC thermistor and a resistive humidity sensor.
An IC on the back of the module converts the resistance measurements from the
thermistor and humidity sensor into digital outputs of degrees Celsius and Relative
Humidity.

FACT SHEET – DHT11


 Ultra low cost
 3 to 5V power and I/O
 2.5mA max current use during conversion (while requesting data)
 Good for 20–80% humidity readings with 5% accuracy
 Good for 0–50°C temperature readings ±2°C accuracy
 No more than 1 Hz sampling rate (once every second)
 Body size 15.5mm x 12mm x 5.5mm
 4 pins with 0.1" spacing

There are two variants of the DHT11 you‟re likely to come across. One is a four pin stand alone
module, and the other is a three pin, PCB mounted module. The pin out is different for each one,
so connect the DHT11 according to which one you have:

MMANTC Page 4 IOT and Embedded System


Exp. No. 2 Raspberry-Pi / Beagle board with temperature sensor

CIRCUIT DIAGRAM – DHT11


 VCC of DHT11 -> 5v Pin of Raspberry Pi 3
 GND of DHT11 -> GND Pin of Raspberry Pi 3
 Signal pin of DHT11 -> GPIO 4 Pin of Raspberry Pi3

PROGRAMMING THE DHT11 IN PYTHON


 We will be using the Adafruit DHT11 Python library. We can download the library using
Git, so if you don‟t have Git installed on your Pi already, enter this at the command
prompt: sudo apt-get install git-core
 Note: If you get an error installing Git, run sudo apt-get update and try it again.

MMANTC Page 5 IOT and Embedded System


Exp. No. 2 Raspberry-Pi / Beagle board with temperature sensor

INSTALL THE ADAFRUIT DHT11 LIBRARY


1. Enter this at the command prompt to download the library:
git clone https://github.com/adafruit/Adafruit_Python_DHT.git
2. Change directories with:cd Adafruit_Python_DHT
3. Enter this: sudo apt-get install build-essential python-dev
4. Install the library with: sudo python setup.py install

PROGRAM:

#Setup

sudo pip3 install Adafruit_DHT

sudo apt-get install python3-dev python3-pip

sudo python3 -m pip install --upgrade pip setuptools wheel

# Program

import Adafruit_DHT

import time

import Adafruit_DHT

import time

while True:

humidity, temperature = Adafruit_DHT.read(DHT_SENSOR, DHT_PIN)

if humidity is not None and temperature is not None:

print("Temp={0:0.1f}C Humidity={1:0.1f}%".format(temperature, humidity))

MMANTC Page 6 IOT and Embedded System


Exp. No. 2 Raspberry-Pi / Beagle board with temperature sensor

else:

print("Sensor failure. Check wiring.");

time.sleep(3);

CONCLUSION:_______________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
__________________________________________________________________________

ASSESMENT:

Roll Date of starting


Exp. No. 02 No. Date of completion

Remarks/ Signature of subject teacher


Grade

ASSIGNMENT
Create a circuit using Raspberry Pi, DHT11 and Buzzer. Write a program when the
temperature goes beyond 35 degrees, the buzzer will start ringing.

MMANTC Page 7 IOT and Embedded System


Exp. No. 2 Raspberry-Pi / Beagle board with temperature sensor

MMANTC Page 8 IOT and Embedded System

You might also like