Shares

ESP8266 0.96 inch OLED Display with Arduino IDE

Shares

This post shows how to use the 0.96 inch OLED display with the ESP8266 using the Arduino IDE.

(There is also a post about how to use the OLED display with the Arduino).

Introducing the 0.96 inch OLED display

The OLED display is the one in the following figure:

dsc09476

This is a very small display that is made of 128 by 64 individual OLED pixels and no backlight is required. This display uses I2C communication. This means that it can communicate with the ESP8266 using just 2 pins.

Libraries

To control the OLED display, you will need to install the esp8266 oled ssd1306 library.

Installing the esp8266 oled ssd1306 library

  1. Click here to download the esp8266 oled ssd1306 library. You should have a .zip folder in your Downloads folder
  2. Unzip the .zip folder and you should get esp8266-oled-ssd1306-master folder
  3. Rename your folder from esp8266-oled-ssd1306-master to esp8266_oled_ssd1306
  4. Move the esp8266_oled_ssd1306 folder to your Arduino IDE installation libraries folder
  5. Finally, re-open your Arduino IDE

Example: Display the temperature and humidity in the OLED display

In this example you will display the temperature and humidity in the OLED display. This is just an example for you to understand how to integrate the OLED display with your ESP8266 using the Arduino IDE.

The idea of using the OLED display with the ESP8266 is to ilustrate how you can create a physical user interface for your ESP (you can also add web server capabilities to this project).

The temperature and humidity will be measured using the DHT11 temperature and humidity sensor.

dht-11

If you’re not familiar with the DHT11 sensor I recommend that you check out the following blog posts:

Parts required

For this example you’ll need the following components:

Schematics

Assemble the circuit by following the schematics below.

display-dht11-oled_bb

Code

Before uploading the code, make sure you’ve installed all the necessary libraries. Note that for this example, you also need to install the DHT library.

Installing the DHT sensor library

  1. Click here to download the DHT-sensor-library. You should have a .zip folder in your Downloads folder
  2. Unzip the .zip folder and you should get DHT-sensor-library-master folder
  3. Rename your folder from DHT-sensor-library-master to DHT_sensor_library (you really need ro replace those “-” by “_”)
  4. Move the DHT_sensor_library folder to your Arduino IDE installation libraries folder
  5. Finally, re-open your Arduino IDE

Here’s the code that you should upload to your ESP8266.

Demonstration

Here’s what you will have in the end.

demonstration-esp8266-oled

Wrapping up

I hove you’ve found this post useful.

If you want to use the OLED display with the Arduino check the following post:

If you like this post probably you might like my next ones, so make sure you subscribe the RNT blog.

Thanks for reading,

Rui

Leave a Comment:

Add Your Reply