Oled error of Particle Photon

I try OLED with particle photon by the following schema.
pin connection

photon        OLED
3.3V          Vin
GND           GND
SCA           D0
SCK           D1

this is my program code.

// This #include statement was automatically added by the Particle IDE.
#include <Adafruit_SSD1306.h>
#define OLED_RESET D4
Adafruit_SSD1306 oled(OLED_RESET);

void setup()
{
    oled.begin(SSD1306_SWITCHCAPVCC,0x3C);
    oled.display();
    delay(2000);
}
void loop()
{
    oled.clearDisplay();
    oled.setCursor(0,0);
    oled.println("Hello Photon");
    oled.display();
    delay(2000);
}

but my OLED show only this…


explain me plz

You will need pull up resistors (4.7K or 2.2K) from the D0 and D1 to 3V3 for the I2C bus to operate. Otherwise the voltage will float around. Try that first.

I have Oled displays looking much like the one on the picture.

Some of mine use the SH1106 chip and not the SSD1306 chip - and using the Adafruit_SSD1306 library gives a result like your picture.

But they work fine with the SH1106 library – I ended up porting a library supporting the Adafruit_GFX library (as I remember, a long time ago, didn’t invest a lot time in it).

I have 10+ of these cheap ebay Oled displays and wasted a lot time bc of different default I2C addresses and driver chips. If the pull-ups don’t do the trick, do a I2C scan to verify the address and try the SH1106 library :wink:

Mine don’t need the pull-up resistors.

1 Like

I changed with Sh1106 but it still remain appearance like that…

i add two resistors as u mentioned but still errors…

i used u8glib library with this OLED and successfully display.
but u8glib not exist on particle web ide…

If the display works using u8glib (Arduino ?), you should know the I2C address and chip type ? - and this could indicate the course of the problem.

Does the display work with Adafruit libraries on platforms other than Particle (Arduino) ?

I have no experience using u8glib or u8g2 (the newer version), but the author gives advise for porting to other MCU’s. https://github.com/olikraus/u8g2/wiki/Porting-to-new-MCU-platform

I suggest you use the following libraries and ensure the screen size is correctly set - I guess 128 x 64? This is the example application for the Adafruit OLED feather backpack

#include <Adafruit_GFX_RK.h>
#include <Adafruit_SSD1306_RK.h>

Adafruit_SSD1306 display = Adafruit_SSD1306(128, 32);
 
#define BUTTON_A  D4
#define BUTTON_B  D3
#define BUTTON_C  D2

void setup()
{
    // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
    display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Address 0x3C for 128x32
    // Show image buffer on the display hardware.
    // Since the buffer is intialized with an Adafruit splashscreen
    // internally, this will display the splashscreen.
    display.display();
    delay(1000);
 
    // Clear the buffer.
    display.clearDisplay();
    display.display();
    pinMode(BUTTON_A, INPUT_PULLUP);
    pinMode(BUTTON_B, INPUT_PULLUP);
    pinMode(BUTTON_C, INPUT_PULLUP);
 
    // text display tests
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(0,0);
    display.print("Working Display");
    display.setCursor(0,0);
    display.display(); // actually display all of the above
}
 
void loop()
{
    if(!digitalRead(BUTTON_A)) display.print("A");
    if(!digitalRead(BUTTON_B)) display.print("B");
    if(!digitalRead(BUTTON_C)) display.print("C");
    delay(10);
    yield();
    display.display();
}

Thx bro.I successfully configure OLED display with this library…

Hi how are you, excuseme, how do you add u8glib library to your proyect ?

Try including the library in the web IDE. If you search on u8glib and then include.

If you tried this and it doesn’t work as I just did then I guess the link to the github repo has not been maintained by the author!

A tip in future for posting is to not add to a thread that is ticked as solved.

1 Like