2 OLED Displays on 1 Device


#1

I intended to connect 2 OLE displays to the photon. One is designed for I2C and works, the second supports SPI and I2C, but does nothing display.
I am now approached via I2C scanner, since I suspect the problem with the addressing. On the serial monitor I get however no output indicated (neither of narrow, nor of the large OLE). Uppsala.
Afterwards, I am a community contribution followed by my software SPI my luck - the big OLE still shows nothing.

// Ingo Lohs
// MyOLE Display v1.0, 19.09.2017
// works with Spark Core and Photon v0.6.2 / v0.7.x

//Specifications:
//1.OLED display, no need backlight, self-illumination,
//2.The display performance is better than the traditional LCD display, also lower consumption.
//3.Driver IC: SSD1306
//4.Size: 0.91 inch OLED
//5.Resolution: 128 x 32
//6.IIC interface
//7.Display Color: white
//8.Pin Description:
//GND: Power Ground
//VCC: Power + (DC 3.3 ~5v)
//SCL: Clock Line
//SDA: Data Line


int baudrate = 9600;                          // Serial Monitor 
unsigned long lastmillis = 0;                 // time for interation the loop


// OLE
#include <Adafruit_SSD1306.h>                 // This #include statement was automatically added by the Particle IDE.
Adafruit_SSD1306 display(-1);


void setup() {
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // 0x3C
  display.display();                   // show splashscreen
  delay(2000);
  display.clearDisplay();              // clears the screen and buffer

  Serial.begin(baudrate);
  while(!Serial);                      // Waiting for Serial connection
  Serial.print("0.91 inch 128x32 IIC I2C Blue OLED LCD Display DIY Module DC 3.3V 5V BLUE started");
  
  Time.zone(+2.00);  // setup a time zone, which is part of the ISO6801 format 
}

// *********  

void loop() {

    if ((millis() - lastmillis) > 1000) {
        lastmillis = millis();
        displayData();
    }
}

// *********

void displayData() {

    // OLE Display init 
	display.setTextSize(4);  // 1 = mini
	display.setTextColor(WHITE); // my OLE can only BLUE and will ignore this
	display.setCursor(0,0);
	display.clearDisplay();
    
    display.println(Time.format(Time.now(), "%H:%M"));
       // Output
    display.display();
}

What is to do to get 2 OLE Displays on work?
How can I exclude a hardware problem of the display?


#2

Your second OLED Dislplay (the middle D stands for Diode not for Display) is setup for 4Wire SPI not for I2C.
To have it use I2C you’d need to set the resistors as indicated on the silk print for IIC: R1, R4, R6, R7, R8


#3

@Postler, you will also need to create a second display object, using Adafruit_SSD1306 display2(-1); for example. The second display needs its own commands to be sent to it, such as display2.clearDisplay();.


#4

OK Peekay123, did it with another I2C OLE Display. Work.

But I don’t understand ScruffR plan - I found the instructions on the silk, but don’t understand the context from I2C to R1 to R8.
I repeat my understanding: this OLED supports 2 methods and the first is 4Wire SPI (missing schematic).
To use it in the 2nd method “I2C” I need one/more resistors (missing schematic).

I followed this thread, but this schematic with Software SPI will not work.


#5

There is a very similar display with this info about I2C setup


#6

Read the context for 4-wire SPI, wired like in the datasheet described and it works at expected!
In Summery: The 4-wire serial interface consists of serial clock: SCLK, serial data: SDIN, D/C#, CS#. In 4-wire SPI mode, D0 acts as SCLK, D1 acts as SDIN.

Mapping: OLED 4-wire SPI to Photon by using Adafruit_SSD1306 example from libary:
define OLED_MOSI (D1) = D0
define OLED_CLK (D0) = D1
define OLED_DC = D2
define OLED_CS = D3
define OLED_RESET = D4

First time using a 4-wire SPI OLED with success. Thx!
However, I am not brave enough to convert it to I2C.


#7

I’d rather go with hardware SPI on A2…A5 or SPI1 D2…D5