NodeMCU with buil-in OLED display

I have NodeMCU 1.0 (ESP-12E Module) with built-in OLED display. It was bought on Aliexpress a several years ago.

In a device it is written that it has ESP8266MOD chip.

I am using Arduino IDE 2.3.4 where I set board as NodeMCU 1.0

Board info says:
BN: Unknown board
VID: 0x10c4
PID: 0xea60
SN: 0001

Now my problem... I want to write something on this OLED display, but it is blank. I tried to upload a .bin file from Deauther, and in that case I can see text on OLED. So OLED is working! Just my code is wrong.

First I ran I2C scanner and it says there are no I2C devices. Then I found out it is SPI screen, because the code below prints out that OLED SPI Display is initialized.

Here is my code:

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_MOSI   D7  // GPIO13
#define OLED_CLK    D5  // GPIO14
#define OLED_DC     D4  // GPIO2
#define OLED_CS     D8  // GPIO15
#define OLED_RESET  D3  // GPIO0

Adafruit_SSD1306 display(128, 64, &SPI, OLED_DC, OLED_RESET, OLED_CS);


void setup() {
  Serial.begin(115200);

  delay(1000);
  Serial.println("NodeMCU 1.0 (ESP-12E Module)");  // Print text

  // Initialize build-in LED
  pinMode(LED_BUILTIN, OUTPUT);

  // Initialize OLED display with the correct resolution
  if (!display.begin(SSD1306_EXTERNALVCC, 0x3D)) {
    Serial.println("OLED SPI display not found!");
    while (true);  // Stay here if display not found
  }
 
  Serial.println("OLED SPI Display Initialized!");

  display.clearDisplay();  // Clear the display

  display.setTextSize(3);  // Set larger text size for better visibility
  display.setTextColor(WHITE);  // Set text color to white
  display.setCursor(1, 1);  // Set cursor position for better alignment

  display.println("TEST!");  // Print text
  display.display();  // Show the content on the display
}

void loop() {
  Serial.println("My first test");  // Print text
  digitalWrite(LED_BUILTIN, LOW);  // LED ON
  delay(1000);
  digitalWrite(LED_BUILTIN, HIGH); // LED OFF
  delay(1000);
}

Device blinks internal LED diode, I can see output in serial console, but OLED display is blank.

This are the pictures of a device:


Any idea how to solve this? I suspect that OLED_MOSI, OLED_CLK, etc. values could be wrong, but I have no idea how to find out the correct values...

Edit: there was a problem uploading pictures, I repaired that.

Welcome to the forum.

Have you checked out How to Set Up NodeMCU ESP8266 with 0.96 Inch OLED Display | Beginner Tutorial?

Yes. It compiles, can upload it to board, but the screen is blank.

I guess I don't have correct SDA and SCL pins defined... How to find out which are correct for my board?

Ah, stupid me. It is written on the board. Thanks for pointing me into right direction. Problem solved.

:+1:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.