U8glib: Graphics Lib for LCDs and OLEDs

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 :slight_smile:

Hi

It seems to be this display: 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

U8GLIB_KS0108_128(d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw [, reset])

but Bill's GLCDv3 will also work: GLCD library version 3 (end of life - no longer supported) - Displays - Arduino Forum

Oliver

Thank you very much :*

but still need more information please :blush:

I think it is best to use GLCDv3 first. It has a very good user manual.

Oliver

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 :~

Did you download glcd-v3-20111205.zip from Google Code Archive - Long-term storage for Google Code Project Hosting.?
Which IDE are you using?

I am not an expert on glcd-v3. Better to ask here: GLCD library version 3 (end of life - no longer supported) - Displays - Arduino Forum

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

Oliver

Thank you for your care :slight_smile:

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

Hi

Examples are here: Google Code Archive - Long-term storage for Google Code Project Hosting.

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:
//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:

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
  1. Ensure that the arduino board is not connected to any power or usb
  2. 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
  3. The variable potentiometer (see datasheet)

Oliver

Thank you very much Oliver :*

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

and Thank you

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

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);
}

momtot:
but i have a question
why connecting cs1 , cs2 , di and wr to analog pins :relaxed:

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

momtot:
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

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

#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);
}

and that is the second picture

and thank you Oliver :*

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

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? :cold_sweat:

and thank you Oliver you really a good person :*

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

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):

  • set the ATtiny internal clock to 8 MHz
  • (OS X) install the latest CrossPack-AVR and replace /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/bin/ld with /usr/local/CrossPack-AVR/avr/bin/ld (solves code relocation issues at the link stage)
  • remove all U8glib/utility/*_hw_spi.c files
  • use a small font because the 8 kB flash is easily exhausted
  • of course, use the lib constructor for software SPI

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.

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