Hello to all Arduino fans (or Lora).
I am having a problem with invalid characters on the LoRa TTGO OLED. This problem only occurs on this device, on the Arduino Uno, everything is normal. The invalid characters only apply to LoRa on the Serial Monitor and when communicating with another device via jumper cable, which it receives with invalid characters. When something is displayed on the OLED screen, it does not look strange. (The image below already contains the code.)
Here is the code when I use the OLED screen:
// Libraries for LoRa #include <SPI.h> #include <LoRa.h> #include "DHT.h" // Libraries for OLED Display #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> // Sensor pin and type #define DHTPIN 2 // Connect the DHT data pin to TTGO GPIO 2 #define DHTTYPE DHT11 // DHT 11 // Definitions for the TTGO LoRa32-OLED board #define SCK 5 #define MISO 19 #define MOSI 27 #define SS 18 #define RST 14 #define DIO0 26 #define BAND 866E6 // Use a frequência correta para sua região // Definitions for the OLED display #define OLED_SDA 4 #define OLED_SCL 15 #define OLED_RST 16 #define SCREEN_WIDTH 128 #define SCREEN_HEIGHT 64 Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RST); void setup() { Serial.begin(9600); // Configure the OLED display pinMode(OLED_RST, OUTPUT); digitalWrite(OLED_RST, LOW); delay(20); digitalWrite(OLED_RST, HIGH); Wire.begin(OLED_SDA, OLED_SCL); if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3c, false, false)) { Serial.println("OLED display allocation failed!"); for(;;); } display.clearDisplay(); display.setTextColor(WHITE); display.setTextSize(1); display.setCursor(0,0); display.println("Initializing..."); display.display(); // Configure LoRa SPI.begin(SCK, MISO, MOSI, SS); LoRa.setPins(SS, RST, DIO0); if (!LoRa.begin(BAND)) { Serial.println("LoRa initialization failed!"); while (1); } Serial.println("LoRa OK!"); } void loop() { display.clearDisplay(); display.setCursor(0,0); display.println("Hello lora ttgo"); display.display(); delay(9000); }
Here is the photo:
I have already tried changing the Serial frequency, checking if it matched the one selected in Arduino IDEA (baud rate), I added a delay after serial begin, changed the display modes in the Serial monitor (Carriage return, New Line, No line ending, Both), I have already changed the Upload Speed to be slower, I have already replaced the USB cable, and I even installed the CP210x USB to UART Bridge VCP driver. I used it on another computer with Windows 11, installed and uninstalled the Arduino IDE, and yes, I have already visited that forum to look for solutions. A friend suggested me that it could be the absence of the BOM that indicates the text formatting. When transmitting data, they appeared without corruption on both OLED screen.
This seems to be a new problem that has been found. I am counting on your kindness to try to solve it. Here is more information:
Board Info:
BN: LilyGo T-Display
VID: 0X1A68
PID: 0X55D4
SN: 531C007448
Computer Info:
Windows 10
AMD processor