Introduction
In this tutorial, we are going to learn to interface Arduino UNO with OLED 128×64 I2C Monochrome Display.
Skills Required
Basic: This tutorial is well explained for beginners.
Circuit
Connect the pins of OLED with the following pins of Arduino UNO, as shown below.
Arduino UNO
|
OLED I2C Display
|
5v
|
VCC
|
GND
|
GND
|
SDA/A4
|
SDA
|
SCL/A5
|
SCL
|
Install Required Libraries
- Adafruit_GFX.h https://github.com/adafruit/Adafruit-GFX-Library
- Adafruit_SSD1306.h https://www.github.com/adafruit/Adafruit_SSD1306
- Wire.h this library will be installed by default
Either you can download the libraries from Github and add the ZIP file in Arduino IDE using add .zip library option.
Or you can install the libraries directly from Arduino IDE from Manage Libraries. Follow the below steps to install.
sketch -> include library -> manage libraries |
Open manage library from sketch -> include library -> manage libraries
install adafruit ssd1306 library |
Then Search for AdafruitSSD1306 and click on the install button.
install adafruit gfx library |
Then Search for the AdafruitGFX and click the install button. Now we have successfully installed the required libraries for this project.
Adafruit Example Code
Let’s upload the adafruitSSD1306 library example program and test our setup.
Open the example program from File -> Examples -> Adafruit SSD1306 -> ssd1306_128x64_i2c,
because We are using OLED display with I2C interface with the screen size of 128×64.
Now let’s Upload the code
Go to tool menu -> Boards select Arduino UNO, then from Port select the port to which the Arduino is connected