Arduino Leonardo Pro Micro with DHT11 and 128x64 OLED display tutorial

Teacher
Vivek Gupta
Vivek Gupta
Role : Writing free tutorials in free time
  • Website : http://vsgupta.in/
  • Experience : 5+ Years
  • Specialist in : IoT, NLP, Machine Learning, Chatbots, Voice Assistants, Hardware Engineering
Read More

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1

Introduction

In this tutorial, we are going to to program the circuit with the code. This lesson is divided into two parts. In part 1 we will install the DHT11 library in Arduino IDE and program it with the default code. And in the second part we will program our breadboard circuit with the code to display temperature and humidity captured from sensor on our 128x64 I2C OLED display.

We will first download the dht11 library for arduino.

1. Go to : https://github.com/adafruit/DHT-sensor-library and download the zip library.

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1 (1)

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1 (1)

2. Now add the downloaded library in your Arduino IDE. If you don't know how to add library in arduino IDE, see this tutorial : "Adding External library in Arduino IDE"(Follow only still step 3 and come back here).

3. Now you will need one more file for running this library. For that goto : https://github.com/adafruit/Adafruit_Sensor and download the zip file.

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1 (7)

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1 (7)

4. Extract the zip file, and go inside the folder. And copy "Adafruit_sensor.h"

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1 (8)

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1 (8)

5. Now got "Documents->Arduino->libraries->DHT-sensor-library-master" and paste the file their.

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1 (9)

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1 (9)

6. Now Open your Arduino IDE and goto "File->Examples->Dht sensor library->dht tester" and click their.

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1 (2)

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1 (2)

7. An example code will open. Now, you need to do two changes in the example code. Now change the DHT pin to 10 "#define DHTPIN 10" in the code as shown bellow.

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1 (4)

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1 (4)

8. And then go and uncomment the line "#define DHTTYPE DHT11" and comment the two lines below it. We are doing it because we are using DHT11 Sensor.

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1 (6)

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1 (6)

9. Now upload the code in the Arduino and open your serial terminal(make sure your settings are similar to the serial terminal as shown below).

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1 (10)

Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part1 (10)

You have succesfully tested the library and the circuit. Now in the next tutorial, I will explain step by step for programming your Arduino Leonardo Pro Micro to display the DHT11 data on the OLED screen.

Please login to get access to the quiz
Wiring Up Arduino Leonardo Pro Micro with DHT11 and 128×64 OLED display on Breadboard (Prev Lesson)
(Next Lesson) Programming and output of Leonardo Pro Micro with DHT11 and 128×64 OLED-Part2
Back to Arduino Leonardo Pro Micro with DHT11 and 128×64 OLED display tutorial

Comments ( 4 )

  • Marlon troy

    Hello, I saw your videos about SERVER on YouTube and would like to know if we could create a MQTT home automation project without the need of opening ports on my ROUTER, I have posted task on freelancer but people only wasting my money with no outcome. My whatsapp # is +17133028183, I am Marlon.

Post a Reply