Problems using Hosyund .96 in OLED display module

I am trying to test display module with Arduino Uno R4 WIFI. I downloaded the u8glib_arduino_v1.14.zip and installed it in the libraries folder. When I Upload the HelloWorld sketch in the provided Examples I get this error:

c:\*********\Arduino\Code\libraries\U8glib\src\clib\u8g_com_arduino_st7920_custom.c:59:10: fatal error: wiring_private.h: No such file or directory.

I found a topic concerning this error and it says to edit the cpp file but I am not finding any reference to "wiring_private.h" in the file. Probably the wrong file. Anyone familiar with this display and its drivers to be able to help me fix the error.

Fred

Hi @doxrus2 !

Try the newer U8g2 library; it looks like an incompatibility of the (newer) Uno R4 Wifi and the old U8glib.

Remove the old lib, install U8g2 and give it a try; use also the examples that come with the newer lib!

Good luck!
ec2021

Hi! Welcome to the Forum!

Two aspects to look at:

  1. this library doesn't seem to support Uno R4 WiFi (ARM architecture), @ec2021 beats me on that.

  1. The Hosyond 0.96 display uses SSD1306 driver while your sketch is apparently looking for ST7920.

Since that is your very first post, it's recomended to take a look in the topic How to get the best out of this Forum before posting again. The topic contains important tips with info that will help people here to help you, like posting your code.

Have fun! :upside_down_face:

Search on "libraries compatible arduino uno r4"

This link show "u8g2" under "displays" GitHub - arduino/uno-r4-library-compatibility · GitHub

Other "lists" exist, this was just a short search.

this test works on a UNO R4 WiFi

//  AUNO R4 WiFi SSD1306 test - read characters from Serial and display

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

#define SCREEN_WIDTH 128  // OLED display width, in pixels
#define SCREEN_HEIGHT 64  // OLED display height, in pixels

#define OLED_RESET -1        // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C  //0x3D ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

#define NUMFLAKES 10  // Number of snowflakes in the animation example

#define LOGO_HEIGHT 16
#define LOGO_WIDTH 16

void setup() {
  Serial.begin(115200);
  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;)
      ;  // Don't proceed, loop forever
  }
  Serial.println(F("SSD1306 allocation OK"));
}

// display text in buffer - read characters into buffer - on backspace or DEL delete last character
void loop() {
  static char text[100] = "enter text\n";
  static int index = strlen(text);
  display.clearDisplay();  // Clear the buffer
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);  // Draw white text
  display.setCursor(0, 0);              // Start at top-left corner
  display.println(text);                // display text
  display.display();
  // read character
  while (!Serial.available()) delay(50);  // wait for keyboard hit
  char ch = Serial.read();                // read character
  Serial.println((int)ch, HEX);           // print it if required
  // if printable or new line print it
  if (isprint(ch)) text[index++] = ch;
  else if (ch == 0x0D) text[index++] = '\n';
  else if (ch == 0x08 || ch == 0x7f) index--;  // backspace or DEL - delete last character
  text[index] = 0;                             // terminate string
}

serial monitor output (I entered "hello")

SSD1306 allocation OK
68
65
6C
6C
6F
D
A

photo

The core issue is that U8glib is old and unmaintained, and wiring_private.h doesn't exist on the R4's Renesas core, that header is an AVR-era thing, so the library simply won't compile on an Uno R4. The fix isn't editing the file, it's switching libraries: install U8g2 instead, which is the actively maintained successor and fully supports the R4. For a .96 OLED it's almost certainly an SSD1306, so use a U8g2 constructor like U8G2_SSD1306_128X64_NONAME over I2C, wire SDA/SCL, and the HelloWorld example should just work. What driver chip does your module list, SSD1306 or SH1106?

Yes, this works. Thanks.