Posted on

DHT11 Sensor Data to New blynk2.0 IoT using Raspberry Pi

This tutorial will guide you how you can connect Raspberry Pi with New Blynk2.0 IoT App and Web Dashboard..

So connect the DHT11/DHT22 Sensor with Raspberry pi as  per this circuit diagram.

Now, install the DHT sensor poython library in the Raspberry Pi through the below commands.

sudo pip3 install Adafruit_DHT

If you are getting any problem to install the DHT sensor library, Watch the complete video tutorials on “How to get Humidity and Temperature data to raspberry pi using DHT11 sensor”.

Once installed, then you need to install the New Blynk library through below command.

git clone

After the installation of blynk library, you need to create the text file uisng TextEditor. So go to the Accessories and open the TextEditor. Copy the below code and paste in to the file.

git clone

Now, go to the Accessories and open the TextEditor. Copy the below code and paste in to the file.

After that, save this file in the inside the Blynk Library folder with name as

This Code is belong to SME Dehraun. for any query write to


import BlynkLib
import RPi.GPIO as GPIO
from BlynkTimer import BlynkTimer

import Adafruit_DHT
import time

#BLYNK_AUTH_TOKEN = 'kt85ldXRL362juNQiymMClUUxdsuygTN'

# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH_TOKEN)

# Create BlynkTimer Instance
timer = BlynkTimer()

# function to sync the data from virtual pins
def blynk_connected():
print("Hi, You have Connected to New Blynk2.0")
print("................... By SME Dehradun ...................")

# Functon for collect data from sensor & send it to Server
def myData():
humidity, temperature =, 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))
print("Sensor failure. Check wiring.");

blynk.virtual_write(0, humidity,)
blynk.virtual_write(1, temperature)
print("Values sent to New Blynk Server!")

timer.set_interval(2, myData)

while True:


So we have successfully save our program. Now time to run the program in the Terminal and send the Humidity & Temperature values to New Blynk2.0 IoT app and Web Dashboard.

So run the following command to run the program.


cd blynk-library-python
sudo python

After running the command, You will get the output in the serial like this.


Now you can see the humidity and Temperature Values in the New Blynk Web Dashboard like this.

You can also see the data in New Blynk Mobile App.

Watch the Video Tutorial- How to connect the Raspberry with New Blynk2.0.