> For the complete documentation index, see [llms.txt](https://wiki.openelab.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.openelab.io/aiot/openelab/0.96-inch-oled-ssd1306-display-i2c-128-x-64-pixels.md). Agents can also search and read this documentation through its [MCP server](https://wiki.openelab.io/~gitbook/mcp).

# 0.96 inch OLED SSD1306 Display I2C 128 x 64 pixels

### 0.96 inch OLED SSD1306 Display I2C 128 x 64 pixels

***

### Product Link

{% embed url="<https://openelab.io/products/096incholedssd1306display?variant=43512221073606>" %}

### Introduction

OLED is organic light-emitting diode, OLED is considered to be the next generation of flat panel displays due to its excellent characteristics such as self-luminous, no backlight, high contrast, thin thickness, wide viewing angle, fast response time, flexible panels, wide range of temperatures, and simple construction and manufacturing process.

### Features

* Resolution: 128 x 64 dot matrix panel&#x20;
* Power supply
  * VDD = 1.65V to 3.3V for IC logic
  * VCC = 7V to 15V for Panel driving&#x20;
* For matrix display&#x20;
  * OLED driving output voltage, 15V maximum&#x20;
  * Segment maximum source current: 100uA&#x20;
  * Common maximum sink current: 15mA&#x20;
  * 256 step contrast brightness current control&#x20;
* Embedded 128 x 64 bit SRAM display buffer&#x20;
* Pin selectable MCU Interfaces:&#x20;
  * 8-bit 6800/8080-series parallel interface&#x20;
  * 3 /4 wire Serial Peripheral Interface&#x20;
  * I 2 C Interface&#x20;
* Screen saving continuous scrolling function in both horizontal and vertical direction&#x20;
* RAM write synchronization signal&#x20;
* Programmable Frame Rate and Multiplexing Ratio&#x20;
* Row Re-mapping and Column Re-mapping&#x20;
* On-Chip Oscillator&#x20;
* Chip layout for COG & COF&#x20;
* Wide range of operating temperature: -40°C to 85°C

### Pinout

Because the OLED display uses I2C communication protocol, wiring is very simple. You just need to connect to the Arduino Uno I2C pins as shown in the table below.

| **Pin** | **Wiring to Arduino Uno** |
| ------- | ------------------------- |
| Vin     | 5V                        |
| GND     | GND                       |
| SCL     | A5                        |
| SDA     | A4                        |

### Dimensions

<figure><img src="https://1292444914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtgOfPnscWebs1eh82EKq%2Fuploads%2FxyzDRbzBWcawBYf4ouv3%2Fimage.png?alt=media&amp;token=d91373fe-2a94-4f18-8c0e-56237a61d183" alt=""><figcaption></figcaption></figure>

### How to Use

If you’re using a different Arduino board, make sure you check the correct I2C pins:

* Nano: SDA (A4); SCL (A5);
* MEGA: SDA (20); SCL (21);
* Leonardo: SDA (20); SCL (21);

<figure><img src="https://1292444914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtgOfPnscWebs1eh82EKq%2Fuploads%2F0JQbunzY4erqVGI7oLiJ%2Fimage.png?alt=media&amp;token=f7496cb7-9227-48ef-b2db-9e19cc9c53a7" alt=""><figcaption></figcaption></figure>

#### Libraries

To control the OLED display you need the [adafruit\_SSD1306.h](https://github.com/adafruit/Adafruit_SSD1306) and the [adafruit\_GFX.h](https://github.com/adafruit/Adafruit-GFX-Library) libraries. Follow the next instructions to install those libraries.

1\. Open your Arduino IDE and go to **Sketch** > **Include Library** > **Manage Libraries**. The Library Manager should open.

2\. Type “**SSD1306**” in the search box and install the SSD1306 library from Adafruit.

<figure><img src="https://1292444914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtgOfPnscWebs1eh82EKq%2Fuploads%2F9Aou5XEssgjvlhF42XHw%2Fimage.png?alt=media&amp;token=8423709c-4664-4973-9af4-1ebce14702c0" alt=""><figcaption></figcaption></figure>

3\. After installing the SSD1306 library from Adafruit, type “**GFX**” in the search box and install the library.

<figure><img src="https://1292444914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtgOfPnscWebs1eh82EKq%2Fuploads%2Fd6j5vTOWimp69h2XPzqc%2Fimage.png?alt=media&amp;token=328a639f-bed6-462c-aa8e-268db4ce6e4d" alt=""><figcaption></figcaption></figure>

4\. After installing the libraries, restart your Arduino IDE.

#### Tips for writing text using these libraries

Here’s some functions that will help you handle the OLED display library to write text or draw simple graphics.

* display.clearDisplay() – all pixels are off
* display.drawPixel(x,y, color) – plot a pixel in the x,y coordinates
* display.setTextSize(n) – set the font size, supports sizes from 1 to 8
* display.setCursor(x,y) – set the coordinates to start writing text
* display.print(“message”) – print the characters at location x,y
* display.display() – call this method for the changes to make effect

#### Testing the OLED Display

After wiring the OLED display to the Arduino and installing all required libraries, you can use one example from the library to see if everything is working properly.

In your Arduino IDE, go to **File** > **Examples** > **Adafruit SSD1306** and select the example for the display you’re using.

<figure><img src="https://1292444914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtgOfPnscWebs1eh82EKq%2Fuploads%2FGEsBTgdtXgJ5cZMv4crb%2Fimage.png?alt=media&amp;token=34cac53b-c847-45a3-9615-c5ac69ca7b4c" alt=""><figcaption></figcaption></figure>

If your OLED doesn’t have a RESET pin, you should set the OLED\_RESET variable to -1 as shown below:

```c
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
```

<figure><img src="https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/oled_reset.png?resize=772%2C143&#x26;quality=100&#x26;strip=all&#x26;ssl=1" alt="set RESET pin arduino IDE OLED display" height="143" width="772"><figcaption></figcaption></figure>

Upload the code to your Arduino board. Don’t forget to select the right board and COM port in the **Tools** menu.

You should get a series of different animations in the OLED as shown in the following short video.

{% file src="/files/rxMr9DbrL0a4GJ64rjvB" %}
