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.
- 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.
27 People Made This Project!
Steen EilerJ made it!
Bearduino made it!
dajosco made it!
k11275764 made it!
ChipStewart made it!
foxthedrummer made it!
dipa57 made it!
clovisf made it!
DanR67 made it!
Len61 made it!
danieldiasm made it!
kcvrokz made it!
PaulD7 made it!
MrCm made it!
WilIiam made it!
sahils100 made it!
HSS1978 made it!
damianvila made it!
DominicB30 made it!
WojciechW10 made it!
dmainmon made it!
abilly made it!
AlvinN14 made it!
TheRadMan made it!
techno guy made it!
johnnyfrx made it!
PrashantM38 made it!
See 18 more that made it
We have a be nice policy.
Please be positive and constructive.
I am new to Arduino so i have a basic question. I think i have install the libs, but the examples don't show up as in the Step 4 image. ant suggestions?
Download the lib from URL mentioned above in a folder say "Download"
Load Arduino, Click Sketch -> Include Library-> Add .Zip and load both the libs
(zip) file downloaded.
Thanks. Had mine up and running on a nano in no time. Powers fine off the usb as well :-)