Introduction: The First Usage of 0.96" I2C OLED Display With Arduino UNO

Picture of The First Usage of 0.96" I2C OLED Display With Arduino UNO

Today, I am going to show you how to use 0.96" I2C OLED display with Arduino UNO board. There are a lot of different type of OLED displays. I have got 4-pinned OLED display with me. This displays can be with SPI pins instead of I2C. These versions can be seen on Adafruit's website

The Need List:

1. Arduino UNO (With USB A to B cable)

2. 0.96" I2C OLED display (4-pinned)

3. Tiny Breadboard or male-female tiny cables

4. Your computer (Arduino IDE loaded)

Step 1: The Code

Download the file below, then copy the codes to paste on Arduino IDE.

Step 2: The Necessary Libraries

Picture of The Necessary Libraries

On Arduino IDE >> Sketch >> Include Library >> Manage Libraries >> search for Adafruit_SSD1306 then install, and search for Adafruit_GFX then install.

Also check Adafruit's Github page for more

Step 3: The Connections

Picture of The Connections

Arduino 3.3V - VCC OLED

Arduino GND - GND OLED

Arduino Analog In A5 - SCL OLED

Arduino Analog In A4 - SDA OLED

Step 4: The Modifications

Picture of The Modifications

When we loaded Adafruit library we need to modify it.

Go to the folder where Arduino libraries are loaded,

C:\Users\<em>**your pc name**</em>\Documents\Arduino\libraries\Adafruit_SSD1306 

On this folder, find Adafruit_SSD1306.h file, click on it or press F2 to rename, rename it as Adafruit_SSD1306.h.txt then find this sentences in the middle of the codes, seems like:

<p>//#define SSD1306_128_64<br>   #define SSD1306_128_32
//#define SSD1306_96_16</p>

Comment the 32, and uncomment the 64 as

<p>     #define SSD1306_128_64<br>//   #define SSD1306_128_32
//   #define SSD1306_96_16</p>

CTRL + S to save this text. Go to the library folder and find Adafruit_SSD1306.h.txt to rename as Adafruit_SSD1306.h then return to Arduino IDE.

Step 5: Upload the Codes to Arduino UNO

Picture of Upload the Codes to Arduino UNO

On Arduino IDE (I used v1.6.8 for this instructables, learn how to update/download Arduino IDE) click on upload button to upload the codes from your computer to your Arduino UNO via USB cable type A to type B.

After the upload, click on reset button on Arduino board, then check your OLED display for the joy :D

Step 6: BONUS PROJECT: Reading Temperature and Humidity Values to Put These on OLED Display

Picture of BONUS PROJECT: Reading Temperature and Humidity Values to Put These on OLED Display

Let's see what the temperature and the humidity ratio are on our OLED display. I modified the codes. On below, you can get code.txt file as codes are written on there by Bay Yolal.

The connections are like this:

Arduino 3.3V - VCC OLED

Arduino GND - GND OLED

Arduino Analog In A5 - SCL OLED

Arduino Analog In A4 - SDA OLED

Arduino 5V - VCC DHT11

Arduino GND - GND DHT11

Arduino pin 2 - Data DHT11

.

Note: code.txt is the original code included. code_°C.txt file is for displaying the centigrade degree symbol.

.

That's all !

Step 7: BONUS: Reading This Instructable

NOTE: This instructable's step is aimed for visually impaired people to hear the sentences to learn what's going on here. Watch the video, it explains all steps.

Comments

schubbel. (author)2017-08-19

Very nice explanation :-)

belfastrab (author)2017-07-07

Thank you for a thoroughly superb tutorial that covered everything for a beginner which a lot of other tutorials leave bits out. Really appericiate the help. Thanks

makanga (author)2016-09-30

I get the error below, what can do bout it?


#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");

Bay Yolal (author)makanga2016-09-30

It means that your screen height is not 64 pixels. If you have 128 or something other like that you need to modify your Adafruit_SSD1306.h library That's all.

bennyleo (author)2016-05-04

Excellent work, thank you for explaining to edit the Adafruit library !!!!

Daniel:)

About This Instructable

9,005views

31favorites

License:

Bio: Living in Istanbul, answering your questions :)
More by Bay Yolal:How to use Raspberry Pi 3 Model B+ V1.2 For The First Time!How to knit baby booties in only one hour! Ta-Da!How to Extract Walnut
Add instructable to: