Introduction: OLED I2c Display With Arduino
In this instructable I will show you how to connect and test a 0.96" i2c OLED display module to an arduino.
Parts:
- Breadboard and hookup wires
- Arduino (using a nano v3 5v 16mhz clone in this case)
- External power supply (regulated 5v)
- The OLED i2c display
I bought my display around 6 months ago, and I can’t seem to find the exact display on ebay now, but searching for “0.96 ssd1306 i2c OLED” shows a whole lot of similar displays. Other sites, like adafruit, got the same displays if you prefer to shop there.
Step 1: Connecting Your Display
The display is connected by utilizing the i2c pins on your arduino.
Which pins to use for this differs on some arduino models, but on the UNO and NANO you use pin A4 (SDA) and A5 (SCL). If you’re using another arduino, google the pinout and look for SDA and SCL pins. (For example, google “arduino mega pinout”, and check the images).
I first attempted to power my display from my arduinos 5v. This worked, but only halfway – the display fired up, and started cycling the demos in the sketch we will see later on, and then froze after a few seconds.
I then powered my display from my external 5v supply (with common ground to the arduino), which did the trick – the display is now working properly.
The connections from the display:
- VCC to external 5v
- GND to external GND
- SCL to arduino pin A5 (or the SCL pin for your arduino)
- SDA to arduino pin A4 (or the SDA pin for your arduino)
- arduino GND pin to external psu GND
Arduino is connected to the computer via an USB cable. The USB powers the arduino.
Step 2: I2c Scanner
To start out, we need to find out the i2c address of the display. To
accomplish this, I use a quick i2c scanner uploaded to the arduino. The scanner code can be found on http://playground.arduino.cc/Main/I2cScanner.
Copy and paste the code into your arduino IDE, build and upload, and fire up your serial monitor. If your display are connected, powered and working, you will get an address back from the scanner (in serial monitor). My display shows up at address 0x3C.
Step 3: Libraries
In this instructable I am using the arduino IDE (http://arduino.cc) and libraries from adafruit downloaded via github.
Link to the libraries:
I will assume you know how to download and install libraries in your arduino IDE. If not, there are tons of nice tutorials/instructions out there on how to get started with the arduino IDE and libraries.
Both libraries below needs to be installed before you are able to continue with this instructable.
https://github.com/adafruit/Adafruit_SSD1306 (SSD1306 library)
https://github.com/adafruit/Adafruit-GFX-Library (GFX library)
Step 4: Test Sketch
Now that we know our displays i2c address, we can open the example sketch in our adafruit ssd1306 library.
In your arduino IDE, check your examples menu and locate the 128×64 i2c sketch found under Adafruit SSD1306 (as shown in the picture).
Change the address of the display to whatever the scanner told you, in my case 3x0C.
Compile and upload to your arduino, give it a second, and the display should fire up and show some different display modes.
The demo sketch ends with stars that continues to fall forever. You can copy-paste from the demo sketch to use the display modes that fits your needs.

Participated in the
First Time Author Contest
41 People Made This Project!
- Aquas15 made it!
- philtrim made it!
- MarvinAndroid made it!
- Flowersun made it!
- SurroundedByMuons made it!
- hori64 made it!
- WenHao1223 made it!
- PhilJ29 made it!
- MilanB49 made it!
See 32 More
111 Comments
Question 1 year ago on Step 4
How do i buy this product?
Answer 5 months ago
The fastest way for USA and Canada, and with "real" customer support, is UNIVERSAL-SOLDER Electronics Ltd.
You can find the 0.96" I2C version here:
https://universal-solder.ca/product/oled-128x64-pi...
If you prefer SPI, instead of I2C, look here:
https://universal-solder.ca/product/oled-display-0...
We also have a version with 1.3" diagonal in stock.
VERY IMPORTANT:
These displays are not always equipped with the SSD1306 controller chip, and Adafruit's library does NOT work with the (more common) SH1106 controller. You can find a working library on our website, one that works with both controllers.
Question 1 year ago on Step 1
Is it possible to use this display to see the frequencies from 100-600 MHz ? If you can help, please do so. If we can make any practical decision, it will help me a lot. It will make me to order more than 50 of this display in the first wave.
Lot of thank for your time and efforts to help.
Very Kind Regards, Nik.
Question 2 years ago
Hey there, I'm getting _this_ error
In file included from C:\Users\Owner\Documents\Arduino\libraries\Adafruit-GFX-Library-master\Adafruit_GrayOLED.cpp:20:0:
C:\Users\Owner\Documents\Arduino\libraries\Adafruit-GFX-Library-master\Adafruit_GrayOLED.h:30:10: fatal error: Adafruit_I2CDevice.h: No such file or directory
#include <Adafruit_I2CDevice.h>
^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Arduino Uno.
Anyone have any idea what this means? I made sure to include and install all listed libraries.
Answer 2 years ago
Hello,
Install the library with the library manager (in arduino), and choose the last version.
Answer 2 years ago
https://learn.adafruit.com/adafruit-veml6075-uva-u...
This helped my problem
2 years ago
Thanks, helped me a lot running the display
Tip 2 years ago
We usually don't have enough ram for the Adafruit libraries - but these displays are not that hard to drive directly. And with I2C OLED's getting so cheap lately, there's no reason to squash it all onto just one display either:
https://thecavepearlproject.org/2020/11/15/adding-...
5 years ago
Hello,
My OLED is a just white color I want to change to different color.
Is it possible?
Thank you and wish you a nice day.
Reply 5 years ago
Most of these small OLED displays can only use black and white
Reply 3 years ago
I burned one of these up years ago, and tore it apart. The one I had was a yellow top over blue bottom. When pulled apart, the color was done using pretty much gel paper to color the white true color of the OLED display..
Reply 3 years ago
Years ago I worked in theatrical lighting and stage sound. We used Gel Paper to change the color of spot lights as well as floods for effective presentations. A short time ago, my wife complained that one of the clock kits I built for fun was to bright, so I did a quick search for this on Ebay and found it readily available. I ordered a small square, about 1 foot square, and cut a small piece from a corner, I added that to the face of the clock and it lowered the brightness as well as changing the color to a much deeper green (I ordered green gel paper)
Reply 4 years ago
If it's white, I'd think you could put a square of colored acetate or some other transparent tinted plastic over the display to get whatever color you want. Assuming you mean you know it's a monochrome display and you're not wanting to change colors under program control.
Reply 5 years ago
I suppose, it is impossible. The colour is unchangeable, it defined by the used OLED type.
Reply 5 years ago
Is there different ROLES with the same controller but different color? because as you can see up there it's blue .
Reply 5 years ago
Yes, you are rigth. The same SSD1306 controller can supplied with blue or white monohrome display panels.
3 years ago
well done, thanks for the tutorial, this is fantastic ! much appreciated !
4 years ago
I have this problem, what I have to do?
Reply 3 years ago
You may have a different display driver to the SSD1306. This was my problem in this case. I had the SH1106. Try this library... https://github.com/wonho-maker/Adafruit_SH1106
Reply 3 years ago
You are a life saver .. can you help me with this "every second line is blank... "