[solved] ESP32 TTGO - can't get OLED to work!!!!

Hey guys,

I bought this:

https://www.aliexpress.com/item/ESP32-T2-0-95-OLED-SD-card-Module-WiFi-Bluetooth-development-board/32844263180.html?spm=a2g0s.9042311.0.0.27424c4dv9YfwB

It had a demo installed, showing nice colors and shapes and everything.

I wanted to write my own code to display stuff; but when I found some code and compiled it, it didn't work, no matter which library I tried.

I have another similar display and another ESP32 board, so I connected those together and ran this code:

#include <Wire.h>
#include "SSD1306.h" 
 
SSD1306  display(0x3c, 26, 27);
 
void setup() {
 
  display.init();
  display.drawString(0, 0, "Hello World");
  display.display();
}
 
void loop() {}

But this very same code (with the pins changed accordingly to the Aliexpress description) doesn't run on the TTGO.
I suspected that I might need to pull CS low and DC either high or low (wasn't sure :D), but none of that helped.

I tried running an I2C scan on my other board and it worked perfectly. I have peeked into the display datasheet (ssd1306), adjusted the I2C scan code accordingly and ran it on the TTGO board, but it doesn't even see the display (doesn't find any devices).

Here is the I2C scan code I have found and then edited:

#include <Wire.h>
 
 
void setup()
{
  pinMode(15,OUTPUT);
  digitalWrite(15,LOW);//CS
  pinMode(16,OUTPUT);
  digitalWrite(16,LOW);//DC
  
  pinMode(13, OUTPUT);
  pinMode(14, OUTPUT);


  pinMode(4,OUTPUT);
  digitalWrite(4,LOW);
  delay(50);
  digitalWrite(4,HIGH);//reset

  
  Wire.begin(13,14);
 
  Serial.begin(9600);
  Serial.println("\nI2C Scanner");
}
 
 
void loop()
{
  byte error, address;
  int nDevices;
 
  Serial.println("Scanning...");
 
  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
  {
 
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
 
    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");
 
      nDevices++;
    }
    else if (error==4) 
    {
      Serial.print("Unknow error at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");
 
  delay(5000);           // wait 5 seconds for next scan
}

I have pried the display off to access the pins (its hanging by the flatflex now) and have continuity tested everything - it seems like the pins listed on Ali (4, 15, 16, 14, 13) are indeed connected to the display. Furthermore, I cannot seem to find any pin that would be connected to 3.3V or 5V, which is bizzare. I tried it in both polarities (in case there was a protective diode or something). This being said, it worked before (with the default code it shipped with) and I was careful with it, so I don't think the hardware is damaged.

Have you guys encountered something similar ? :confused: Thanks in advance!

(deleted)

spycatcher2k:
See me

Wowsers!

Thanks a lot, I will go check it out immediately and let you know if it works!

spycatcher2k:
See me

IT WORKS!!!!!!! THANK YOU SO MUCH! OMG I THOUGHT I'D NEVER GET IT WORKING!

(deleted)

spycatcher2k:
Was liked to on the page you supplied the link to above :slight_smile:

Crap.

I just spent 7 hours on that.

I have seen that link, but it wasn't really a link, just a text; I tried copying it and pasting it, but it gave me 404, so I assumed it was dead.

Turns out I just haven't selected the whole text.

Oh well... Thanks a lot anyway! :smiley: :smiley: