Class: - TE Div.:- _Name:-_ _Roll No.
_
Assignment 3: Connectivity of Raspberry Pi / Beagle Board circuit with
temperature sensor.
Problem Statement:-
Understanding the Connectivity of Raspberry Pi / Beagle Board circuit with
temperature sensor. Write an application to read environment temperature. If
temperature crosses a threshold value generate an alert using LEDs.
Components: Temperature Sensor DHT 11, LED, Raspberry Pi board, connecting
wires etc.
Theory:
DHT 11 Raspberry Pi
Vcc Vcc
Gnd Gnd
Data GPIO4 or Board Pin
7
Raspberry Pi LED
GPIO5 or Board Through Register
Pin 29 to Anode
Gnd Cathode
Fig.1 DHT 11 Temperature Sensor Pin Out
Raspberry Pi Buzzer
GPIO5 or Board Positive or Long
Pin 29 Pin
Gnd Negative or Short
Pin
Fig.3 Connection Diagram of DHT 11 Temperature Sensor with Raspberry Pi
Software Setup
To start with update your package lists and install a few Python libraries :
1. sudo apt-get update
2. sudo apt-get install build-essential python-dev
Then clone the Adafruit library from their repository :
3. git clone https://github.com/adafruit/Adafruit_Python_DHT.git
4. cd Adafruit_Python_DHT
Then install the library for Python 2 and Python 3 :
5. sudo python setup.py install
6. sudo python3 setup.py install
Hopefully at this point the library is installed and ready to be used within a
Python script.
Adafruit Example Python Script
Adafruit provide an example script that you can use to check your sensor is
operating correctly.
7. cd ~
8. cd Adafruit_Python_DHT
9. cd examples
python3 AdafruitDHT.py
The first is the sensor type so is set to “11” to represent the DHT11.
The second is the GPIO number “4” for GPIO4.
Connection DHT 11 Temperature Sensor With Raspberry Pi Board
DHT 11 Temperature Raspberry Pi Board
Sensor
Vcc
Gnd
Data
Connection Raspberry Pi Board With LED
Raspberry Pi LED
GPIO5 or Board Pin 29
Gnd
Connection Raspberry Pi Board With Buzzer
Raspberry Pi Buzzer
Positive or Long Pin
Negative or ShotPin
Raspberry Pi Code
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
Conclusion:-
_
_
_
_
_
_