2

Description

I'm currently trying to get this SSD1306 0.91" OLED screen with an Arduino Nano with the U8G2 library (as per seller's guide), and in any code I run, as soon as a delay() is executed, the screen goes blank and doesn't show any further text or image.

What is the possible cause?

Wiring

enter image description here

Code

To first make sure the OLED module works, I'm using one of the HelloWorld examples from the U8G2 library, from which (with comments removed) I'm executing the next code:

#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI #include <SPI.h> #endif #ifdef U8X8_HAVE_HW_I2C #include <Wire.h> #endif

U8G2_SSD1306_128X32_UNIVISION_F_SW_I2C u8g2(U8G2_R0, /* clock=/ SCL, / data=/ SDA, / reset=*/ U8X8_PIN_NONE);

void setup(void) { u8g2.begin(); }

void loop(void) { u8g2.clearBuffer(); // clear the internal memory u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font u8g2.drawStr(0,10,"Hello World!"); // write something to the internal memory u8g2.sendBuffer(); // transfer internal memory to the display delay(1000);
}

Expected Result

The OLED Screen should always show "Hello World!" text, as per this youtube video with the same setup.

Actual Result

At startup, it shows the "Hello World" text for a fraction of a second and it disappears.

I've found out that as soon as the delay() is executed, screen goes blank forever and doesn't reload any text. I don't want this approach if possible since:

  • I plan on using a battery to power the Arduino and the screen, and a permanent screen refresh would decrease autonomy
  • When doing so, the screen is a little bit flickery.

Troubleshooting executed

  1. I used a different Arduino Nano, and result was the same.
  2. I'm using a 5V 2A power supply for the entire circuit.
  3. I tried different U8G2 example sketches, with the same result (only working if no delay()).
  4. I tried using another OLED module of the same specs, and result is the same.
  5. I've tried to use Adafruit SSD1306 library, and screen doesn't show anything.
jsotola
  • 1,554
  • 2
  • 12
  • 20
Markussen
  • 21
  • 4

0 Answers0