Arduino Forum

Using Arduino => Displays => Topic started by: olikraus on Feb 11, 2012, 10:09 am

Title: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Feb 11, 2012, 10:09 am
U8glib 1.00 is available for download.

https://github.com/olikraus/u8glib (https://github.com/olikraus/u8glib)


Features
 * Universal graphics library for OLED and LCD displays
 * Monochrome and graylevel
 * Controller support: SSD1325, UC1701, ST7565, ST7920, UC1610, PCD8544, PCF8812, KS0108
 * Many fonts included
 * F() macro and "print" support
 * XBM Bitmaps
 * Landscape and portrait mode

(http://wiki.u8glib.googlecode.com/hg/otherpic/dogs102_180.jpg)

Note: The DFRobot ST7920 should be supported by the U8GLIB_ST7920_128X64 device,
but it has been reported that this is not working. Maybe someone from the Arduino
community is able to check this (I do not own this display).

Thanks to everybody who tested the beta releases during the last weeks!

Oliver

Edit: Modifed project home.
Title: Re: U8glib
Post by: rotceh_dnih on Feb 12, 2012, 10:07 am
i've seen this now a few times , would there be any chance of haveing the ST7687s added ?
i found some init code for another micro but im very noob at this and need help

http://pastebin.com/yQMJWqH3 (http://pastebin.com/yQMJWqH3)
Title: Re: U8glib
Post by: olikraus on Feb 12, 2012, 11:20 am
For sure, this is possible. However, i need some more information: What is the name of the display, is there a datasheet for the display? I am also a little bit confused: The provided link is for the ST7637, but you requested the ST7687.

Oliver
Title: Re: U8glib
Post by: rotceh_dnih on Feb 12, 2012, 12:30 pm
sorry i misread that thinking it was a 7687 the screen is a COG-C144MVGD-02 but the 04 others are the same , i found the datasheet for the controller http://www.displayfuture.com/engineering/specs/controller/ST7687S.pdf (http://www.displayfuture.com/engineering/specs/controller/ST7687S.pdf) and also the data sheet for the lcd if that helps http://forums.parallax.com/attachment.php?attachmentid=75229&d=1289666192 (http://forums.parallax.com/attachment.php?attachmentid=75229&d=1289666192) i also found some code that had 90% correct commands but cound not port it over to arduino here it is if it helps there are some cool drawing classes in there might be handy but i broke it xD ie not compileing in arduino ide "not that it ever did" https://rapidshare.com/files/3415949665/rotcehlcd.rar (https://rapidshare.com/files/3415949665/rotcehlcd.rar)

i also have a pcb made ready for testing

(http://www.tom-bmx.com/img/jss/rd/20120211-q44-41kb.jpg)
Title: Re: U8glib
Post by: olikraus on Feb 12, 2012, 03:59 pm
It could be done with u8glib, if a limited color space is acceptable. This means, that you could use 64 colors (out of the full color range). Would this be ok?

Oliver
Title: Re: U8glib
Post by: rotceh_dnih on Feb 12, 2012, 09:43 pm
yea that would be great i only have text to display atm, latter on down the track id like to do more with this litte screen but anywhere is a great start :) this screen is found in manny micro photoframes ie the COBY DP151 and the XC0211 from jaycar http://www.jaycar.com.au/productView.asp?ID=XC0211 (http://www.jaycar.com.au/productView.asp?ID=XC0211) i also thought about makeing a video tut on makeing the breakout pcb ,etching, de soldering the lcd , and re working it to the breakout pcb if that could be helpfull as i found a few tricks that help

oh with the 64 colors thing would it look like this or worse or better ?
(http://www.waitingforfriday.com/images/thumb/e/ec/Lcd_close_up.jpg/600px-Lcd_close_up.jpg)
Title: Re: U8glib
Post by: eotech on Feb 13, 2012, 11:36 am
Your libary sounds interesting but....
I have purchased a 128x64 display named JN12864J obviously with a different controller than the KS108 stuff.
Controller is a Sitronix 7920 ([url][/http://www.dfrobot.com/image/data/FIT0021/ST7920.pdf ]).
Pinout is app type B with main difference that only one CS is needed and NOT 2 (CS1,CS2) as on KS0108.
Would it be possible to use/change your library to this type of interface?
Title: Re: U8glib
Post by: olikraus on Feb 13, 2012, 12:01 pm
@eotech
At least the U8GLIB_ST7920_192X32 constructor works fine in parallel and serial mode.
You may assign U8G_PIN_NONE to cs2 (and also cs1 if this is not tied to the Arduino).
The correct constructor for your display probably is: U8GLIB_ST7920_128X64.
You can try both by uncommenting the constructor in the example files.


@rotceh_dnih
I will start working on it, but it requires are totally new memory architecture. So it might take some time.

Oliver

Title: Re: U8glib
Post by: eotech on Feb 13, 2012, 12:18 pm
Thankyou Oliver
I am a newbie and need some time to have it all setup.
I will make an attempt to have your lib included and defined to see what happens.
I would be happy to see that my purchase was not totally lost due to missing drivers :-)

Eo
Title: Re: U8glib
Post by: rotceh_dnih on Feb 13, 2012, 09:40 pm
:) yes thank you oliver you really are a life saver , caint wait to see what you come up with
Title: Re: U8glib
Post by: olikraus on Feb 17, 2012, 10:35 pm
Some news on U8glib:

I have added a 8-bit color memory architecture (screenshot from the sdl-simulator):
(http://wiki.u8glib.googlecode.com/hg/otherpic/8bit_rgb.png)

With this, I added a U8GLIB_ST7687_C144MVGD (SPI interface) device to support
the requested C144MVGD TFT display. However, I do not know if the device code is correct nor do I know if the init sequence is correct (I simply do not have access to the device for testing).
http://code.google.com/p/u8glib/source/browse/csrc/u8g_dev_st7687_c144mvgd.c (http://code.google.com/p/u8glib/source/browse/csrc/u8g_dev_st7687_c144mvgd.c)

I have also added the U8GLIB_LC7981_160X80 device to support the LC7981 controller. Also untested, but I might get feedback.

Download the prerelease here:  http://code.google.com/p/u8glib/downloads/list (http://code.google.com/p/u8glib/downloads/list)

@manu_07 and eotech
Is U8glib working with your display?

Oliver
Title: Re: U8glib
Post by: bperrybap on Feb 18, 2012, 08:18 am
ooooh, color.... Nice!
--- bill
Title: Re: U8glib
Post by: DD313 on Feb 19, 2012, 02:16 am
Hi
I found some libraries at dfrobot, for their display.
http://www.dfrobot.com/index.php?route=product/product&path=53&product_id=240
Good luck
DD
Title: Re: U8glib
Post by: olikraus on Feb 19, 2012, 08:58 am
Thanks,
However, the problem is that I do not have access to this DFRobot display. I do not know if my code works or not.  :~

Oliver
Title: Re: U8glib
Post by: rotceh_dnih on Feb 19, 2012, 11:13 am
wow great work man i love it i havent got it to work but i love it :) ,
im not sure if its hardware or not but theres a few things im not sure about
first off i used constructor U8GLIB_ST7687_C144MVGD u8g(2, 4, 6, 8, 10); i hope thats fine
im useing logic level converters to talk at 3v to the screen and looking at the datasheet for the ST7687 im guessing that " pin 27 A0" is SCL , "pin 25 D0" is SI and "pin 24 D1" is A0 a little confuseing but i keep going

its then i look at how its set into spi mode (http://www.tom-bmx.com/img/jss/rd/20120219-sp0-37kb.jpg)
and it says that IF1 & IF2 go high and IF3 is pulled low however according to the screen datasheet
http://www.google.com.au/url?sa=t&rct=j&q=COG-C144MVGD-02&source=web&cd=1&ved=0CCUQFjAA&url=http%3A%2F%2Fwww.tecenstar.com%2Findex.php%3Froute%3Dproduct%2Fproduct%2Fdownload%26documento_id%3D7&ei=U8NAT4TXCY-QiQedlrjpBA&usg=AFQjCNFtwSGhdvKUyZXm9nlnIDxCk-TfTA&sig2=6Cfdzb6YmMsOfZ3v13Y37w (http://www.google.com.au/url?sa=t&rct=j&q=COG-C144MVGD-02&source=web&cd=1&ved=0CCUQFjAA&url=http%3A%2F%2Fwww.tecenstar.com%2Findex.php%3Froute%3Dproduct%2Fproduct%2Fdownload%26documento_id%3D7&ei=U8NAT4TXCY-QiQedlrjpBA&usg=AFQjCNFtwSGhdvKUyZXm9nlnIDxCk-TfTA&sig2=6Cfdzb6YmMsOfZ3v13Y37w) my lcd has only IF1 "pin14" & IF2 "pin 13" so unsure what todo next i tried combos of IF1 and 2 high and low but nothing is working the rest of the pins seem to be there and it looks to be hooked up right but im really not sure maybe the screem caint do spi? i really hope it can but this isnt looking good lol might have to be an  wire interface :s not a big drama but i do like the idea of less pins :) , thanks you for your great work and i hope i've given enough info for you to help please let me know if theres anything else you'd like to know or how i can help get this working :)
Title: Re: U8glib
Post by: olikraus on Feb 19, 2012, 04:52 pm
to my understanding your pic seems to be correct (according page 20 of the st7687 datasheet).
I will create also a 8bit interface,

Oliver
Title: Re: U8glib
Post by: rotceh_dnih on Feb 19, 2012, 09:38 pm
:) thanks man i replyed to your email address
Title: Re: U8glib
Post by: rdeweerd on Feb 28, 2012, 12:35 am
Thanx for the great lib! it works great with my DFRobot ST7920 128X64 display.

I've got one question. I use software SPI on pins 9 and 8, but it looks like that it interferes with my hardware SPI which I want to use to communicate with a DS3234 RTC.
Title: Re: U8glib
Post by: olikraus on Feb 28, 2012, 06:11 am
Good to know, that the DFRobot display is fine with the lib. Thanks for the feedback.

Regarding the RTC: What is the problem: Display does not work, RTC does not work, both do not work?
Maybe you can post the setup code for your display and your RTC: What are the involved pin numbers for both devices?

Oliver
Title: Re: U8glib
Post by: bperrybap on Feb 28, 2012, 06:28 am
Can't both use the hardware spi if you use separate pins for the slave selects?
Title: Re: U8glib
Post by: rdeweerd on Feb 28, 2012, 09:18 am
I must have been verry sleepy yesterday evening because it works now!

But for the others how to connect the DFRobot to the ARduino:

This is my innitialization string:

U8GLIB_ST7920_128X64 u8g(9, 8, 3, U8G_PIN_NONE); // SPI Com: SCK = en = 9, MOSI = rw = 8, CS = di = 3

And this is how I connected it:
Arduino pin = function = DFRobot pin
Pin 9 = SCK = e 
Pin 8 = MOSI = rw
Pin 3 = CS = rs
Title: Re: U8glib
Post by: olikraus on Feb 28, 2012, 06:21 pm
Thanks for the information.

Oliver
Title: Re: U8glib
Post by: olikraus on Mar 17, 2012, 04:15 pm
Release v1.02 is available vor download.

* Support for LC7981 controller
* drawCircle, drawDisc
* Ported "little rook chess", a full playable chess engine with graphical user interface

(http://wiki.u8glib.googlecode.com/hg/otherpic/nhd_oled_chess_180.jpg)

Oliver
Title: Re: U8glib
Post by: NeOCzx on Mar 19, 2012, 05:08 am
hi and good day..

thx for the wonderful library, works great on my DS-LCD-TG12864E (ST7920 controller) in spi mode. (R/W = MOSI, E= CLK , PSB =LOW, RS=HIGH)
speed is quite ok in spi, gotta try the parallel mode soon. the liquid crystal itself may be limiter.

Hmm..is possible can u make point to point drawline (x1,y1,x2,y2) available? :D

thx again :)




Title: Re: U8glib
Post by: olikraus on Mar 19, 2012, 06:28 am
Hi

Thanks for the feedback.
I will add a drawLine procedure with the next release.

Oliver
Title: Re: U8glib
Post by: NeOCzx on Mar 19, 2012, 07:49 am
Thx for the feedback, looking forward for it :)

in progress in porting the GLCD lib into u8glib now. :3

it is any procedure is equivalence to GLCD.ClearScreen for u8glib?

now using drawBox procedures for clearing screen :P


Title: Re: U8glib
Post by: olikraus on Mar 19, 2012, 12:19 pm
Hi NeOCzx

There are some imporant differences between GLCD v3 and U8glib. While porting is for sure possible, there are some restrictions on U8glib, which are not present for GLCD lib. GLCD and U8glib have two completly different programming concepts. It might require much more than just replacing the drawing primitives.

I suggest reading the article here, before porting:
http://code.google.com/p/u8glib/wiki/tpictureloop

Also, Bill's library is highly optimized and much faster than U8glib. On the other hand, U8glib should be more flexible regarding the graphics hardware.

One result of the different concepts is that there is no clear screen available in U8glib. The screen is cleared as soon as you enter the "picture loop".

Oliver
Title: Re: U8glib
Post by: NeOCzx on Mar 20, 2012, 04:48 am
thx for the claraficatiion  & tips olikraus :D

if it doesnt work out well maybe i will as well try to use 2 LCD display with different library on a same arduino board. it is possible to be done or someone here had done it before?

just curious :)
Title: Re: U8glib
Post by: olikraus on Mar 20, 2012, 06:38 am
It should be possible to use more than one display, but i never tried.
Oliver
Title: Re: U8glib
Post by: olikraus on Mar 31, 2012, 08:41 am
Hi

Release v1.03 is available for download. It includes the requested drawLine procedure.
http://code.google.com/p/u8glib/downloads/list (http://code.google.com/p/u8glib/downloads/list)

Oliver

Title: Re: U8glib
Post by: s-lighte on Apr 13, 2012, 02:00 pm
Hi Oliver,

is there some pitfall in get your lib running on an Arduino Mega 2560 with an EA DOGXL-160 ? ;-)

if tried it yesterday and it did not work. i looked at the signals of the pins (with an oscilloscope) and the clock pin was a little bit confusing.
in Hardware SPI Mode the signal was realy destroyed.
in Software SPI Mode the u8g.setContrast(127); worked. but the 'hello World' not.
It looked like something is setting the clock pin manually some times..
the signal of the clock was at ~3.3V level out of the arduino and the odd spikes were at 5V level...
i used the Hardware SPI Pins on the Arduino Mega - see constructor..

i used the example hello world sketch and added the contrast command in setup.
my constructors that i tried were the following:
Code: [Select]
//U8GLIB_DOGXL160_2X_BW u8g(52, 51, 53, 49);            // Software SPI ARDUINO MEGA   SPI Com: SCK = 52, MOSI = 51, CS = SS = 53, A0 = 49 //there is something wrong...
U8GLIB_DOGXL160_2X_BW u8g(53, 49);            // Hardware SPI ARDUINO MEGA   SPI Com: SCK = 52, MOSI = 51, CS = SS = 53, A0 = 49 // here is something wrong too


have you got an idea?

know i will try it with an arduino Duemilanove. we will see :-)

sunny greetings

Stefan
Title: Re: U8glib
Post by: olikraus on Apr 13, 2012, 02:14 pm
Hi

I recently added the 2X driver. Can you please check the single buffer constructor (without 2X).
I also do not own a Mega Board, so i have to rely on whatever the Arduino.h file has defined for the Hardware Pins.
If these hardware pins require some special settings, than these settings are not known to me.

But in any case, the SW SPI should work.

Your observation might also be caused by the connected hardware. How do you do the level transition?
Is it a HC4050 level translator for the signals? Resistor networks might work, but you might observe
other voltage ranges.

Oliver
Title: Re: U8glib
Post by: olikraus on Apr 14, 2012, 12:14 am
I checked v1.03 with my DOGXL160 display. HW SPI and SW SPI are fine. I do not see any issues here.

Oliver
Title: Re: U8glib
Post by: Bigtoff on Apr 14, 2012, 07:04 am
Hi

I have been using the u8g Library to complete a university project. I have been playing around with it and must say that it is fantastic. The one problem I am having is that I want to display a line of ASCII print for a certain period of time, clear the entree screen and then write another set of ASCII text. I am using an ST7920 screen as it was the only one locally available as all shops have sold out of the KS0108. The screen i attached to a DFRobot mega clone...

Please if anyone can help me I have tried so many ways to get this to work but with no success

thanks in advance

Chris
Title: Re: U8glib
Post by: olikraus on Apr 14, 2012, 08:13 am
Hi Chris

I am not sure what you mean by "ASCII print". A chart of ASCII glyphs can be produced in this way:

Code: [Select]
void u8g_ascii_1() {
  char s[2] = " ";
  uint8_t x, y;
  u8g.drawStr( 0, 0, "ASCII page 1");
  for( y = 0; y < 6; y++ ) {
    for( x = 0; x < 16; x++ ) {
      s[0] = y*16 + x + 32;
      u8g.drawStr(x*7, y*10+10, s);
    }
  }
}


As shown in the second tutorial (http://code.google.com/p/u8glib/wiki/thelloworld (http://code.google.com/p/u8glib/wiki/thelloworld)) there is no clear screen command. Instead, as soon as you enter the picture loop, the screen gets cleared.
See also the background article here: http://code.google.com/p/u8glib/wiki/tpictureloop (http://code.google.com/p/u8glib/wiki/tpictureloop)

In order to display a screen, wait some time and than display another screen, you may use the code and ideas from "GraphicsText.pde" (attached to this post, but also part of the Arduino examples).

Oliver
Title: Re: U8glib
Post by: cnavnath on Apr 14, 2012, 08:15 am
hi is it possible to display hindi (indian language) using this library. what i need to do
Title: Re: U8glib
Post by: olikraus on Apr 14, 2012, 08:31 am
Hi cnavnath

This is possible. You need a font which contains hindi glyphs. U8glib can use the glyphs from unifont (http://unifoundry.com/unifont.html). The font u8g_font_unifont_18_19 (http://code.google.com/p/u8glib/wiki/fontgroupunifont) already contains some Sanskrit glyphs from unicode page 09xx.

You just provide this hindi font to u8glib with the setFont command:
Code: [Select]

u8g.setFont(u8g_font_unifont_18_19);

After this, you can use u8g.DrawStr(x,y, "abc") to draw the Sanskrit glyphs.

If you need glyphs from another uncode page, you may use bdf2u8g (http://code.google.com/p/u8glib/source/browse/#hg%2Ftools%2Ffont%2Fbdf2u8g) to construct your own selecton of glyps.
You can also tell me which glyphs you need from unifont and I can construct one or more fonts for you.

Oliver

Edit: Fontname
Title: Re: U8glib
Post by: cnavnath on Apr 19, 2012, 01:36 pm
hii i used this library it very nice.
i am from india and it also supporting my regional language hindi.
but there is one issue that in that language i need to OVERSTRIKE two characters some time.
means if i send "K" and "a"
then result on lcd should be as shown in image
please help me for this


Title: Re: U8glib
Post by: olikraus on Apr 19, 2012, 02:34 pm
Hi
Overstrike of two chars is no problam. Simply draw the char at the same location
Code: [Select]
u8g.drawChar(10,10, "K");
u8g.drawChar(10,10, "a");


Of course you need to use a font with latin "a" and "K" glyphs.

Oliver
Title: Re: U8glib
Post by: bperrybap on Apr 19, 2012, 08:56 pm
Oliver,
Is there drawChar() api function ;)

That aside,

I also played around with overstrike on a modified glcd lib and the resulting characters are not
very legible for a 5x7 font.
The other tricky thing is that the font either needs to be a fixed width
or the variable width characters need to be rendered centered
within a fixed width.

--- bill
Title: Re: U8glib
Post by: olikraus on Apr 19, 2012, 09:30 pm
Hi Bill
Quote
Is there drawChar() api function smiley-wink

Good point. It does not exist on the Arduino C++ interface, but it is there on the C-level interface. It should be added.

Quote
The other tricky thing is that the font either needs to be a fixed width
or the variable width characters need to be rendered centered
within a fixed width.

Additionally the are two different "a" out there.

Reference to Wikipedia (http://en.wikipedia.org/wiki/A):
(http://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/LowercaseA.svg/220px-LowercaseA.svg.png)

I am not sure, why there is a need to overstrike two glyphs. I would expect, that all common glyphs are inside unifont.

Oliver
Title: Re: U8glib
Post by: bperrybap on Apr 19, 2012, 09:54 pm
I'm wondering if this really is a request/need for digraph support vs overstrike.
The two are very different.
I had to deal with using digraph support in the early 80's when writing
C code on IBM machines and printers.
EBCDIC does not have curly braces in its font.
(Makes C programming really tough)

So the digraph (<  is { and >) is }

When the device can render a curly brace it all happens
under the hood and is hidden,
however it can make writing code on devices/terminals or
reading printouts when the digraph is displayed
rather than the actual curly brace characters a bit challenging/confusing sometimes.

--- bill
Title: Re: U8glib
Post by: olikraus on Apr 19, 2012, 10:19 pm
Also a good question. For sure, u8glib does not support any digraphs.
Oliver
Title: Re: U8glib
Post by: tilthz on May 01, 2012, 03:57 pm
Hi,

u8glib is working great with a st7920 lcd over SPI on my Arduino Nano, but it does not compile for the atmega 32u4 (arduino leonardo) on Arduino 1.0. Using a earlier version of u8glib on arduino 1.0-RC2 works fine.
Title: Re: U8glib
Post by: olikraus on May 01, 2012, 06:29 pm
Hi
What is the u8glib version? What are the exact compiler errors?

Thanks, Oliver
Title: Re: U8glib
Post by: tilthz on May 01, 2012, 06:49 pm
I'm using 1.04. When I said I made it work in 1.0-rc2, I was using 1.23.
You can replicate this error by just selecting the arduino leonardo board in the 1.0 IDE (uncomment its lines from /arduino-1.0/hardware/arduino/boards.txt if you haven't done it already) and try to compile any u8glib sketch (I haven't tried compiling it with other constructors than st7920 over SPI)
Code: [Select]

/arduino-1.0/libraries/U8glib/utility/u8g_com_arduino_port_d_wr.c: In function 'u8g_com_arduino_port_d_wr_fn':
/arduino-1.0/libraries/U8glib/utility/u8g_com_arduino_port_d_wr.c:80:7: error: 'UCSR0B' undeclared (first use in this function)
/arduino-1.0/libraries/U8glib/utility/u8g_com_arduino_port_d_wr.c:80:7: note: each undeclared identifier is reported only once for each function it appears in

Title: Re: U8glib
Post by: olikraus on May 01, 2012, 07:28 pm
Ok, thanks. I will fix this in the next release.
As a workaround, you can remove or comment out line 80:
Code: [Select]
// UCSR0B = 0;

Oliver
Title: Re: U8glib
Post by: olikraus on Jun 10, 2012, 06:06 pm
Hi

U8glib v1.05 is now available.

It includes some new icon fonts:
(http://wiki.u8glib.googlecode.com/hg/fontpic/u8g_font_m2icon_9.png)

There is a new hardware state backup and restore procedure to solve conflicts
where pins are shared with other devices.
http://code.google.com/p/u8glib/wiki/userreference#setHardwareBackup (http://code.google.com/p/u8glib/wiki/userreference#setHardwareBackup)

U8glib has also been tested with Arduino 1.0.1 IDE.

Additionally I have some experimental code for SSD1306 (Adafruit 128x64 OLED)
and SSD1322 based OLEDs inside the release. This code has not yet been confirmed
because i do not have access to these displays. Any confirmation or bug-reports on
these display types would be great.

Oliver
Title: Re: U8glib
Post by: olikraus on Jun 15, 2012, 09:14 pm
I had to release v1.06 because of the broken u8g.h file. This will fix the problem with U8G_PROGMEM.

Additional there is now support for SSD1306 (thanks to Yann) and SBN1661 (thanks to Alex).

Project page: http://code.google.com/p/u8glib/

Oliver

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: rdeweerd on Jul 12, 2012, 01:55 pm
I'm using the library for the DFRobot ST7920 128 X 64 LCD and it works without a problem, both in serial as in parallel mode. But the weird thing is, is that the parallel mode is a bit slower. In SW serial I got a refresh rate of 6 to 7 frames per sec and in 8bit it goes down to 4 to 5.

Is this normal behavior or am I doing something wrong?

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 12, 2012, 07:36 pm
Thanks for the hint. I will investigate this.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: charlespax on Jul 21, 2012, 04:42 am
I'm trying to get NHD-C12864A1Z-FSB-FBW-HTT working with the u8glib, but I'm getting nothing the screen. It works fine with the Adafruit library. I've checked the pin mapping several times and I have connected to the Arduino correctly. I've unsuccessfully tried loading it as the following ST7565 devices: U8GLIB_DOGM128, U8GLIB_LM6059, U8GLIB_LM6063, and U8GLIB_DOGM132. Is there something I'm missing?

New Haven Display
NHD-C12864A1Z-FSB-FBW-HTT
http://www.newhavendisplay.com/nhdc12864a1zfsbfbwhtt-p-3895.html

Digikey link
http://www.digikey.com/scripts/DkSearch/dksus.dll?WT.z_header=search_go&lang=en&keywords=NHD-C12864A1Z-FSB-FBW-HTT-ND%20&x=0&y=0&cur=USD

Manual
http://www.newhavendisplay.com/specs/NHD-C12864A1Z-FSB-FBW-HTT.pdf
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 21, 2012, 07:25 am
Hi

So, the NHD display works with Adafruit Lib https://github.com/adafruit/ST7565-LCD/tree/master/ST7565 (https://github.com/adafruit/ST7565-LCD/tree/master/ST7565) but not with U8glib, correct?

What is the constructor line (pin definition) for the Adafruit Lib? What is the constructor line for U8glib? Note that the pin order is different:

ST7565             (SID, SCLK, A0, RST, CS)    // Adafruit Lib
U8GLIB_LM6059(SCLK, SID, CS, A0 , RST)   // U8glib

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: charlespax on Jul 21, 2012, 04:45 pm
Below is the code used in the Adafruit and u8glib sketches. The Arduino is connected the same in both cases. The Adafruit one works, but the other does not.

Adafruit
Code: [Select]
// pin 9 - Serial data out (SID)
// pin 8 - Serial clock out (SCLK)
// pin 7 - Data/Command select (RS or A0)
// pin 6 - LCD reset (RST)
// pin 5 - LCD chip select (CS)
ST7565 glcd(9, 8, 7, 6, 5);


u8glib
Code: [Select]
U8GLIB_LM6059 u8g(8, 9, 5, 7, 6);

The Adafruit library leaves the left most column of pixels garbled. There are a few activated pixels, the rest are inactive. This makes pixel (0,0) actually located at (1,0). The rest of the screen is fine. I don't know if this is relevant information
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 21, 2012, 08:18 pm

Seems ok. Can you use the following construcor call:
Code: [Select]
U8GLIB_LM6059 u8g(8, 9, 5, 7, U8G_PIN_NONE);
and connect the reset signal to 3.3V.

Will this work?

Oliver

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: charlespax on Jul 21, 2012, 09:40 pm
Awesome! Thanks a ton.
(https://lh3.googleusercontent.com/-4jgfz0Ou7cs/UAsBwPqvhPI/AAAAAAAABCE/NvwOa758M-o/s512/IMG_20120721_151850.jpg)

It looks like the paging is off. To get the Adafruit library pages in the right order I had to change the following line in ST7565.cpp from
Code: [Select]
const uint8_t pagemap[] = { 3, 2, 1, 0, 7, 6, 5, 4 }; // Adafruit original
to
Code: [Select]
const uint8_t pagemap[] = { 7, 6, 5, 4, 3, 2, 1, 0 }; // Adafruit changed

I poked around and I haven't found where I would define the page mapping.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 21, 2012, 10:07 pm
Great. Now we need to correct the display and the Bias. I have seen that the Adafruit code and the NHD display do differ in that. I also guess that I need to implement another variant for this display. So, here is another request from me. Can you apply the U8GLIB_DOGM128 constructor?

Maybe you can also send a picture of the result with the DOGM128 constructor. Main questions are: Is the contrast as good as before? Is it better? I also expect that the wrong line will disapear but the display might be flipped (not a problem, because u8glib can rotate the screen by 180 degree) and probably the row mapping is still wrong.

If the row mapping is still wrong, i would like to use the DOGM128 as a template for further changes.

Thanks, Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: charlespax on Jul 21, 2012, 10:59 pm
I'm making an Arduino shield for this LCD, so I'd be thrilled to see these changes make it upstream. It would be nice to point folks to u8glib. I really appreciate the work you're doing to unify the graphics libraries. I'll match the pin mapping with the u8glib default pins.

To see graphics I had to change the contrast in ug8_dev_st7576_lm6059.c, line 70 from
Code: [Select]
0x018 /* contrast value*/
(https://lh6.googleusercontent.com/-fmbUwM286so/UAsR9juom_I/AAAAAAAABCg/-iOKaIfFeug/s1024/IMG_20120721_163229.jpg)
to
Code: [Select]
0x005, /* contrast value*/
(https://lh5.googleusercontent.com/-29xcLHACB5Q/UAsRoIGVD3I/AAAAAAAABCk/IzqU8zKVSfI/s1024/IMG_20120721_163106.jpg)

I have tried the U8GLIB_DOGM128 constructor. The default contrast was also poor, so I changed the contrast in u8g_dev_st7565_dogm128.c, line 59 from
Code: [Select]
0x018, /* contrast value, EA default: 0x016 */
(https://lh6.googleusercontent.com/-lE1Bd0DAYdc/UAsVI6TrTCI/AAAAAAAABC4/xYPMk_KDGqc/s512/IMG_20120721_164120.jpg)
to
Code: [Select]
0x005, /* contrast value, EA default: 0x016 */
(https://lh6.googleusercontent.com/-oDeD94Rn0sI/UAsVLg9slxI/AAAAAAAABDA/rKeDzQlIotc/s512/IMG_20120721_164406.jpg)

A contrast of 0x005 in the DOGM128 constructor seems a little more washed out than the LM6059 constructor.

I've cloned your google code repo and I'm able to run ...arduino/create_release.sh. Do you want to make the changes in there and I'll test it? I can also rewire my setup to be consistent with your library.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 22, 2012, 12:08 am
Thank a lot for the pictures.
So, this is what i understand:
- page mapping is ok now
- col offset wrong by 4 pixel
- contrast wrong
- dogm128 a little bit washed out

I have created a new device in the repo: NHD_C12864. So you need to update the repo.

I have added this to the U8gLogo.pde example only (at the moment)
line 75: http://code.google.com/p/u8glib/source/browse/sys/arduino/U8gLogo/U8gLogo.pde (http://code.google.com/p/u8glib/source/browse/sys/arduino/U8gLogo/U8gLogo.pde)

The code for the display is here:
http://code.google.com/p/u8glib/source/browse/csrc/u8g_dev_st7565_nhd_c12864.c (http://code.google.com/p/u8glib/source/browse/csrc/u8g_dev_st7565_nhd_c12864.c)
At the moment, this is an exact copy of the DOGM128 code.

- col offset wrong by 4 pixel
--> change line 79 to "0x004"

- contrast wrong
--> probably change contrast in line 68 to 0x005 (or maybe other values like 0x006 or 0x007)
--> you might also try to change the value in line 55 from 0x0a2 to 0x0a3

Once you find the best values, i would be really glad to add these values to the new device.
Also, let me know if there is something else wrong with the new NHD_C12864 device.

Thanks for testing, Oliver


Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: charlespax on Jul 22, 2012, 01:13 am
Changing line 79 to 0x004 worked. The pixels are aligned.

Changing line 61 (not 68) to 0x008 looked good for contrast. I played with several values. 0x009 also worked. 0x010 is where the background started getting funky.

Keep line 55 at 0x0a2. To get a reasonable screen using 0x0a3 I had to bring the contrast down to 0x003.

Some people might consider the display to be upside down, but this is the orientation in which I would like to use it. It allows buttons beneath the screen to be as close as possible. Are you cool with leaving it like this in the library? It would mean one fewer steps in my instructions.

(https://lh3.googleusercontent.com/-ks18VZ0SjWw/UAs2fO8_h8I/AAAAAAAABDU/_py458s_4Hk/s512/IMG_20120721_190827.jpg)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 22, 2012, 07:43 am
Good work.
I changed line 79 to 0x004, line 61 to 0x008 and added the constructor U8GLIB_NHD_C12864 to all examples.
The orientation can be changed later by the group of rotation commands: http://code.google.com/p/u8glib/wiki/userreference#setRot90 (http://code.google.com/p/u8glib/wiki/userreference#setRot90)

Quote
I'm making an Arduino shield for this LCD

Looking forward to read about your shield.  :)

I want to include issues 75, 79 and 81 into the next u8glib release. So i am not sure about the next release date at the moment, but everything is in the repository.

Thanks for all the testing and the pictures,
Oliver

Edit: I have also updated the reset functionality. So maybe this will also work now. Connecting the reset line to 3.3 is a little bit critical. It may work, but usually reset control by the controller or a RC circuit is better: http://code.google.com/p/dogm128/wiki/dogs102_arduino_hardware
For a shield i would suggest to add the RC circuit to have one more pin for the user.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: charlespax on Jul 22, 2012, 05:06 pm
Thanks so much for your help, Oliver. I wouldn't expect my shield to be available until after December 2012, so no rush on a release.

I used the constructor as "U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);" and connected the LCD reset pin to Arduino pin 8. Works just fine, but I will use the circuit you mention.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Aug 12, 2012, 04:43 pm

I'm using the library for the DFRobot ST7920 128 X 64 LCD and it works without a problem, both in serial as in parallel mode. But the weird thing is, is that the parallel mode is a bit slower. In SW serial I got a refresh rate of 6 to 7 frames per sec and in 8bit it goes down to 4 to 5.

Is this normal behavior or am I doing something wrong?


I have improved speed for the parallel mode by 30%. This fix will be available with the next regular release. Please send PM for a beta release including this fix.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: koyaanisqatsi on Aug 13, 2012, 09:36 am
Hello,

I'm using u8glib for an LCD screen I pulled out of an old Dell LTO tape backup library.  It turned out to be a LC7981 chipset at 240x128.  I was able to modify the library files for the screen, based on some other mods I found already in the files and all is well. (U8GLIB_LC7981_240X128)

I have a question about fonts - I'd like to create my own font, both for a custom look and to save some memory by omitting characters I know I won't need.  Can you post some info for how to create/add custom fonts?  I've been looking at u8g_font_data.c and it looks like they're just a big bitmap with some parameters indicating the boundaries of each character, but I can't seem to get my head around the array structure.

It will soon be a super deluxe HVAC controller:
(http://www.chestersgarage.com/2012-08-12%2023.54.41.jpg?height=480&width=640)

Thanks!
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Aug 13, 2012, 09:44 pm
Hi

Nice work. Glad to see that u8glib is usefull for you.

The U8glib font format not only contains the bitmat data but also a lot of glyph information for precise font rendering (mainly used for my other lib m2tklib). Some information available in the fonts are described here: http://code.google.com/p/u8glib/wiki/tstring (http://code.google.com/p/u8glib/wiki/tstring).
The U8glib font format also tries to crop the bitmap data to save as much ROM as possible. All the glyph metric calculation, the bitmap reduction and the font encoding is done by an external program: http://code.google.com/p/u8glib/source/browse/tools/font/bdf2u8g/bdf2u8g.c (http://code.google.com/p/u8glib/source/browse/tools/font/bdf2u8g/bdf2u8g.c). Simply compile the c-file with a unix or windows c-compiler (or send me a PM if you need the executable).

bdf2u8g requires a font in the bdf format: http://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format (http://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format)

On the internet several fonts are available as bdf files, see for example here: http://cgit.freedesktop.org/xorg/font/ (http://cgit.freedesktop.org/xorg/font/)

But it is also possible to convert truetype fonts (ttf) to bdf: I have used http://sofia.nmsu.edu/~mleisher/Software/otf2bdf/ (http://sofia.nmsu.edu/~mleisher/Software/otf2bdf/) and http://fontforge.org/ (http://fontforge.org/). I am sure there are more tools (google has some 100.000 hits for "ttf bdf").

Oliver



Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: koyaanisqatsi on Aug 14, 2012, 07:54 am
Cool, thanks!  I'll see if I can get anywhere with this.  I have little knowledge of how fonts work, so this may be more than I have patience to do.  ;)

U8glib is a really nice library, BTW - pretty easy to use and modify.  I was a little intimidated at first, but dug into the files and figured out how to create a new constructor.  I have two other LCDs I've pulled out of old equipment that I'm going to try and get working.  One is a little  5 x 2 character out of a Dell server (it's the little status/diag LCD).  I haven't figured out what chip is on it yet.  The other came from a Quantum tape library and I believe is a ST7565 128 x 64 chip-on-glass type.  Both have ribbon cables so I need to get breakout boards to use them.

Anyway, thanks for your help and the LCD library!
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: GeorgeG on Aug 14, 2012, 03:27 pm
Thank you Oliver for your wonderfull work!

I tested the DFRobot st7920 witch has an spi module attatched to take care of contrast etc. and it works fine in arduino environment.
I would like to use it in pure C but the constructor requires an A0 connection,while the arduino library does not.

How could i resolve  this?

Thanks again!
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Aug 14, 2012, 05:38 pm
Hi

The st7920 does not require an A0 line. Instead it has a very special low level protocol. Unfortunately i have not yet ported the Arduino version of the low level driver: http://code.google.com/p/u8glib/source/browse/csrc/u8g_com_arduino_st7920_spi.c (http://code.google.com/p/u8glib/source/browse/csrc/u8g_com_arduino_st7920_spi.c)

I have put this as  issue 85 on the u8glib issue list.

Thanks, Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: GeorgeG on Aug 14, 2012, 06:38 pm
Thanks for the reply..
Ill will use the arduino library then,no problem!
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Aug 15, 2012, 12:57 pm
Hi

I have added support for the st7920 with avr to u8glib:
(http://wiki.u8glib.googlecode.com/hg/otherpic/st7920_avr.jpg)
The test environment includes my NHD 192x32 display with ST7920 controller (upper right, the bright light from upper left makes the contrast a little bit weak). Lower left is an unused EA 132x32 display. Lower right the ATMEGA 328 with green power LED. Upper left the AVR programmer.

A beta release with support for st7920 for avr is avilable on request.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 02, 2012, 07:48 pm
Hi

I have released version 1.08 of u8glib. The new release has been optimized for speed and includes support for some more OLED chips. See details here: http://code.google.com/p/u8glib/ (http://code.google.com/p/u8glib/).

This release also has a new COM interface for I2C/TWI based displays. The first supported I2C display is the Seeedstudio 96x96 OLED.

Thanks to all testers of the beta releases!

Oliver



Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: bperrybap on Oct 02, 2012, 08:11 pm
Oliver,
I've looked but can't seem to locate any information on the bitmap pixel format.
i.e. things like is it LSB to MSB, 8 bit vs 16 bit, vertical vs horizontal encoding etc...
Is it universal in that it works on any glcd or is the bitmap format just a raw image
for the given glcd so each glcd has a different pixel format?
Have I missed this somewhere?

--- bill
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 02, 2012, 10:02 pm
Hi Bill

The drawBitmap procedure expects a byte array, which is printed from left to right, MSB on the left. The drawXBM also expects a fixed format, but i can't remember the bit orientation.

The fact that each display might have a different byte orientations forces U8glib to perform a bitmap translation step from the high level command to the native display byte orientation. Indeed this is one of the most time consuming steps in U8glib. Unfortunately i do not know how to avoid this. There is not common memory layout for the displays. Each chip has an individual memory setup. Everytime I add a new chip, I am surprised to see another new memory layout  :smiley-roll:

Because i anyway had to add such a bitmap translation, it was not a big task to add the 90 degree rotation for the display orientation. Indeed this is something what i got almost for free (with respect to computation time): I just had to exchange the bitmap translation procedures, when such a different display orientation is requested.

For one of the newly added OLEDs I had to implement a completly new memory layout:
- I noticed that the new memory layout reduces speed (of course only for this display)
- So i decided to work on an overall speed optimization.
- All of the u8glib code was ported to my desktop so that i can apply "gprof" to it.
- I did a lot of gprof tests with the code to identify those procedures where most of the computation time is lost
- This all lead to several improvements, including one, where i had to restructure parts of the high level/low
level communication.
- Depending on the high level comands, speed is now improved by up to 30%, but still, GLCD is much faster.
- After spending many many hours on speed and performance analysis this summer, i know that there is not much room for further improvements.

U8glib offers flexibility and trades this for speed.

The good news is, that u8glib still is faster than many existing libraries (except GLCD).   ;)

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: andrew-d on Oct 21, 2012, 05:52 am
First off the U8glib is fantastic. I've used it successfully with several displays. For me with my limited programming skills this library just lets me use displays and get on with my projects. Thank you Oliver.

On to my problem, I have a new LCD module with a UC1701 controller in it that I'm struggling to make work properly with U8glib. Looking at the "Supported Devices" table it's not supported, but from my testing it almost is because it uses a UC1701 controller. Here's what little I know about it:

Quote

Labelled: "Open Jumper, 12864"
Size: 47 x 38 x 4mm
Supply Voltage: VCC 4.5 to  5.5V (built-in booster circuit, no negative voltage required)
Controller: UC1701, Based on: 12864
Display: 128x64
Interface: SPI


Deal Extreme link to product I purchased.
http://dx.com/p/mini12864-blue-backlight-dots-graphic-lcd-display-module-red-153821?Utm_rid=90992748&Utm_source=affiliate" (http://dx.com/p/mini12864-blue-backlight-dots-graphic-lcd-display-module-red-153821?Utm_rid=90992748&Utm_source=affiliate")

I'm using Ardunio v1.0.1 IDE, Arduino Uno R3 and U8glib v1.08 with the U8gLogo example sketch, I've added two lines:
Code: [Select]

u8g.setContrast(0);  // in the setup
u8g.drawFrame(0, 0, 127, 63); // in the picture loop, helps determine screen edges / locations


Here's what I've tried:

U8GLIB_DOGS102 u8g(13, 11, 10, 9);                    // expects 102x64 display mine is 128x64


U8GLIB_DOGM128 u8g(13, 11, 10, 9);



U8GLIB_DOGM132 u8g(13, 11, 10, 9);  // expects 132x32 display some errors expected


Note: I had to power cycle the display between testing as it seems to retain the display memory from previous programs.

Here's some photos of the display using U8GLIB_DOGM132:
http://www.flickr.com/photos/andrew-d/8107440762/in/photostream

Would it be possible to support this device? I'm happy to perform any testing and provide photos for galleries (I'm a better photographer than programmer).

Corrections to version numbers made.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 21, 2012, 07:07 am
Hi

I am always happy to support new displays with u8glib.

This is my usual procedure for adding new devices:
1. Select a u8glib device which almost works
2. Rename this device to the new display
3. Fix display problems (garbage, display shift etc)
4  Fix contrast issues

What is your impression? Which u8glib device would be a good starting point for the "Mini12864"?

One of your pics shows a perfect u8glogo: http://www.flickr.com/photos/andrew-d/8089943789/in/photostream/
But you did not mention the u8glib device.

Additionally i wonder about the version number v12.
Official download is here: http://code.google.com/p/u8glib/downloads/list
Latest version of u8glib is 1.08

All in all, there are good pictures and existing u8glib devices mostly work, so it should not be a big problem
to fix issues with your display.

Oliver

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: andrew-d on Oct 21, 2012, 07:39 am
I'm sorry I've stuffed up some of the information I've presented. I'm attempting to correct it now. v12 is very wrong sorry about that.

The older flickr photos were using v1.04 and "U8GLIB_DOGM128 u8g(13, 11, 10, 9);". I modified this to add contrast from another device (I think U8GLIB_DOGM132 but cannot remember). The photo of it working perfectly was after I messed around with the reset pin and resting the Arduino. It was not easily repeatable. Leaving me to believe perhaps timing was involved in the problem.

The current flickr photos use the newer v1.08 U8glib. It's my opinion the U8GLIB_DOGM132 device would be a good starting point as it has the contrast code and only two minor issues.

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 22, 2012, 12:14 am
Hi

I have attached a version of u8glib with support for the MINI12864:
Code: [Select]
U8GLIB_MINI12864 u8g(13, 11, 10, 9);                    // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
It has been derived from the DOGM132 with adjusted dimensions.

Please let me know if this is ok or if some other adjustments are required.

Oliver

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: andrew-d on Oct 22, 2012, 01:52 am
Thank you Oliver!

I will test this out and post photos of the result as soon as I can.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: andrew-d on Oct 22, 2012, 11:57 am
The device U8GLIB_MINI12864 is close. Thank you. The image is still shifted five pixels to the left, with the far right edge filled with garbage pixels. Contrast is set and works but seems to be fixed.

I've attempted to read the source code and the datasheets registers and I must admit I don't understand what I'm looking at. For what it's worth I think this is the datasheet for the controller http://www.lcd-module.de/eng/pdf/zubehoer/uc1701.pdf (http://www.lcd-module.de/eng/pdf/zubehoer/uc1701.pdf)

However I did experiment with the u8g_dev_uc1701_mini12864.c file. I messed with this line
Code: [Select]
  0x0a1, /* ADC set to reverse. Was a0 now a1 */

I found if I change this value from "a0" to "a1" the image is reversed but does not have pixels shifted.

I also played with this device:
Code: [Select]
U8GLIB_LM6059 u8g(13, 11, 10, 9);                    // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9

It does not have contrast adjustment (image is almost impossible to view) and has the top and bottom of the image swapped, but again the pixels are not shifted.

I will post photos shortly.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: andrew-d on Oct 22, 2012, 01:06 pm
More progress. It works as it should if I use:
Code: [Select]

Line 51:  0x0a0, /* ADC set to reverse */
Line 52:  0x0c8, /* common output mode */
Line 60:  0x027,          /* contrast value, EA default: 0x01f */


"c8" Flips the screen 180 and so far appears to work without fault. I'm guessing this is the proper or intended orientation. The contrast value just makes the screen a little easier to read. Note I also returned ADC to "a0".

I feel a little stupid. I've just re-read some of this the messages in this thread and I must have missed at least page 4. It's the same typical types of issues. I feel I should have experimented more before asking for help.

Here's the photos:
http://www.flickr.com/photos/andrew-d/8112363433/in/photostream (http://www.flickr.com/photos/andrew-d/8112363433/in/photostream)
http://www.flickr.com/photos/andrew-d/8112371880/in/photostream (http://www.flickr.com/photos/andrew-d/8112371880/in/photostream)

It would be nice to be able to control the contrast within the main program but I'm unsure how to do this.

My next change is fonts like koyaanisqatsi posted. I'd like to be able to draw my own as bitmaps and then convert to fonts. I can draw fonts no problem (I have very small and very large fonts in mine for a specific project) but I'm lost on converting them. I need fixed height and widths and some only numbers.

Updated with more info
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 22, 2012, 09:53 pm
Hi

I have applied your setting to the attached pre-release. I also added code for contrast setting. Hopefully everything works as expected. Feedback would be great. Thanks for supporting u8glib so far (Karma given...).

Fonts: If your font is available as .ttf or .bdf, then a conversion is no problem. Tools like fontforge are able to export .bdf
The tool otf2bdf can convert ttf into bdf.
To convert bdf to the internal font format, you need bdf2u8g:
http://code.google.com/p/u8glib/source/browse/tools/font/bdf2u8g/bdf2u8g.c
It compiles on windows and unix.

Oliver


Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: andrew-d on Oct 23, 2012, 12:15 pm
Using
Code: [Select]
u8g.setContrast(208);
works as it should and sets the contrast. But I have a few questions. From what I've read in the datasheet the contrast value is a 6 bit value. I'm guessing the range 0 - 255 is divided down to 0 - 63?

I've begun investigating bdf fonts using FontForge. I looks like converting a font then modifying / drawing the bitmap for the size I want might be the best method, but I don't really understand how point size converts to pixel size. I think I have a lot to learn before I can produce a usable font.

Thanks again for all of your help and support.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 23, 2012, 08:50 pm


Quote
works as it should and sets the contrast. But I have a few questions. From what I've read in the datasheet the contrast value is a 6 bit value. I'm guessing the range 0 - 255 is divided down to 0 - 63?


I try to keep a range from 0 to 255 for the user interface. I think the actual range is from 0 to 127. It is scaled down in line 106
http://code.google.com/p/u8glib/source/browse/csrc/u8g_dev_uc1701_mini12864.c (http://code.google.com/p/u8glib/source/browse/csrc/u8g_dev_uc1701_mini12864.c)

Quote
I've begun investigating bdf fonts using FontForge. I looks like converting a font then modifying / drawing the bitmap for the size I want might be the best method, but I don't really understand how point size converts to pixel size. I think I have a lot to learn before I can produce a usable font.


The SIZE parameter () of the BDF format defines the PointSize and Resolution of the BDF font. It is ignored by the bdf to u8g converter. The bitmaps are extracted and converted to the internal u8g format without any additional transformation.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: DooMMasteR on Dec 14, 2012, 02:39 am
has anyone ever made a USABLE number font in the size range from 25-30 pixels of height?

all fonts in u8glib in that range have different heights for the numbers 0-9, they are never aligned in height
and the format only has a windows converter which is quite inconvenient -.-

Made some pics of the problem:
(http://farm9.staticflickr.com/8209/8270407913_6f8b6fb449.jpg) (http://www.flickr.com/photos/doommeer/8270407913/)
the one and five sit one line lower than 3 and 0
(http://farm9.staticflickr.com/8223/8271466584_2032db88e5.jpg) (http://www.flickr.com/photos/doommeer/8271466584/)
the one is one line lower -.-
(http://farm9.staticflickr.com/8344/8271461122_1df3f052d7.jpg) (http://www.flickr.com/photos/doommeer/8271461122/)
and here the 7 is one line less high than the 3s and 0
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: andrew-d on Dec 14, 2012, 03:53 am
Hi DooMMaster,

I encountered the same issues as you but when I understood a little more about fonts and the conversion process I found this is (in most computer applications) the norm. Fixed width fonts (and perhaps height) don't typically reach a large size. I wanted fixed width and height so I converted and modified my own. It's about 30 pixels high and from memory 28 pixels wide and only includes numbers. My application was for a GPS clock.

Here's a link to a photo with the font: http://www.flickr.com/photos/andrew-d/8130562486/ (http://www.flickr.com/photos/andrew-d/8130562486/)

When I have access to the code I'll update it and paste it here.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 14, 2012, 08:12 am
For the discussed number fonts, i have used the following conversion process:
1. Convert (scale+raster) truetype font into a bdf font. Result is a .bdf file. Tool: otf2bdf
2. Convert .bdf file to a .c file (internal u8glib format). Tool: bdf2u8g

Misalignment already appears in step 1. To fix this, either add information to the original .ttf file or update/fix the intermediate .bdf file. I am always happy to update, fix or add fonts. Just send me the related .bdf or .ttf files.

I have made all bdf file available here:
http://code.google.com/p/u8glib/source/browse/#hg%2Ftools%2Ffont%2Fbuild (http://code.google.com/p/u8glib/source/browse/#hg%2Ftools%2Ffont%2Fbuild)
So one solution is to download the bdf file and modify this bdf file with some of the existing bdf editors.

Once i receive a bdf (prefered) or ttf, i can offer:
- Update the release process for u8glib with the new bdf file
- replace/add the bdf for future releases
- setup a wiki page with updated or modified bdf files
- optional: give credits to the contributor

For sure, helping hands are needed here. I know that the converted fonts are not that good. As of now, i do not have anything else.

Thanks in advance,
Oliver

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: DooMMasteR on Dec 14, 2012, 01:18 pm
ok… got SERIOUSLY annoyed by the problem :P so I took the fub25 and fixed all the numbers…

It would be nice if you could make them u8glib compatible in format and create a "numbers" version frim it, or at least a restricted.

All Numbers are now aligned on line -1 and have exactly 26 pixels in height… so 25 is the upper line… it is not pretty but a lot pretier than before.

http://uschok.de/~doommaster/fub25.bdf

I will create a Numbers only font now… custom… and simple and clean :) will post the file here once it is done

EDIT:
I have also made a numeric font on my own… simple and clean… all numerics are monospaced
http://uschok.de/~doommaster/freedoomr25n.bdf

Feel free to do whatever you want with it… this font is Free in all human and lawful senses.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 14, 2012, 10:34 pm
Many thanks to DooMMasteR for the contributed fixes and the new font.

The font update applies to this font:
http://code.google.com/p/u8glib/wiki/fontgroupfreeuniversal (http://code.google.com/p/u8glib/wiki/fontgroupfreeuniversal)

The new font is described here:
http://code.google.com/p/u8glib/wiki/fontgroupcontributed (http://code.google.com/p/u8glib/wiki/fontgroupcontributed)

I have also added some more fonts from the X11 distribution. Some nice large bitmap fonts are also included:
http://code.google.com/p/u8glib/wiki/fontgroupadobex11 (http://code.google.com/p/u8glib/wiki/fontgroupadobex11)

I have attached u8glib version v1.09pre14, which includes all these fonts.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: DooMMasteR on Dec 15, 2012, 10:54 pm
nice :) thx a lot
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: DooMMasteR on Dec 16, 2012, 01:21 pm
I will also make another font… in 10px height…maybe even today

EDIT: done
numerics, capitals, degree, math included… 10px high 7-8 wide
http://uschok.de/~doommaster/freedoomr10r.bdf
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: koyaanisqatsi on Dec 16, 2012, 10:28 pm
I'm really stoked you guys are doing this!  I took a look and was a little intimidated by the process of making my own font and converting it, as I know almost nothing about fonts.  (Also FontForge crashes on my computer.)

Thank you!
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 16, 2012, 10:32 pm
@DooMMasteR

Great, thanks for the contribution (Karma+)

I have added your font to the distribution: http://code.google.com/p/u8glib/wiki/fontgroupcontributed (http://code.google.com/p/u8glib/wiki/fontgroupcontributed)

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 16, 2012, 10:54 pm
@koyaanisqatsi

I usually only use Linux software here (like FontForge). For Windows also "Fony" might work.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: DooMMasteR on Dec 17, 2012, 11:36 am

I took a look and was a little intimidated by the process of making my own font and converting it, as I know almost nothing about fonts.  (Also FontForge crashes on my computer.)

Thank you!


FontForge is definitely the way to go… but I am also a bit noobish in using it.
I cannot for example, get into bitmap mode from an empty font… I have to import another existing bitmapfont and work from there on -.- which is kind of annoying… but it works.

If you have it in bitmap mode… it is VERY easy to create a pixel perfect bitmap font

I am using a selfcompiled version of FontForge on MacOS X

@olikraus
the new fonts are also copyleft :) (public domain) as the other too… I think that I will never do a copyrighted/limited/unfree font :P
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: koyaanisqatsi on Dec 18, 2012, 09:53 am
HA HA, I have prevailed!  FontForge is now running in Ubuntu in a VM (the version available in Ubuntu is kinda old, but it works fine so far).  And I think I might be getting the hang of this.

I found how to make bitmap fonts from a new/empty font:


Will be trying out dbf2u8g.exe in the next few days.

Now if only I had an idea on how I want the font to look...   :smiley-roll:
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: DooMMasteR on Dec 18, 2012, 06:57 pm
nice…
I have updated the Numerics font, since the 1 was made non monospaced…
http://uschok.de/~doommaster/freedoomr25n.bdf
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: DooMMasteR on Dec 20, 2012, 03:32 am
I pushed my wor to gihub, including my started PCB/schematics
https://github.com/DooMMasteR/scootcompute
I am still struggling with the license I should use… U8Glib is BSD style… so basically anything is fine… but the DallasTemperature library is LGPL and I do not know in what aspects that is limiting my options :P ahhrg LicenseWars :P
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 20, 2012, 09:18 pm
This is my personal interpreation about the difference between LGPL and BSD License:
LGPL is more strict and requires that the user can rebuild the complete project which makes use of the LGPL Software. It must be possible to rebuild the complete project with an updated version of the LGPL part. In the case where your complete software is available on github or similar platforms, than this difference does not matter.

However you need to inform the user about the different parts and licenses of your software.

For example, have a look at the u8glib license: http://code.google.com/p/u8glib/source/browse/license.txt (http://code.google.com/p/u8glib/source/browse/license.txt)
U8glib does not have a single license. Each font might have a different license with different requirerments.
Depending on the font, which are used in your project, you might need to give proper reference.

Oliver



Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 23, 2012, 10:18 am
New release available for download: U8glib v1.09

http://code.google.com/p/u8glib/downloads/list (http://code.google.com/p/u8glib/downloads/list)

* Verified with Arduino 1.0.3
* Fixes several issues with the ST7920 controller
* Additional fonts
* Box and frame with round edges: u8g::drawRBox(), u8g::drawRFrame()
* Support for more displays and communication interfaces

Thanks for all the input and contributions!

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Muhammad on Jan 11, 2013, 12:46 am
I downloaded this library a couple days ago and am having a blast with it! It is the most comprehensive and flexible display library I've seen.

However, I'm having a bit of trouble doing some simple stuff.

I'm basically trying to get my screen to plot the input of the ADC; a line over time, sort of like the way an oscilloscope scans when the time/div is big enough. Or how an EKG display refreshes (which is what my application is.) I was previously doing this with a generic parallel GLCD using the GLCD library. Here's how I was doing it:

Code: [Select]
#include <glcd.h>

int xPos = 0; // X position value.
int pot; // Potentiometer value.

void setup()
{
  GLCD.Init();
  GLCD.ClearScreen();
}

void  loop()

  for(xPos = 0; xPos < 127; xPos += 1)
  {                               
    pot = analogRead(A0); // Sample ADC
    pot = map(pot, 0, 1023, 0, 63); // Scale down readings to LCD's vertical pixel count.
    GLCD.DrawVLine(xPos, 0, 63, WHITE); // Erase column of pixels previously set.
    GLCD.SetDot(xPos, pot, BLACK); // Set new pixel.
    delay(10);
  } // End FOR statement.

  if(xPos == 127)
  {
    xPos = 0; // Return to the first column when the last column is reached.
  } // End IF statement.

} // End void loop()


I changed this to fit the profile of this library by doing away with the For loop and fitting it in a Do While, changing the functions, so on. (I'd post it, but it appears that I didn't save it :~ ) It of course doesn't work since this library (to my understanding) rewrites the entire screen each time it cycles rather than just the pixels specified in the functions. Instead, it just scans a single pixel.

I guess what I'm asking is for some insight on how I might be able to get this library to continuously draw without necessarily rewriting the entire display, if that's possible in the first place.

If I must rewrite the full display, I guess I could store all 128 columns in an array and write them all over every time I refresh. I'm not sure how efficient that is, though.


Cheers,

- Muhammad.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 11, 2013, 07:22 am
Quote
If I must rewrite the full display, I guess I could store all 128 columns in an array and write them all over every time I refresh. I'm not sure how efficient that is, though.


This is correct. You must store the 128 values in order to be able to refresh the display. It is indeed the key difference between u8glib and GLCDv3. For sure this makes u8glib slower than GLCDv3, but this enables u8glib to support displays where the display frame buffer can not be read back from the display (and still avoid a local full frame buffer).

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: rgroener on Jan 11, 2013, 08:04 am
First, thanks for this great library!
I just tested a LM096-128064 (128x64 OLED; SSD1306) with a atmega168 and it works flawless.

Is there a chance, that in a future version, the picture loop philosophy can be activated / deactivated for drawing graphs.
I am facing the same problem as Muhammad in the last posting.

Best regards Roman
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 11, 2013, 09:54 pm
Hi Roman

Background:
There are GLCDs were the internal frame buffer (display memory) can not be read by the microcontroller.
This is usually true for displays with SPI interface.
 
Solutions:
1) Reserve memory in the microcontroller, render the picture into it and transfer the memory from the microcontroller to the display.
Disadvantage: Large SRAM consumtion, possible only if display frame buffer size is smaller than the available SRAM.
2) Reserve some smaller amount of memory (e.g. 1/4 of the display frame buffer size) and render the picture more often (e.g. 4x). This trades time vs. SRAM
Disadvantage: Slower frame rate, picture loop (more complex API)

U8glib was designed to support displays without read back ability.
U8glib follows solution 2)
U8glib is one of the view libs which support large SPI displays on small (ATTINY) controllers (with very limited SRAM).

A graphics lib such as GLCDv3 for KS0108 controller has a much more convinient programming interface. But GLCDv3 also depends on the fact that it can read memory from the display frame buffer.

U8glib offers a solution for displays not support by other graphics librarys.
U8glib sometimes is the only available lib.
U8glib might be a bad choice in other cases (like using it for KS0108 based displays)
 
I am glad to hear about success stories with U8glib and i am sorry to offer programming API, which is more complicated and difficult to understand.
I tried to compensate this with many features, a good collection of fonts, reliable functions and a documentation with many pictures.
I am always open to improvements, but i probably can not change its basic feature.

I also suggest to read Bill's remarks on GLCDv3 and u8glib:
http://arduino.cc/forum/index.php/topic,56705.msg1001066.html#msg1001066 (http://arduino.cc/forum/index.php/topic,56705.msg1001066.html#msg1001066)

More Information:
http://code.google.com/p/u8glib/wiki/tpictureloop (http://code.google.com/p/u8glib/wiki/tpictureloop)

Thanks for your picture,
Oliver



Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: bperrybap on Jan 11, 2013, 11:07 pm


A graphics lib such as GLCDv3 for KS0108 controller has a much more convinient programming interface. But GLCDv3 also depends on the fact that it can read memory from the display frame buffer.

GLCD also has a write-through cache option which creates a frame buffer that it uses for reads
instead of reading the data from glcd memory which can speed up display updates at the expense
of using additional memory.
Turning on the write-through cache also allows GLCD to work the same on write-only displays at the expense of the
memory for the frame buffer. I've thought about creating a shift register interface that could reduce
the number of pins down to 2-3 pins but have never gotten around to it.

Maybe there are some optimizations that could be done to speed up u8glib or offer more capabilities.

For a little speed:
- maybe provide hints to the low level PAGE_NEXT function as to which area(s) are "dirty" and need updating.
It could be as simple as a low and high value that indicates the starting page and ending page
that needs to be pushed to the display.
Or it could be as complex as a bitmap indicating which bytes have pixel data to be flushed out.
The low level code could choose to ignore the hints but smarter lower level update routines could
choose to take advantage of it to reduce updates.
Seems like the simple low/high hints would be pretty easy to implement and might offer some
significant speed improvements in certain situations.

- Could it treat the page buffer as a write through cache instead?
Seems like a pretty big change but that would allow only writing the modified pages to the display.

Form some additional functionality:
- Could it create a full frame buffer to provide additional functionality?
Without write-through, it seems like it wouldn't be that difficult to wedge in.
The code could use all the same mechanisms it does now, so none of the lower interface code
has to change. The difference being it would simply always have the rows of data always available.
The flush code could call the PAGE_NEXT (flush) routines as necessary for each row in the frame buffer
to update the physical display.
This would allow for the possibility for things like scrolling or graphic updates on top of existing pixels.

It's always a tradeoff. Some strategies work better than others depending on the nature
of the display updates being done.

--- bill
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 12, 2013, 01:24 am

Quote
- maybe provide hints to the low level PAGE_NEXT function as to which area(s) are "dirty" and need updating.

After the first iteration, it could be known which pages are written. So, empty pages could be skipped. But instead of copying the page to the display, the page needs still to be cleared.

Quote

- Could it treat the page buffer as a write through cache instead?

not exactly sure what you mean about this.

Quote

- Could it create a full frame buffer to provide additional functionality?

Sure, this could be done (as long as there is enough SRAM)

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Muhammad on Jan 12, 2013, 01:43 am
After some late-night tinkering, I managed to get it to scan. I guess it just took me some time to get acquainted with the Do While structure of execution. It renders a tad slow, but it's still pretty good. I might have an idea on how to speed things up...

I'm using an LCD I bought off of Ebay, similarly found here: http://tinyurl.com/cxujsag which works perfectly under NHD_C12864.

I can definitely understand the memory oriented design of this library. A lot of display libraries don't fare well on the ATMega168. I know Adafruit's library for the Nokia 5110 display will only work on a 328 and up.

I've attached a photo of it plotting a .4Hz signal from a function generator. I've also attached the program for whoever may be interested in it. Ideas on optimization would be much appreciated :)

I really appreciate the work you've put into this library!


- Muhammad.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 12, 2013, 03:04 pm
Hi Muhammad
Thanks for sharing your project, however, the code is not readable (downloadable) at least for me.

Oliver

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Muhammad on Jan 12, 2013, 05:52 pm
Oops. Sorry about that. Here it is:

Code: [Select]
#include "U8glib.h"

U8GLIB_NHD_C12864 u8g(13, 11, 10, 9);

int val; // Y value (Read from the Analog input)
int xPos = 0; // X position
int prevXPos = 0; // Previous x position
int scanVal[128]; // Array to hold the graphs values as it scans.
int xDraw; // Used to

//--------------------------------------------

void drawText(void) {
  val = analogRead(A0);// Poll ADC
  val = map(val,0,1023,63,0);// Scale things down to fit the vertical pixel count of the LCD.

  scanVal[xPos] = val;// Write the Y value to the appropriate element (X value).

  u8g.setPrintPos(50, 63);// Set Cursor.
  u8g.print("Y");
  u8g.print(val);// Print out the Y value.

  u8g.setPrintPos(20, 63);// Set Cursor.
  u8g.print("X");
  u8g.print(xPos);// Print out the X value.
}

//--------------------------------------------

void drawScan(void) {// This function cycles 128 times per update to draw the full scan of the line.
  val = scanVal[xDraw];// Pull the Y value from the appropriate element.
  u8g.drawPixel(xDraw,val);// Set a pixel.
  xDraw++;// Increment the column position (X value).
}// End of scan

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

void setup(void) {
  u8g.setRot180();// Flip screen
  u8g.setFont(u8g_font_6x10r);// Set Font
  pinMode(7,OUTPUT);
}

void loop(void) {

  u8g.firstPage(); 
  do {
    drawText();
    xDraw = 0;
    do
    {
      drawScan();
    }
    while(xDraw <= 127); // Loop to draw every column of the array.
  }
  while( u8g.nextPage() );


  if(xPos == 127) xPos = 0; // Reset X to 0 when it reaches the last column on the screen.
  else xPos++; // Increment X position

}// End Void Loop()



I couldn't get it to draw lines instead of points. It would visibly buffer the pages.

I'm actually running my display in parallel mode with a different library to see if I can get it to work right. It works well, but I have to figure out how to set the contrast since it is not set up to be externally controlled like KS0108 driven displays. I think I've found out how to adjust it in the datasheet, though.

- Muhammad.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: tack on Jan 12, 2013, 09:41 pm
Does this library work with the ST7735S driven 128x160 TFT displays?
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 13, 2013, 09:59 am
@Muhammad
Thanks for the code. The only little optimization, could be to poll the ADC outside of the picture loop.

@tack
U8glib has been optimized for monochrome displays. It is possible to support full color displays and some work has been done already, but probably u8glib is too slow to support these kind of displays. Another issue is the init sequence of the display. It is already complicated for some graylevel displays, but becomes a nightmare with full color displays.

Have a look at the ILI9325d code for the 320x240 TFT
http://code.google.com/p/u8glib/source/browse/csrc/u8g_dev_ili9325d_320x240.c

Results from u8glib perspective are:
- only 256 colors
- slow
- complex init sequence, needs to be derived from many sources and verified with the display.

I think the ILI9325 code could be a good starting point, but the programmer needs physical access to the display and a reliably start up sequence.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: rgroener on Jan 13, 2013, 10:04 am
Oliver, thanks a lot for your explanation. I will read more about it.
I really do like your U8glib and will use it in my curent project. Especially the fonts are great!
I should have enough memory to draw a graph.

Best regards Roman
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: DukeR on Jan 27, 2013, 05:53 pm
Oliver, hi, and sorry for my english in advance.
Just bought a 12864B (st7920) lcd from dx.com, and wired it to my arduino (compatible) nano v3.0. When connecting it thru SPI and using your 1.09 library I can use all the demos you provide, but (as you explain) it's a little slow (fps wise). So I tried to wire it thru 8bit parallel, but I get a corrupted screen (some or most of the image it's supposed to show is there, but the rest is... random.). I've checked and rechecked the wiring and just can't find the error.
The two are connected like this:
Arduino --> LCD function --> LCD naming
d5, d6, d7, d8, d9, d10, d11, d12 --> d0, d1, d2, d3, d4, d5, d6, d7 --> db0, db1, db2, db3, db4, db5, db6, db7
d4 --> clock --> E
d3 --> RW --> R/W
d2 --> CS --> RS
GND --> Ground logic, PSB, ground backlight --> GND, PSB, BLK
5v --> vcc logic, vcc backlight --> VCC, BLA

and the constructor used for parallel is
U8GLIB_ST7920_128X64 u8g(5, 6, 7, 8, 9, 10, 11, 12, 4, U8G_PIN_NONE, U8G_PIN_NONE, 2, 3);
in SPI is
U8GLIB_ST7920_128X64 u8g(4, 3, 2, U8G_PIN_NONE);

The only wire I change when testing from SPI (working) to 8bit parallel (garbage) is the PSB from gnd to 5v, and reupload the sketch with the other constructor

And here is a video of what it looks like when running the "graphics" example in parallel:
http://www.youtube.com/watch?v=4qIpiHyE36g&feature=youtu.be

What am I doing wrong?
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 27, 2013, 07:40 pm
I have uploaded a beta release 1.10pre1. Could you please check this version also. I think i also added some delays to the strobe signal.

Thanks,
Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: DukeR on Jan 27, 2013, 07:54 pm
Perfect! That's it. Though looks slower now (fps).
Does anyone have a fps benchmark sketch with this library?
Thanks Oliver.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 27, 2013, 08:47 pm
U8glib is not fast. This has been discussed some weeks ago in this thread.
But there is a pending issue, to improve speed for your controller.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: DukeR on Jan 27, 2013, 08:55 pm
I read that discussion, and understand why. What I meant is that from the garbage displaying 1.09 to the working 1.10pre1, the garbage looked like it was drawn faster.
Would be great if at some point you could implement the low level functions that take advantage of the "read" capabilities of 8bit parallel conection, while maintaining the flexibilities it has now for the rest.
Great library!
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Feb 02, 2013, 06:56 pm
Hello All

A new release of U8glib is available for download (v1.10).
* Support for SSD1309 and NHD-C12832
* Bugfixes for parallel-mode (reset pin) and ST7920 controller

@DukeR
Except for checking the "busy" flag, adding read capabilities to U8glib would require a huge rework of the lib. I currently do not have the time to do this.

Oliver

http://code.google.com/p/u8glib/
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: ibh4 on Mar 02, 2013, 03:43 pm
I've got a problem in my mind,needing for help:how to control LCD12864,by only using SPI .Can you give me some picture about it? Thank's a lot. I am learnning to display the data play in the 12864 using mega 2560.Thanks!!!!! :) :)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Mar 02, 2013, 05:18 pm
Hi

Can you provide a link to the display? This would help a lot.

In general displays with SPI interface are usually connected like this:

(http://wiki.dogm128.googlecode.com/hg/dogm_block.jpg)


Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Mar 02, 2013, 10:33 pm
I have finished release v1.11:
  * Support for T6963
  * Support for Arduino Due
  * Sleep Mode
  * 4x mode for ST7920
  * New C++ interface for ST7920

http://code.google.com/p/u8glib/ (http://code.google.com/p/u8glib/)

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: raalst on Apr 06, 2013, 03:21 pm
I got a specific ST7565 board to work on the DUE, but i did not know this thread yet,
it is posted here : http://arduino.cc/forum/index.php/topic,158709.msg1188374.html#msg1188374 (http://arduino.cc/forum/index.php/topic,158709.msg1188374.html#msg1188374)

including details on wiring it up (and a few tweaks).


Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 06, 2013, 06:43 pm
Hi

U8glib Version v1.13 is available for download:


Updates include:


Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: momtot on Jul 07, 2013, 03:51 am
Hi everyone !

I am new to the arduino.   

and i have an GLCD  type of wdg0151-tmi  and i dont know to wire it and also how to program it with arduino mega .

please please help and thank you and sorry for my bad language  :)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 07, 2013, 07:52 am
Hi

It seems to be this display: http://www.mikroe.com/download/eng/documents/development-tools/components/glcd_128x64_spec.pdf (http://www.mikroe.com/download/eng/documents/development-tools/components/glcd_128x64_spec.pdf)
It is a KS0108 based display. With U8glib, you can use
Code: [Select]
U8GLIB_KS0108_128(d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw [, reset])
but Bill's GLCDv3 will also work: http://forum.arduino.cc/index.php?topic=56705.0;topicseen (http://forum.arduino.cc/index.php?topic=56705.0;topicseen)

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: momtot on Jul 07, 2013, 07:15 pm
Thank you very much  :*

but still need more information please  :smiley-red:
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 07, 2013, 08:33 pm
I think it is best to use GLCDv3 first. It has a very good user manual.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: momtot on Jul 07, 2013, 09:09 pm

C:\Users\Mohamed\Documents\Arduino\libraries\ks0108\ks0108.cpp: In member function 'void ks0108::Init(boolean)':
C:\Users\Mohamed\Documents\Arduino\libraries\ks0108\ks0108.cpp:505: error: 'OUTPUT' was not declared in this scope
C:\Users\Mohamed\Documents\Arduino\libraries\ks0108\ks0108.cpp:505: error: 'pinMode' was not declared in this scope
C:\Users\Mohamed\Documents\Arduino\libraries\ks0108\ks0108.cpp:511: error: 'delay' was not declared in this scope

would you please tell me what is that error , and thank you :~
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 07, 2013, 09:30 pm
Did you download glcd-v3-20111205.zip from http://code.google.com/p/glcd-arduino/downloads/list (http://code.google.com/p/glcd-arduino/downloads/list)?
Which IDE are you using?

I am not an expert on glcd-v3. Better to ask here: http://forum.arduino.cc/index.php?topic=56705.0 (http://forum.arduino.cc/index.php?topic=56705.0)

In the case you decide to use U8glib, then you are welcome to ask questions in this thread here.

Oliver


Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: momtot on Jul 07, 2013, 11:29 pm
Thank you for your care  :)

but  can  you tell me please ?  =(

how to use the the wdg0151-tmi and how to wire it to arduino mega

and please give me an example to learn from it .
and thank you Oliver 
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 08, 2013, 07:00 am
Hi

Examples are here: http://code.google.com/p/u8glib/wiki/tdisplaysetup

You could also follow this list of steps:

1) Download u8glib
2) install u8glib in the libraries folder (unzip there)
3) start arduino IDE
4) You should see the u8glib submenu in the Examples section
5) locate "HelloWorld"
6) open "HelloWorld" example
7) Find this line in the example:
Code: [Select]
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16

8 ) Uncomment this line:
Code: [Select]
U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16

9) Ensure that the arduino board is not connected to any power or usb
10) Connect your display as described in the comment: // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
10a) Connect Data lines from D0 to D7 to pins 8,9,10,11,4,5,6,7
10b) Connect the chip enable signals to pin 14 and 15, which are labled as A0 and A1 on the Uno
10c) Connect the di display pin to pin 17, which is labled as A3 on the Uno
10d) Connect wr to pin 16, which is A2
11) The variable potentiometer (see datasheet)

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: momtot on Jul 08, 2013, 05:21 pm
Thank you very much Oliver  :*

but i have a question
why connecting cs1 , cs2 , di and wr to analog pins   :smiley-slim:

and Thank you 
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: momtot on Jul 08, 2013, 06:42 pm
and another question please

it does  not work with my wdg0151 lcd

it just works and nothing appears on the screen

please i need your help.

and to connect it to arduino mega if there is something wrong with connection
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: momtot on Jul 08, 2013, 08:28 pm
Hi Oliver this is the program i used in my arduino mega and the lcd does not work and gives me a white light only

please help and thank you



U8GLIB_KS0108_128 u8g(29, 28, 27, 26, 25, 24, 23, 22, 37, 33, 34, 36, 35);


void draw(void) {
 
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(0, 20);
 
  u8g.print("Hello World!");
}

void setup(void) {
 
   u8g.setRot180();

}

void loop(void) {
 

  u8g.firstPage(); 
  do {
    draw();
  } while( u8g.nextPage() );
 

  delay(500);
}
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 08, 2013, 08:34 pm

but i have a question
why connecting cs1 , cs2 , di and wr to analog pins   :smiley-slim:


You can use any pins you want. In fact on the Arduino Mega, you must use different pins.
But you need to tell U8glib the pin numbers.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 08, 2013, 08:36 pm

Hi Oliver this is the program i used in my arduino mega and the lcd does not work and gives me a white light only

please help and thank you



Your program looks correct, this is what i can say. There is no more light i can give unless you provide some more information.
Maybe you can make a picture from your setup. Good enough to trace wires from your display to the Mega.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: momtot on Jul 09, 2013, 02:39 am
Thank you Oliver for your care

and i am so sorry for my poring asking =(



this is the code i use and there is some pictures in attachments

Code: [Select]


#include "U8glib.h"



U8GLIB_KS0108_128 u8g(36, 40, 42, 44, 46, 48, 50, 52, 34, 22, 24, 28, 30 );


void draw(void) {
 
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(0, 20);

  u8g.print("Hello World!");
}

void setup(void) {
 
   u8g.setRot180();

}

void loop(void) {
 
 
  u8g.firstPage(); 
  do {
    draw();
  } while( u8g.nextPage() );
 

  delay(2000);
}

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: momtot on Jul 09, 2013, 02:41 am
and that is the second picture

and thank you Oliver  :*
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 09, 2013, 06:38 am
Thanks for the pictures. Still it is difficult to follow the wires. In general, i think the wires are too long.
Another question: What happens if you change the variable pot. Can you see the pixels at the most left or most right position?

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: momtot on Jul 09, 2013, 11:16 am
Hi Oliver

yes i see some pixels but it about to disappear

i almost seeing these pixels

and i cant see it from a distance i can see it hardly when i am close enough to the lcd

and when i change the variable pot there is nothing happened ,the pixels not going lighter and not even being darker .

shall i change the variable pot?   :smiley-roll-sweat:

and thank you Oliver  you really a good person  :* 
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 09, 2013, 06:25 pm
Hi

With the variable pot it should be possible to turn off and on all pixels. So probably something is miswired with your variable pot.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Atvaark on Jul 12, 2013, 04:20 pm
Hallo Oliver,

Thanks a lot for U8glib, it's great when RAM is limited. Thanks to that, I've been able to use an ATtiny85 w/ Arduino core to control an OLED display.

FYI, I had to remove all *_hw_spi.c files from the library because some symbols were undefined at compile time (for instance SPDR). It seems logical because ATtiny85s don't have any direct hardware API support. Do you believe there is a way to exclude those files automatically? Maybe with the right #ifdef...

If that can help anyone else, here's what I had to do to get everything working (in addition to configuring an Arduino as ATtiny programmer):


The next thing I would like to do is to use the USI provided by the ATtiny in order to implement hardware SPI, with the hope that it will both improve performance and reduce program size (currently, just creating the library instance takes 4 kB). I saw that there is some ATtiny support in the library, though not in Arduino context. Does it use USI or just software SPI? If hardware SPI is implemented, can you give me a few hints that would help me make the port from AVR to Arduino? I can then submit a patch.

Thanks again for your lib.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 12, 2013, 09:12 pm
Hi Atvaark

As far as i remember there is no HW support for the ATTiny. I would be glad to add support for ATTiny to U8glib, but i need to be able to compile for the ATTiny to check and test the modifications for ATTiny. Is there some extension for the Arduino IDE so that ATTiny appears as a board?

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Atvaark on Jul 12, 2013, 09:23 pm
I followed the instructions there and it works like a charm:
http://hlt.media.mit.edu/?p=1695

The Arduino IDE + core can be used to program the ATtiny using an Arduino as programmer.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 12, 2013, 10:59 pm
Somehow the link does not work :-(

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Atvaark on Jul 12, 2013, 11:32 pm
Strange… It did yesterday!

I hope I remember all the steps:
1. Download the ATtiny Arduino core at https://github.com/damellis/attiny
2. Create a 'hardware' directory in the Arduino directory (the one in the preferences of the Arduino IDE)
3. Copy the downloaded attiny directory (the one that contains boards.txt) to the new hardware directory
4. Relaunch the Arduino IDE, you should now see ATtiny items in the Tools > Boards menu
5. Open the ArduinoISP sketch from File > Examples
6. Upload the sketch to the Arduino (must be ATMega328-based!)
7. Connect the ATtiny to the Arduino : Arduino pin 10 --> ATtiny pin 1, 11 --> 5, 12 --> 6 and 13 --> 7
8. Add a 10 µF capacitor between the Arduino reset pin and ground (prevents the Arduino from resetting when uploading a sketch to the ATtiny)
9. In the Arduino IDE, choose your ATtiny chip from Tools > Board
10. In the Arduino IDE, choose 'Arduino as ISP' from Tools > Programmer
11. You can now upload a sketch directly from the IDE to the ATtiny

To set the ATTiny internal clock to 8 MHz (necessary for software SPI) :
1. Choose the 8 MHz variant from Tools > Board
2. Tools > Burn Bootloader (this won't actually burn any bootloader, just set internal ATtiny flags)

I hope I didn't forget anything.  :smiley-roll-sweat:
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 13, 2013, 08:21 am
Hi

I have fixed  the errors for ATTiny in the repository (snapshot attached). Thanks for pointing out this problem.
Currently there is no HW SPI support for ATTiny.  :(

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Atvaark on Jul 13, 2013, 11:35 am
Hi Oliver,

Thanks for fixing the compilation issue!

Once I have understood the design of the U8glib abstraction layer, I'll try to implement hw SPI using the code posted by Nick on this thread:
http://forum.arduino.cc/index.php?topic=152432.0
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 13, 2013, 01:05 pm
You can use this file as a template:
https://code.google.com/p/u8glib/source/browse/csrc/u8g_com_arduino_std_sw_spi.c (https://code.google.com/p/u8glib/source/browse/csrc/u8g_com_arduino_std_sw_spi.c)

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Atvaark on Jul 21, 2013, 11:43 pm
Hi Oliver,

I managed to add support for Arduino ATtiny85 hardware SPI. I tested it with an SSD1306 OLED controller (Adafruit 128x32) and it seems to be working OK. As predicted, it spares some CPU time and program memory.

The mod is attached. Feel free to include it into future releases, as is or modified.

Part of the credit goes to Nick Gammon, thanks to the code he posted there: http://forum.arduino.cc/index.php?topic=152432.0

Danke schön for your library.  :)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 22, 2013, 12:30 am
Thanks. I have updated issue 190 to add your patch as part of the support for attiny.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: jcdillin on Oct 01, 2013, 10:26 pm
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?
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 01, 2013, 10:41 pm
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.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 04, 2013, 10:36 pm
The new version 1.14 is available for download.

Currently there are two download locations:
Bintray: https://bintray.com/olikraus/u8glib (https://bintray.com/olikraus/u8glib)
Google Code: http://code.google.com/p/u8glib/downloads/list (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 (http://u8glib.googlecode.com/hg/ChangeLog)

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: charlespax on Dec 15, 2013, 10:12 pm
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?
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 15, 2013, 10:35 pm
Hi

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]
u8g.setContrast(0x018*4);

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

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: charlespax on Dec 15, 2013, 10:57 pm
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.
https://plus.google.com/photos/yourphotos?pid=5957739922966613330&oid=101791184065155123125

Regular NHD constructor.
https://plus.google.com/photos/yourphotos?pid=5957739197532901250&oid=101791184065155123125

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.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 15, 2013, 11:12 pm
Hi

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

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: charlespax on Dec 15, 2013, 11:16 pm
Thanks, Oliver! I'll use the NHD constructor and use the change contrast command.

Ugh I hate Google plus. Maybe this works.
https://lh3.googleusercontent.com/-x2YLoK_BNy0/Uq4k5PyWjVI/AAAAAAAAHSA/ghUJV_kwYMg/w991-h743-no/IMG_20131215_165313.jpg

https://lh5.googleusercontent.com/-38bxM67uC4c/Uq4kPBVej4I/AAAAAAAAHR0/gZjQX-NZCLc/w991-h743-no/IMG_20131215_165026.jpg
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 15, 2013, 11:19 pm
Excellent.   :D

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: IanJohnston on Dec 16, 2013, 08:42 pm
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?

Ian.
www.ianjohnston.com
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 16, 2013, 09:04 pm
Hi

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
U8GLIB_ST7920_128X64_4X(6)
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:
U8GLIB_ST7920_128X64_4X(6)
U8GLIB_ST7920_128X64_4X(7)
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...

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Dj_Garfield on Dec 17, 2013, 05:22 pm
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.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 17, 2013, 10:01 pm
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.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: MAS3 on Dec 18, 2013, 12:54 am
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.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Dj_Garfield on Dec 18, 2013, 02:54 am
:) 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();
 u8g.setFont(u8g_font_unifont);
 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(cols);
 u8g.print("=> Px on Y");
 u8g.setPrintPos( 0, 46 );
 u8g.print(rows);
 u8g.print("=> Px on X");
 u8g.drawLine(5,50,90,50);
 u8g.setPrintPos( 5, 62 );
 u8g.setFont(u8g_font_tpss);
 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 !!

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 18, 2013, 06:40 am
@MAS3
We discussed this some months back here http://forum.arduino.cc/index.php?topic=159851.0 (http://forum.arduino.cc/index.php?topic=159851.0)? But i can not remember that anyone has confirmed that this OLED works with u8glib. Thanks for the information.

@Dj_Garfield
The dimensions of the display are provided by the driver (hardcoded into the driver c code).

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: MAS3 on Dec 18, 2013, 10:24 pm
The brightness of the CO-16 display can be set, i do not know (yet) if the brightness can be set per pixel, or for the entire display.
But this line:
Code: [Select]
    u8g.setColorIndex(1);
Just will work with a zero or a one.
Anything larger than one is a one, meaning i can only enable or disable the pixel.
I can't set the brightness this way.
Is there any other way to control the brightness ?
In the other sketch this sets the brightness (here described as contrast), maybe this can offer some help:
Code: [Select]
  i2c_OLED_send_cmd(0x81); // Setup CONTRAST CONTROL, following byte is the contrast Value
  i2c_OLED_send_cmd(0xaf); // contrast value between 1 ( == dull) to 256 ( == bright)


I'll try if i can set different contrast levels in one sketch, and if that will be of any influence on the entire display, or on the next drawn items.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: MAS3 on Dec 18, 2013, 11:06 pm
Hmm, tried already.
This contrast setting sets the entire display.
I can make the display fade out this way.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 18, 2013, 11:14 pm
The SSD1306 controller is a pure monochrome controller. There are no gray levels. Pixel is either on or off, but the "brightness" of all "on" pixel can be controllt by the u8glib contrast setting.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: gcharles on Dec 24, 2013, 04:38 pm
Is there any plan to start supporting these interesting tft

http://www.buydisplay.com/default/lcd-5-ssd1963-tft-module-touch-screen-display-800x480-mcu-arduino.html

thanks
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 24, 2013, 09:10 pm
Indeed a nice display for a good price. U8glib supports some true color displays, but mainly the reason for this support had been that other people started to create such devices. However, U8glib has been optimized for monochrom displays with SPI interface. TFT LCDs could be supported, but speed (especially for such a large 800x480 display) will be very poor. Maybe UTFT has support for it.

Merry Christmas to everybody,

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Dj_Garfield on Dec 27, 2013, 01:43 am
Merry Christmas to you Oliver :) ( and for all )

I have some question about using fonts with u8g Lib .

Is it possible to truncate the font list to reduce it at the very strict necessary ? I explain , I'm Working on a DashBoard Atmega based , and I would like to know if it is possible to delete all characters I don't need in the way to have just numbers in the ASCII table ? because speed ( in km/h ) is displayed with numbers and no letters , so if I delete all the references to a letter in the ASCII table for any font , should this works ?

Is It Easy to create personal fonts like the font I use for the speed indicator on the following picture ?
( in the picture the oil indicator is an 10x19px icon , the battery a 7x10 icon , time is displayed wit u8g_font_helvB08 ( I would like to reduce this font to keep numbers only if it is possible , the same for the ODOmeter ), that I would like to do is build font for Speedometer .
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 27, 2013, 08:25 am
Hi

All fonts in u8glib are derived from the ".bdf" file format. It is a standard format to store bitmap fonts. Details are here: http://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format (http://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format). It is a plain text format, so you could also use a simple text editor to modify the bitmaps. There are also several font editors which allow export to bdf. Just to name two of them:
Fony: http://hukka.ncn.fi/?fony (http://hukka.ncn.fi/?fony)
Fontforge: http://fontforge.org/ (http://fontforge.org/)

I have not used Fony for a while, but if i understand the latest ChangeLog corretly, it should be easy to copy and past your existing icons into a new font. Once this is done, export the font as bdf and convert it into a U8glib font with "bdf2u8g" (available for Windows on the U8glib download page on google code).

Have a look here on details how to use bdf2u8g: http://code.google.com/p/u8glib/wiki/bdf2u8g (http://code.google.com/p/u8glib/wiki/bdf2u8g).

As an example, here is how to extract the numbers only from helvB08:
1. Download http://u8glib.googlecode.com/hg/tools/font/bdf/helvB08.bdf
2. Use
Code: [Select]
bdf2u8g  -b 48 -e 57  ../bdf/helvB08.bdf u8g_font_helvB08n u8g_font_helvb08n.c
to extract the font with the bitmaps for chars "0"..."9". The result will look like this:
Code: [Select]
const u8g_fntpgm_uint8_t u8g_font_helvB08n[157] U8G_FONT_SECTION("u8g_font_helvB08n") = {
  0,12,19,255,251,8,0,0,0,0,48,57,0,8,0,8,
  0,5,8,8,6,0,0,112,216,216,216,216,216,216,112,3,
  8,8,6,1,0,96,224,96,96,96,96,96,96,5,8,8,
  6,0,0,112,216,24,24,48,96,192,248,5,8,8,6,0,
  0,112,216,24,48,24,24,216,112,6,8,8,6,0,0,8,
  24,56,88,152,252,24,24,5,8,8,6,0,0,248,192,192,
  240,24,152,216,112,5,8,8,6,0,0,112,216,192,240,216,
  216,216,112,5,8,8,6,0,0,248,24,24,48,48,96,96,
  96,5,8,8,6,0,0,112,216,216,112,216,216,216,112,5,
  8,8,6,0,0,112,216,216,216,120,24,216,112};

3. Copy this code into your .ino file and use "u8g_font_helvB08n" as argument for the "setFont" command.

Oliver



Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: boomych on Dec 27, 2013, 11:06 pm
Hi all!

I use Arduino Mega 2560 with two displays ST7920.
Since most of the ports used for sensors, ports remain free 8,9,10,11,12,13
So I connected displays to these ports with software SPI
U8GLIB_ST7920_128X64_4X    u8g(10, 9, 8 );
U8GLIB_ST7920_128X64_4X   u8g2(13, 12, 11 );

In the  function "loop" I do rendering these displays alternating with intervals of 1 second.

Code: [Select]

if ((displayNo == 0) && (currentDisplayMillis - lastDisplayUpdate) > 1000)
{
 u8g.firstPage();
 do {
....
      }
 while( u8g.nextPage());
 displayNo = 1;
 lastDisplayUpdate = currentDisplayMillis;
}
else if ((displayNo == 1) && (currentDisplayMillis - lastDisplayUpdate) >1000)
{
 u8g2.firstPage();
 do {
....
      }
 while( u8g2.nextPage());
 displayNo = 0;
 lastDisplayUpdate = currentDisplayMillis;
}


The problem is that the first display only drawn for the first time and then is no longer updated. And the second is updated at the desired interval.
If I disable update of second display, the first starts normally updated.
Prompt where to find the error?
thanks
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 28, 2013, 01:03 am
What i can say, is that two displays at the same time is not testes very well.
Can you replace one of the constructors with the 1x variant. For example
U8GLIB_ST7920_128X64_4X    u8g(10, 9, 8 );
U8GLIB_ST7920_128X64_1X   u8g2(13, 12, 11 );
Will this work?

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: boomych on Dec 28, 2013, 09:49 am
I have tried almost all combinations, behavior does not change - the second monitor is updated, not the first.
Only one combination was different: updated first display and the second would not be updated:
U8GLIB_ST7920_128X64_4X    u8g(10, 9, 8);
U8GLIB_ST7920_128X64           u8g2(13, 12, 11);

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 28, 2013, 11:14 am
To be honest, i do not have an idea why this does not work. From U8glib perspective it should work. The only issue could be, that the same buffer is used if the same constructure is called. However, it seems, that this does not make a difference.
Can you ensure that youre code works correctly?
Maybe you should do a simple test script first. Pseudo code:

int cnt = 0;
void loop(void)  {
  print "cnt" on first display
  cnt++;
  delay(1000)
  print "cnt" on second display
  cnt++;
  delay(1000)
}

Now, even numbers (0, 2, 4, 6, ...) should be printed on the first display and odd numbers (1, 3, 5, ...) are printed on the second display. Will this work?

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: boomych on Dec 28, 2013, 11:54 am
It`s new code for test
Code: [Select]

#include "U8glib.h"
U8GLIB_ST7920_128X64_1X     u8g(10, 9, 8);
U8GLIB_ST7920_128X64_4X     u8g2(13, 12, 11);

int cnt = 0;

void setup(void) {
if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
    u8g.setColorIndex(255);     // white
  }
  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
    u8g.setColorIndex(3);         // max intensity
  }
  else if ( u8g.getMode() == U8G_MODE_BW ) {
    u8g.setColorIndex(1);         // pixel on
  }
  else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
    u8g.setHiColorByRGB(255,255,255);
  }
if ( u8g2.getMode() == U8G_MODE_R3G3B2 ) {
    u8g2.setColorIndex(255);     // white
  }
  else if ( u8g2.getMode() == U8G_MODE_GRAY2BIT ) {
    u8g2.setColorIndex(3);         // max intensity
  }
  else if ( u8g2.getMode() == U8G_MODE_BW ) {
    u8g2.setColorIndex(1);         // pixel on
  }
  else if ( u8g2.getMode() == U8G_MODE_HICOLOR ) {
    u8g2.setHiColorByRGB(255,255,255);
  }
}

void loop(void)
{
  u8g.firstPage(); 
  do {
         u8g.setFont(u8g_font_unifont);
         u8g.setColorIndex(1);
         u8g.setPrintPos( 0, 30);
         u8g.print(cnt);
  } while( u8g.nextPage() );

  delay(1000);
  cnt++;
 
  u8g2.firstPage(); 
  do {
         u8g2.setFont(u8g_font_unifont);
         u8g2.setColorIndex(1);
         u8g2.setPrintPos( 0, 30);
         u8g2.print(cnt);
  } while( u8g2.nextPage() );

cnt++;
delay(1000);
}


First display all time shows 0, second display shows 1, 3, 5, 7 ... etc
(http://i.piccy.info/i9/ac86b51f52e5be93cbfd7c2a02b18c25/1388228324/31289/671999/2displ.jpg)

So, third display is TFT with UTFT library,  makes no difference whether it is on or not, I tried to disable it physically, it has no effect
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 29, 2013, 09:37 pm
It took some time to reproduce the problem,  but indeed, this is a bug: Attaching two ST7920 displays with SW SPI does not work correctly. I have fixed this in v1.15pre3 of U8glib (attached...).

@boomych: Thank you very much for the bug report (karma+). I hope that this is now fixed.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: boomych on Jan 01, 2014, 09:08 pm
Oliver, Happy New Year!
I tried your new version of the library. Huge thanks! Everything works just fine!
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Dj_Garfield on Jan 02, 2014, 09:17 pm
Thank you Oliver ( for the Font tips ), and Happy new Year to you , and all who read this topic :)
( I'm on the numeric font creation for my project , but the party for the new year's day was pretty hard :) )
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 02, 2014, 09:36 pm
@Dj_Garfield: Good, but note that there is a size limitation for the glyphs. They can not be larger than about 48/49 pixel.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Dj_Garfield on Jan 03, 2014, 12:19 am
Ok , I keep this in mind , but The Font I expect to create , is 17 pixels Width x 24 pixels Height . Actualy I just test your tips by extracting only chars from 42 to 59 => just displaying time, but I need the ":" char in the font table :). and it works fine :)

I can do everything I need with the u8g lib , It is realy a wonderfull one , simple , as fast as the board could be .
I love it :)
==========================
Edit :
The Font I expect to create is the one who displays the speed as digit numbers in the middle of the screen, the truncated Helv font is used to display time , and odometer informations.

I have a mysterious issue with time displaying : when I put the code to display time on a 40x2 LCD the display is like that : 01:03:30 for example , but here with the 128x64 with the Helv Font I obtain for the same time :  1:3:30 there is no leading 0 .. and I dont know why ...

Edit 2 :

All Right , the font is made :) very simply , and is exactly what It was expected :) , Now I start from a scratch bdf File , I open it with FONY , and when done  : bdf2u8g and It works !:)

Edit 3:

For those who wants the font :
Code: [Select]

// FONT DS-DIGITAL NUMERIC ONLY
const u8g_fntpgm_uint8_t u8g_font_DSDGNUM[527] U8G_FONT_SECTION("u8g_font_DSDGNUM") = {
  0,16,30,0,251,24,0,0,0,0,48,57,0,25,0,24,
  0,14,24,48,16,1,1,127,248,191,244,223,236,224,28,224,
  28,224,28,224,28,224,28,224,28,192,12,128,4,0,0,128,
  4,192,12,224,28,224,28,224,28,224,28,224,28,224,28,224,
  28,223,236,191,244,127,248,3,24,24,16,12,1,32,96,224,
  224,224,224,224,224,224,224,96,32,0,32,96,224,224,224,224,
  224,224,224,96,32,14,24,48,16,1,1,255,248,127,244,63,
  236,0,28,0,28,0,28,0,28,0,28,0,28,31,236,63,
  244,127,248,191,240,192,0,224,0,224,0,224,0,224,0,224,
  0,224,0,224,0,223,224,191,240,127,248,13,24,48,16,2,
  1,255,240,127,232,63,216,0,56,0,56,0,56,0,56,0,
  56,0,56,63,216,127,232,255,240,127,232,0,24,0,56,0,
  56,0,56,0,56,0,56,0,56,0,56,63,216,127,232,255,
  240,14,22,44,16,1,2,128,4,192,12,224,28,224,28,224,
  28,224,28,224,28,224,28,223,236,191,244,127,248,31,244,0,
  12,0,28,0,28,0,28,0,28,0,28,0,28,0,28,0,
  12,0,4,14,24,48,16,1,1,127,248,191,240,223,224,224,
  0,224,0,224,0,224,0,224,0,224,0,223,224,191,240,127,
  248,63,244,0,12,0,28,0,28,0,28,0,28,0,28,0,
  28,0,28,31,236,63,244,127,248,14,24,48,16,1,1,127,
  248,191,240,223,224,224,0,224,0,224,0,224,0,224,0,224,
  0,223,224,191,240,127,248,191,244,192,12,224,28,224,28,224,
  28,224,28,224,28,224,28,224,28,223,236,191,244,127,248,13,
  23,46,16,2,2,255,240,127,232,63,216,0,56,0,56,0,
  56,0,56,0,56,0,24,0,8,0,0,0,8,0,24,0,
  56,0,56,0,56,0,56,0,56,0,56,0,56,0,56,0,
  24,0,8,14,24,48,16,1,1,127,248,191,244,223,236,224,
  28,224,28,224,28,224,28,224,28,224,28,223,236,191,244,127,
  248,191,244,192,12,224,28,224,28,224,28,224,28,224,28,224,
  28,224,28,223,236,191,244,127,248,14,24,48,16,1,1,127,
  248,191,244,223,236,224,28,224,28,224,28,224,28,224,28,224,
  28,223,236,191,244,127,248,63,244,0,12,0,28,0,28,0,
  28,0,28,0,28,0,28,0,28,31,236,63,244,127,248};


Below all the Files needed for the operation , if someone need some , It's free :)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: LarsSorensen on Jan 12, 2014, 09:55 am
I have a problem getting a SSD1306 128x64 OLED to work. It does not show anything.
The OLED works flawless using the Adafruit lib.
Using the u8glib and any example sketch, I cannot get it to work and I admit it might a case of identifying the correct pins.

The OLED I am trying to work with is this one:
http://www.ebay.com/itm/SPI-IIC-0-96-128X64-White-GreenLand-OLED-Display-Module-SSD1306-for-Arduino-AVR-/310740698356?pt=LH_DefaultDomain_0&hash=item485996c4f4

In the sketch I have uncommented  "U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9);"

In the attached picture I have tried to identify the different pins and functions of the board vs Adafruit lib and U8GLIB.
The connections I am most unsure of is MOSI and A0.
(http://farm8.staticflickr.com/7436/11902777073_bc75331051_o_d.png)


Reading the U8G device documentation an comparing it to Adafruit and OLED documentation it seems as MOSI should be connected from the D1 pin on the OLED to PIN 11 on the arduino boardm and a0 should be connected from the DC PIN on the OLED to PIN 9 on the Arduino board.
However it is not working, and I have tried to identify the pins on the OLED according to the U8GLIB terminology, but nothing works. Even when I sporadically move around the connectors on the OLED ;)

Anyway, I hope someone can shed some light on this.

- Lars
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 12, 2014, 01:24 pm
With the SW SPI constructor
U8GLIB_SSD1306_128X64(sck, mosi, cs, a0 [, reset])
you can use any Arduino pin. For example
U8GLIB_SSD1306_128X64(1,2,3,4)
tells U8glib, that the sck line of the display is connected to pin 1 of the Arduino board, MOSI (data) line is connected to pin 2 of the Arduino and so on. In fact you can mimic the Adafruit setup with U8glib (pin values from your table):
U8GLIB_SSD1306_128X64(10, 9, 12, 11, 13)

Also ensure, that your display is put into serial mode.

Oliver


Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: richardtheboffin on Jan 18, 2014, 08:02 pm
Just to confirm when using U8glib on Arduino, it's a Software SPI and can therefore use any pins?
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 18, 2014, 10:33 pm
U8glib supports SW SPI (with any pins), but also HW SPI.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: richardtheboffin on Jan 19, 2014, 07:17 pm
So it uses HW SPI if you define the HW SPI pins in the setup function?
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 19, 2014, 07:22 pm

So it uses HW SPI if you define the HW SPI pins in the setup function?


The opposite is true, see page http://code.google.com/p/u8glib/wiki/device (http://code.google.com/p/u8glib/wiki/device).

Text copy from there:
Code: [Select]
SW SPI u8g_dev_st7565_64128n_sw_spi U8GLIB_64128N(sck, mosi, cs, a0 [, reset])
HW SPI u8g_dev_st7565_64128n_hw_spi U8GLIB_64128N(cs, a0 [, reset])



Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: timofteandrei on Jan 22, 2014, 07:41 pm
Have anyone tried to use this lib with Nokia 7110 display? It doesn't work for me and I've tried few configurations for different so-called compatible displays, but didn't work. I need help because I have 3 lcd displays collected from some 7110 phones. Thanks!
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 22, 2014, 07:49 pm
Which constructors did you use? The display should be compatible with the ST7565 controller.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: LarsSorensen on Jan 22, 2014, 08:25 pm

In fact you can mimic the Adafruit setup with U8glib (pin values from your table):
U8GLIB_SSD1306_128X64(10, 9, 12, 11, 13)
Also ensure, that your display is put into serial mode.
Oliver


Thank you!

Actually, I DID try to mimic the Adafruit example without luck - Thanks to your suggestion, I noticed that I had lacked the RESET PIN - which I did not read about in the documentation.
Thank you very much for a fabulous library and your devoted help to people using your library.

- Lars
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 22, 2014, 11:56 pm
@Lars
Glad to read that your display works.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 25, 2014, 07:16 pm
U8glib (http://code.google.com/p/u8glib/ (http://code.google.com/p/u8glib/)) version v1.15 is available for download.

Google finally had stopped any new downloads. I had to remove the tab on the google code project page. Please download U8glib from here: https://bintray.com/olikraus/u8glib/Arduino (https://bintray.com/olikraus/u8glib/Arduino)

The new release includes (together with some bug fixes) the following new features:


ProFont comes with several sizes and is very readable
(http://wiki.u8glib.googlecode.com/hg/fontpic/u8g_font_profont15r.png)

"drawTriangle" draws a filled triangle:
(http://wiki.u8glib.googlecode.com/hg/descpic/triangle.png)

The UC1608 is a modern controller for large COG displays:
(http://wiki.u8glib.googlecode.com/hg/otherpic/u8glib_uc1608_240x64.jpg)

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: oscar0226 on Feb 13, 2014, 03:30 am
Hi I am trying to show 2 plots in the same loop on a LCD by using the U8glib library but it fails.

The reason that the plots has to be presented sequentially in the same loop is I am showing an averaged value and FFT result from an analog pin, and whenever the loop update it would pick a new measurement.  

I was trying to write the program as the way below, however, it is apparently one of the programming restriction in the library and I would like to ask how can I do the same thing without updating to the new loop?

Code: [Select]

show plot A
delay 5s
show plot B


Information of LCD and library can be found below:
Used LCD: LM6059, 128x64, Adafruit
Controller: ST7565
GLib:  U8glib

Many thanks!
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Feb 13, 2014, 12:22 pm
You should break down your task into three independent steps:

Code: [Select]
loop() {
  do measure and derive other values (FFT)
  display data
  calculate which page should be visible
}


"display data" will look like this:
Code: [Select]
if ( page_to_display == 1 )
  display_page_1();
else if ( page_to_display == 2 )
  display_page_2();


The "calculate which page should be visible" steps solves the task to calculate a suitable value for  "page_to_display". This calculation will be done based on the current system time, which is returned by millis(). So every 5 seconds you could switch the value for "page_to_display" from 1 to 2 and 2 to 1.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: oscar0226 on Feb 13, 2014, 03:55 pm

You should break down your task into three independent steps:

Code: [Select]
loop() {
 do measure and derive other values (FFT)
 display data
 calculate which page should be visible
}


"display data" will look like this:
Code: [Select]
if ( page_to_display == 1 )
 display_page_1();
else if ( page_to_display == 2 )
 display_page_2();


The "calculate which page should be visible" steps solves the task to calculate a suitable value for  "page_to_display". This calculation will be done based on the current system time, which is returned by millis(). So every 5 seconds you could switch the value for "page_to_display" from 1 to 2 and 2 to 1.

Oliver


Thanks for the reply!

I just wonder if I should do the "display data" inside the draw function picture loop or..? as if I do it in the main loop I would need delay(5000) after obtaining the millis() value so as to switch between the display page for every 5 seconds.

could you please explain a bit more detail about how to perform the function as I am confused?

The below is the program structure I am trying to perform and it needs to be finished in one cycle since the system picks new measurement during every cycle.

Code: [Select]

loop(){
     do measure and derive FFT value
    picture loop {
       draw();
    }
}

draw(){
   for (i=0; i<3; i++){
       display value
       wait 5s
       display FFT result
   }
}

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Feb 13, 2014, 08:53 pm
You should not do the delay inside the picture loop.

You could do it like this:
Code: [Select]
loop(){
     do measure and derive FFT value
     picture loop {
        display value
     }
     wait 5s
     picture loop {
        display FFT result
     }
     wait 5s
}


Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: DukeR on May 02, 2014, 05:11 am
Hi Oliver.
I've been trying the new 4X 8 bit parallel mode for ST7920 and it's an obvious improvement. Thanks.
Since (for what I've seen) the ST7920 has become more "popular", I was wondering if you would reconsider writing the driver for the READ/WRITE/SHIFT low level capabilities of the parallel connection to it.
Keep up the good work!
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on May 02, 2014, 07:11 am

Hi Oliver.
I've been trying the new 4X 8 bit parallel mode for ST7920 and it's an obvious improvement. Thanks.
Since (for what I've seen) the ST7920 has become more "popular", I was wondering if you would reconsider writing the driver for the READ/WRITE/SHIFT low level capabilities of the parallel connection to it.
Keep up the good work!


Thanks, but your request is not so clear to me It is not so clear me. The parallel connection is there:
Code: [Select]
    U8GLIB_ST7920_128X64_4X(uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7,
        uint8_t en, uint8_t di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE)

But i do not know what you mean by READ/WRITE/SHIFT.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: heathzap on May 04, 2014, 01:43 pm
Hi

Two questions:

1.Trying to get the Adafruit 0.96" 128x64 OLED to work with U8glib. Seen other posts on 12C (TWI) not working and mine doesn't either. I have 4k7 pullups on D2 & D3. This running on Leonardo. Cant see anything to change other than selecting this line in code:

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);   // I2C / TWI

2.I intend getting the 128x128 color OLED from adafruit and running it on SPI. Not certain how to specify this in U8glib since SPI not linked to pins as on other arduinos?

Look forward to getting your excellent lib working.
Best regards
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on May 04, 2014, 01:53 pm
1) Is it working with the Adafruit Libs?

2) I stopped supporting color oleds in U8glib. Better use Ucglib, which has better support for color OLEDs: https://code.google.com/p/ucglib/

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: heathzap on May 04, 2014, 02:04 pm
Hi Oliver

Works fine with the adafruit libs. I'm using D2,3 & 4 (Rst)

Tx for the link
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on May 04, 2014, 04:33 pm
Unfortunately i do not have the Adafruit displays for testing.
Some people reported that u8glib will work with a different setup sequence (line 178 of u8g_dev_ssd1306_128x64.c)
You could modify the code to check if (for example) sequence 2 works better.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: heathzap on May 04, 2014, 05:34 pm
Tx Oliver. I'll try that and revert
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: JLLL on Jun 10, 2014, 07:55 am
May I know how to draw text only on a small region of the LCD without the previously drawn text being wiped out?

I try to put one draw in setup() and another draw in loop(), however what was drawn during setup was all wiped out during loop().
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jun 10, 2014, 10:08 pm
Yes, whenever you use the "picture loop", any previous picture is overwritten. U8glib behaves somehow different to other librieres, but it does only require a small amount of memory.
To solve this problem, add your graphics primitives from the setup procedure to your draw procedure in loop().

For more information on this, please see here: https://code.google.com/p/u8glib/wiki/tpictureloop (https://code.google.com/p/u8glib/wiki/tpictureloop)

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: JLLL on Jun 11, 2014, 05:53 am
Thanks Oliver. I see. It is indeed different with other display libraries where you need to purposely clear the screen.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 05, 2014, 09:42 pm
Hi

Today, I have released v1.16 of U8glib (https://code.google.com/p/u8glib/ (https://code.google.com/p/u8glib/)). Changes include:
  * Added support for LD7032 60x32 OLED
  * Added support for SSD1306 OLED, which does not send I2C ACK (issue 239)
  * Added support for SH1106 128x64 OLED
  * Added support for T6963 128x128 displays
  * Added U8GLIB_SSD1306_ADAFRUIT_128X64 constructor

The picture below shows a 0.5" OLED module based on the LD7032 controller (from
here (http://www.aliexpress.com/store/product/0-5-inch-OLED-display-shield-for-Arduino-OCELL/329792_1944014364.html)):

(http://wiki.u8glib.googlecode.com/hg/otherpic/ld7032_nano2.jpg)

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: ElmoC on Jul 06, 2014, 03:38 am
How do you use the P version of functions like getStrWidthP?  The normal way used with things like strncpy_P(dest, PSTR("SOURCE"), size) doesn't seem to work.  I get an error when I try it...

invalid conversion from 'const char*' to 'u8g_pgm_uint8_t* {aka unsigned char*}' [-fpermissive]

Code: [Select]
const char szLabel[] PROGMEM = "Max:";  // defined in global space

u8g.getStrWidthP(szLabel); // Inside a function
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 06, 2014, 06:45 am
Hi

Without having this tested, i think the warning can be ignored.

Code: [Select]

const char szLabel[] PROGMEM = "Max:";  // defined in global space

u8g.getStrWidthP((unsigned char *)szLabel); // Inside a function

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: askjacob on Jul 29, 2014, 06:06 am
Just thought I'd say thank you for this library. I have used it to get some ebay 1.6 inch 128x64 yellow/green oleds up and running with no hassle at all, what an amazing feat.

These displays are all over ebay at the moment, the top 16 rows are yellow, the rest are green and if you can use that in your application they look pretty great.

My config is:

Code: [Select]

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);

void setup ()  {
 
//oled
uint8_t setmode = 1; //set to BW mode
u8g.setColorIndex(1); //Set colour to "white"


...for anyone "googling" out there how to get started with a 1.6" ebay yellow-green OLED display and arduino.

A quick question however:

Do you have any tips on how to slim down the program memory footprint? I am only using a single small font, and a few 'primitives' - basically print and scale2x2. As far as I know, the complier/linker SHOULD only use stuff that is called, but I have a suspicion more is tacked on, used or not when it comes to libraries... thoughts? Otherwise I am going to just make a copy of the library and just try the slash, burn and see method :)

Cheers and thanks again,

Jacob
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: bperrybap on Jul 29, 2014, 06:39 am

I have a suspicion more is tacked on, used or not when it comes to libraries... thoughts? Otherwise I am going to just make a copy of the library and just try the slash, burn and see method :)

Before running off and spending time on a hunch, why not just take a look and
actually see where all the space is going?
Create a listing file from the linked image and you will see all the code generated
and linked in.
That will tell you exactly what is being linked in and how big things are.

--- bill
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: askjacob on Jul 29, 2014, 06:44 am
I have, and there is a large chunk there. A lot of stuff in the code is, for example dedicated to constructors for devices that may or may not be invoked during run-time - not compile time, so I think I can save a fair bit of space if I trim it to the bone.

Or, end up with a non-functioning library as I sever a vital organ. Hence asking the author for his thoughts as I head in.

Cheers
Jacob
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: bperrybap on Jul 29, 2014, 07:02 am

I have, and there is a large chunk there. A lot of stuff in the code is, for example dedicated to constructors for devices that may or may not be invoked during run-time - not compile time, so I think I can save a fair bit of space if I trim it to the bone.

Or, end up with a non-functioning library as I sever a vital organ. Hence asking the author for his thoughts as I head in.

Cheers
Jacob

So you created a listing file from the .elf file and actually saw dead code that isn't called and constructor code
for other devices in the linked image?

When I built the "HelloWorld" example for the i2c SD1306 128x64 module for a UNO board,
I only saw the routine for the one expected constructor and not any others.

I'm curious what you saw.

--- bill
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 29, 2014, 10:21 am
Yes, the listing file would be nice to see.
Depending on the fonts U8glib requires about 10K. If you do not need ASCII chars with code higher than 127, then fonts with a "r" postfix can be used to reduce flash memory.
Also other libraries and the use of floating point are common reasons for increased memory usage.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: askjacob on Jul 30, 2014, 12:40 am
Hi Oliver.

First of all, this was not ever intended as any kind of critique on your library - but more on the lack of control and visibility on what the Arduino IDE gives on it's handling of libraries and compiling.

I have found inconsistent results with certain individual libraries with what is done - trimming out unused classes and functions can "greatly" reduce the final build, slightly reduce it, or not at all. Additionally moving code from a library into the main codebase can sometimes also reduce the overhead. Keep in mind here, I am talking about a handful of bytes here and there, not huge amounts all over the place. It all adds up though, when you are at the limit. Same with SRAM.

My thoughts here: this can hard to quantify and test easily, and often does not show up until your program is complex enough possibly edge case the compiler and optimizer, at whatever configuration the Arduino IDE uses.

Perhaps I am outgrowing the Arduino IDE. The hardware platform is nice, and the ability to ignore the 'arduino bits' when you want to is nice too.

Here is the thing though:

1 - Thanks Oliver for the great library. It has saved me much energy and head scratching, and allowed me to provide a neat UI to my project
2 - Thanks for the suffix "r" tip - that alone gave me 4K headroom to play with - much more breathing space and now development time rather than needing to start chopping around inside libraries :)

I'm glad I asked in here :)

PS does anyone have any good win32/win64 elf listers? I cannot find anything that has been developed beyind say 2009/2010 and they all crash post list generation, making anylsis/comparison between compiles very HARD!

Cheers
Jacob
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: bperrybap on Jul 30, 2014, 01:07 am
Without looking at the actual final linked image to see everything and
what is linked in you are dancing in the dark.

Previously you said you did this,  but now it sounds like you haven't.

The gcc tool set comes with a set of binutils. There is a tool "objdump" to look at .elf files
The avr-gcc tool package that comes with the IDE comes with the gcc binutils.
In that package,  objdump is called "avr-objdump"
I recommend using that with the -S and -h options.

--- bill
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: askjacob on Jul 30, 2014, 02:31 am

Without looking at the actual final linked image to see everything and
what is linked in you are dancing in the dark.

Previously you said you did this,  but now it sounds like you haven't.

--- bill



I have been 'doing it' , but the best I could get using was T34 - however it would crash out post-parsing so I had to work with what was visible with the crash dialogue box open (it didn't cover the output) but I could not screengrab it to compare. The machine I am using is a corporate device where I have been given a sandbox area to play in, however it is still restricted somewhat and does seem to make a lot of apps misbehave, especially since we had some GPO's pushed to minimise the impact of the crytpobit type of viruses (limits execution locations etc).

I will grab the gcc toolchain and give it a shot.

Thanks for that!

Jacob
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: bperrybap on Jul 30, 2014, 02:40 am

I will grab the gcc toolchain and give it a shot.
Jacob

If you are using the IDE, then you already have everything you need
as the IDE comes with the avr-gcc tools and the avr version of gnu binutils.
--- bill
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Raphango on Sep 12, 2014, 02:44 am

Yes, the listing file would be nice to see.
Depending on the fonts U8glib requires about 10K. If you do not need ASCII chars with code higher than 127, then fonts with a "r" postfix can be used to reduce flash memory.
Also other libraries and the use of floating point are common reasons for increased memory usage.

Oliver



Thanks for this awesome piece o' advice in reducing consumed memory. But how do I exactly implement it to my code? I'm intending to use my Attiny85 controlling a SSD1306 and I really don't know where to begin..... =(
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Raphango on Sep 12, 2014, 02:48 am

Hi Oliver,

I managed to add support for Arduino ATtiny85 hardware SPI. I tested it with an SSD1306 OLED controller (Adafruit 128x32) and it seems to be working OK. As predicted, it spares some CPU time and program memory.

The mod is attached. Feel free to include it into future releases, as is or modified.

Part of the credit goes to Nick Gammon, thanks to the code he posted there: http://forum.arduino.cc/index.php?topic=152432.0

Danke schön for your library.  :)


Please, would you tell me how did you manage to do it? I'm pretty noob at these advanced issues. I have downloaded your zip file but I don't know where to put the files. Could you please make a little "tutorial" on how to use u8glib with the ATtiny85? I'm using an Arduino Nano as ISP.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Sep 12, 2014, 08:06 am
Quote
I have downloaded your zip file but I don't know where to put the files.

In the Arduino IDE, there is a "Sketch" menu, which allows you to import and add a library. Just provide the zip from the u8glib download location. After this, you will find all the u8glib examples available in the Menu of the Arduino IDE.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Raphango on Sep 13, 2014, 02:52 am

Quote
I have downloaded your zip file but I don't know where to put the files.

In the Arduino IDE, there is a "Sketch" menu, which allows you to import and add a library. Just provide the zip from the u8glib download location. After this, you will find all the u8glib examples available in the Menu of the Arduino IDE.

Oliver
I have sucessfully imported the u8glib into my Arduino and I've already managed to upload some of the example codes. Using my Arduino Nano and the SSD1306, it works perfectly! The problem is: I want to use an ATtiny85 instead of the Arduino Nano you get it? The same codes that were uploaded to Ardu Nano won't work in the ATtiny85... I am using the Ardu Nano as ISP, with all the correct options selected, but it still give me these errors while compiling:
Code: [Select]
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: OLED128x64_HelloWord.cpp.elf section .text will not fit in region text
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: region text overflowed by 1436 bytes
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_14':
(.text+0x0): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_default' defined in .vectors section in c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0x0): relocation truncated to fit: R_AVR_13_PCREL against symbol `__init' defined in .init0 section in c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_1' defined in .text section in c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0x4): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_2' defined in .text section in c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0x6): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_3' defined in .text section in c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0x8): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_4' defined in .text section in c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0xa): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_5' defined in .text.__vector_5 section in core.a(wiring.c.o)
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0xc): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_6' defined in .text section in c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0xe): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_7' defined in .text section in c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0x10): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_8' defined in .text section in c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0x12): additional relocation overflows omitted from the output
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Sep 13, 2014, 09:26 am
I have never tested U8glib with Attiny85. The error message seem to indicate, that the size of the sketch is to big for the Attiny85.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Raphango on Sep 13, 2014, 06:32 pm

Yes, the listing file would be nice to see.
Depending on the fonts U8glib requires about 10K. If you do not need ASCII chars with code higher than 127, then fonts with a "r" postfix can be used to reduce flash memory.
Also other libraries and the use of floating point are common reasons for increased memory usage.

Oliver


Do you think doing this procedure would help me to reduce the size to possibly upload the code to an ATtiny85? If so, how can I do this procedure?

Thanks in advance! =D
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Sep 13, 2014, 07:15 pm
In the HelloWorld example, line 130, replace
Code: [Select]
u8g.setFont(u8g_font_unifont);

with
Code: [Select]
u8g.setFont(u8g_font_unifontr);

Try to upload this example. If you get the same errors, then u8glib might be to big for the Attiny85.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Raphango on Sep 13, 2014, 08:15 pm
Thanks for the "r"!!

I tried to compile (just compile, Ctrl + R) the "Hello World" from the u8glib and i get the following results, according to the board i've choosen:

Board:::::::::::::Result
Arduino Uno: Compiling successful
Arduino Nano w/ ATMega328: Compiling successful
ATtiny85 (internal 1 MHZ clock):
Code: [Select]
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0xa): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_5' defined in .text.__vector_5 section in core.a(wiring.c.o)
core.a(main.cpp.o): In function `main':
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/main.cpp:15: relocation truncated to fit: R_AVR_13_PCREL against undefined symbol `serialEventRun()'

ATtiny85 (internal 8 MHZ clock):
Code: [Select]
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0xa): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_5' defined in .text.__vector_5 section in core.a(wiring.c.o)
core.a(main.cpp.o): In function `main':
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/main.cpp:15: relocation truncated to fit: R_AVR_13_PCREL against undefined symbol `serialEventRun()'


I have followed this tutorial to use my Arduino as ISP for the ATtiny: http://highlowtech.org/?p=1695

Thanks again!
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Sep 13, 2014, 09:21 pm
Hi

Somehow the error messages sounds like, that the sketch is still to big. But again, i am not an expert for the Attiny45. It seems to be more often discussed in " Arduino Forum :: Using Arduino :: Microcontrollers".

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Raphango on Sep 14, 2014, 03:17 am
OK, thanks for your help! ^^
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: card5 on Sep 15, 2014, 07:51 pm
Hi


Amazing Library, I am using it with a small OLED display I bought from eBay:
http://www.ebay.com/itm/121288137874

I chose U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE) and it works perfectly.


Thank you for creating it.


May I ask you,
the webstore ElectroDragon sells 2 LCD-TFT Displays:


(http://s4.electrodragon.com/wp-content/uploads/2013/10/EDS-TFT-LCD-LCM-SPI-Interface-Variable-1.8-2.2-04.jpg)

http://www.electrodragon.com/?product=eds-tft-lcd-lcm-spi-interface-variable1-82-2



The left one is 1.8",
the right one is 2.2".


I bought the 1.8" one, and according to their Wiki page, it is based on ST7735S.
http://www.electrodragon.com/w/EDS_TFT_LCD_LCM_SPI_Interface


Does U8glib support that display too?

From the list of classes, I did not find that chip,
but maybe it's another name?


Thank you
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Sep 15, 2014, 10:42 pm
Hi

Thanks.

The question regarding color displays  came up very often. I finally decided to split off color displays and created Ucglib: https://code.google.com/p/ucglib/ (https://code.google.com/p/ucglib/).

It has some small differences: I removed the "picture loop" (because it does not make sense for color TFTs/OLEDs), added true color support to all graphics primitives and updated the fonts a little bit (actually i replaced one of the fonts with another font).

Ucglib has its own thread here: http://forum.arduino.cc/index.php?topic=214966.0 (http://forum.arduino.cc/index.php?topic=214966.0)

Ucglib is quite young and it does not have the popularity as UTFT or the Adafruit Lib, But Ucglib is infact U8glib for color displays, especially for those users, who do not want to miss a large collection of fonts and an online documentation.

Oliver



Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: card5 on Sep 16, 2014, 06:34 am
Great,
I will wait for the display from ElectroDragon to arrive, and then use Ucglib.

Thank you for creating them :)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: fahad1 on Sep 20, 2014, 01:27 am
Hi Olikraus and Community,
could you guys look at my thread and help me out with some connections at the following thread
http://forum.arduino.cc/index.php?topic=267860.0

the module used is UC1610B i hope that is same as UC1610.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: cabecinhas on Sep 29, 2014, 07:37 pm

Hi

Nice work. Glad to see that u8glib is usefull for you.

The U8glib font format not only contains the bitmat data but also a lot of glyph information for precise font rendering (mainly used for my other lib m2tklib). Some information available in the fonts are described here: http://code.google.com/p/u8glib/wiki/tstring (http://code.google.com/p/u8glib/wiki/tstring).
The U8glib font format also tries to crop the bitmap data to save as much ROM as possible. All the glyph metric calculation, the bitmap reduction and the font encoding is done by an external program: http://code.google.com/p/u8glib/source/browse/tools/font/bdf2u8g/bdf2u8g.c (http://code.google.com/p/u8glib/source/browse/tools/font/bdf2u8g/bdf2u8g.c). Simply compile the c-file with a unix or windows c-compiler (or send me a PM if you need the executable).

bdf2u8g requires a font in the bdf format: http://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format (http://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format)

On the internet several fonts are available as bdf files, see for example here: http://cgit.freedesktop.org/xorg/font/ (http://cgit.freedesktop.org/xorg/font/)

But it is also possible to convert truetype fonts (ttf) to bdf: I have used http://sofia.nmsu.edu/~mleisher/Software/otf2bdf/ (http://sofia.nmsu.edu/~mleisher/Software/otf2bdf/) and http://fontforge.org/ (http://fontforge.org/). I am sure there are more tools (google has some 100.000 hits for "ttf bdf").

Oliver







Hi Oliver.. I'm trying and following your posts about how to create custom fonts.. But didn't get anywhere :( !

I Decided(reading yur answers) the best thing to do is create my own font..(AM I RIGHT?)

So I think the solution is create my own BDF fonts.. and then convert using bdf2u8g.exe to the library. Am I Right?

If I'm right, could you give me a clue about how to start creating my BDF files?

TKS SO MUCH!

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Sep 29, 2014, 08:06 pm
I think your are right with your assumptions.

Currently the simplest way to create a new font is this:
Use fony (http://hukka.ncn.fi/?fony (http://hukka.ncn.fi/?fony)), a font editor where you can save the font as .bdf file. Then use bsf2u8g to create the binary font for u8glib.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: cabecinhas on Sep 30, 2014, 01:26 am
Hi Oliver.. that's what I was looking for! I'll make a donation  because It helped me a lot(just like you did)

If you had an account I would "donate" to you as well lol..

I don't know if you have used the u8g.drawBox



I'm using it from the middle of the display so the bar can grow to bottom and to top of the display.

The problem is that the bar only "grows" in direction of bottom .

Do you know if there is a way to make it grow(increase its height) from the middle of display  to the top too?

Thank you so much again, Oliver!

Rodrigo


Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Sep 30, 2014, 06:21 am

Quote
I don't know if you have used the u8g.drawBox

I'm using it from the middle of the display so the bar can grow to bottom and to top of the display.

The problem is that the bar only "grows" in direction of bottom .


I guess this is a programming problem, not a problem of drawBox(). Can you post your code?

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: cabecinhas on Sep 30, 2014, 10:09 am
Hi,  Oliver.

Actually I don't think it's a Problem. It's a characteristic of u8glib..

Using drawBox by changing its height on real-time makes its height increases from the Start position (y)  to the down and I wanted the option of when changing the height, the box increases its height from the start position to the top.. ..
Is there an option to do it or I will need to do by code?

Tks,  Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Sep 30, 2014, 01:12 pm


Using drawBox by changing its height on real-time makes its height increases from the Start position (y)  to the down and I wanted the option of when changing the height, the box increases its height from the start position to the top.. ..
Is there an option to do it or I will need to do by code?

Tks,  Oliver


Decrease y and increase height at the same time. This should do the job.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: cabecinhas on Sep 30, 2014, 08:09 pm



Using drawBox by changing its height on real-time makes its height increases from the Start position (y)  to the down and I wanted the option of when changing the height, the box increases its height from the start position to the top.. ..
Is there an option to do it or I will need to do by code?

Tks,  Oliver


Decrease y and increase height at the same time. This should do the job.

Oliver



Hi, Oliver.. Yes Worked like a charm! Perfect!

Just to finish(If I still can after lots of your help).... Could I change the z-index of a box?

I mean.. I need to write a "blank" text inside a "drawBox".. Is it possible?

Tks so much, Oliver.




Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Sep 30, 2014, 08:52 pm
Hi

Quote
I mean.. I need to write a "blank" text inside a "drawBox".. Is it possible?

You can change the current "draw color":

setDefaultForegroundColor
drawBox
setDefaultBackgroundColor
drawStr
setDefaultForegroundColor

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: cabecinhas on Sep 30, 2014, 09:52 pm
That worked again!

Are you the developer :) ?

The library is working perfectly..Just like the Fony Software... the only issue is the speed now.

I'm running it @ 3.3v/8Mhz

The screen refresh is only about 3Hz and sometimes a character seems to deform due to the low refresh speed.

Do you know if this issue is because bad constructor like? I have selected some and some seems to work and I took one that looked like a better one to use.

I'm Using this one:
U8GLIB_NHD_C12864_2X u8g(sock, mosi, cs, a0, reset);


If you know something I would be appreciated again.

Regards.

Rodrigo


Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 01, 2014, 06:13 am
Hi

Yes, u8glib has been developed by me.
To some extend the speed can be influenced by the constructor and the _2X denotes already the faster constructor, which uses more RAM.

For further speed improvement, you need to optimize the "picture loop". The key adviceis: Do as much of the calculation outside the picture loop.

Instead of
Code: [Select]

  u8g.firstPage(); 
  do {
    a = 5;
    b = 3 * a;
    u8g.setFont(u8g_font_unifont);
    u8g.setPrintPos(0, 20);
    u8g.print(b);
  } while( u8g.nextPage() );

do this:
Code: [Select]

  a = 5;
  b = 3 * a;
  u8g.firstPage(); 
  do {
    u8g.setFont(u8g_font_unifont);
    u8g.setPrintPos(0, 20);
    u8g.print(b);
  } while( u8g.nextPage() );


You could post your u8glib related code and we can discuss optimization with your code.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: cabecinhas on Oct 02, 2014, 10:58 pm
Hi, Oliver. Everything is working greatly now!

Thank you so much.

Is your library donateware?

I want to contribute.

Tks
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 03, 2014, 07:19 am
Thanks for the feedback.

No donation required, U8glib is freeware.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: oldsergio on Oct 03, 2014, 03:09 pm
Hi

How must I setup the code to send a bitmap array for 4-bit pixel grayscale OLED.
As I see in the picture example there is only on or off pixels in the uint8_t picture array.


As I understand if I use drawBitmapP() it draws the byte of the uint8_t array  as a 4 bit value
for each bit. -> dark or light.

Is it possible to send byte by byte as they are in the array so I'll get the 4bit greyscales?
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: cabecinhas on Oct 03, 2014, 03:45 pm
ok. Oliver.

tks

Just one last question, maybe you can help me.

Is there a software where  I can import a bitmap/bmp and convert it into U8glib format?

Tks a lot, again.

Rodrigo
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 05, 2014, 08:04 pm

Hi

How must I setup the code to send a bitmap array for 4-bit pixel grayscale OLED.
As I see in the picture example there is only on or off pixels in the uint8_t picture array.


As I understand if I use drawBitmapP() it draws the byte of the uint8_t array  as a 4 bit value
for each bit. -> dark or light.

Is it possible to send byte by byte as they are in the array so I'll get the 4bit greyscales?



Currently u8glib does not support bitmaps with two or four bits for graylevels.
Also: Only 2-bit modes (four graylevels) are available. In such a 2-but mode, use setColorIndex to set the graylevel.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 05, 2014, 08:06 pm

ok. Oliver.

tks

Just one last question, maybe you can help me.

Is there a software where  I can import a bitmap/bmp and convert it into U8glib format?

Tks a lot, again.

Rodrigo


For example you can use "gimp" to export as XBM file. XBM is a plain text c code, which can be pasted into your code and is accepted by drawXBM procedure.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Sozruh on Oct 18, 2014, 08:42 pm
Hello !

I own a EA DOGXL240W-7 and have search very hardly on the net how i can bring this lcd with the arduino mega to live.

Any path and informations are deeply appreciated.

Best Regards

Selim
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 18, 2014, 09:54 pm
Hi

There is some contributed code for the DOGM240. It can be used with the following constructors:
Code: [Select]
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)

See also the HelloWorld example of the attached pre release.

My suggestion is this: Please check whether the DOGM240 is working for you. It will not be perfect, but maybe you can create and post a picture of the display. If it works (more or less), it can be extended to the DOGXL240.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Sozruh on Oct 18, 2014, 10:08 pm
Thank you for the quick reply!

the XL240 datasheet shows no A0 pin. Any advice?

Best Regards

Selim
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 18, 2014, 10:34 pm
A0 = CD

For SPI, use 4-wire SPI (BM0 = 0, D13 = 0). 3-wire SPI is not supported by U8glib.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: hatoupix on Oct 22, 2014, 10:06 pm
Hi,
sorry I'm a newbie ... I've read all of this thread ...  and a lot of other one !
I've trying to "switch on" my oled and wrtiing on it "hello world"

I've a chinese low cost oled SSD1306 and a nano
nano D5 on SLC oled
nano D4 on SDA oled

I've downloding the last u8glib (1.17pre4) ...
modifiy U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);   
or U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);


 the compilation is ok and transfert OK on nano ... but nothing else ! ...


thanks for your help,
Hatoupix (olivier)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 23, 2014, 08:27 pm
Hmmm.. I2C is at A4 and A5 not D4 and D5. So this might be the problem.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: hatoupix on Oct 23, 2014, 08:57 pm
Hmmm.. I2C is at A4 and A5 not D4 and D5. So this might be the problem.

Oliver
SHAME on me ....  :smiley-sad-blue: ... it's works fine !!!
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Sozruh on Oct 24, 2014, 11:38 pm
A0 = CD

For SPI, use 4-wire SPI (BM0 = 0, D13 = 0). 3-wire SPI is not supported by U8glib.

Oliver
Hello Oliver;

Thanks again for helping. Now i'm one step further. If i'm turning on the mega, on the screen i'm seing 240x64 px black area.

But : a very short time long ( maybe miliseconds ) before the black area appears i can see the "Hello World!" text. After that just the 240x64 black area.

What can i do for the next step?

Best Regards and many thanks in advance.

Selim
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Sozruh on Oct 25, 2014, 12:15 am
A0 = CD

For SPI, use 4-wire SPI (BM0 = 0, D13 = 0). 3-wire SPI is not supported by U8glib.

Oliver
Hello Oliver;

Thanks again for helping. Now i'm one step further. If i'm turning on the mega, on the screen i'm seing 240x64 px black area.

But : a very short time long ( maybe miliseconds ) before the black area appears i can see the "Hello World!" text. After that just the 240x64 black area.

What can i do for the next step?

Best Regards and many thanks in advance.

Selim

So,it seems to be about the resistans on pin VLCD. I have no 10M resistorsat the moment. I have connected some other values in serial. Now the text appears continuesly. But after each reset i must disconnect the VLCD to ground over resistors and connect again to see the text.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Sozruh on Oct 25, 2014, 01:08 am
One more step.

It has nothing to do with the resistor value from vlcd to ground.

i have edited in file u8g_dev_uc1611_dogm240.c the lines for Set COM End and Set partitial display end form 0x3F to 0x7F.

Now i have display area of 240x128 pixels.

But the  bottom half is pixelated randomly.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 25, 2014, 12:53 pm
Hi

Please change
Code: [Select]
#define HEIGHT 64
to
Code: [Select]
#define HEIGHT 128
in u8g_dev_uc1611_dogm240.c

Will this work?
If so, can you attach your current version of u8g_dev_uc1611_dogm240.c?
I could then create a u8g_dev_uc1611_dogxl240.c based on your modifications.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: M4vrick on Oct 29, 2014, 11:45 am
Hi Oliver,

I've read some pages on this thread but not the whole thread so please excuse me if this question was already mentionned.

I'm using an Oled 128x64 SSD1306 display from Adafruit, using SPI communication.
My sketch actually use the adafruit GFX library, simply because it was on the page where I bought the display.

Your library looks more usefull, but does it also a bit faster than the adafruit lib ?
I have some refresh issue and I don't know if it's the Arduino which is not fast enough or the library which is not fast (or maybe my code which is very bad ;D )

thank you, and really great work for this lib !
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 29, 2014, 02:02 pm
Hi M4vrick

I never did compare the Adafruit Lib with U8glib. I can only say this: U8glib has been designed to minimize RAM consumption. Although speed has been considered, but RAM consumption has been the primary goal.

It also depends on your Arduino Board.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: M4vrick on Oct 29, 2014, 02:50 pm
Thank you for this reply :)
I'll try and see if it's better, and if I see a significant improvement I'll come back to inform you.

I'm using a R3 for devellopment and Mini Pro 5V/16Mhz for the final design.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: jboyton on Oct 29, 2014, 08:33 pm
M4vrick -- are you using software SPI (the default with the Adafruit lib) or hardware SPI?

I measured the refresh time and the difference was a factor of 10. The soft SPI required 26ms to refresh the screen (128x64, Uno R3 at 16 MHz) whereas the H/W SPI was took only 2.6ms.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: M4vrick on Oct 29, 2014, 09:04 pm
Many thanks, that's a usefull information !
I'm using the software SPI, I'll try with hardware :)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: jboyton on Oct 29, 2014, 09:38 pm
If you are like how I was (new to SPI and Arduino) you may find it a little confusing, which pins are which for H/W SPI. Here is the detail, stolen from someone else. Maybe it will save you some head scratching.

Code: [Select]
    /*
    For Hardware SPI:
     GND goes to ground
     Vin goes to 5V
     DATA to hardware MOSI = 11
     CLK to hardware SCK = 13
     D/C to 6 (user choice, defined below)
     CS to 7 (user choice, defined below)
     RST to 8 (user choice, defined below)
     Hardware MISO (12) unused.
     */

    [...]

    //For Hardware SPI
    #define OLED_DC     6
    #define OLED_CS     7
    #define OLED_RESET  8
    Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: M4vrick on Oct 30, 2014, 11:23 am
I've found it before your post, but it'll be usefull for other guys looking for it.

And in fact the hardware SPI is much more faster, I can have a decent scrolling speed now.

Next step is to switch to U8glib to compare the performances.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: cabecinhas on Nov 14, 2014, 12:58 am
Hello Oliver.. how are you?

I've been trying to use your lib and its PERFECT and easy to use.. tks for sharing!!

I'm having some problem by how to access a custom character.

There is no a regular character where I could Just call...  like "a,b,c" etc..

I have created as an example a degree symbol on 1st row , 3rd column but don't know how to access it from library

I have tried u8g.print(0x02) but didn't return anything



Could you please help about how to access a special symbol created?


thank you so much...
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Nov 14, 2014, 06:51 am
Hi

How did you convert the font to u8gli? What are the commandline options you used with bdf2u8g?
At least you must ensure that the glyph at position 2 is included (-b 2).
Although the print function is part of u8glib, it is only derived from the Arduino library. Maybe .print("\x02") will work.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: cabecinhas on Nov 14, 2014, 02:18 pm
Hello Oliver!


Maybe you can help me in finding another way to reduce memory space..


What I'm trying to do is to reduce the array size, because there are a lot of "empty" characters  before "a,b,c..." begins.. and those are using space.

Do you have an Idea how to trim or another way to just keep the memory of characters I'm using?

ie. I'm using only a~z and 0~9...

I've used Fony and converted exporting BDF format.. and then used the command "bdf2u8g.exe output.bdf output output.c"
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Nov 14, 2014, 09:20 pm
Hi

Using Fony is a good choice. You can remove any unneeded characters. You should then use bdf2u8g_101.exe which is avialbale on the main page: https://code.google.com/p/u8glib/ (https://code.google.com/p/u8glib/)

You may need to apply values for the starting character (-b) and the last character (-e):

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: cabecinhas on Nov 17, 2014, 02:12 pm
hi Oliver.... Tks a lot.

I'll try to use this way than!


tks


Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: orlee on Nov 19, 2014, 10:21 am
Hi Oliver
Thanks a lot for your great work.  After reading how to, i wired my OLED  5.5" 256x64 display with SSD1322 driver, and no issues at all.  Work.
I had to adjust the obvious pins for Atmega 2560, apart that everything is great.
All examples work.
Now I try to figure out how to speed it up and what effects it will have on my concurrent code in the Atmel.

Again - big thanks!  great work!
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Nov 19, 2014, 02:53 pm
Thanks for the feedback!

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: tchleb on Nov 19, 2014, 06:13 pm
Thank you oliver for your great work.  :)

I tried today to use it with 2x Dalllas 18b20. Works great :D
But how can i clear the screen? I would like to Display two other sensors in the position "oben" and "unten" after a delay from 10s in a loop?

temp1-->10s delay --> sensor3-->10s delay-->...
temp2-->10s delay --> sensor4-->10s delay-->...   this in a loop

i try it with a delay, but i doesn't found any solution to clear the last value at the screen

Quote
#include "U8glib.h"  //https://code.google.com/p/u8glib/

 #include <OneWire.h>
 #include <DallasTemperature.h>
 #define ONE_WIRE_BUS 3   //OWB an PIN 3
 OneWire oneWire(ONE_WIRE_BUS);
 DallasTemperature sensors(&oneWire);
 DeviceAddress sensor1 = { 0x28, 0xFF, 0x19, 0x8B, 0x4C, 0x04, 0x00, 0x3B };
 DeviceAddress sensor2 = { 0x28, 0xFF, 0x12, 0x8B, 0x4C, 0x04, 0x00, 0x4B };



   U8GLIB_SSD1306_128X64_2X u8g(U8G_I2C_OPT_NONE);     //Banggood SSD1306 0.96" OLED I2C     http://www.banggood.com/0_96-Inch-White-IIC-I2C-OLED-Display-Module-12864-LED-For-Arduino-p-932606.html
                                                       //SDA = Pin A4 ; SCL = PIN A5
                                                     

  double temp1 = 0;
  double temp2 = 0;

 
  void u8g_prepare(void)
  {
  //u8g.setFont(u8g_font_6x10);
  //u8g.setFont(u8g_font_fub42n);
  //u8g.setFontRefHeightExtendedText();
  //u8g.setDefaultForegroundColor();
  //u8g.setFontPosTop();
  }


void setup(void)
{
 
    sensors.begin();
  // Display um 180° grehen, wenn erforderlich
  u8g.setRot180();
 
  //u8g.setContrast(0x30);
  //u8g_prepare(); 


 }

void draw(void)
{   
 
    //oben
    u8g.setFont(u8g_font_fub17n);
    u8g.setPrintPos(0, 20);
    u8g.print(temp1);
    u8g.setFont(u8g_font_fub17);
    u8g.drawStr( 75, 20, "C");

   
     //unten
    u8g.setFont(u8g_font_fub17n);
    u8g.setPrintPos(0, 50);
    u8g.print(temp2);
    u8g.setFont(u8g_font_fub17);
    u8g.drawStr( 75, 50, "C");

       
 
}

void loop(void)
{
 
  sensors.requestTemperatures();
  // temp = sensors.getTempCByIndex(0); //Sensor ohne Adressierung
  temp1 = sensors.getTempC(sensor1);
  temp2 = sensors.getTempC(sensor2);

 

  // picture loop
  u8g.firstPage();
  do
  { 
    draw();
  }
  while( u8g.nextPage() );
   
  // Bild nach delay neu erzeugen
  delay(450); //0.45sekunden
  }

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Nov 20, 2014, 09:06 pm
Hi


There is no clear screan as such, instead you can say, that FirstPage will clear the screen.

To implement the switching between your sensors, you should implement two or more "draw" precodures. Let me call these procedures draw1() and draw2().
Now you need a new master draw procedure, let me call this "draw()". draw1() and draw2() are called from draw(), but this depends on a globale "state" variable, like this:

Code: [Select]

void draw(void)
{
  if ( state == 0 )
   draw1();
  else
   draw2();
}


Now you need to call draw() within the picture loop (like in your code). Additionally you must change "state" from 0 to 1 and back to 0 every 10 seconds. I think this often refered as "blink without delay()" problem.

Another option is to implement the picture loop twice The first picture loop calls draw1(), then add a 10 sec delay, then implement second picture loop with draw2() and add a delay again.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: arssant on Nov 22, 2014, 01:26 pm
Hi.

Just to say thanks for sharing this. Nice work with your lib.
I tested it with a 3310 nokia lcd (PCD8544) and is working smoothly.
Any chance to get supported for a 1100 nokia lcd ( PCF8814 ), I have some of them from old nokia 1100 cell phone, and want use them ?

Again, nice work.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Nov 22, 2014, 03:52 pm
Thanks,
maybe the Nokia 1100 display is compatible with the PCF8812 controller: U8GLIB_PCF8812(sck, mosi, cs, a0 [, reset])

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: kevin_yeo on Nov 23, 2014, 01:56 pm
Hi there,

Please excuse my noobness as I'm relatively new to all this. So I've managed to get the library working on an Uno and SSD1306 (the 4 pin kind with only VCC, GND, SDA and SCL) using the i2C pins A4 and A5.

I'm trying to port this over to an ATTINY85 using the Arduino as ISP. I've tried using pin 0 and 2 (the SDA and SCL pins) on the 85 but nothing is registering. Am i missing something?

I understand that someone else has tried this before and if anyone could share some thoughts or experience, it'd be much appreciated!

Thanks!
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Nov 24, 2014, 08:13 pm
If i remember correctly, i never ported u8glib to the ATTINY.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: tchleb on Nov 26, 2014, 05:41 pm
Hi


There is no clear screan as such, instead you can say, that FirstPage will clear the screen.

To implement the switching between your sensors, you should implement two or more "draw" precodures. Let me call these procedures draw1() and draw2().
Now you need a new master draw procedure, let me call this "draw()". draw1() and draw2() are called from draw(), but this depends on a globale "state" variable, like this:

Code: [Select]

void draw(void)
{
  if ( state == 0 )
   draw1();
  else
   draw2();
}


Now you need to call draw() within the picture loop (like in your code). Additionally you must change "state" from 0 to 1 and back to 0 every 10 seconds. I think this often refered as "blink without delay()" problem.

Another option is to implement the picture loop twice The first picture loop calls draw1(), then add a 10 sec delay, then implement second picture loop with draw2() and add a delay again.

Oliver

Thank you, this works  :D
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Eitan on Nov 30, 2014, 07:20 pm
hi,
I'm using ssd1322 with 4 wire SPI connection.

in draw() I'm calling only this


void draw(void){
        if(flag) {
            u8g.drawBox(0,0,255,63);
        }

draw() called by loop() which also updates my flag to 1000msec ON and 1000msec OFF

the screen should blink fast but I got a slow pixel rows turning ON and little bit faster pixel rows turning OFF.
it looks like a very slow refresh rate.
How can I make it more fast?

Thanx
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 02, 2014, 01:05 am
Eitan, can you also provide the code for loop()?
"flag" should not get modified within  the "picture loop"

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: cattzalin on Dec 04, 2014, 11:19 am
hi,
 can someone help me to change a library that uses shiftOut to use hardware spi. I am fairly new to working with microcontrollers. using a pcf8814 and shiftOut is too slow for what I need. I should only change the function that sends data to the lcd, someone correct me if I'm wrong: P.

void PCF8814::send(unsigned char type, unsigned char data)
{
    digitalWrite(this->pin_sdin, type);
    digitalWrite(this->pin_sce, LOW);
    digitalWrite(this->pin_sclk, HIGH);
    digitalWrite(this->pin_sclk, LOW);
    shiftOut(this->pin_sdin, this->pin_sclk, MSBFIRST, data);
    digitalWrite(this->pin_sce, HIGH);
}
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 04, 2014, 07:56 pm
Hi

This thread is about an already existing library called "u8glib", which also supports the PCF8812 (not sure whether this is compatible with the PCF8814). You are always wellcome to check u8glib, but a porting request for a different library might be placed better in a new thread.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: cattzalin on Dec 05, 2014, 10:20 am
Thanks Oliver
 I'll make a new thread. I used the u8glib with some other displays but is not working with PCF8814 or maybe i make something wrong :P, anyway u8glib is a great library
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: bingshao1006 on Dec 06, 2014, 02:44 am
Hi Oliver

            Nice to reply to you! I'm a Chinese.I love the U8glib very much.But in my  country.we can't  get into website Google.So I can't see everything
about U8gllib.Can you help me?

            Can you put your U8glib both in the Google and the gitHub?

            Thank you!



Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 06, 2014, 08:47 am
Hi

The code itself is available for download at
https://bintray.com/olikraus/u8glib (https://bintray.com/olikraus/u8glib)

Do you also need the documentation?

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 06, 2014, 09:12 am
I have added two snapshots of the u8glib wiki pages.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: maroonbrownie on Dec 07, 2014, 07:04 am
Hi Oliver,

I'm using the u8g library for my project.

I've run into an issue I think.

When I use the picture loop inside the void loop like the first image attached it seems to run fine and there's no problem. I intend to use this as a loading screen so I wanted it to display for a while and then move on to other things.

To do that I decided to run the code as shown in the 2nd image. When I run this it doesn't seem to display the image properly (it appears to display it from whatever is in its memory - i checked this by changing the image and it kept displaying the image from the previous program I had run).
It clears it like I intended after a few seconds though.

Am I implementing your library incorrectly here? Is there any obvious mistake that you notice?
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 07, 2014, 01:13 pm
Hi
In any case, you need to keep the do-while loop. However you can move the do-while loop completly into the setup() procedure and do a delay after the while.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: MAS3 on Dec 07, 2014, 08:27 pm
Hey maroonbrownie, welcome.

You didn't tell what display you are using, and i can't see that from the pictures you uploaded.
In case you are using an Oled like the much discussed Crius one, your description sounds familiar.
If so, you should try to find out whether the reset (power up) function of that display works correctly.
In another thread (click !) (http://forum.arduino.cc/index.php?topic=159851.0), i told about my suspicion that when a reset is incomplete, the buffer will not be emptied and can not be written to.
The display will however display the content and if you select some shifting (scrolling)or whatever manipulation (inverse or flip the display) to the screen, that will happen.
Leaving the display without power for a few minutes (not just a few seconds),or a relatively long reset will erase the buffer.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: strawmedia on Dec 10, 2014, 09:27 pm
What have i done wrong? Using 2 OLEDS and SSD1306 control
Image of the OLED's
(http://puu.sh/dpiuM/ead7b20dac.jpg)
Code
Code: [Select]
U8GLIB_SSD1306_128X64 u8g(10, 9, 12, 11, 13);
And everything else from "GraphicsTest.pde"

Parts:
-Arduino Mini pro 3.3v 8mhz
-usb to uart
-oled1 : From ebay using SSD1306
oled2: From SainSmart 1.3" SPI (SH1106, but wont work with that one)


Wiring:
OLED -> Arduino
3.3V -> VCC
GND -> GND
SDIN -> 9
SCLK -> 10
DC -> 11
RST -> 13
CD -> 12

there are two  rows of pixels which are white, and the complete image is moved 2 pixels to the left, so its also cutted of.

Thanks for help :)

~Straw
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 10, 2014, 10:33 pm
Hi

Good to see, that your two displays are working with u8glib  :D

As i mentioned in your thread, use SH1106:

U8GLIB_SH1106_128X64 u8g(10, 9, 12, 11, 13);

A complete list of all supported controllers is here:
https://code.google.com/p/u8glib/wiki/device (https://code.google.com/p/u8glib/wiki/device)

Below the table, all different names of A0 are also discussed.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: strawmedia on Dec 10, 2014, 10:54 pm
Thank you sir, now it works fine :)
Gonna try to change the sourcecode of the main project to work with u8glib ^^

~Straw
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: hazymat on Dec 16, 2014, 09:40 pm
Hi Oli

I'm hoping to draw some mockups in Photoshop for various display options, graphics, icons, text, etc.

Two quick questions:

1/ Do you have an example sketch with different strings and fonts? I know this sounds basic, and I can preview all the fonts on your wiki, but I really want to see them on my display and compare. Maybe something useful that allows you to scroll through various pages, or maybe something that works out the height of the font to avoid wasted gaps etc? Obvs would need to be configured a bit to work on the aspect ratio of my display... (256x64)

I'm using a Mega, so plenty of memory for all those font include :P

2/ Do you know any Windows fonts I can use that match u8glib fonts, so I can do mockups?

Thanks!

Mat
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 17, 2014, 03:47 pm
1) Impossible: All fonts would require several megabytes of flash memory. They simply will not fit into the typical Arduino Boards (including the Mega board). I guess you need to create a small selection of the fonts in your own example file.

2) I think except for the X11 fonts, all fonts are available as ttf files.
Additionally, some fonts are available as ttf file in the u8glib repo: https://code.google.com/p/u8glib/source/browse/#hg%2Ftools%2Ffont%2Fttf (https://code.google.com/p/u8glib/source/browse/#hg%2Ftools%2Ffont%2Fttf)

Oliver
Title: Menus, buttons and rotary encoder
Post by: EK701 on Dec 21, 2014, 04:17 am
First, thank you Oli for the great u8g library!  I have it successfully running on a Teensy 3.1 with a NHD OLED display.  Where I'm running into an issue is with a menu system.  Here is what I'm trying to accomplish:

1. Display results from various sensors
2. Adjust the OLED display brightness with the rotary encoder
3. Activate a menu system with the press of a button
4. Modify various system settings using the menu system and navigating with the rotary encoder and single push button
5. The menu system will have submenus
6. Select a menu item to return back to the screen that displays the results from the sensors

I have items 1, 2, and 3 working. 

Item 6, when I press the button, I get a blank screen.  Debugging shows the Teensy appears to be executing the code to display the sensor info, but nothing is displayed.

I'm having difficulty with items 4 and 5.  I've been using the basic menus from the u8glib wiki, but I can't seem to get sub menus to work. 

I've looked at m2tklib, but it's design just doesn't seem to make any sense to me and I can't seem to figure it out.  Plus, it appears that m2tklib doesn't allow for the rotary encoder to have a different function (adjusting screen brightness) when the menu system isn't active.

I'd post the code, but it's very large (75k) and spread across 13 tabs.

Any general suggestions, especially regarding understanding m2tklib, are appreciated.

Thanks!

Eric
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 21, 2014, 08:48 am
Hi Eric

Are you able to run the m2tklib examples on Teensy? If so, my suggestion is to start a new thread here (maybe also drop me a PM about this new thread) and we discuss the usage of m2tklib in more detail.
I also do not see a problem to adjust the brightness with the rotary encoder.


Oliver


Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 22, 2014, 12:10 am
U8glib release v1.17 is now available.

Project Home: https://code.google.com/p/u8glib/ (https://code.google.com/p/u8glib/)

From the Change Log:
* Added U8GLIB_UC1611_DOGM240 constructor (Issue 284)
* Added U8GLIB_UC1611_DOGXL240 constructor
* Added support for UC1608 controller (Issue 300)
* Added U8GLIB_SSD1306_ADAFRUIT_128X64 for Adafruit OLEDs (Issue 289)
* Bufix in the sleep on/off sequence (CS has not been released, issue 298)
* helvB and helvR number only fonts (Issue 271)
* 400KHz option for I2C with U8G_I2C_OPT_FAST available for Due and Uno (Issue 303)
* I2C support for Arduino Due. 100KHz/400KHz, TWI & TWI1, ACK will be ignored (issue 285)
* Unifont update (Issue 297)

Support for the UC1608, DOGM240 and DOGXL240 has been contributed. Thanks a lot.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: EK701 on Dec 22, 2014, 05:28 am
Hi Eric

Are you able to run the m2tklib examples on Teensy? If so, my suggestion is to start a new thread here (maybe also drop me a PM about this new thread) and we discuss the usage of m2tklib in more detail.
I also do not see a problem to adjust the brightness with the rotary encoder.


Oliver

Yes, I was able to get the m2tklib examples to run on the Teensy 3.1 without issue (other than my inability to grasp the m2tklib structure).  I will start a new thread when I have a bit more time, but that may not be for a few weeks.

Thank you.

Eric
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: jarconman on Dec 23, 2014, 08:20 pm
Hi Oliver,

Thanks for the very nice library. I bought a white 1.3" i2c oled display on ebay

http://www.ebay.com/itm/131305499040?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

I installed your library and selected the sh1106 driver and it worked like a charm. No problems at all. Reading this threat i was a little bit afraid that i had to change some things. It turns out good.

Thanks again.

Jarco.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 24, 2014, 12:27 am
Hi jarconman

Glad to hear, that u8glib works with your display.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: louwin on Dec 31, 2014, 05:32 am
Thank you for your absolutely BRILLIANT library.  :)

You, Sir, are an Analyst/Programmer extraordinaire....
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: yenan1001 on Dec 31, 2014, 05:54 pm
Hi Oliver,

greeting from the new year 2015.
thank you for your great work of the lib.

I got my OLED works fine.
My OLED use 1306 chip and I2C interface without ack.

Today I tried a ECN28J60 ethernet card with the lib "ethercard". I want my OLED to display the ip info like what the serial does.

what teh serial does like below, it works fine. all the ip info shown in serial monitor.
Code: [Select]

    ether.printIp("IP:  ", ether.myip);
    ether.printIp("GW:  ", ether.gwip);  
    ether.printIp("DNS: ", ether.dnsip);


I use below code to display the same info to my OLED.
Code: [Select]

void draw_ip(void) {
 
  u8g.firstPage();
  do{
     u8g.setFont(u8g_font_unifont);
 
     u8g.setPrintPos(35, 16);
     u8g.print(ether.hisip);
     u8g.drawStr(0,16,"SVR:");
 
     u8g.setPrintPos(35, 32);
     u8g.print(ether.myip);
     u8g.drawStr(0,32,"IP :");
 
     u8g.setPrintPos(35, 48);
     u8g.print(ether.gwip);
     u8g.drawStr(0,48,"GW :");
 
     u8g.setPrintPos(35, 64);
     u8g.print(ether.dnsip);
     u8g.drawStr(0,64,"DNS:");
 
    }while(u8g.nextPage());
}


there is a error when it compile.
(http://image.geek-workshop.com/forum/201412/29/214721b552j25xnh29yjj9.jpg)

I want to know is there any limitation for the u8g.print?

thank you and happy new year.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 01, 2015, 09:10 am
Hi

My best wishes for 2015 for all readers of this tread.

The print function in "u8g.print()" is derived from the Arduino environment. It is identical for Serial.print(). Any solution to print the ip address for Serial will also work for u8g.

I do not know your ethernet lib, but here (http://arduino.cc/en/Tutorial/DhcpAddressPrinter) this code is used:
Code: [Select]
  // print your local IP address:
  Serial.print("My IP address: ");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(Ethernet.localIP()[thisByte], DEC);
    Serial.print(".");
  }


This should work with "Serial" replaced by "u8g".

 Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: coliban on Jan 03, 2015, 08:17 pm
Hello,

i am able to compile a sample program for the atmega328. But when i try to compile it for example, for the attiny85, i throws errors and at the end the ide is complaining, that it is not able to compile because of the following errors

Code: [Select]
var/folders/32/h3dgvnld4874qs3tvpkm6qv80000gn/T/build5616997422776575155.tmp/core.a -L/var/folders/32/h3dgvnld4874qs3tvpkm6qv80000gn/T/build5616997422776575155.tmp -lm
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld: sketch_jan03a.cpp.elf section .text will not fit in region text
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld: region text overflowed by 1298 bytes
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_14':
(.text+0x0): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_default' defined in .vectors section in /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0x0): relocation truncated to fit: R_AVR_13_PCREL against symbol `__init' defined in .init0 section in /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_1' defined in .text section in /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0x4): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_2' defined in .text section in /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0x6): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_3' defined in .text section in /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0x8): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_4' defined in .text section in /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0xa): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_5' defined in .text.__vector_5 section in core.a(wiring.c.o)
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0xc): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_6' defined in .text section in /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0xe): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_7' defined in .text section in /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0x10): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_8' defined in .text section in /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0x12): additional relocation overflows omitted from the output


Is it correct that this code will not compile on the tiny avrs?

thank you and regards



Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: MAS3 on Jan 03, 2015, 08:42 pm
If i remember correctly, i never ported u8glib to the ATTINY.

Oliver
That's reply 280 in this thread (click the blue text next to "quote" to find it), you should have come across it when you read it.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: coliban on Jan 03, 2015, 11:29 pm
Ok, thank you.

(It would be great, if there was a solution for attain, because the display is small and so are the attinys.)

regards
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 04, 2015, 01:07 am
If i remember correctly, i once tried to compile for attiny. One issue had been, that not much memory will be remaining for your own code. I have created an issue for this.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: coliban on Jan 04, 2015, 09:08 am
Hello olikraus,

thanks a lot for your efforts for the "normal" avrs. I already had a glance at the code, but since i didn't had programming praxis for years, i am not able to "tune" it. I´d just thought, maybe it would be possible to relinquish some features, maybe graphics, for the attinys. The reason i insist on the attinys is, that they are the "natural" partners for the small oleds like the 128x64 because the aim is to build very small systems, and therefore it is mandatory to use also small older and the 128X64 OLED is really small, so it would be possible to build mini systems. But maybe this is only my own requirement and nobody else is interested, then it would be a waste to put work in a feature which nobody (except me) needs.

Never mind, thank you for your work, it is really great.

regards
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 04, 2015, 09:13 am
My previous graphics library (dogm128 lib) has supported attinys. There should be a test board in my lab, so porting and testing should not be a problem. I always wanted to do this, but never found time to start the porting for the ATTinys. I personally moved to LPC81x in some projects now.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: maroonbrownie on Jan 18, 2015, 02:17 am
Hello!

I was able to fix the original issue (I realized I was just being stupid with the coding).

While I don't have any obvious issue in the part of my project right now (still the same project as last time) I am curious about a part of the coding in the interactive menu folder. (Please refer attached images).

While m2tklib appears more interesting it is a bit too advanced for me and would take me more time than I want to spend in understanding it before I can wield it effectively. Thus, I am using u8glib but am pleased with how its turning out anyway.

In the menu system the function uiSetup() which configures the keys is a bit confusing to understand for me. In the original code (image 2) the pin mode is defined as INPUT while the comment  for the digitalWrite() that follows it says that it is being used to turn on the pullup resistors. From what I read that should involve the pinMode() being passed INPUT_PULLUP as the 2nd argument.

I tried both (images 1 and 2) and saw no discernible difference in the way the program ran. Can someone explain exactly how this part of the code functions?

Thanks once again!

P.S> I'm using an Arduino UNO/Adafruit SSD1306 128x64 OLED (IDE 1.0.6 on Windows 8.1)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jan 18, 2015, 06:50 am
Hi

The code had been written before the INPUT_PULLUP was available. I should now better use INPUT_PULLUP. I have created an issue for this.

Thanks!
Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: ArduinoDSP on Feb 20, 2015, 06:09 pm
Hi Oliver,
I've just realized that u8glib is also your child :)
The reason I'm writing is that I'd like to modify profont22r to remove the line from 0 (zero).
Do you know a way to do that directly in u8g_font_data.c?
If it's easier to modify a font in bdf format and convert it afterwards, could you send me your profont22r.bdf file?
Much appreciated!
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Feb 20, 2015, 09:41 pm
Hi

profont22.bdf is available here:
https://code.google.com/p/u8glib/source/browse/tools/font/bdf/profont22.bdf (https://code.google.com/p/u8glib/source/browse/tools/font/bdf/profont22.bdf)

This command will generate the u8glib font:
Code: [Select]

bdf2u8g  -b 32 -e 127 profont22.bdf u8g_font_profont22r u8g_font_profont22r.c


Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: ArduinoDSP on Feb 21, 2015, 09:29 pm
Brilliant! It's working great.
Your karma points are on the rise for sure. :)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: jptheripper on Mar 02, 2015, 10:29 pm
is there a way to convert a ttf font into a bdf?
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Mar 02, 2015, 11:10 pm
I personally use otf2bdf (http://sofia.nmsu.edu/~mleisher/Software/otf2bdf/ (http://sofia.nmsu.edu/~mleisher/Software/otf2bdf/)). It is a simple command line tool.
Fontforge also offers BDF export, but is more complicated to use.

Please note, that the results from an automatic conversion is usually not very good.
A lot of nice bitmap fonts are available from http://fontstruct.com/ (http://fontstruct.com/).

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: slotrios on Mar 03, 2015, 11:21 am
Hi Oliver!!

I recently found your library and it is just great!! I want to go one step further and create some custom fonts, but it its being quite hard. I have downloaded your bdf2u8g executable and the C program to compile, but they are not executing in windows, the console just appears for 0,1 second and then suddenly closes. Do you know why this can be happening?

Thanks in advance.
Greetings from Spain!
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Mar 03, 2015, 08:47 pm
Please ensure that you use version 101 from google drive. The command line tool expects some arguments. Best is to execute bdf2u8g from cmd.exe. This means, start cmd.exe first and execute bdf2u8g_101.exe inside this window. Then you will also see any error message.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Bianco on Mar 06, 2015, 05:02 pm
(http://puu.sh/dpiuM/ead7b20dac.jpg)
Hum...I think I have the same screen (the one on the right) but I can't make it work.

I'm actually not sure what it is :smiley-mr-green:

Here is a link to the ad: http://www.aliexpress.com/item/1PCS-Yellow-blue-double-color-and-white-128X64-0-96-inch-OLED-LCD-LED-Display-Module/32276417609.html (http://www.aliexpress.com/item/1PCS-Yellow-blue-double-color-and-white-128X64-0-96-inch-OLED-LCD-LED-Display-Module/32276417609.html)

And here are my connections:

(https://lh3.googleusercontent.com/-8PfJmllqQGY/VPnLU6_6pPI/AAAAAAAAMYs/p-iguxI2LfU/s800/20150306_164308.jpg)

I (mainly) tried the U8GLIB_SSD1306_128X64 definition. With no luck (screen remains completely black when I upload the logo sketch) :(

I saw there might be problems with the Uno (!?). I have a nano & a Pro Mini on end: would I be more lucky with these?

Also, I didn't put pull ups but I thought the screen would at least flickers without them, wouldn't it?


EDIT: The resistors on the back of the screen indicate it's a 4SPI.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: scrumfled on Mar 06, 2015, 06:00 pm
For 4SPI you dont need pull ups, they're an I2C thing.

I have a very similar display working using : U8GLIB_SSD1306_ADAFRUIT_128X64.

However, i suspect your main problem is in the wiring. I think d0 should be wired to 13 (Serial Clock), d1 to MOSI and you shouldnt let the reset line float.

Try with that and if it doesnt work, maybe post your code & wiring.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Bianco on Mar 06, 2015, 07:37 pm
Thanks for the message.


With the HelloWorld example from U8glib, I got this (uncommenting U8GLIB_SSD1306_ADAFRUIT_128X64 with SW SPI):

(https://lh6.googleusercontent.com/-_Hk7IOn5X0A/VPnxinIGFlI/AAAAAAAAMZM/Od7KhD6INkM/s800/20150306_192339.jpg)


Then I tried the GraphicsTest and the screen turned off.

Back to the HelloWorld...screen stays off.

I didn't change the wiring between test 1 and 3, which is:
Pin 13 to D0
Pin 11 to D1
Pin 10 to CS
Pin 9 to DC
GND to GND
3.3V or 5V to VCC

A pull up between RES and VCC.



I've tried the adafruit library's example though and it works. It randomly flickers but it sort of worked :D
Then I pulled RES low with a jumper cable and it turned off until I reset the Uni.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Mar 06, 2015, 07:59 pm
What is the actual constructor line? Did you tried any other constructor, like the SH1106 or the none-Adafruit SSD1306?

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Bianco on Mar 06, 2015, 08:50 pm
What is the actual constructor line?
Code: [Select]

U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9


Also tried:
Code: [Select]
U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9As well as the hardware SPI version.


Quote
Did you tried any other constructor, like the SH1106 or the none-Adafruit SSD1306?
The compiling time is a bit of an issue on my laptop, so I admit I didn't try too many :D


Code: [Select]
U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
Doesn't work.
There's a reset pin to be set with adafruit's library. Did I miss it on yours or there is no need for one?



To be thorough, here are my adafruit's pins:
Code: [Select]
#define OLED_MOSI  11
#define OLED_CLK   13
#define OLED_DC     9
#define OLED_CS    10
#define OLED_RESET 12
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Mar 07, 2015, 11:15 pm
Yes, you probably should set the reset bin. The pin number of the reset pin is applied as fifth argument to the constructor.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Bianco on Mar 08, 2015, 12:23 pm
Yes, you probably should set the reset bin. The pin number of the reset pin is applied as fifth argument to the constructor.
Well, that was it!

I substituted U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9, 12); to U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); and the displays works.

Thanks for the help :)


EDIT: Now I removed the fifth argument...the display still works. I haven't changed the wiring.



Now, I'm gonna try to make my TFT touchscreen work...
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Bianco on Mar 27, 2015, 02:08 pm
It's me again, remember?  :smiley-mr-green:

Often, I get this weird noise on power-up:

(https://lh6.googleusercontent.com/-Ig9TyLu6zjs/VRVNvSHjOuI/AAAAAAAAMdU/2-cyWRMjzs8/w945-h709-no/IMG_20150327_125650.jpg)


It works normally after if I (manually) reset the screen (and then the MCU).



The issue disappeared after I re-added the fifth argument (reset pin). So, yeah, don't forget it ;)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: rgroener on Apr 01, 2015, 10:34 am
Oliver, are there any major changes in U8glib between version 1.15 und 1.16?
I use version 1.14 in an older project and wanted to upgrade the lib to the current version 1.17.

After getting only a black screen, I checked the versions between and found out, that it runs as expected until version 1.15. Later versions are only giving me black screens. Did I miss any major changes?

Test setting was all the same.

Controller: Atmega328p
u8glb device: u8g_dev_ssd1306_128x64_hw_spi
compiler: avr-gcc
example program: "hello world" form the u8glib
changes in u8gib: only adjusted u8g_setup() and the controller and burning device in Makefile
warnings: no errors, warning when compiling all versions are the same.


Any ideas what happened.

Thanks and best regards roman

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Apr 01, 2015, 11:08 pm
Hmm... all changes are tracked in the issue tracker:
https://code.google.com/p/u8glib/issues/list?can=1&q=&colspec=ID+Type+Status+Priority+Milestone+Owner+Summary&sort=&groupby=&mode=grid&y=Milestone&x=&cells=tiles&nobtn=Update

Will sw_spi work?

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: satoer on Apr 10, 2015, 08:51 am
Hi Oliver,

I'm using an basic 128x64 ST7920 display with an "Atmighty" 1284p and Hardware SPI. On the breadboard I'm getting a solid 10 FPS on it. But now I've integrated the display upside down in my project and using the "u8g.setRot180();" to rotate the screen in the good orientation, the frame rate drops to an unacceptable 6 FPS. Apparently the screen rotation eats a massive amount of CPU power? Didn't expect a 40% performance loss.
Is this a known problem, and is there a way to improve performance?
Thanks :)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Apr 10, 2015, 11:04 am
Hi

Unfortunately speed will be lower.
Did you use "u8g_dev_st7920_128x64_4x_hw_spi"?

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: satoer on Apr 10, 2015, 01:41 pm
Oh, okay. Maybe you could add a performance loss note to the wiki Reference manual?

I've used:
U8GLIB_ST7920_128X64_4X u8g(4);
This gave me a performance boost of 3 fps compared to:
U8GLIB_ST7920_128X64_4X u8g(7, 5, 4);
So I suspected I used Software SPI with the U8GLIB_ST7920_128X64_4X u8g(7, 5, 4); Syntax.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Apr 10, 2015, 01:51 pm
Yes, second version is SW SPI. I will update the manual.
Thanks,

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: doobedoobedo on Apr 18, 2015, 11:57 pm
I have something odd with an SSD1306 OLED. The pins are labeled:
GND
VCC
CLK
MOSI
DC
CS

If I use software SPI (U8GLIB_SSD1306_128X64_2X u8g(10,7,9,8)) it works fine, however I'd prefer to use hardware SPI if I can.

The problem is that if I use the HW SPI (U8GLIB_SSD1306_128X64_2X u8g(9,8)) I get large amounts of corruption on the screen, with the smaller page size (U8GLIB_SSD1306_128X64 u8g(9,8)) I get a lot less, but still some.

Any idea what's going on?
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Apr 19, 2015, 07:48 pm
Which Arduino Pins did you use? Did you use the correct HW pin numbers?

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: doobedoobedo on Apr 19, 2015, 09:31 pm
For Hardware SPI I'm using

CLK -> 13
MOSI -> 11
DC -> 8
CS -> 9
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: CrossRoads on Apr 19, 2015, 09:45 pm
You have the hardware SS pin set to an Output so the Arduino stays SPI master?
Usually 10.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: doobedoobedo on Apr 19, 2015, 10:22 pm
The SS pin is 9. I have an SPI digipot connected too, that uses pin 5 for SS, but I still get corruption when I load the 'GraphicsTest' example which won't know anything about the digipot.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: kikiz on Apr 20, 2015, 03:59 pm
Hello everybody,

I worked with U8GLIB for a few weeks. First, i used a arduino uno to control my QC12864B (ST7920 chip). Everything worked fine but i decided to buy a mega 2560 (clone of arduino mega) which use ch340g to communicate. The problem is that i'm not able to control the screen with that mega2560.
The rest of the code works but nothing on the screen (i made the same connection).

I initialize by U8GLIB_ST7920_128X64_4X u8g(10);.

Is anyone able to help? Does that library work with that clone?
Are the pins 10, 11 and 13 of the UNO equivalent to the pins 10, 11 and 13 of the MEGA2560?
I'm lost...

Thank you.
Kikiz
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: MAS3 on Apr 20, 2015, 05:36 pm
Are the pins 10, 11 and 13 of the UNO equivalent to the pins 10, 11 and 13 of the MEGA2560?

No.

Have a peek here (click !) (http://www.arduino.cc/en/Hacking/PinMapping2560)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: doobedoobedo on Apr 20, 2015, 06:05 pm
I moved some stuff around on the breadboard and now I get corruption with software SPI too :(. This is the first one of these I've had that doesn't have a reset pin, maybe it has something to do with that. The horizontal alignment seems to move up/down.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: kikiz on Apr 20, 2015, 06:15 pm
Thank you MAS3. I solved the problem using U8GLIB_ST7920_128X64_4X u8g(13,11,10);
//SCK : pin 13, mosi : pin11, cs : pin 10
instead of U8GLIB_ST7920_128X64_4X u8g(10). I don't know why that works now with the MEGA 2560 because
i didn't change the wiring...

Kikiz
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: MAS3 on Apr 20, 2015, 08:04 pm
Best guess is that that creates a soft-spi solution with the specified pins 13, 11 and 10.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Apr 21, 2015, 07:54 pm
Best guess is that that creates a soft-spi solution with the specified pins 13, 11 and 10.

Correct,

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: RayWB on May 20, 2015, 10:27 pm
Hi,

i´m very interested in your Lib and impressed of the huge quantity of supported Displays.
As i´m using several different Displays it looks great for me to have only one Lib to deal with them.

As i´m mostly everytime low on I/O Pins i often use Nick Gammons i2C/SPI solution with the MCP23017
respectively MCP23S17 so i can use SPI or I2C .

are you planning to implement Portexpander Use to support the 8Bit Displays?

for me the KS0108 or SED 1520 would be interesting, respectively a Base to implement the portexpanders.

Thanks for response

RAyWB
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on May 21, 2015, 07:03 am
Hi

There is no plan to support a port extender. Maybe the arm version of u8glib could be extended with a custom communication interface for such a port extender.

Personally, I do not have much time to work on u8glib and also I do not have the hardware to test such a port extender.

Oliver

Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: mdobres on Jun 22, 2015, 09:51 pm
Having the same problem to get U8lib working for ATTiny85, the directions for file replacement seem to apply to MAC, I cannot seem to find the same files in WinAvr or the same windows location.
Regards

Max
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jun 25, 2015, 09:43 pm
I have never tried u8glib on an ATTiny85.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: bingshao1006 on Jun 28, 2015, 10:10 am
Hi:

   How did you solve these problems:

" a very short time long ( maybe miliseconds ) before the black area appears i can see the "Hello World!" text. After that just the 240x64 black area."



Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: MAS3 on Jun 28, 2015, 12:57 pm
Hi.

You're probably referring to reply 257 (http://forum.arduino.cc/index.php?topic=91395.msg1934381#msg1934381) on page 18 of this thread.

This behavior doesn't seem to be very strange.
The display's memory isn't erased right away after power down.
It will remain there for quite some time.
You need to reset the driver to erase the contents of that memory (and the display).
Initializing the display in the sketch also would do a similar thing, but it will happen a bit later which i suspect is what's happening here.
If you keep the display powered down for a quarter of an hour or so, you might see noise appearing before the "black box" appears.
You also might want to investigate the hardware reset circuitry on the display board.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 15, 2015, 11:48 pm
Just a small note on the new release 1.18.0:

At the moment V1.18.0 is available only with the new library manager (Arduino IDE 1.6.5).

Changes include:
 * Transition to Github finished: https://github.com/olikraus/u8glib (https://github.com/olikraus/u8glib)
 * Fixed contrast assignment for SSD1309 and UC1611
 * Fixed bug in u8g_DrawLine(), Github issue 343
 * Fixed bug in u8g_DrawStr90P(), Github issue 331
 * Support for SSD1306 with 64x48 pixel

Please note, that the new project home is on Github:
https://github.com/olikraus/u8glib (https://github.com/olikraus/u8glib)

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Raphango on Aug 16, 2015, 09:47 pm
Just a small note on the new release 1.18.0:

At the moment V1.18.0 is available only with the new library manager (Arduino IDE 1.6.5).

Changes include:
 * Transition to Github finished: https://github.com/olikraus/u8glib (https://github.com/olikraus/u8glib)
 * Fixed contrast assignment for SSD1309 and UC1611
 * Fixed bug in u8g_DrawLine(), Github issue 343
 * Fixed bug in u8g_DrawStr90P(), Github issue 331
 * Support for SSD1306 with 64x48 pixel

Please note, that the new project home is on Github:
https://github.com/olikraus/u8glib (https://github.com/olikraus/u8glib)

Oliver

First of all, congratulations for your work!
It works greatly with my stuff here.

But I really would like to use your awesome library with my AtTiny85, so I could shrink my projects. Maybe you could add support in the next versions.... Thanks in advance! :)  :)  :)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Aug 17, 2015, 10:02 pm
I tried once, but u8glib became to big. Bigger changes are required for make U8glib smaller. However i will consider this for a later version.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: poganytamas on Oct 24, 2015, 08:41 pm
Hello,

I would like to know, if I can do anything with this double blink behavior:
https://www.youtube.com/watch?v=2QI8mQNaGD4 (https://www.youtube.com/watch?v=2QI8mQNaGD4)

It is a Nokia 5110 LCD with chip PCD8544. I upload the first sketch, it displays it. I upload the second sketch, Arduino restarts, display blinks twice, shows the previous sketch output twice in negative (some kind of framebuffer content remnant?), then display the picture of the second sketch.

Can I do anything to prevent it?
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 25, 2015, 12:17 am
Unfortunately, u8glib enables the display before you are able to write something to the frame buffer. This can lead to such an effect.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: poganytamas on Oct 25, 2015, 05:46 am
Unfortunately, u8glib enables the display before you are able to write something to the frame buffer. This can lead to such an effect.

Oliver
Thanks, then I will live with this :)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 25, 2015, 10:49 am
At least this is on the list of things, which needs to get fixed.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: dd7lp on Nov 11, 2015, 01:49 am
Guten Tag, ich bin am experimentieren mit der UG8lib und einem Oled-display SSD1306_128X64 mit I2C-Bus, angeschlossen an einen Atiny 85 im Dil 8 Gehäuse, clock und Data sind an Pin 5 und 7 angeschlossen. Leider weiss ich nicht 100 %ig welche Eintragung in der u8glib freischalten muss. Ich verwende die Lib 1.18 sowie die Enwickungsumgebung 1.66 für den Arduino. Das einbinden des Atiny Prozessors war kein Problem, ich habe auch schon Erfolge mit der Ausgabe auf dem display allerdings mit einer andwer Librariy. leider ist die nicht so gut wie die u8glib vom Olli Kraus (Danke Olli) Wer kann mir weiter helfen, ich weiss das der Speicherplat im Atny 85 begrent ist, aber ich benötige relativ wenig an Programmplatz.Wäre schön wenn einer eine Lösung oder eine Idee hätte
Gruß Christian DD7LP
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: Simian_196 on Nov 22, 2015, 10:42 pm
Hi Oliver,

Thanks for such a great library.

I have written a simple program (home heating control) using various snippets from examples on line and your u8glib and it works a treat. see attached pictures.

I'm using a Nano and a generic OLED screen with DHT22 sensor and a generic quadrature encoder. I can give more details about the hardware but this is not the issue, its my understanding of the software. Please forgive me if I don't use the correct terminology, I'm just getting my head around this programming business :)

I was looking through your examples and in particular the graphics test example. Now this is worrying me because I think I might have my code set up incorrectly.

I noticed that you have each display set up as a void()

Code: [Select]
void u8g_box_frame(uint8_t a) {
  u8g.drawStr( 0, 0, "drawBox");
  u8g.drawBox(5,10,20,10);
  u8g.drawBox(10+a,15,30,7);
  u8g.drawStr( 0, 30, "drawFrame");
  u8g.drawFrame(5,10+30,20,10);
  u8g.drawFrame(10+a,15+30,30,7);
}



and you use the void draw(void) to contain your switch case statement. I understand the switch, case statement but to be honest I don't really understand how your implementation of the switch, case works and how it works in the void loop etc. I need to be sat down and shown  :smiley-confuse:


Code: [Select]
void draw(void) {
  u8g_prepare();
  switch(draw_state >> 3) {
    case 0: u8g_box_frame(draw_state&7); break;
    case 1: u8g_disc_circle(draw_state&7); break;
    case 2: u8g_r_frame(draw_state&7); break;
    case 3: u8g_string(draw_state&7); break;
    case 4: u8g_line(draw_state&7); break;
    case 5: u8g_triangle(draw_state&7); break;
    case 6: u8g_ascii_1(); break;
    case 7: u8g_ascii_2(); break;
    case 8: u8g_extra_page(draw_state&7); break;
  }



I have placed my switch, case statement in the void loop and it seems to work ok. Is this correct?

Code: [Select]
//This is the display screens for the OLED screen, more can be added in the future - keeping it basic at the moment

  switch (encoderPos) {

    case 0: // Room Temperature - displays the current room temperature level
      do {
        u8g.setFont(u8g_font_unifont);
        u8g.drawStr( 20, 11, "Temperature");
        u8g.drawStr( 40, 63, "(Room)");
        u8g.setScale2x2();
        u8g.drawStr( 7, 21, dtostrf(t, 4, 1, str));
        u8g.drawStr( 39, 21, "\260C");
        u8g.undoScale();

        }
    while( u8g.nextPage() );
 
      break;


I use an encoder to determine which page is selected using the switch, case feature.

I have tried to use the graphics test example to try and replicate my current code and I cant seem to get it to work :( One of the issues is to display the current temperature that the DHT is reading onto the OLED using the graphics test example.
I generally get 't was not defined' when compiling, so I declare 't' globally and the code compiles correctly, but then when the screen is displayed I still don't get the temperature reading.

All I'm looking for is an explanation of how your switch case is implemented and is it the standard way it should be and should I look at changing my code to a more standard format?
I enjoy the challenge of trying to figure out problems but this is a little beyond me at the moment.

I have attached my code... I'm a little embarrassed as its only in rough at the moment and needs tidying up.

Any pointers would be a great help

Regards

Si



Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Nov 27, 2015, 06:00 am
Hi

I had a look at your code, but i did not find any issues regarding u8glib. The only optimization i suggest is to place u8g.firstPage in the case itself, directly before the do statement.

What exactly does not work? What is displayed at the moment?

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: M4vrick on Nov 29, 2015, 11:56 am
Hello Oliver :)

I'm actually using an adafruit oled display, 128x64 pixels, with SSD1306, hardware SPI and the adafruit libraries.
I have some performance issues, and after testing all the parts of my sketch it appears the display is taking barely 70% of the cycle time.

I expect your library to be faster than the adafruit, do you think it will be ?

Below is my screen, I don't have any animated feature. Its only display some variables inside boxes.
But as you can see it's rotated to use it in portrait mode, and I see the setRot will decrease performance.

Do you have any advice for me to keep this display and having the best performance ?
Maybe using drawstr90 will be faster than rotating the entire screen ?

(http://perso.m4vrick.com/tinycomp/serie_1_small.jpg)

Thank you for your help :)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Nov 29, 2015, 10:05 pm
Hi
U8glib probably will be slower, however in your application, I assume it should be fast enough. Maybe you could share your u8glib code (if any).
Rotating the text only is probably faster than rotating the entire screen.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Apr 10, 2016, 05:16 pm
Hi All

I have finally create another release. It is available via Library Manager of your Arduino IDE. 
From the ChangeLog:
  * Fixed contrast (brightness) setting for SH1106 and SSD1306 devices
  * Fixed compiler warnings
 
Also some contributed code should be includes (as far as I have accepted pull requests).

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: matthewpoletin on May 03, 2016, 01:10 pm
Hello,
I am creating my little project using this library (github.com/matthewpoletin/podzol) and ran into a little problem. After creating some simple openGL programs, i thought that the way to deal with this lib is similar: specify what you want to draw anywhere in your program and then call update function to draw it.
Unfortunately, i've spent some time looking for similar solutions, but didn't find any yet. The closest one is this code (https://github.com/michaelmargolis/asip/blob/master/asip/utility/asipLCD.cpp), author creates buffer of strings himself and then draw them between "first-" and "nextpage" functions.
If there is any common way to deal with it, i will be glad to take it as an advice.
Edit: I want to add that i fully understand that all works in picture loop. We create an image inside MCU and then draw it on GLCD. But in doing so i got a several lines of text instead of one.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: matthewpoletin on May 08, 2016, 05:45 pm
Hello, everyone!
After some time of research and thinking I came to a simple solution to my problem. In my program I store all the information about graphics primtives all together. Then in the begining of the main while loop I draw them all. I've tested code on my ks0108 GLCD and got quiet a good speed with about 10 primitives, which is enough for me.
If anyone is intrested, for more details you can checkout my implementation on github.
I would like to hear any suggetions on such a solution from you.
Matthew
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: eptheca on May 24, 2016, 08:43 pm
Hi,
Thank's for the library.
I have got it working, but would also like to make a custom font and icons.
I have made a .bdf of my font, and have downloaded the bdf2u8g_101.exe, but I don't understand how I can use the .exe to convert the .bdf file.
I have read this page https://github.com/olikraus/u8glib/wiki/bdf2u8g, but I still don't get it.
Can someone please enlighten me.

Cheers, Hal
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jun 12, 2016, 02:57 pm
Hal, are you able to generate the .c file?

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: smithy on Jul 18, 2016, 07:58 pm
Hello Olli,

thanks for that awesome library.
I´ve been following your answers but i couldn´t find the right information.
I need to reduce code size of the fonts i´m using (right now 3 different are used, 6x10, courb12r/14r and symbol). Since i need an arrow up/down which is not in courb12/12r i used fony and opened the original bdf. On any font i checked you begin with 0x20, i guess there is some predefined order to find the right character when using lcd.print("A").
Where should/can i place my special characters while maintaining minimal flash usage for the font ?

Thanks in advance

Edit:
Successfully converted my custom font :)

After some tests i understand that "A" converts to some number which is the big A as ascii code. So the space required for the font depends on the range of characters i provide bdf2u8g to convert.

What i don´t understand is how the width per character is defined in fony, i can only see height and ascent (ascent != width)
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 19, 2016, 01:13 am
Hi

bdf2u8g accepts several options. You could also instruct to start with glyphs below 0x020 (dec 32): Use -b 30 to start two glyphes before 0x020 (which would be 0x1e and 0x1f)

Also in u8g.print(" ") is identical to u8g.print("\x20"). So if your custom char is at 0x1e, you could print this by using u8g.print("\x1e")

If i remember correctly, fony defines width by the number of columns in the grid.

Another option is to use u8g2, which has a build in compression for the fonts.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: smithy on Jul 19, 2016, 09:22 pm
Hello Oliver,

thanks for the fast reply !

I still have a problem with the output on my glcd (KS0108), sometimes the display seems not to be fast enough and some digits are displayed with bugs. I wonder if this could be a problem with my ram or rather the picture loop

This is my constructor : U8GLIB_KS0108_128 lcd(2, 3,  4,  5, 6, 7, 8, 9, A0, 11, 10, 13, 12);

I bought an 2,4" oled via the bay with SSD1305 controller and want to give it a try with your lib and SPI.
Do you suggest to use the old or the new u8g2 with this device ?

Best regards
smithy
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Jul 19, 2016, 11:46 pm
> some digits are displayed with bugs
You probably change the values within the picture loop. Keep your variables constant while looping through the first/next loop of u8glib.

SSD1305 is not supported with both of the libs. Maybe the SSD1306 works, but i have never checked. U8g2 is more powerful and has a full frame buffer mode, which avoids the problem with wrong digits.

Oliver
Title: Pass fonts using functions
Post by: Pspranav7 on Aug 12, 2016, 07:41 am
hi,
i am using this u8glib library for t6963c graphic lcd(240x128).
I am having trouble using it, as i want to Pass font via function, but hen i do that i got this error

"invalid conversion from 'char*' to 'const u8g_fntpgm_uint8_t* {aka const unsigned char*}' [-fpermissive]"

can anybody help me?
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Aug 18, 2016, 07:53 am
You have to use one of the internal fonts or convert the font with bdf2u8g.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: ali2526 on Sep 23, 2016, 11:54 am
Hi

how I can mirror the screen(flip canvas horizontal)?

I want to use the LCD for HUD.

thanks.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 02, 2016, 08:38 am
Hi

how I can mirror the screen(flip canvas horizontal)?

I want to use the LCD for HUD.

thanks.
There is no such feature in U8glib or U8g2, however for some controllers (such as SSD1306) this can be done by the controller itself. In such a case only the init sequence has to be modified.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: shakeNbake on Oct 19, 2016, 12:37 pm
Hi Oli

I am trying to convert a font for the U8g2 lib using the bdf2u8g_101.exe. When I have tried convert my .bdf file it only converts to a U8g lib format. What argument in the command line do I need to use to convert it to work with U8g2?

I have also tried using the bdfconv.exe but had no luck in getting that to work as below,

cmd input: bdfconv.exe -v -f 1 -m '32-255' myfont.bdf -o myfont.c -n myfont -d myfont.bdf

The output i get in the myfont.c file is:

/*
  Fontname: myfont
  Copyright:
  Glyphs: 1/256
  BBX Build Mode: 0
*/
const uint8_t myfont[30] U8G2_FONT_SECTION("myfont") =
  "\1\0\2\2\0\0\1\1\4\0\0\0\0\7\376\10\377\0\0\0\0\0\5\0\3;\0\0\0";

This looks too short to be a whole font

Any help is appreciated

Michael
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Oct 29, 2016, 09:42 pm
Hi Michael

The font formats for u8g2 and u8glib are different. You must use bdfconv for u8g2 and bdf2u8g for u8glib.
The commandline options look correct, are you sure that there are more than one glyphs in your bdf file?
I probably need to see the bdf file.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: shakeNbake on Oct 31, 2016, 03:28 pm
Hi Oliver

Thanks for the reply.

I have tried again with bdfconv.exe. I have checked the .bdf file I created and it has 11 glyphs (I only need numbers 1-10 and a degree symbol which I replaced glyph 47 with)

The code I put into the command line:

Code: [Select]
bdfconv.exe -v -b 2 -f 1 -m '47-57' myfont12.bdf -o myfont12.c -n myfont12 -d myfont12.bdf

It then output the following log:

Code: [Select]
Parse File myfont12.bdf: 11 glyph(s) found
Map: map_cmd_list=''47-57''
Map: exclude=0 from=0 to=0 map=0
Reduce: Start
Reduce: End
CalculateMaxBBX: x=1095254868, y=726999122, w=173162824, h=1380013139
CalculateMaxBBX: Encodings x=0, y=0, w=0, h=0
bf_CalculateMinMaxDWidth: dx_min=32767, dx_max=-32767
bf_CalculateMinMaxDWidth: x_min=32767, x_max=-32767
bf_CalculateMaxBitFieldSize: bbx.x=0, bbx.y=0, bbx.w=0, bbx.h=0, dwidth=0
RLE Compress: best zero bits 2, one bits 2, total bit size 0
RLE Compress: Font code generation, selected glyphs=0, total glyphs=11
RLE Compress: 'A' pos = 0, 'a' pos = 0
RLE Compress: Font size 27
Monospace Statistics: Max width extention 0, average width extention 0.0
bf_WriteU8G2CByFilename: Write file 'myfont12.c'


Opening the myfont12.c file doesn't seem to have found any glyphs:

Code: [Select]
/*
  Fontname: myfont
  Copyright: Michael
  Glyphs: 0/11
  BBX Build Mode: 2
*/
const uint8_t myfont12[27] U8G2_FONT_SECTION("myfont12") =
  "\0\2\2\2\0\0\0\0\0HSTR\14\0\14\0\0\0\0\0\0\2\0\0\0";


I have attached the myfont12.bdf as a .txt for you too. Please let me know where I have gone wrong

Thanks

Michael
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Nov 02, 2016, 09:55 am
Hi
This is acutally a u8g2 problem (while this thread is for u8glib).
I have created an issue here: https://github.com/olikraus/u8g2/issues/81
Let us discuss the problem on github instead.

Thanks,
Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: pyksdys on Nov 10, 2016, 01:58 pm
Hi all. Ive connected LCD RG12864C-BIW-V to my Arduino DUE via voltage coverters 74LVX3245MTC and i have problem with software. Im sure that wrote right GPIO pins in class contructor from this library (using DB0..DB7, CS1,CS2,RS,RW,DI,E), but theres no LCD reaction. (I did everything what was wrote here: https://github.com/olikraus/u8glib/wiki/thelloworld). I've used constructor U8GLIB_KS0108_128. On my board theres 1 way communication so im not checking LCD's busy flag, wanted deal with it using delays, but i can't find any delays in this library. Any ideas?
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: pyksdys on Nov 11, 2016, 03:00 pm
Problem solved, after checking everything 20th time found that i mixed CS1 with CS2 so position 0,22 was out of display. :) rly nice library, ty.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: RSDieskau on Nov 13, 2016, 12:27 am
Hallo,
ich möchte auf dem Nokia1510 mit dem "U8glib" font fub11 " °C" mit dem Befehl
 
u8g.drawStr(60, 15, " °C");
 
anzeigen lassen.
Es wird aber " Ä°C" angezeigt.
Was mache ich falsch?

Reinhard
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: MAS3 on Nov 13, 2016, 01:02 am
Hallo und willkommen.
Dies ist ein Englischsprachiges Thema.

You are telling the library to put a character number, followed by degrees Celsius on the screen.
The character is number 196 in that font (click !) (https://github.com/olikraus/u8g2/wiki/fntgrpfreeuniversal#fub11).
You should tell it to put your value to the screen instead of a character.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Nov 13, 2016, 07:44 pm
@Reinhard: You need to enter the correct hex code of the glyph into the string in the form " \xXYC" where XY should be the correct hex code of the symbol.
The problem is caused by the mismatch of the string encoding. Arduino IDE supports UTF-8 which is not supported by u8glib. The new version of u8glib (u8g2) supports UTF-8. So this problem will not appear any more with u8g2.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: RSDieskau on Nov 14, 2016, 12:18 am
Hello Oliver and MAS3,
thanks for your very quick answer.

Reinhard
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: pevecg on Mar 03, 2017, 12:00 am
Hello Oliver,

I am wondering if you could help me out with a problem. I have ARM STM32f4Discovery  (STM32f407 if we are exact) I followed some guide and example code from the internet and while he had a working lcd mine is glitched. The square that you can see on the bottom right is something that I wanted to draw, everything else I didn't. (http://i.imgur.com/znJiEJC.jpg)

I am using the following SPI u8g_dev_st7920_128x64_hw_spi

Any suggestions? Also the screen is working normally on the u8g2 library on Arduino but I need to get it working on the STM
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Mar 04, 2017, 09:33 am
You should slow down the STM specific code.

Oliver
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: mOskit on Aug 11, 2017, 09:24 am
Hi. is this lib work with attiny85 and attiny84 over I2C?
Thanks
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: photoncatcher on Aug 11, 2017, 11:26 am
U8glib 1.00 is available for download.

Note: The DFRobot ST7920 should be supported by the U8GLIB_ST7920_128X64 device,
but it has been reported that this is not working. Maybe someone from the Arduino
community is able to check this (I do not own this display).

Oliver
I have a 128x64 graphic ST7920 display clone that looks, walks, quacks and feels like a Robot. This one works with your updated library (> 1,000,000 x thanks) displaying temperature (DS18B20) and humidity (DHT11) see sketch, see picture of the setup 
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: tashiwangdue on Dec 08, 2017, 05:38 am
hello Arduino friends,
I have been looking for how to display Tibetan character on tft 2.4` mcufriend lcd for a week now...  I am not able to find any related articles to display Tibetan character at all.  can anyone help me how to make the display recognize Tibetan character Unicode encoding start with F00, and can display my language on any display

thank you in advance.
Title: Re: U8glib: Graphics Lib for LCDs and OLEDs
Post by: olikraus on Dec 08, 2017, 06:36 pm
u8glib does not support unicode, but it could be added to u8g2 (which does support unicode).
However u8g2 does not support tft RGB displays.

Shell I add Tibetan font to u8g2 (which is a monochrome graphics lib)?

Oliver