OLED problems

I'm pretty new to this so please bear with me. I got my hands on a 128x64 OLED display which can be used for either SPI or IIC communication. I opted to go with IIC as it requires less hookup, and downloaded two libraries from here:

https://github.com/adafruit/Adafruit_SSD1306

and

https://github.com/adafruit/Adafruit-GFX-Library

I installed the libraries and loaded up the example for 128x64 IIC. It compiled and uploaded to the Arduino (UNO by the way) fine, but nothing is happening on the display. My hookup is as follows:

GND - GND VCC - 5V RST - D4 SDA - A4 SCA - A5

There's still a D/C pin on the display that is unused, but based on the stuff I've read online, it's not required. Can anybody give me a hand in getting this thing going? Thanks.

Bump

There are pull-up resistors for SDA and SCA?

Also provide a link to the datasheet of the module (mainly to check if it is an Adafruit module or not): Regarding I2C there are two variants and only one of this hardware variants will work with the Adafruit libs. U8glib supports both hardware variants (see the topmost entry on the U8glib gallery page: http://code.google.com/p/u8glib/wiki/gallery)

From a software point of view I can only speak on U8glib...

Oliver

SDA/SCA are the data lines for IIC aren’t they? So I didn’t think they would need pull up resistors. I can’t find a datasheet for the exact model I have, but I could provide pictures if that would help…

The I2C bus requires pullups, 4k7 nominal.

I got it sort of working with pull-ups and this code right here:

#include <Adafruit_ssd1306syp.h>
#define SDA_PIN 8
#define SCL_PIN 9
Adafruit_ssd1306syp display(SDA_PIN,SCL_PIN);
void setup()
{
  delay(1000);
  display.initialize();
}
void loop()
{
  display.drawLine(0, 0, 127, 63,WHITE);
  display.update();
  delay(1000);
  display.clear();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.println("HelTec Automation");
  display.setTextColor(BLACK, WHITE); // 'inverted' text
  display.println(3.141592);
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.print("0x"); display.println(0xDEADBEEF, HEX);
  display.update();
  delay(2000);
  display.clear();
}

Found it somewhere in those previous threads (thanks olikraus). But it’s nothing of substance… just some garbled random pixilation…

Sorry… should have included this too…

Some things are not clear to me: - How is the reset line controlled? - How do you know that the display is in I2C mode? I do not see a jumper or solder bridge to put it into I2C mode. - Does the library really fit? It does not seem to be the original Adafruit lib.

Oliver

The reset is connected to D4 on my UNO, but the code I got it to light up with doesn't seem to use it. I believe it's written for the 4 pin version (Vcc, GND, SCL, SDA). I haven't soldered any jumpers or anything like that on the OLED, but when I bought it it was advertised as IIC, so I assumed (naively I guess) that is was. As for the source of the code, I just found it in the above linked thread, I was basically just trying anything I came across to see what I could see. Based on the pictures, do I need to solder a jumper? Thanks again.

ok, then some more suggestions: - Reset (your D4 pin) should be at high level. - Maybe try an SPI library for the OLED. The display looks more like an SPI variant.

Oliver

I looked into the SPI configuration also, but couldn't find anything with regards to the wiring of it with my OLED model. Could you help me out?

Did you do anything with the D/C pin ? The name of it makes me guess the module accepts Data (to display) when HIGH, and Control when LOW. That would be strange however for a I2C device.

Exactly, the D/C is not needed with I2C.

You could use u8glib (http://code.google.com/p/u8glib/). There is a SPI constructors for your display:

U8GLIB_SSD1306_128X64(sck, mosi, cs, a0, reset)

(with a0 = D/C)

As arguments put in the pin numbers of those ports to which the corresponding display signal is connected.

Oliver

Yeah but I don't have any MOSI/MISO, CS, or SCK pins. So how do I adapt for that?

I went over to heltech.cn, and it was pretty unfriendly in terms of the setup instructions. It looks like the chip defaults to SPI instead of I2C. You might contact them, and get the Arduino code that they say can supply. It might give wiring directions.

I suspect if you can't find a library and hookup guide, it may be better to cut your losses, and go with a different one, buying it from a vendor that has hookup instructions on their site, and pointers to a working library. Adafruit sells one for instance.

I happen to like the digole OLED/LCD monitors. They don't use the programming that a lot of OLED/LCD monitors support, but they have their own library. Their monitors tend to support SPI, I2C, or serial connnections at both 3.3 and 5v power systems without having to do level conversions. I generally use it via a 9600 baud serial connection. One advantage of having the controller on the LCD, is for textual output, you don't have the bitmap for the display in memory, which means you can use it on small memory systems like ATtiny85. http://www.digole.com/index.php?categoryID=153.

Yeah that may be the best option. There just doesn't seem to be any support for this thing. Well thanks for all the help anyway guys.

jools: Yeah but I don't have any MOSI/MISO, CS, or SCK pins. So how do I adapt for that?

U8GLIB_SSD1306_128X64(sck, mosi, cs, a0, reset)

sck = SCL = SCK mosi = SDA cs = solder pad on the back side a0 = D/C reset = reset line

Oliver

Thanks again Oliver. I downloaded the library but I'm not finding the constructor that you're referring to. Here's the ones I see for my display (They're from the Hello World example):

//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
//U8GLIB_SSD1306_128X64 u8g(10, 9);     // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);  // I2C / TWI

I uncommented the top one, wired it as you suggested, and put RESET to Vcc. Still nothing though. Did I download the right library? It was the U8glib for Arduino V 1.15.

Alright. I got it working. First off, it is definitely in SPI mode, not IIC as it was advertised. So I used the 128x64 SPI library from the original SSD1306 Adafruit library I posted (initial post). I had to solder a jumper to the CS pad on the back of the display too. Once I did all that it sparked up perfectly. Thanks for all your help though guys. This forum is awesome.

I was able to get this style Heltec OLED working with I2C after struggling with it for a few hours.

I found that the OLED was physically configured as Jools suspected, in 4-wire SPI mode. The BS0, BS1, & BS2 Pins on the OLED were all connected to ground. BS1 has to be tied high to be in I2C mode.

I also found that D2 was shorted to ground as well. The OLED datasheet mentions that D1 and D2 must be tied together to form the SDA line when in I2C mode.

I made these modifications and boy it wasn't pretty. Let's just say a tiny box cutting knife was involved and some edge-of-your-seat soldering to the ribbon breakout.

Finally, I tied the D/C pin to ground, used 1Kohm pullups to VCC from SDA & SCL, used the 0x3C address in code and was then able to talk to the OLED via I2C.

I don't recommend trying what I did, look for the I2C version on the interwebs instead.