Problem with SSD1306 LCD and U8glib

Hi,
Many thanks Oliver for posting the updated U8glib library here.
I also bought one of these cheap OLED's from eBay (different seller) and the U8glib in this thread has worked first time for me.
Thanks again.

Greg in Oz

Good to read that it is usefull.

Oliver

I also purchased a cheap display from ebay:
http://www.ebay.com.au/itm/310909052356

I was able to get u8glib working using your most recent v1.16, with the new constructor (U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK) )
However, the image on the display is very dim compared to the other code (IIC_without_ACK) attached earlier in this thread
I have tried adjusting the contrast register to 0x81, 0xff - but I see no change in the brightness of the display.

Comparing the initialization code in the two pieces of code, they are very similar - so I cant see why there is the difference in brightness.

Does anyone have any other suggestions?

If you say similar, what are the actual differences? Maybe you can put the init code of the other code here.

Oliver

Great work getting these displays to work!
I just bought 2 and have had no problems with them, they're great for the price.

I am now trying to get both displays to work at the same time and display different things.
I'm a little confused as to how to address them and I'm not sure whether it's possible with this display since it sends no acknowledge.

On the back of the displays there is a jumper to select between two addresses 0x7A and 0x78. So I was going to swap one of these jumpers over, but then how do I get this to work with U8glib?

Sorry for my lack of knowledge, this is my first time using displays and U8glib.

SSD1306 I2C address:

In the utility folder you will find the file "u8g_com_arduino_ssd_i2c.c". In line 57 you will see:

#define I2C_SLA		(0x3c*2)

Change this to 0x03d*2 (or 0x07a). You could also change this macro a global variable:

uint8_t I2C_SLA = 0x3c*2;

Then add to your .ino file:
extern uint8_t I2C_SLA;

Now you can change between the displays by assigning the address to this global variable.

 I2C_SLA = 0x078;   // first display
 I2C_SLA = 0x07a;   // second display

ok, not tested, but i think it should work.

Oliver

Worked perfectly! They're running very nicely together now :slight_smile:

Thanks very much Oliver

Thanks, works perfect! :slight_smile:

Hello there!

I've been trying to get this working http://www.ebay.co.uk/itm/261433793901.

Seems to be about the same display someone else is talking too? With the heltec.cn text.
So i think its the same display as on previous posts.

Luckily i read this and found the newer U8Glib with the "U8G_I2C_OPT_NO_ACK"

I tried it but still my screen has nothing on it. Im using 4.7k pullups.

All i can think of that this display has "address select" telling me its 0x78. How or where do i tell the library it? Im guessing the
u8g_com_arduino_ssd_i2c.c file but how?

pic from behind:

Just for reference: The previous question has been discussed here 0.96" OLED. No sign of life. -solved - Displays - Arduino Forum

Hi Oliver,

firstly thanks for this cool library.
I at last got mine up and running. I used both the 1.15 and 1.16 versions and I see this strange issue. The hello world shows up in 2 colours. top half yellow and bottom blue. Attaching the pic.

Also would you advice where I can learn to change the color to blue and yellow?

You can not change the colors. This is a bi-color OLED. Actually a Monochrome OLED, but the top view rows have a different (fixed) color.
See for example here:
http://www.ebay.com/itm/Two-Color-0-96-inch-LED-128-64-High-resolution-OLED-Display-Module-/221120509913

Oliver

elecopper:
Worked perfectly! They're running very nicely together now :slight_smile:

Thanks very much Oliver

GunterO:
Thanks, works perfect! :slight_smile:

Hi guys, would you mind post some of your code (or sample) on how you were changing/referencing the address in your normal run time loop? I'm able to address and talk to multiple displays one at a time (ie, change variable then compile in my main .ino file), but not dynamically within the same compile.

Cheers,
Matt

I had trouble too and I think it came down to the order that I was addressing them within the program. Here's an example that works.
In the ug8_com_arduino_ssd_i2c.c

//#define I2C_SLA		(0x7A)
uint8_t I2C_SLA = 0x7A;

This will write to the screens at startup and then swap what is written on each after 5 seconds:

#include "U8glib.h"

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);
extern uint8_t I2C_SLA;

boolean redraw_display_one = false;
boolean redraw_display_two = false;

void setup()
{
  I2C_SLA = 0x078;
  u8g.firstPage();
  do
  {
    draw_message_one();
  }
  while(u8g.nextPage());

  delay(10);

  I2C_SLA = 0x07A; 
  u8g.firstPage();
  do
  {
    draw_message_two();
  }
  while(u8g.nextPage());
}

void loop()
{
  if (redraw_display_one)
  {
    I2C_SLA = 0x078;

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

    redraw_display_one = false;
  }

  if (redraw_display_two)
  {
    I2C_SLA = 0x07A;
    u8g.firstPage(); 
    do
    {
      draw_message_one();
    }
    while(u8g.nextPage());
    redraw_display_two = false;
  }
  
  unsigned long time = millis();
  
  if (time > 5000 && time < 5033)
  {
    redraw_display_one = true;
    redraw_display_two = true;
  }
}

void draw_message_one()
{
  u8g.setFont(u8g_font_fub20);
  u8g.drawStr(12, 28, "Hello");
  u8g.drawStr(12, 58, "World");
}

void draw_message_two()
{
  u8g.setFont(u8g_font_fub20);
  u8g.drawStr(12, 28, "Goodbye");
  u8g.drawStr(12, 58, "World");
}

Thank you thank you thank you!

Got it working, I had to change the third line to
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);

but other than that, worked a treat! Thanks!

Thanks for the great work done on this device.

I've managed to get it working well on the Arduino using the examples which is working well.

However, is it possible to get the same release version for AVR as I can't see a way to make it work with the current version.

Many thanks.

Steven

I have attached snapshots of the current repository for Arduino and AVR. Not tested, just development releases.

Oliver

u8glib_arduino_v1.16pre3.zip (1.06 MB)

u8glib_avr_v1.16pre3.zip (1.01 MB)

Hi Oliver,

Just a quick reply to say thanks for uploading the pre-release version.

After a few tweaks of the main c file, I was able to get each of the examples working well.

I'm now in the process of incorporating the libraries into my own project and it seems to be going well (though I need to try and figure out how to use the library more).

Thanks again, and if you'd like any testing done on the device, feel free to let me know.

I am glad to read, that the avr release works. For the final release, the avr version also undergoes some release testing.

Oliver

Hi Oliver,

the pre-release worked 'out of the box'.
I only had to add the constructor
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);

and Bingo! there was the 'Hello World'.

Thanks for the great work.
Kurti