Good morning!
The uber driver said he found my iPhone, so all is good on that front. Meanwhile, back in the lab:
The question: are OLED displays slow, is there a better library or are the cheap ones cheap because they are - stupid slow?
The library I finally found for this display is at github by olikraus/u8g2.
I present this sketch gleaned from internet searching. It does run the little SSD1327 I2C 128x128 OLED display and the results are what you'd think by examination.
However each line of text takes 1.333 seconds to display. Watching the pin 13 indicator I measure 0.75 Hz, not a typo.
I've used OLED displays elsewhere, I never noticed that they were particularly this slow.
/* minimal sketch for b**gg**d 1.5" OLED I2C SSD1327 display */
# include <U8g2lib.h>
U8G2_SSD1327_EA_W128128_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
void setup() {
u8g2.begin();
pinMode(13, OUTPUT);
}
int pos = 20;
void loop() {
digitalWrite(13, HIGH);
u8g2.firstPage();
do {
u8g2.setFont(u8g2_font_ncenB14_tr);
u8g2.drawStr(0,pos,"Hello World!");
} while (u8g2.nextPage());
digitalWrite(13, LOW);
pos += 20; if (pos > 120) pos = 0
delayMicroseconds(50); /* stretch LOW state so frequency can be meaasured */
}
On a hunch I moved the setFont call to the setup() function, no joy.
alto777
Please provide click-able link to the exact library on github.
At olikraus · GitHub there are two plausible links
and
the latter I noticed in getting the "click-able link", and I thought uh-oh there's the prob but I removed the first and installed the second. No joy.
a7
Thanks for the nudge.
I am throwing in the towel on this. As in giving up, not accepting a penalty!
After some experimentation:
The module marked 128x128 has actually a 128x96 pixel screen, unless I am missing the "unlock extra pixels and adjust aspect ration" function call…
And it appears that it is just a slow device - thinking text might be the slog I drew some lines, just as slow and where I (finally) saw that it was 128X96.
Dunno if I'll bother to take it up w/ the supplier. Live and learn + caveat emptor ya know.
alto777
Just in case:
I return here to report that much to my surprise using the wrong library worked the way it did:
The wrong library resulted in a 128x96 "visible" window centered vertically in the real 128x128 pixel grid. Leading me to think the worst of my good friends who sell really cheap but almost usually quite good electronics bits and pieces.
I apologize and have scheduled a slapping of me with a large damp trout. You'll have to trust me, there will be no youtube proof.
So not
U8G2_SSD1327_EA_W128128_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
but
U8G2_SSD1327_MIDAS_128X128_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
Googling differently or better (!) turned up some traffic which perfectly well explains the slow speed. Even on systems with enough RAM for a larger buffer these displays are never going to be amazing.
But at least I have the 128x128, I'll deploy it in something where the speed won't matter.
alto777
There are multiple reasons for the slow speed:
- You have used the
_1_
u8g2 constructor, better use the _2_
or _F_
if you have enough RAM (U8G2_SSD1327_MIDAS_128X128_F_HW_I2C
).
- U8g2 will use the Arduino Wire library, which in turn is not very fast. You can tweek the speed with the u8g2.setBusClock command.
- The biggest slowdown is the display itself. It is a 4 bit 16 graylevel OLED. So each pixel requires 4 bits to transfer. Simply spoken, the transfer speed quartered.
- There is a small issue in u8g2 which currently reduces the speed by 4%. This will be fixed in an upcoming release.
Note: U8g2 is available in the Arduino library manager. The gitub projects u8g2 and U8g2_Arduino are the same. The later is the Arduino variant and is generated out of the other project.
Oliver
1 Like
alto777:
- thinking text might be the slog I drew some lines, just as slow and where I (finally) saw that it was 128X96
It probably isn't, but drawing text instead of using characters might be.
Live and learn + caveat emptor ya know.
A situation that may be fixed by user-acquired competence. I don't know what your speed problems really are, but you might find this useful. It is for SSD 1306
I used setBusClock to 1500000 (default is 100000) and that makes the OLED considerably faster, so that's definitely worth a try. I use an Arduino MKR1000 for a Fractal AXE-FX III midi controller project and changing this value makes it work a lot better. No more waiting for the OLED to update... 
u8g2.setBusClock(1500000);