Connect Raspberry Pi to DHT11 Temp Humidity Sensor

We’ll be working with this existing project code.

Video overview long version:

Project instructions long version –

Hooking up the DHt 11 sensor to the Raspberry Pi visual –

Be sure to watch the YouTube videos and run through all 4 parts!

Get to the Terminal.  CTRL-T if you are on the desktop version will bring up the terminal

cd /
cd opt
sudo git clone

cd /
cd opt/Raspberry_Pi_SQLite_Sensors
cd Part_3 flask run –host=

cd Raspberry_Pi_SQLite_Sensors
cd Part_3
sudo sqlite3 dht.db

CREATE TABLE readings (time DATETIME, name TEXT, value REAL);
CREATE TABLE sensors (name TEXT, type TEXT, pin INTEGER);

INSERT INTO sensors VALUES (‘DHT1’, ‘DHT11’, 4);

CTRL-Z to exit the SQL prompt. Edit dht_read and update to DHT11. Then run the file.

Download the app code –
Let the above report on the Temp/Humidity and write to the database. Open a new Putty/Terminal window
Lets go to the Lesson 3 folder –
Open a brown a navigate to http://IpAddress:5000

sudo apt-get install git
sudo apt-get update
sudo apt-get install -y python3 python3-dev python3-pip git sqlite3
cd /
cd opt
sudo git clone
cd Adafruit_Python_DHT
sudo python3 install
sudo pip3 install flask flask-admin wtf-peewee

sudo nano

data.define_sensor(‘DHT1’, Adafruit_DHT.DHT22, 18)
data.define_sensor(‘DHT2’, Adafruit_DHT.DHT22, 25)


data.define_sensor(‘DHT1’, Adafruit_DHT.DHT11, 4)

sudo python3