Introduction: Arduino - DHT11 and OLED V3.0

Hello Guys,

With reference to my last tutorial [Arduino - DHT11 and Serial Plotter v2.0], I decided to make similar project but one which is portable and can be battery powered. In this tutorial, I decided to use an OLED display to visualize the incoming data stream from the DHT11 sensor.

I used the Adafruit OLED display, this is made up of 128x64 individual white led pixels to make the OLED display. This is a miniature module, very clear due to the high contrast from the led pixels as such no backlight is required.

Interestingly, in this project i used the OLED display to visualize the following graphs. These graphs are easy to implement and of course you can choose any of the graphs you find exciting and suitable for your needs, the Arduino sketches are found below. Enjoy

a. Non-continuous dotted [refreshing] graph.

b. Non-continuous bar [refreshing] graph.

c. Continuous dotted [non-refreshing] graph.

d. Continuous bar [non-refreshing] graph.


Parts Required:

You will need the following to make the circuit.

· 1 x Arduino Uno

· 1 x Adafruit OLED 128 x 64

· 1 x DHT11

· 1 x 10KΩ Resistor

· Jumper Wires

Step 1: Schematic:

Here’s how to connect the components to the Arduino module.

Step 2: Source Code:

Here’s the codes for this project.

1. Download the following libraries from Adafruit repository.

2. Unzip the libraries and rename the extracted folder to following.

  • DHT
  • Adafruit_SSD1306
  • Adafruit_GFX

3. Copy the folders to the following path to install the libraries.

  • C:\Program Files (x86)\Arduino\libraries

4. Upload any of the below sketches.



Sketches:

  • Non-continuous dotted [refreshing] graph.
  • Non-continuous bar [refreshing] graph.
  • Continuous dotted [non-refreshing] graph.
  • Continuous bar [non-refreshing] graph.

Step 3: Demonstration:

Now you can easily differentiate between the Temperature and Humidity readings on the OLED display, and enjoy the various graph on the OLED.

I hope you like the post and hope this tutorial helps you find a way to implement your own OLED graphs.

Thanks for reading.

-Avishek Hardin

Comments

author
TueN3 (author)2017-09-09

Hi! super nice code brah!
I have been working a bit with it, but i can't figure out to make a delay in the refreshing time so the curve is adding a bar for each minute and not each cycle.

I have added a RTC to also add the time. my idea is to have the time displayed at top and the temp and humi at the bottom. if i just add an delay the time will only update every minute and i want seconds on my clock. :-)

Could you help me? or come with and idea?

author
KamilK40 (author)2016-11-21

I was looking for code like that whole weekend! Thanks man :)