Site icon AranaCorp

Using a 0.91in OLED display with Arduino


The 0.91in OLED display is a compact graphic display with a resolution of 128×32 pixels that allows you to draw and display text to create a graphical interface. Among all the displays available for the Arduino, the OLED display is taking more and more space on the market. Since they are thinner and do not require backlighting, they are easy to insert in miniaturized projects.


Principle of operation

The 0.91in OLED display is a monochrome display driven by the SSD1306 IC and interfaces using I2C communication.


The OLED screen has 4 pins to allow the management of the display. It is powered by the microcontroller and connects to the I2C bus.


Once your OLED display is correctly connected, you can modify the following code to obtain the desired functionality. In the following example, we will simply realize the display of a manage the OLED screen, the libraries used are Adafruit_GFX.h and Adafruit_SSD1306.h whose functions to know are the following:

Other more specific functions exist to draw rectangles, lines or to display images. Once you have mastered these functions, it will be easy to display what you want.

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

Adafruit_SSD1306 display = Adafruit_SSD1306(128, 32, &Wire);

byte compteur;

void setup() {

  Serial.println("OLED intialized");
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Address 0x3C for 128x32


  // Clear the buffer.

  // text display tests

void loop() {

  for (compteur = 0 ; compteur < 25 ; compteur++) {
    display.setCursor(0, 0);
    display.println("test compteur");
    display.print("compteur: ");


Observe carefully where the displayed strings are placed and play with the input parameters of the functions to compare their effects. This will allow you to have a better understanding of the library and the functionalities of the Oled module.



Retrouvez nos tutoriels et d’autres exemples dans notre générateur automatique de code
La Programmerie

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 3

No votes so far! Be the first to rate this post.

Exit mobile version