Troubles with OLED display

Hello everyone,

Problem description:
I'm working on a project where I want to display data recieved from a LoRa module on an OLED display. Both LoRa and the OELD work perfectly when used one at a time. The problem is when I try to display data to the OLED after I initialize LoRa. No matter what I try I'm unable to send send anything to the OLED after the LoRa initialization. I'm currently using SH110x library but I've also tried U8G and U8G2 library, unfortunately results were the same (unable to communicate with the display)

Hardware being used:
arduino nano clone
1.3'' OLED display I2C
RA-02 LoRa module SPI

here's the code:

#include <SPI.h>
#include <Wire.h>
#include <LoRa.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>

#define i2c_Address 0x3c
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1
Adafruit_SH1106G display = Adafruit_SH1106G(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

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

  delay(250);

  display.begin(i2c_Address, true);
  display.display();
  
  delay(2000);

  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SH110X_WHITE);
  display.setCursor(10, 0);
  display.println("TEST");
  display.display();

  //display works up to this point
  Serial.println("LoRa Sender");
  if (!LoRa.begin(433E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
  LoRa.setSyncWord(0x7a);
  LoRa.setSPIFrequency(1e6);
  LoRa.setTxPower(20);
  LoRa.setSpreadingFactor(10);
  //anything after this isn't displayed
 
  display.setCursor(20, 10);
  display.print("LoRa init success");
  display.display();
  
}

void loop() {
  
}

Send the same text to the Serial Monitor while sending to the OLED. Show the Serial Monitor output here.

SH1106G display........ did you change the resistor location on the rear of the display from SPI default to I2C position?

https://www.smart-prototyping.com/1_3-inch-OLED-Display-SH1106-SPI-I2C-128-64

My first thought would be a memory problem, since the Adafruit library and U8g2 with a full display buffer need 1024 bytes of memory, but that would not apply to the U8g library which uses a paged display buffer. Did you properly implement the firstPage()/nextPage() code when using U8g?

If your just displaying text on the OLED use the U8X8 library for the OLED, it uses far less memory than the others you tried. I have used the U8X8 library extensivly with LoRa modules on Atmega328 controllers, no problems.

Stick to the standard Syncwords, 0x12 and 0x34, there can be significant problems with other values.

If your using the RA-02 LoRa module with a Nano, be sure to use logic level conversion circuits so that its safe to connect the 3.3V Logic LoRa module to the 5V Logic level Nano.

Thanks for the reccomendations, I'll change the syncword. The Lora module worked perfectly a few days ago but now I've found out that the initialization fails and that's why the code stops working. I'm still trying to figure out what's wrong but thanks for the suggestions everyone.

I get that message on the OLED with an Arduino Pro Mini 3.3V.

yeah, there's definitely some issue with the lora

Problem fixed. Wire connecting lora to ground had a damaged conductor. Now it's working.
Thanks everyone!

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