Show Temperate and Humidity on an OLED screen 128x64 pi

Show Temperate and  Umidity on an OLED screen 128x64 pi

LCD Screen

Show Temperate and  Umidity on an OLED screen 128x64 pi

Living on an island I'm used to a fairly high humidity rate, especially in summer, the evening is almost unbearable.
I was curious to know how much moisture saturation (%) was in my house, then in the future logging data on an SD card to compare the data with the dehumidifier switched on and not ..... but we will talk about this later on!

Today we talk about how to display data on an OLED screen of the smallest size of just 0.96 "

Let's Prepare the Soup

What you need:

Arduino + LCD Screen + DHT11

Wiring Up

Now let's connect the modules with our Arduino Nano.
Having Male Pin on Arduino and Modules I do not need a Breadboard as the links will be direct.
If in your case it is different adapt accordingly.

Let's connect as following:

  • Arduino 3.3V  --- OLED Vcc
  • Arduino GND --- OLED GND
  • Arduino A4  --- OLED SDA
  • Arduino A5  --- OLED SCL
  • Arduino D2  --- DHT11 Data 
  • Arduino 5V  --- DHT Vcc
  • Arduino GND --- DHT11 GND

Or grafically better shown below:

Arduino + LCD Screen + DHT11 wiring

The OLED screen is usually powered at 5V but for comfort in this circuit I'll feed it with 3.3V as it does not compromises the brightness of the screen.

This is mine once connected:

Arduino + LCD Screen + DHT11 final

Coding Time!

The code is very simple, OLED uses the Adafruit SSD1306 library while I had an old DHT11 bought on Amazon from an Elegoo kit I use their SimpleDHT library (the zip file comes from my google drive).

To you the code:

In the dataShow () function we only set the size, color then show the temperature and humidity with the display.print () function with update set every second.

For the rest there is not much to say except to build a nice container, to add some more sensors, and to play with other features in the examples of the Adafruit library.

The end result is a cute and tiny tool that can be installed with a battery in a small box to keep in the desk!

Arduino + LCD Screen + DHT11 powered

I hope You enjoyed the Tutorial,  leave some comments if you find something wrong or improve it! 

And Dont Forget To Subscribe!😇

A noob like me


  1. This was just what I was looking for.
    I made a few changes to suit myself.
    I changed the text to 3 and modified the display slightly to make it easier to read.
    I also added the readDht line into the void dataShow to update the temp every 1 second.


    #define OLED_RESET 4
    Adafruit_SSD1306 display(OLED_RESET);

    #if (SSD1306_LCDHEIGHT != 32)
    //#error("Height incorrect, please fix Adafruit_SSD1306.h!");

    int pinDHT11 = 2;

    SimpleDHT11 dht11;

    byte temperature = 0;
    byte humidity = 0;
    byte data[40] = {0};

    void setup() {
    // put your setup code here, to run once:

    if (, &temperature, &humidity, data)) {
    display.print("Read DHT11 failed");

    display.begin(SSD1306_SWITCHCAPVCC, 0x3C);


    void loop() {
    // put your main code here, to run repeatedly:

    void dataShow(void) {, &temperature, &humidity, data);
    // display.println("OLED DHT TEST");
    display.print("Temp ");
    // display.println(" C");
    display.print("Hum ");
    // display.println(" %");


    Thanks for sharing the original code.


    1. Im glad you found it useful!
      Thank you for sharing your modification! :)



Post a Comment

Potrebbe interessarti anche:

Use a Telegram Bot to receive data from a Thingspeak channel

Control a Relay with Arduino according to the Temperature

Build a DIY IR Remote Controlled Arduino Lego Car

Home Made Weather station with Arduino