Arduino OLED Display Library

by Oscar
Published: Last Updated on

There are many different sizes of OLED displays that are compatible with the Arduino. I bought some cheap mini I2C OLED from ebay, works pretty well but the library the seller provides was very difficult to understand, so I decided to write my own library OLED driver.

Understanding How the OLED Display Works

Before we go onto explain how we use the library, I think it’s important that we understand how the OLED display works.

How the OLED Display is Communicated with Arduino

The OLED display is connected to the Arduino using i2c buses, so the “wire” library is used here. As you might know i2c communication allows multiple devices to share the same connection, and each device will have a specific address in hex number between 0x00 and 0xFF. You need to specify the device address in order to talk to the device you want.

Within the OLED display, there are many register, each register controls a certain functionality, such as inverting the display colour, or powering down the display. Again each register will have a unique hex address between 0x00 and 0xFF.

So to tell the display to do something, you basically need 3 parameters: device address, register address and the command. The code example would be:

Wire.beginTransmission(devAddr);
Wire.write(regAddr); 
Wire.write(data);
Wire.endTransmission(); // stop transmitting

For example, to shut down the display of address 0x3C, we change the data in register 0x40 (command register), with value 0xAE, which is the shutdown command.

Wire.beginTransmission(0x3C); // might be different for your display
Wire.write(0x80);
Wire.write(0xAE);
Wire.endTransmission(); // stop transmitting

There are mainly only two registers we need to know here, the command register (mentioned above), and data register, which we use to control the pixels on the screen. For more details on the registers and commands, check out the datasheet.

How to Control Each Pixel on Screen

The matrix arrangement on the display is quite confusing. The screen is divided  into “8 pages” (I know it’s not divided into rows, but pages), and 128 columns. Each page-column unit contains 8 pixels. We control the 8 pixels unit with one hex number (which can be seen as 8-bit-binary number, and each bit controls a pixel).

page-column-arduino-096-i2c-oled-display

oled-matrix-arrangement

For example, display a dot on the top left corner, we need to send a hex number 0x01 (B0000 0001) to the data register, e.g.

Wire.beginTransmission(0x3C); // might be different for your display
Wire.write(0x40);
Wire.write(0x01);
Wire.endTransmission(); // stop transmitting

example-oled-display

To get to the next column, we just need to send the next data, the pointer will automatically increment. Depends on which Addressing Mode we are using, by the time we get to the end of the page columns (col127), we will either move down to the next page automatically (Horizontal Addressing), or the pointer will be reset back to the first column of the same page (Page Addressing). There is also a third addressing mode – the vertical addressing mode. But I don’t think it’s useful so I won’t discuss it here.

So that’s pretty much you need to know to get started coding the OLED Display for Arduino.

Circuit Connection

The OLED I bought is a mono colour, I2C 0.96′ 128×64 OLED display which is about $14. I like I2C because it’s very simple (only 2 data connections), and it leaves other pins available for other devices.

arduino-oled-display-connection

How to use the Library

First Declare Library <OzOLED.h>, an object OzOled will be created automatically. Then initialize the object with “init()” function. You can then use “printString()” function to print text on the screen. Here is a quick example.

#include <Wire.h>
#include <OzOLED.h>

void setup(){

  OzOled.init();  //initialze SEEED OLED display
  OzOled.printString("Hello World!"); //Print the String

}

void loop(){

}

There are many more functions you can use, check out the library for more.

OLED Display Library Download

I might not have time to work on this library and keep it up to date, so free feel to customize as you need to.

https://code.google.com/p/ozoled-oled-display-096-i2c-driver-library/source/browse/OzOLED.zip

Leave a Comment

By using this form, you agree with the storage and handling of your data by this website. Note that all comments are held for moderation before appearing.

83 comments

Daniel de Silva 27th January 2020 - 12:29 pm

Sorry, last source pasted was wrong. Change this 2 lines:
if ((c&(2<<(dy<<1)))!=0) o+=128+64+16+32;; //bit is on?
if ((c&(1<<(dy<<1)))!=0) o+=8+4+2+1; //bit is on?

(the dy<<2 must really be dy<<1)

Thanks again Oscar for share.

Reply
Daniel de Silva 27th January 2020 - 12:25 pm

Hi again,
As comment before, for scaling 4x the fonts i made this:
Add this to TinyOzOLED.h:
void printCharX4(char c, byte X=255, byte Y=255);
void printStringX4(const char *String, byte X=255, byte Y=255, byte numChar=255);

And this to TinyOzOLED.cpp:

void OzOLED::printStringX4(const char *String, byte X, byte Y, byte numChar){
byte count=0;
while(String[count] && count<numChar){
printCharX4(String[count++],(X+count),Y);
}
}
void OzOLED::printCharX4(char C, byte X, byte Y){
byte o,c,dy,i;
//Ignore unused ASCII characters. Modified the range to support multilingual characters.
if(C 127) C=’*’; //star – indicate characters that can’t be displayed
for (dy=0;dy<4;dy++) //real Y size
{
for(i=0;i<8;i++) //bytes of font
{
c=pgm_read_byte(&BasicFont[C-32][i]);
o=0;
if ((i % 2)==0) setCursorXY((X<>1),(Y<<2)+dy); //set cursor only even numbers
if ((c&(2<<(dy<<2)))!=0) o+=128+64+16+32;; //bit is on?
if ((c&(1<<(dy<<2)))!=0) o+=8+4+2+1; //bit is on?
sendData(o); //send 4 times
sendData(o);
sendData(o);
sendData(o);
}
}
}

Reply
Daniel de Silva 27th January 2020 - 10:12 am

Hi Oscar.
Thanks a lot for you share. Im really happy with it.
For those of asking about bigger fonts, here a simple way to do x2 fonts.
Sorry about my source quality but i made it for easy understand.
Im using the same array instead bigger font array. Then less memory ussage ;)
Can testes calling PrintStringX2(“Hello”,0,0);
X4 sized soon.

Add this to TinyOzOLED.h file:
void printCharX2(char c, byte X=255, byte Y=255);
void printStringX2(const char *String, byte X=255, byte Y=255, byte numChar=255);

And this to TinyOzOLED.cpp file:
void OzOLED::printStringX2(const char *String, byte X, byte Y, byte numChar){
byte count=0;
while(String[count] && count<numChar){
printCharX2(String[count++],(X+count),Y);
}
}
void OzOLED::printCharX2(char C, byte X, byte Y){
byte o=0;
//Ignore unused ASCII characters. Modified the range to support multilingual characters.
if(C 127) C=’*’; //star – indicate characters that can’t be displayed
setCursorXY((X<<1), (Y<<1));
for(byte i=0; i<4; i++)
{
byte c=pgm_read_byte(&BasicFont[C-32][i]);
o=0;
if ((c&8)!=0) o+=128+64;;
if ((c&4)!=0) o+=32+16;
if ((c&2)!=0) o+=8+4;
if ((c&1)!=0) o+=2+1;
sendData(o);
sendData(o);
}
setCursorXY((X<<1)+1, (Y<<1));
for(byte i=4; i<8; i++)
{
byte c=pgm_read_byte(&BasicFont[C-32][i]);
o=0;
if ((c&8)!=0) o+=128+64;
if ((c&4)!=0) o+=32+16;
if ((c&2)!=0) o+=8+4;
if ((c&1)!=0) o+=2+1;
sendData(o);
sendData(o);
}
setCursorXY((X<<1), (Y<<1)+1);
for(byte i=0; i<4; i++)
{
byte c=pgm_read_byte(&BasicFont[C-32][i]);
o=0;
if ((c&128)!=0) o+=128+64;;
if ((c&64)!=0) o+=32+16;
if ((c&32)!=0) o+=8+4;
if ((c&16)!=0) o+=2+1;
sendData(o);
sendData(o);
}
setCursorXY((X<<1)+1, (Y<<1)+1);
for(byte i=4; i<8; i++)
{
byte c=pgm_read_byte(&BasicFont[C-32][i]);
o=0;
if ((c&128)!=0) o+=128+64;
if ((c&64)!=0) o+=32+16;
if ((c&32)!=0) o+=8+4;
if ((c&16)!=0) o+=2+1;
sendData(o);
sendData(o);
}
}

Reply
Level42 29th May 2018 - 6:06 am

The link to the library zip is dead, can you please update it ? Thank you !

Reply
andro 6th December 2017 - 1:17 pm

hello how to have a negative value in big numbers?
thank you in advance
andro

char tmp[10];
dtostrf((float)celsius, 3, 1, tmp);
OzOled.printBigNumber(tmp, 0, 0, 5);

Reply
Igor 5th July 2016 - 9:54 am

Neat little library! Well done!
But, I’ve noticed that some decimal numbers are printed wrong when using printNumber(). First of all the numbers are truncated and not rounded but the real problem is with numbers beginning with zero after decimal point, for example:

OzOled.printNumber( (float) -0.00199, 3, 0, 0) prints -0.1 !

Reply
nopphong 4th May 2016 - 12:17 pm

This is good library with some problem.For me i have problem when restart arduino and then the lcd will never work again.
i like this easy to understand and easy to use very much so i try to make it really work.

The problem is from Ozoled,init have some problem in it.I think it from it missing some init command that i don’t know what is it. So i take easy way.Erase all this library init and replace with init from other lcd program.

I take init sequence from this http://robotcantalk.blogspot.in/2015/03/interfacing-arduino-with-ssd1306-driven.html
and edit OzOled.h and OzOled.cpp .I put all the define part in OzOled.h and init part in OzOled.cpp and add Ozoled.clearScreen();
It work like a charm.

Reply
Luis 16th May 2016 - 2:08 pm

Hi. Please, can you put a link here with these modified files? Thanks.

Reply
TBear 29th December 2016 - 10:03 pm

nopphong – can you post your code?

Reply
kim chan 5th January 2016 - 12:36 pm

Hi Oscar
#include
#include

void setup(){
Serial.begin(9600);

}

void loop(){
int a = analogRead(A0);
Serial.print(a);
OzOled.init(); //initialze SEEED OLED display

OzOled.printString( 0, 15, a); //Print the String.

}
Uploads a code or three $ 5 * oled that output. Help me!.

Reply
marten 19th December 2015 - 11:27 am

Hi Oscar

Hello, could you please put in a larger font ? the size is so small that i need reading glasses :(

I have tried a oled font generator, but the format seems wrong ..

Very nice work btw.

Reply
Carl Pedersen 27th October 2015 - 6:56 am

Hi Oscar
Great library, thanks for sharing.
I like it is non-buffered and just update the characters in question.
For your information, I made a few changes in my copy .
Easy to modify to use text on SH1100 controlled oleds.
I added a few functions in order to flip the display vertically as well as adding (a usable) font for the range 128 to 255, iso8855-1 like, and only made changes in printChar() to accomodate for unsigned char output. It adds about 1K to the code size.

Carl

Reply
Olav Gullaksen 15th November 2015 - 4:47 pm

Hi Oscar
Thanks a lot for this tiny and easily used library. After implementing the two additional lines as mentioned by frederic4950 it works well. But I cannot figure out how to output a variable ??

To Carl Pedersen,
I have problems with writing a variable using the printChar function.
Can you maybe release your code for using unsigned char output ?

Br, Olav

Reply
Carl Pedersen 30th December 2015 - 6:45 am

Hi Olav Gullaksen,
Sorry for the later reply, but here are the changes.
Note that I use a #define LATIN1 to allow characters greater than 127.

/***
* printChar takes signed char as input, but converts to unsigned
* before output in order to print chars > 127
*/
void OzOLED::printChar(char C, byte X, byte Y){

if ( X < 128 )
setCursorXY(X, Y);

byte c = C;
//Ignore unused ASCII characters. Modified the range to support multilingual characters.
#ifdef LATIN1
c = (C < 0)?(C + 256):C;
if(c 127 && c < 161) )
#else
if(c 127)
#endif
c=’*’; //star – indicate characters that can’t be displayed

for(byte i=0; i<8; i++) {

//read bytes from code memory
sendData(pgm_read_byte(&BasicFont[c-32][i])); //font array starts at 0, ASCII starts at 32. Hence the translation

}
}

Reply
Per 26th September 2015 - 9:31 pm

Great job providing a minimalistic OLED driver!

Will this work on a larger OLED like a 256×64 unit?

Thanks!

Reply
Bob 14th September 2015 - 6:07 pm

Hi Oscar
Great library – I can seen how to print text in quotes, but is there any way to print a String variable? Can’t see any examples.

Reply
Andreas Spiess 7th August 2015 - 5:06 pm

Excellent work! I ported it to Attiny platform (using TinyWireM library) and included the charge pump code.

I called it TinyOzOLED: github.com/SensorsIot/TinyOzOled

The project is shown on Youtube: youtu.be/mKPKQm0uPBQ

Reply
Devis 26th July 2015 - 5:48 pm

Hi hello,
thanks for great work about OLED.
I`ve some question:
1. how should I do, if I want the display is big alphabet or number?
2. I have RTC, but I don`t know how to display in OLED, her is the RTC example:
———————————————————————————————————————————————————–
#include
#include

RTC rtc(DST_ON);

void setup()
{
Serial.begin(9600);
while(!Serial);
delay(1000);
}

void loop()
{
Data d = rtc.getData();

// GET DATE:
Serial.print(d.year); Serial.print(“/”);
Serial.print(d.month); Serial.print(“/”);
Serial.print(d.day); Serial.print(” “);

// GET TIME:
Serial.print(d.hour24h); Serial.print(“:”);
Serial.print(d.minutes); Serial.print(“:”);
Serial.println(d.seconds);

delay(1000);
}

Reply
Tom 21st July 2015 - 7:10 am

Hi Oscar – Thanks for sharing the code! I was able to get this working on an attiny841 with some modifications. Nice work!!!

Reply
Oscar 21st July 2015 - 10:47 am

Thanks Tom! great to hear it’s working for you!

Reply
frederic4950 1st July 2015 - 3:47 pm

Hello,

Be careful to those who use the heltec.cn OLED module, SDA and SCL pins are reversed from the above connection diagram.
Thanks to Colin, I have added the two following line after OzOled.init() call in the “Hello World” example to have a correct display :
OzOled.sendCommand(0x8d);
OzOled.sendCommand(0x14);
(Perhaps it is better to put them in OzOLED.cpp as Colin said).

Thank you Oscar Liang

Best regards

Reply
irun4fundotca 24th June 2015 - 7:39 pm

should this also work on a Teensy 3.1 I have tried a few times using every set of i2c pins and dont seem to have anything displayed using the hello world example

Reply
Bernd Blumberg 7th June 2015 - 7:14 pm

I bought this display on ebay but it doesn´t work.

ebay.de/itm/171803863493?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

Does anyone know what to change in the library ?

Bernd

Reply
Stuart 5th May 2015 - 12:57 pm

One problem I found is that with the OLED I have, the scroll examples do not work.

Reply
Stuart 5th May 2015 - 12:53 pm

I was getting compilation errors with the example scripts that use your logo:

static unsigned char OscarLogo[]

Here is the compilation error
=============================================================
Arduino: 1.6.1 (Mac OS X), Board: “Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)”

Build options changed, rebuilding all
In file included from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/WString.h:29:0,
from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Print.h:26,
from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Stream.h:26,
from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/Wire/Wire.h:26,
from OLED_Scroll_Right.ino:1:
OLED_Scroll_Right.ino:4:34: error: variable ‘OscarLogo’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
Error compiling.

This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.
==========================================================

I changed static to const and the sketches now compile and run.

Reply
bula87 16th April 2015 - 11:15 am

I tried to use your lib but I find out that sometimes, if OLED has been shut down during some operation, next initialization was unsuccessful. In other hand when I flashed SW with Adafruit lib -> OLED was restarted and next time your lib worked fine. So now I am using init procedure from Adafruit lib with rest of your solution and now everything works fine. So, please check your init function to fix this issue. Thanks for your work because your lib is the smallest one I was able to find.

Reply
sergio 9th May 2015 - 6:24 pm

Hi bula87.
please, I’m having the same problem.
Can you send your skeet to help me?
thank you very much

Reply
Willy 5th June 2015 - 8:18 pm

Hi bula87, I have the same problem, could you please send me the fixed lib please?
I love Oz’s Library, but whenever the Arudino shuts down, I have to load Adafruit code before loading Oz code to display something.

Reply
Andre Saggin 15th April 2015 - 2:36 pm

Hi,
I’m having problems using the Oled Display… I’m not sure about the problem.
The code is compiling and uploading, but the display do not show anything.

I’m beginning in electronics so can you help me?
Why do we connect the display to analog inputs? Can I change those pin?

Down there people say about this commands…
sendCommand(0x8d);
sendCommand(0x14);
What do they mean?

pin connection
Gnd->Gnd
5V->Vcc
4A->SDA
5A->SCL

Thanks in advance.

Reply
Oscar 16th April 2015 - 1:02 am

This is I2C connection, A4 and A5 in this case are not analog pins, they are i2C pins. You cannot change these pins.
Not sure about 0x8d or 0x14, google it.

Reply
Andre Saggin 22nd April 2015 - 1:28 pm

Hey thanks,
I got it working…

Reply
Andre Matos 16th September 2015 - 9:59 pm

Hello I have same problem, after compile and start lcd using U8glib, if I compile an use OzOLed it works, but if I reboot board, display don’t show anything , any idea about this problem ? thanks

Reply
Lee 22nd March 2015 - 10:09 pm

Hi

Great library, I need one with a smaller footprint that the others.

I have one question.. Due to the way my OLED is fitted I need to rotate the output by 180*

How do I do this?

Thanks in advance

Reply
DANS 1st March 2015 - 2:39 pm

Clemzo,

Mail me buddy, I am more than happy to give you a copy of the modified Lib.

I am still tweaking it adding more, I want to tweak the text print routine so uses standard print format to enable storage in progmem and not ram.

:)

[email protected]

Happy coding :)

Reply
DANS 17th February 2015 - 7:04 pm

Hi Oz,

I must say firstly awesome job on the library. One problem I have encountered is it does not init sdd1306 chipset correctly. I have hacked the Adafruit lib and added init code to your library now works a treat.

Question: with print big number font, what tool can I use to generate an additional full stop and percentage sign to add to this font for displaying voltage with a decimal point and humidity sign ?

Fantastic Job, your library I have chosen because of small memory footprint. A+

Dan

Reply
Oscar 19th February 2015 - 12:50 am

Thank Dans!
There are lots of free tools on the internet, just google “oled font generator”. I bought the oled from a chinese seller on ebay, and they supplied a simple software, can’t find it anymore, it’s been a long time!

Reply
Clemzo 20th February 2015 - 7:56 pm

Hi, thank’s for the great Tuto.
Dans, is it possible you give me your modifications because I try to use an Oled 128×64 i2C with ssd1106 on Raspberry Pi and I have great difficults.

Thank you very much.

Reply
Griffo 10th February 2015 - 4:21 am

Hi..great tutorial….Do you have any idea how to add charge pump to use your library with SSD1306 oled display

Reply
pel 26th January 2015 - 12:26 am

how do we specify the font, font size, and location of a word? for example, “hello world” in the middle screen.

Reply
Oleg 23rd January 2015 - 5:44 pm

just received my package. find your library very helpful! (Adafruit’s not fits my memory) and have some brightness problem on both pieces.. at maximum .setBrightness(254) it lit very very dim… any ideas where might be the problem? using 10K pull-up resistor. [email protected]: https://www.dropbox.com/s/dnvfxrixaizd7xp/Photo%2023-01-15%2018%2033%2031.jpg?dl=0

Reply
Oleg 25th January 2015 - 10:35 pm

i found. the problem was in “charge pump” setting. my screen with it turned off (by default) stays dim and almost unreadable.

sendCommand(0x8d);
sendCommand(0x14);

and my display is bright and shining :)) thanx!

Reply
peter 4th January 2015 - 5:34 pm

The OLED on your picture says: “flexible i2c port assignment allows use of more than 1 oled” this is something i am looking for, any idea if it is posible to change the i2c adress of the display? they are cheap but so small iwas thinking about using two of them simltiously.
Peter

Reply
Oleg 23rd January 2015 - 5:47 pm

to change address you have re-solder short at the back side of the plate. https://www.dropbox.com/s/zpoq5estpiguzgi/Photo%2023-01-15%2018%2046%2006.jpg?dl=0

Reply
Loom Miner 2nd January 2015 - 5:41 pm

Hey, what do you type into the void loop and the “ozoled.init(?);”?
I’m stuck dude.

Reply
PeteWK8S 10th December 2014 - 6:15 pm

In my sketch I have several declared variables that are returned as numerical values. How do I print those variables results to the display at a specific location (page mode). example : print(RX_Frequency) 8,0 ??

Reply
Oscar 11th December 2014 - 11:58 am

have you checked the examples i provided in the library?
example OLED_PrintNumbers.ino
that should answer your question.

Reply
Oleg 25th November 2014 - 2:02 pm

…and scroll does not work. Can you help me?

Reply
Oleg 25th November 2014 - 1:33 pm

Hi, I use your library, it works, but right vertical strip of width one pixel, how to fix it? This is similar forgive shift by one pixel to the left?
Thank you!

Reply
raymondw 10th March 2015 - 12:56 pm

I’ve received a new display and run into the same “problem”
Already tried couple of things but seems to stay to much to the left.
Did you found a solutions for this?

“Old” Adafruit display workes like a charm!
Really like the Ozoled software!

Reply
Nick 31st October 2014 - 7:04 pm

Hello Oscar! I have this problem: After power off and restart Arduino text, the display shows the “top down”!!! I don’t know – why is it? Following the reboot, nothing. All remains to the top of your feet! And yet – I can’t increase the font size, and transfer from one line to the next! ( if the text does not fit on one line, it is not transferred to the second…) Help me Please! Here is my sketch: #include
#include
#include “DHT.h”

#define DHTPIN 7 // what pin we’re connected to

#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);

void setup(){

OzOled.init(); //initialze OLED display

OzOled.clearDisplay(); //clear the screen and set start position to top left corner
OzOled.setNormalDisplay(); //Set display to Normal mode
OzOled.setPageMode(); //Set addressing mode to Horizontal Mode
{

OzOled.printString(“DHTxx test!”);

dht.begin();
}

}

void loop(){
{
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds ‘old’ (its a very slow sensor)
float h = dht.readHumidity();
float t = dht.readTemperature();

// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(t) || isnan(h)) {
OzOled.printString(“Failed to read from DHT”);
delay(1000);
} else {
OzOled.printString(” Humidity: “);
OzOled.printNumber(h);
OzOled.printString(“% “);
delay(4000);

OzOled.clearDisplay();
OzOled.printString(” TEMP: “);
OzOled.printNumber(t);
OzOled.printString(“* C”);
delay(4000);

OzOled.clearDisplay();

}
}
}
It would be desirable that the temperature and humidity are displayed on the center screen and large font. And, of course, was not turned over “to the top of the legs when turning the power off and reboot. THANK you very much!

Reply
LynconGabriel 28th October 2014 - 5:33 pm

if know how to create a more large fonts you can say to me? thanks

Reply
LynconGabriel 28th October 2014 - 4:54 pm

So, i’m was working in my own library using you oZoLed library. I was Implemented the full ASCII table, and others things, like BMP arrays. I’m looking the adafruit and u8glib library, and they can control a independent pixel in the display, example:

DrawPixel(0,0); //this is a example

i tried use this code in my library:

sendData(0x01);

they draw a single pixel, but when i change to de next line, they cue some pixels off and then turn on a pixel, away from the other pixel line..

Can you help me to fix this?

SORRY FOR MY ENGLISH, I’M BRAZILIAN AND I’M LEARNING HOW TO SPEAK ENGLISH haha :D
thanks!

Reply
Oscar 29th October 2014 - 10:02 am

sorry i am getting a bit confused. do you have any videos showing the problem?

Reply
LynconGabriel 29th October 2014 - 1:09 pm

i will make a vídeo today, and i’ll send here… ok?!

Reply
LynconGabriel 28th October 2014 - 12:06 pm

hi Oscar! i’m Lyncon, from twitter… I need your help, can you help me?

Reply
Oscar 28th October 2014 - 2:42 pm

Hi! Please state your question here :)
I will try my best to help!
thanks
Oscar

Reply
Colin 7th September 2014 - 3:02 pm

Hi Oscar,
Problem solved!
After much study of the data sheet ( and trial and error), I found that including the lines

sendCommand(0x8d); // charge pump regulator
sendCommand(0x14); //


in the init() section of the OzOLED.cpp file bring everything to life!

Regards,

Colin

Reply
Oscar 28th October 2014 - 5:02 pm

that’s great find! I will test this as soon as i can!

Reply
Jo 3rd May 2015 - 12:46 pm

Well it nearly worked.
I had a display with large numbers and after re-powering all characters were upside down!
Loading a sketch with adafruit drivers and loading my program with your library brought if back to normal.
Strange!
But I must say I love your library. all other libraries I know consume more than 1K RAM, the Ardafruit library takes up about 1.5KB. Not much left for adding a useful program.
Using your library and a small display program I have not even used up 300 bytes!

Reply
Andrey Vlasov 17th February 2015 - 9:17 pm

Colin,

I also stumbled on initialisation problem and your solution resolved it. Thank you.

Oscar, I contacted you from other page (my apology for using wrong way of communication). I confirm that Colin’s solution works for

OLED 0.96″ 128×64 I2C interface with four pins VCC, GND, SCL, SDA — top: yellow bottom: blue with I2C address printed on the back of display 0x78 (real I2C address is 0x3C as it was confirmed by i2c_scanner).

ebay.com/itm/Yellow-Blue-0-96-IIC-I2C-Serial-LCD-Display-Module-F-Arduino-STM32-128×64-OLED-/291341369509?pt=LH_DefaultDomain_0&hash=item43d54c80a5

Oscar, please integrate Colin’s findings into your library.

Andrey

Reply
Stuart 5th May 2015 - 12:44 pm

I can confirm this worked for me too. Had to change the OLED_ADDRESS to 0x3C instead of 0x78 as Andrey discovered (I bought the same OLED screen) and with these two lines added I have “Hello World” up and running.

Thanks for this.

Reply
Tom 10th June 2015 - 12:06 pm

adding extra commands did the trick but now display is upside down..

Reply
Tom 25th June 2015 - 12:32 am

ok I got it working (at least it seems so far:

sendCommand(0x8d); // charge pump regulator
sendCommand(0x14); // VCC
sendCommand(0xA0 | 0x1); //
sendCommand(0xC8); //

not too sure what exactly last two commands do yet, but it does put everything “straight” it seems

Reply
Colin 3rd September 2014 - 11:00 am

Hi Oscar,
I like your library as it does not use as much SRAM as the Adafruit lib. I have tested the examples and they all work but there is an odd problem.
When I load an Adafruit example it displays correctly. I then load up one of your examples and this also works.
Now if I turn off the power and then turn it on again, the OLED display does not light. Switching the power off and on with the Adafruit examples does not cause a problem.
It seems that there is some setting in the Adafruit init() that allows the display to light but when the 5v supply is removed, this feature is reset.
I had also noticed that Adafruit examples do not display unless the Adafruit_SSD1306::display function is used. Is there an equivalent in your library? I am afraid that my C++ knowledge is only very limited!

Regards,

Colin

Reply
Jo 3rd May 2015 - 12:32 pm

I found the same issue. After I read this psot, I just pulled the powersupply (USB plug) and put it in again. No more display; also not after reset
According to the above advice I loaded a small oscilloscope scetch based on the Adafruit drivers for the OLED. The lights were back on. And then I loaded your program again and all was good..

Reply
Steven 29th June 2014 - 12:23 pm

You might want to look at the u8glib library. I’ve been using that to controller the same OLED display and it works great.

It works with both Arduino (I’ve had it working on Arduino Uno) and AVR (on my atmega328p).

Reply
Oscar 30th June 2014 - 12:51 am

okay thanks!

Reply
tryer 24th June 2014 - 3:05 pm

C:Program Files (x86)ArduinolibrariesOzOLEDOzOLED.cpp: In member function ‘void OzOLED::init()’:
C:Program Files (x86)ArduinolibrariesOzOLEDOzOLED.cpp:448: error: ‘TWBR’ was not declared in this scope

Reply
Pete 9th December 2014 - 5:14 pm

I am getting this same 448 error ‘TWBR’ not declared in this scope…in the OzOLED.cpp

What causes this or better what was the solution so compiling can start??

Reply
Oscar 11th December 2014 - 11:46 am

are you using a different micro controller? (i.e. you are not using the Arduino UNO?)
a quick google gave me this: forum.sparkfun.com/viewtopic.php?f=14&t=38031

Reply
The.ONE 13th May 2014 - 10:14 pm

Could you please re-upload library? I downloaded it, but it says that the archive is damaged. Thanks in advance!

Reply
Halil 10th May 2014 - 5:09 pm

Hey! Great library, I wanted to use this display to program a game, Should i work with hex numbers array and bitwise operations for screen updates or would working with X and Y coordinates and a binary array function be a better idea?

Reply
Oscar 10th May 2014 - 11:47 pm

depends on how much needs to be change each frame (each time). If it’s not a lot, for example, only a few characters, it’s better to update only these characters, ie with X and Y coordinator.

Reply
Nico Verduin 8th May 2014 - 6:05 pm

Got the Oled today
Downloaded the lib
loaded the demo …..AND…..
Works like a charm!!!!!

Reply
Nico Verduin 8th May 2014 - 6:14 pm

Btw
Is there a datasheet anywere of this oled?
Regards
Nico

Reply
Oscar 8th May 2014 - 11:59 pm

Well done! :-D

Reply
Mahouny 4th May 2014 - 8:37 am

Hi,
could you please re-upload your OLED library ?
The zip file on google code seems to be broken.
Kind regards,
Richi

Reply
Oscar 7th May 2014 - 11:12 am

Hi, try again now.

Reply
Filipe 10th April 2014 - 6:45 pm

Great work putting this library up. Many thanks for this!

I, being a beginner at programming, found this extremely helpful, as all other libraries make you sweat just to type something on the screen.

May I suggest you put up a list of how to work with all the functions on your library? I went through the library files and figured the little stuff out, but it would be awesome to use all the features it has.
Yeah I know…. N00bs give a lot of trouble don’t they? =)

Reply
Oscar 11th April 2014 - 4:24 pm

Hi, thanks for the support.
have you checked out the example sketches in the library? I used almost all the functions in the examples (i might have missed a few functions which I just came up with after I wrote the example sketches)

Reply
Toby 24th March 2014 - 5:57 am

Unfortunately the zip file shows up as empty for me..

Reply
Rickard Nordström Pettersson 14th February 2014 - 8:11 am

I should be very greatful to take a look at your library, i sitting to create my own for SSD1306 and looks like they working a lot the same.

Send me a e-mail if you whant to share the code, i am looking forward to see your e-mail ;-)

Reply
Oscar 14th February 2014 - 9:25 am

Yes, functionality wise they will be roughly similar to the ones out there, but I am just trying to make one that can be easily accessed and use the least resourse possible.
I should soon publish my code, maybe in a few days time…

Reply