Go Down

Topic: U8glib: Graphics Lib for LCDs and OLEDs (Read 226303 times) previous topic - next topic


Thanks for this great module!

I couldn't find in the documentation what pins need to be connected for the SSD1306 in 128X64 in I2C mode. I am able to get the display to work fine with the adafruit library but doing a simple hello world with this library gives me nothing.

I'm using it with an Arduino Mega and I have SDA and SCL connected to 20 and 21 and I have tried with the reset line disconnected and connected to pin 4.

Any suggestions?


U8glib will use the I2C subsystem, so pin 20 and 21 should be ok. However external pullups are required. Internal pullups could also be activated.



The new version 1.14 is available for download.

Currently there are two download locations:
Bintray: https://bintray.com/olikraus/u8glib
Google Code: http://code.google.com/p/u8glib/downloads/list

V1.14 of U8glib is mostly a bugfix release.
New features:
* Support for the A2 micro printer
* Ellipse draw procedure

Details are here: http://u8glib.googlecode.com/hg/ChangeLog



Hi, Oliver. I have an LCD I'd like to get working in U8glib. It's the Laurel  LCD model LG12864L. It's an ST7565P device, so I poked around with all the current ST7565 constructors, but none work perfectly.

U8GLIB_NHD_C12864 u8g(SCK, MOSI, CS, A0, RST) gives a good layout, but the screen is very dim. I can change the contrast in the C file, but the screen overall is still very dim.

U8GLIB_DOGM128 u8g(SCK, MOSI, CS, A0, RST) has good contrast and brightness, but there are several garbled columns on the side of the screen.

What can I do to help get this LCD supported in the library?



What is your version of u8glib? Maybe you can also link to the datasheet of your display.

In principle it is better to start with the constructor which has the better layout, so I think the
U8GLIB_NHD_C12864 u8g(SCK, MOSI, CS, A0, RST)
should be the best starting point (assuming a correct layout).

By comparing the init sequences, the only difference with respect to the contrast is the contrast value itself. So it should be possible to get the same contrast as the DOGM128 constructor with he NHD constructor. How did you set the contrast?

Code: [Select]

should give the same contrast as for the DOGM128 init code.



Ah ha, that seemed to work. I changed what I thought was the contrast value in u8g_dev_st7565_nhd_c12864.c, but I may have changed the wrong value.

The change log indicates I'm using v1.14

NHD constructor with your contrast value change.

Regular NHD constructor.

You can see all their displays on http://laurellcd.com/boce/por-01-001.asp. The two relevant models are http://laurellcd.com/webadmin/promgt/files/LG12864L-DW.pd, http://laurellcd.com/webadmin/promgt/files/LG12864L-DW-TP.pdf, http://laurellcd.com/webadmin/promgt/files/LG12864T-DW.pdf and http://laurellcd.com/webadmin/promgt/files/LG12864U-DW.pdf.



Thanks for the feedback. Unfortunately i can not access the google+ pictures. Let me know if there are further problems.



Thanks, Oliver! I'll use the NHD constructor and use the change contrast command.

Ugh I hate Google plus. Maybe this works.




Hi all,

Great library. Am am making use of 2off LCD's running off a single Arduino Nano.

U8GLIB_ST7920_128X64 u8g(13, 11, 12);    // SCK, SID, CS (hardware based SPI for LCD2)
U8GLIB_ST7920_128X64_1X u8g2(10, 8, 9);  // SCK, SID, CS (software based SPI for LCD1)

I'd love to speed up the SPI bus if at all possible, but if I try via SPI.setClockDivider it seems to stay the same.....not sure it's all getting overridden via the actual lib code.

I've had a look through the lib code itself and can't see much to help me................anyone got any ideas, I don't mind tweaking things just to optimize for my particular LCDs etc.

I am refreshing my LCD's every 500mS or so, but i'd like to speed that up......but it seems I'm hitting a roof somewhere.

I have also got a 20mhz bootloader for the Nano which may help if it's simply raw processor speed I need.....but I'd like to explore the SPI bus first just incase it's not running at it's fastest possible.

Any ideas?




U8GLIB_ST7920_128X64_1X(sck, mosi, cs [, reset])
  --> single buffer software SPI variant (slowest)

U8GLIB_ST7920_128X64_1X(cs [, reset])
  --> single buffer hardware SPI variant

U8GLIB_ST7920_128X64_4X(sck, mosi, cs [, reset])
  --> quad buffer software SPI variant

U8GLIB_ST7920_128X64_4X(cs [, reset])
  --> quad buffer hardware SPI variant (fastest)

For hardware SPI is only available on pins 13 and 11. So by using
you have to connect clock to pin 13, serial data to pin 11 and chip select to pin 8.

I think, clock and serial data pins can be shared by two displays if the cs line is different (I have never tried this). For example:
Note that this will require 1K RAM.

Here are some FPS numbers, which i measured 9 months back (not directly comparable, because i only have a 192x32 display):
  ST7920_192X32_1X, SPI:    FPS: Clip=10.3 Box=5.5  @=7.2 Pix=3.9
  ST7920_192X32_4X, SPI:    FPS: Clip=10.9 Box=6.7  @=8.8 Pix=7.4
  ST7920_192X32_1X, HW SPI:    FPS: Clip=14.2 Box=6.3  @=8.7 Pix=4.3
  ST7920_192X32_4X, HW SPI:    FPS: Clip=15.3 Box=8.0  @=11.2 Pix=9.0

Hope this helps...



Hy Oliver ,

Great yob you make !! After spending too much time finding the REAL graphic library , I use yours and abuse it :)

I have a little Question about Nokia 3410 LCD Display : What is its REAL resolution ? 96x65 or 102x65 ?
Depending on the Driver embed I realy don't know wich of them is REALY used in it .

Actualy I can do every thing with the UG8_PCD8812 with The Nokia 3410 LCD , just to provide sufficent current to the Vcc I use 5v DC , a Voltage Divider made with 2 x 100 Homs resistor to power the LCD at 2,8 V this bring a very nice contrast and no flicker when you display something like XBM or BMP array.


It is long time back that i worked with the Nokia displays. At least my own display has 96x65. I applied 5V to my Noika display without further voltage reduction. At least it still works, but I do not know if this is just luck.



Thanks olikraus.
This works with my Crius (CO-16) OLED (but you already knew it would work.
Next is to learn how to use it, so sifting through the load of examples.
Thanks again.
Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html


:) Ok .

I have a little Noob-question : If I execute this code :
Code: [Select]

void draw(void) {
 int cols = u8g.getHeight();
 int rows = u8g.getWidth();
 int hs = u8g.getFontAscent()-u8g.getFontDescent();
 int ws = u8g.getStrWidth("NOKIA 3410");
 u8g.drawStr( 8, 14, "NOKIA 3410");
 u8g.drawFrame(8-2, 1, ws+4, hs+3) ;
 u8g.setPrintPos( 0, 34 );
 u8g.print("=> Px on Y");
 u8g.setPrintPos( 0, 46 );
 u8g.print("=> Px on X");
 u8g.setPrintPos( 5, 62 );
 u8g.print("12 Cols / 8 Rows");

Are the Values returned by the u8g.getHeight(); and u8g.getWidth(); given by the driver or are they "counted" ? .
humm or are the values given by the definition in the library ?

Again , I have to say : Great Job ! The Most Usefull !!

Go Up