Go Down

Topic: 2.42" OLED SSD1309 with U8GLIB (Read 15112 times) previous topic - next topic

BoKKeR

#15
Mar 15, 2018, 06:49 pm Last Edit: Mar 15, 2018, 06:55 pm by BoKKeR
If anyone else has a problem to get this display to work with I2C I posted my own wiring on my blog: 2.42" I2C wiring

AndreK

So I bought one of those (2.4" display) :



I already have a project that works well with the U8X8_SSD1306_128X64 library and 0.96" displays. 

Removed R4 , jumped R3, R5

So far: I added the usual I2C Pullups and connected to an Arduino configures for the before mentioned 0.96"
also tried to pullup RES (2k2)  , pull up/down the DC (for address selection)

no success.
So I compiled it with RES support, and tried with , and without an 3k3 pullup for RES (to bring it up before arduino boots)

what else can I try ?



AndreK

So I bought one of those (2.4" display) :



I already have a project that works well with the U8X8_SSD1306_128X64 library and 0.96" displays.  

Removed R4 , jumped R3, R5

So far: I added the usual I2C Pullups and connected to an Arduino configures for the before mentioned 0.96"
also tried to pullup RES (2k2)  , pull up/down the DC (for address selection)

no success.
So I compiled it with RES support,(connected RES) and then tried with , and without an additional 3k3 pullup for RES (to bring it up before arduino boots)

what else can I try ?



68gt500

Thread is a little old, but for reference:

The  above 2.42" Oled with the jumpers set for I2C operation work when the reset  PIN is connected to the reset pin of the Arduino.

Used SH1109 driver in U8Gxx Lib and also dedicated SH1109 Libs

I2C:
R3 & R5 jumpered
R4 removed.

Also tested with ESP32. Just make sure to use "stickbreakers" updated wire - to avoid hangups.

Greets
Mike

chukovskij

#19
Nov 03, 2018, 08:29 pm Last Edit: Nov 03, 2018, 09:08 pm by chukovskij
@ 68gt500 

> The  above 2.42" Oled with the jumpers set for I2C operation work when the reset  PIN is connected to the reset pin of the Arduino.

Thanks, I've managed get it working, my config is slightly different:


My board is black one: Diymore 2,42" 128x64 OLED Display Module with I2C and SPI support
  • I2C: R4 smd resistor (4.6 kOhm) moved to R3
  • R5 jumpered
  • Reset pin connected to ESP8266 reset pin
  • driver settings:  U8G2_SSD1306_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);


In my case display didn't respond (I thought it could be already dead) until I've connected reset pin to ESP8266 reset pin. If I disconnect it while it is working the screen turns off.
Also, somewhere was mentioned that instead of connecting reset pin to reset you could connect display reset pin to GND via resistor (10 kOhm or greater) and than to some digital pin of your board, so get reset pin low on startup and manually set pin high before lcd init cal)

Not sure what is better for R5: shortcut or resistor (4.6 kOhm similar to others), but shortcut works ok and it is easier to make.

68gt500

It has been working for some time now.

But I have run into an issue:

When powered by USB  - all is good.

When powered via the VIn connector the display is black until I push the reset button.

Anyone an idea?

Should I try chukovskij┬┤s idea?

Any input appreciated

Mike
 

68gt500

Solution:

Connect Display RES to a pin of your choice - I am using #5

Code: [Select]

void setup() {   
  pinMode( 5, OUTPUT);  // RES Pin Display
  digitalWrite( 5, LOW);
  delay (500);
  digitalWrite( 5, HIGH);
  u8g2.begin();   // Start OLED
}


Works ok when powered via USB or VIn Plug

spyder0069

I picked up one of these black pcb displays to work with a esp32 but I can't seem to get anything from it.  I have a couple of questions:

CS:  Connect to ground or leave floating?
DC:  This is the address right?  What address if held high and what address if held low?

RES:  Connecting to a pullup enough or does it actually need to be reset?

I am using the u82lib

I have removed R4 and bridged R3 and R5.

I have tried both the HW I2C and software with a reset pin but I can't get any response.  Does anyone have sample code for esp32 they could post?  Thanks!

olikraus

Consider to use u8g2 if possible.

CS is the chip select line. Connect the CS input of the display with any available GPIO pin and provide the pin number to the u8g constructor.

DC is the data / command line. It indicated, whether a command or same data is about to be transfered. Connect the DC input of the display with any available GPIO pin and provide the pin number to the u8g constructor.

If you have to connect CS and DC, then this is a SPI interface!

Oliver

spyder0069

Thank you for the response.  The display is identical looking the black pcb a few posts up.  After much tinkering I was able to figure it out.

The display can be SPI or I2C.  I was trying to do I2C and for that the modifications are to remove R4 and jumper R3 and R5. 

I had the normal 4.7k pullups on the SDA and SCL.

In order for the display to function:

10K pullup on the RST.  THIS DISPLAY REQUIRES THE RESET.  Pick an IO of your choice.

In I2C mode the DC line is your address.  The displays I received are x78 or x7A.  If you pull DC low it will be at x78 and tied high is x7A (not the x3C that have been reported elsewhere).

The CS line seem to not matter if its floating or tied low but I have tied to ground.  Here is my sample code that works (ESP32).  Hopefully it will help someone else out as this was hours of head scratching for me.  LoL


Code: [Select]

#include "U8g2lib.h"
#include <Wire.h> //Library for I2C interface

//HW i2C is 22 for SCL and 21 for SDA



U8G2_SSD1309_128X64_NONAME0_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ 23);


byte mycounter=0;
String mystring;


void setup() {
delay(1000);
 

  //u8g2.setI2CAddress(0x78);  //if DC is pulled low
  u8g2.setI2CAddress(0x7A);  //if DC is pulled high
u8g2.setBusClock(1500000);
  u8g2.begin();
  u8g2.setFont(u8g_font_6x10);
}

void loop() {
  drawOLED_1();
  delay(1000);
  if(mycounter<200){
      mycounter=mycounter+1;
  }else{
    mycounter=0;
  }
}

void drawOLED_1(void) {
  //char buffer[10];
  u8g2.clearBuffer(); // clear the internal memory

  u8g2.setFont(u8g2_font_ncenB08_tr);

  u8g2.drawStr(0, 10, "LINE1");
  u8g2.drawStr(0, 20, "LINE2");
  u8g2.drawStr(0, 30, "LINE3");
  u8g2.drawStr(0, 40, "LINE4");
  mystring=String(mycounter);


  u8g2.setCursor(0, 50);
 u8g2.print(mystring);
 

  u8g2.sendBuffer();
}

Charlie_Tech

Thanks, we are getting somewhere. I assumed that R13 and R15 should be the same value as R17. Now I have replaced both with 0R. I also pulled RES with 10K up to Vcc, and I am getting response from 0x3C. Should it be pulled with lower value?

Nothing yet on the screen though. At some point I got something, but not sure which combination of params was it.

U8GLIB is too slow over I2C so I was hoping that SSD1306Ascii could be made to work with it.
I2C is not unreasonable.   I would use Adafruit_SSD1306 library first.   But I am sure that u8g would be fine too.

First step is to check DC.   Does it have an existing 10k pulldown on the pcb?   It is essential that DC has a stable value.  Otherwise it will not know whether it is 0x3C or 0x3D.

As a general rule,   a 128x64 monochrome is always going to be fast.    There is only 1kB of data to repaint the whole screen.

David.
Hi mates,

I know the thread is old, but I want exponation my solution for a future people have the same problem with this display, because the manufacture don't gift any information o datasheet.

I'm working with same dislplay of Zdravke:

http://www.befr.ebay.be/itm/181943860429



Now, I have the display working properly in I2C with the library "Adafruit_SSD1306 library". David_prentice is right, first you need to remove R17 and put 0R in R13 and R15. About CS pin, the display works if you put to GND or not, both is correct, for example I put 0R in R18 it's the same that CS pin to GND, and it's working perfectly. About RES pin needs connect to the Arduino output pin, and you can put one resistor of 10k pull-up  to 5Vcc (I did). About DC pin is the adress of display in the bus I2C, in this case if you use "Adafruit_SSD1306 library", you need to a put pull-up of 10K to 5Vcc, because if:

DC connect to GND, adress is 0x3C
DC connect to 5Vcc, adress is 0x3D

The "Adafruit_SSD1306 library" default use 0x3C for 128x32 display and 0x3D for all others, then we use de 0x3D because the display is 128x64.

Summary if you use this display in I2C and "Adafruit_SSD1306 library":

-R17 = Remove
-R13 = 0R
-R15 = 0R
-R18 = 0R (CS pin to GND)
-RES = connect to Arduino Output pin with a 10K pull-up
-DC  =  connect a 10K pull-up. (adress=0x3D)

I hope help somebody about this thread.

Charlie




floresta

#26
May 25, 2019, 04:35 pm Last Edit: May 25, 2019, 04:35 pm by floresta
. . .
In I2C mode the DC line is your address.  The displays I received are x78 or x7A.  If you pull DC low it will be at x78 and tied high is x7A (not the x3C that have been reported elsewhere).
You are confusing the 7-bit address of 0x3C with the shifted 8-bit version of 0x78.  Convert those two numbers to binary and you will see how they are related.

Take a look at this explanation.

Don


zdravke

Thank you for the response.  The display is identical looking the black pcb a few posts up.  After much tinkering I was able to figure it out.

The display can be SPI or I2C.  I was trying to do I2C and for that the modifications are to remove R4 and jumper R3 and R5. 

I had the normal 4.7k pullups on the SDA and SCL.

In order for the display to function:

10K pullup on the RST.  THIS DISPLAY REQUIRES THE RESET.  Pick an IO of your choice.

In I2C mode the DC line is your address.  The displays I received are x78 or x7A.  If you pull DC low it will be at x78 and tied high is x7A (not the x3C that have been reported elsewhere).

The CS line seem to not matter if its floating or tied low but I have tied to ground.  Here is my sample code that works (ESP32).  Hopefully it will help someone else out as this was hours of head scratching for me.  LoL


Code: [Select]

#include "U8g2lib.h"
#include <Wire.h> //Library for I2C interface

//HW i2C is 22 for SCL and 21 for SDA



U8G2_SSD1309_128X64_NONAME0_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ 23);


byte mycounter=0;
String mystring;


void setup() {
delay(1000);
 

  //u8g2.setI2CAddress(0x78);  //if DC is pulled low
  u8g2.setI2CAddress(0x7A);  //if DC is pulled high
u8g2.setBusClock(1500000);
  u8g2.begin();
  u8g2.setFont(u8g_font_6x10);
}

void loop() {
  drawOLED_1();
  delay(1000);
  if(mycounter<200){
      mycounter=mycounter+1;
  }else{
    mycounter=0;
  }
}

void drawOLED_1(void) {
  //char buffer[10];
  u8g2.clearBuffer(); // clear the internal memory

  u8g2.setFont(u8g2_font_ncenB08_tr);

  u8g2.drawStr(0, 10, "LINE1");
  u8g2.drawStr(0, 20, "LINE2");
  u8g2.drawStr(0, 30, "LINE3");
  u8g2.drawStr(0, 40, "LINE4");
  mystring=String(mycounter);


  u8g2.setCursor(0, 50);
 u8g2.print(mystring);
 

  u8g2.sendBuffer();
}


Bought the same display, tried exact steps above, no worky. It does announce itself as 0x3C on the bus when RES is pulled up with 10K, but that's about as far as it goes. I connected it to pin D6 on Nano and have put "6" as reset pin in your code, not sure if that part is correct.

david_prentice

#28
Jun 24, 2019, 05:55 pm Last Edit: Jun 24, 2019, 06:23 pm by david_prentice
I suggest that you follow Charlie_Tech's post (and anything from olikraus)

There should be nothing difficult with using SSD1309.   It is fairly similar to SSD1306.
1.  configure pcb for SPI or I2C.
2.  use correct constructor
3.  it is only 128x64.  So you can afford to use a full buffer in SRAM (1kB) even on Uno.

David.

zdravke

RES = connect to Arduino Output pin with a 10K pull-up


I don't get it - connect RES to arduino output and do what with it? Do you send anything in the code to that output? If not, why connect it to output in the first place? If yes, why omit that part?

Go Up