Go Down

Topic: Getting Started with OLED Displays  (Read 195 times) previous topic - next topic

MannyC

This is a tutorial that explains how OLEDs work, and shows how to use them with Arduino UNO via I2C interface.

The project demonstrates how each of the following features can be displayed:

-Pixel
-Line
-Square
-Circle
-Image

The screen used in this project is a 128x64 with driver SSD1306.

http://www.jayconsystems.com/tutorials/Intro-OLED/



Automate your life

bodmer

#1
May 19, 2016, 12:21 am Last Edit: May 19, 2016, 12:23 am by bodmer
Hi,

I had a few of these 0.96" OLED I2C displays arrive today in the post so I tried your tutorial and it worked fine. The display is not the same so I had to make a few minor changes to the sketches:

1. No Reset pin on my display, so those lines in the sketches can be deleted.
2. The I2C address was not as printed on the back of the OLED PCB ( 0x78 )! So I ran an I2C scanner sketch and found the display actually responded to address 60 (0x3C) so the I2C addresses which were 0x3D in the example sketch were changed.

Then the sketches ran fine.

To progress further I suggest the Adafruit_SSD1306 library is used as this incorporates all the graphics functions inside the library plus printing text and numbers to the screen. There are also quite a few other graphics libraries that efficiently use the UNO's RAM.

It would be worth talking about the need for pullups and whether these are on the display. Also sometimes the OLED display boards are not 5V logic compatible so care needs to be taken.

P.S It would be useful to show a clearer connection diagram at the start of the tutorial as this is where most newbie's go wrong. A link to an I2C scanner will also help so users can check the display is connected correctly.
Formerly Rowboteer (now a broken user profile!)

bodmer

Update:

I now have my display working with the Adafruit_SSD1306 and Adafruit_GFX libraries. I have found that you do have to allocate a pin to the reset in the sketch even though the particular display I have does not have a reset pin, this is just to keep the library happy.  As I am not using pin 4 I used:

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);

Which was already in the "ssd1306_128x64_i2c" example that came with the library.

I also have a SparkFun example sketch running for displaying a micro sized analogue clock which is quite cute. See attached.
Formerly Rowboteer (now a broken user profile!)

bodmer

Just had a look inside the Adafruit library. It looks like setting the reset pin to -1 will keep the library happy and you don't need to reserve a spare pin  :)
Formerly Rowboteer (now a broken user profile!)

MannyC

Thank you for your feedback. We are glad you found this tutorial useful.

The purpose of this tutorial is to have a deeper understanding of OLED displays without the use of libraries.

We have a library that supports not only the SSD1306 (128x64) driver, but also:

Epaper
KS107
PFC8833
SSD1306 (96x16)
SSD1306 (128x32)
SSD1306 (128x64)

You can download it here:

https://github.com/JayconSystems/Jaycon-Universal-Graphics-Library

 
We will show how to use this library in a different tutorial soon.
Automate your life

MannyC

Here is the tutorial that shows how to use the JUGL library

https://forum.arduino.cc/index.php?topic=402740.0
Automate your life

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy