About: i make stuff, like to take projects, ideas, motivation to next level. if you love D.I.Y. and electronics, click on the link in description to get amazed

Hello there! Fellow electronics enthusiasts, I am quite sure we all make some or other projects, as a part of our learning experience or academics. We sure would want to display some data present on our micro-controllers, from sensors or simply display some message, so here is a quick tutorial about OLED displays, in which we will learn how to wire and program a 0.96inch OLED Display with Arduino Microcontroller. so follow up this instructable to understand and display your own Message on a OLED Display.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Watch the Video

Step 2: Gather the Material

for this Tutorial, we will require only 3 things.

1. 0.96" OLED Display https://www.gearbest.com/diy-parts-components/pp_1...

2. Arduino Uno / Nano : https://www.gearbest.com/development-boards/pp_629...

3. Connecting Wires : https://www.gearbest.com/diy-parts-components/pp_2...

Step 3: Wiring

Since this OLED works on I2C Communication, we have to connect

only 4 pins to Arduino

OLED has Sck (i.e. clock), SDA (i.e. Data) and Power pins i.e VCC and Ground.

On the Arduino UNO Board, we have SDA at A4 and SCK at A5.

Connections for OLED to Arduino

  • Vcc - 5V
  • Gnd - Gnd
  • SDA - A4
  • SCK - A5

Step 4: I2C Scanner

we know each I2C device has different Hexadecimal Address.

since this OLED uses I2C Communication protocol, we have to find the I2C address for the display.

this could be done by uploading the following code onto your board with the device connected.

/* I2C Address Finder
* for " Arduino LCD I2C Tutorial| How to Program LCD Display" * subscribe for more arduino Tuorials and Projects https://www.youtube.com/channel/UCM6rbuieQBBLFsxs... */

#include < wire.h>

void setup()

{ Serial.begin (115200); while (!Serial) { }

Serial.println (); Serial.println ("I2C scanner. Scanning ..."); byte count = 0; pinMode(13,OUTPUT); digitalWrite(13,HIGH); Wire.begin(); for (byte i = 1; i < 120; i++) { Wire.beginTransmission (i); if (Wire.endTransmission () == 0) { Serial.print ("Found address: "); Serial.print (i, DEC); Serial.print (" (0x"); Serial.print (i, HEX); Serial.println (")"); count++; delay (1); } } Serial.println ("Done."); Serial.print ("Found "); Serial.print (count, DEC); Serial.println (" device(s)."); }

void loop() {}

Step 5: Download and Include Libraries

you will need to include the following libraries into your IDE before staring the code.

you can include these libraries by following the steps.

  1. go to Sketch menu.
  2. select Include Libraries.
  3. go to Manage Libraries.
  4. search for ADAFRUIT GFX and INSTALL it.
  5. search for ADAFRUIT SSD1306 and INSTALL it.

else, you can install it externally using the following link.



Step 6: Testing the Display

to check if everything works as expected, lets run an example file to test the display.


  • go FILE > EXAMPLES > SSD 1306 > Select 128 X 64 i2c
  • if you get and Error, try SSD 1306 > Select 128 X 32 i2c
  • change the I2C Address on line 61 and replace it with the address you found in step 4.
  • upload the code

once uploaded, you will see the test animation on the screen, which means you have successfully set up the oled.

Step 7: Write Your Own Message

to write our own message,

we will first open a new sketch on IDE,

then Include these 4 Libraries in the header

#include <spi.h>
#include <wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

, then we will write the Reset Protocol.

<p>#define OLED_RESET 4<br>Adafruit_SSD1306 display(OLED_RESET);</p>

Now, in VOID SETUP, we will Begin the display and Clear it

also, here we have ( 0 x3C ) as hexadecimal I2C Address, so change it as shown in step 4

<p>display.begin(SSD1306_SWITCHCAPVCC, 0x3C);</p><p>display.clearDisplay();</p>

In Void Loop, we will write our Main Code i.e. the message we want to display

For which, will need to Describe the TEXT size, TEXT color, Cursor Position and then finally write the Message using println command

<p>display.setTextSize(2);<br> display.setTextColor(WHITE);
 display.println("Subscribe Now! ");      / here the message is inside the "" </p>

Don’t forget to write display.display else we will get a blank screen.


If you followed up properly, this is how the output of the following code should look like.




the entire code is as

<p>/* Starting with Arduino OLED coding<br> *  for " arduino oled i2c tutorial : 0.96" 128 X 32 for beginners"
 *  subscribe for more arduino Tuorials and Projects
<a href="https://www.youtube.com/channel/UCM6rbuieQBBLFsxszWA85AQ?sub_confirmation=1">
 */</p><p>#include <wire.h><spi.h><br>#include <spi.h><wire.h>
#include <</wire.h></spi.h>Adafruit_GFX.h></p><p><spi.h><wire.h><adafruit_gfx.h>#include <</adafruit_gfx.h></wire.h></spi.h>Adafruit_SSD1306.h></p><p>#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);</p><p>void setup() 
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.clearDisplay();</p><p>}</p><p>void loop() 
  display.println("Subscribe Now!");
Electronics Tips & Tricks Challenge

Participated in the
Electronics Tips & Tricks Challenge

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    17 Discussions


    Reply 3 months ago

    it worked for me, without any problem, but if it doesn't works for your case, please change it to UPPER CASE or vise versa, Thank you!


    Reply 3 months ago

    Ahh, right I have the Wire library with uppercase. Thanks for the tutorial


    Answer 11 months ago

    i don't think it can display video, because its resolution is very low, although you can display pictures by converting the picture to digital information, which is quite complex.

    i think your question was regarding application for small video playing device, well arduino cant process that information, although there are other devices and screens which can do this job perfectly.

    thank you for interacting!
    for more questions feel free to comment


    11 months ago

    Great Instructable - BUT - the old I bought doesn’t just have four connections, it has seven!
    How do I connect it to my MEGA 2560?
    Does it require a different library?
    In other words - HELP!!

    7 replies

    Reply 11 months ago

    can you attach a picture of the same, i cant imagine which oled you are talking about! thanks


    Reply 11 months ago

    Thanks for coming back to me.
    The oled’s title was - 0.96” 128x64 IIC I2C SPI OLED White/Blue/Yellow
    I have taken pictures of it, but I am having difficulty transferring them to this posting.
    When I find out how to do it, I will forward them.
    Thanks again for your interest.


    Reply 11 months ago

    you can convert your spi oled to i2c oled ( if your display supports it ) here is a video tutorial for the same

    if you still wish to use spi interface ( i.e. dont want to make changes in your hardware) simply connect the scl a4 and sda a3 as shown in the picture


    Reply 11 months ago

    Many thanks Anton, I will watch, read and inwardly digest in due course.
    It looks good.

    Howard Quinn

    11 months ago on Step 7

    Good tutorial for the I2C oled, but there exists the SPI oled what about it?
    H J Quinn

    1 reply
    MissionCriticalHoward Quinn

    Reply 11 months ago

    only conenctions change for spi OLED, and in examples for adafruits ssd1306, you can find a ssd example too, the code (syntax ) remains same for writing simple codes, for any further questions feel free to comment !


    11 months ago

    Can I recommend the U8g2lib in preference to the Adafruit library.

    It is MUCH smaller than the Adafruit library.
    A little faster too I think.

    1 reply

    Reply 11 months ago

    absolutely, the syntax on this library are much easier than u8g2lib, but yes, u8g2lib is much smaller and little fast and compact too, adafruit is much popular and people can relate to it as its known to everyone.