i cannot get heltec esp32 v3.2 to display anything with an outside sketch. Mesh works ok. Is there a sketch to show how to get the display to work
Heltec display trouble
If you’re using the Arduino IDE:
File > Examples > HeltecExample > FactoryTest > WiFi_LoRa_32_V3_FactoryTest
An important thing to note is that the v3.2 uses inverted logic on the backlight (through Vext) compared to the normal v3 and v3.1.
does anyone have a working sketch that will show the display works on heltec lora32 v3 v3.2. I cannot get anything to work. the display works fine when i flash Meshtastic
No point asking for the same thing again until you tell us why @UniquePete’s suggestion doesn’t work …
after some time i have been working with Grok to solve the problem of haveing the heltec lora 32 v3.2 to write to display without meshtastic. I have a bmp280 sensor outputing to display the temp and pressure in F and "hg. The display is on one i2c bus and the sensor on the other. we will be adding a 0-3.3v anamometer using adc on the sensor bus. Amazing having the resource that Chat and Grok can supply but you still need to help them once and a while. Heres the sketch
#include <Wire.h>
#include “HT_SSD1306Wire.h”
#include <Adafruit_BMP280.h>
#ifdef WIRELESS_STICK_V3
static SSD1306Wire display(0x3c, 500000, SDA_OLED, SCL_OLED, GEOMETRY_64_32, RST_OLED);
#else
static SSD1306Wire display(0x3c, 500000, SDA_OLED, SCL_OLED, GEOMETRY_128_64, RST_OLED);
#endif
Adafruit_BMP280 bmp(&Wire1);
unsigned long updateCounter = 0; // Counter for updates
const float tempOffset = -4.5; // Adjust to align with 75°F (23.9°C)
const float altitude = 1000.0; // Adjust to your altitude in meters
void VextON(void) {
pinMode(Vext, OUTPUT);
digitalWrite(Vext, LOW);
}
void setup() {
Serial.begin(115200);
Serial.println(“Starting BMP280 Continuous Display…”);
VextON();
delay(100);
// Initialize OLED (uses Wire on default pins: SDA_OLED=4, SCL_OLED=15)
display.init();
display.clear();
display.display();
display.setContrast(255);
Serial.println(“OLED initialized”);
// Initialize second I2C bus for BMP280 (pins 41 SDA, 42 SCL)
Wire1.begin(41, 42);
Serial.println(“Wire1 initialized on pins 41, 42”);
// Initialize BMP280
if (!bmp.begin(0x76)) {
Serial.println("BMP280 Failed");
display.clear();
display.setTextAlignment(TEXT_ALIGN_CENTER);
display.setFont(ArialMT_Plain_10);
display.drawString(display.getWidth()/2, display.getHeight()/2-10/2, "BMP280 Failed");
display.display();
while (1);
}
Serial.println(“BMP280 OK”);
}
void loop() {
updateCounter++; // Increment counter
// Read BMP280 data
float tempC = bmp.readTemperature() + tempOffset; // Apply offset
float tempF = tempC * 9.0 / 5.0 + 32.0; // Convert to °F
float pressure = bmp.readPressure() / 100.0F; // hPa
// Convert to sea-level pressure (hPa)
float seaLevelPressure = pressure / pow(1.0 - 0.0000225577 * altitude, 5.255);
float pressureInHg = seaLevelPressure / 33.8639; // Convert to inHg
// Display data
display.clear();
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.setFont(ArialMT_Plain_10);
String tempStr = “T: " + String(tempF, 1) + " F”;
String pressStr = “P: " + String(pressureInHg, 2) + " inHg”;
String countStr = "C: " + String(updateCounter);
#ifdef WIRELESS_STICK_V3
display.drawString(0, 0, tempStr);
display.drawString(0, 12, pressStr);
display.drawString(0, 24, countStr);
#else
display.drawString(0, 10, tempStr);
display.drawString(0, 30, pressStr);
display.drawString(0, 50, countStr);
#endif
display.display();
// Serial output
Serial.print("Update ");
Serial.print(updateCounter);
Serial.print(": ");
Serial.print(tempStr);
Serial.print(", ");
Serial.print(pressStr);
Serial.println();
delay(2000); // Update every 2 seconds
}
Heltec LoRa V3 using Arduino IDE 2.3.5 ESP32 core 3.2.0 display BMP280 results on OLED
// Heltec LoRa V3 OLED and BMP280 test
/* Interfacing Arduino with BMP280 temperature and pressure sensor.
* Temperature and pressure values are displayed on 16x2 LCD.
* This is a free software with NO WARRANTY.
* https://simple-circuit.com/
*/
// BMP280 setup
#include <Wire.h> // include Wire library, required for I2C devices
#include <Adafruit_Sensor.h> // include Adafruit sensor library
#include <Adafruit_BMP280.h> // include adafruit library for BMP280 sensor
// define device I2C address: 0x76 or 0x77 (0x77 is library default address)
#define BMP280_I2C_ADDRESS 0x76
Adafruit_BMP280 bmp280;
// OLED setup
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display1 width, in pixels
#define SCREEN_HEIGHT 64 // OLED display1 height, in pixels
// Declaration for an SSD1306 display1 connected to I2C (SDA, SCL pins)
#define SCREEN_ADDRESS 0x3C //0x3D ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
// use Wire1 for OLED display as BMP280 is using Wire and would conflict (only one works)
Adafruit_SSD1306 display1(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire1, RST_OLED);
void setup() {
Serial.begin(115200);
Serial.println(F("Heltec LoRa V3 OLED and BMP280"));
if (!bmp280.begin(BMP280_I2C_ADDRESS)) {
Serial.println("Could not find a valid BMP280 sensor, check wiring!");
while (1)
;
}
Serial.println("Found BMP280 sensor!");
// OLED setup
// setup OLED display
Wire1.begin(SDA_OLED, SCL_OLED);
// SSD1306_SWITCHCAPVCC = generate display1 voltage from 3.3V internally
if (!display1.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;)
; // Don't proceed, loop forever
}
Serial.println(F("SSD1306 allocation OK"));
// Show initial display1 buffer contents on the screen --
// the library initializes this with an Adafruit splash screen.
//display1.display();
delay(2000); // Pause for 2 seconds
display1.clearDisplay();
display1.setTextSize(2); // Normal 1:1 pixel scale
display1.setTextColor(SSD1306_WHITE); // Draw white text
display1.setCursor(0, 0); // Start at top-left corner
display1.println(F(" Heltec V3\n BMP280"));
display1.display();
delay(2000);
}
void loop() {
// BMP280 get temperature, pressure and altitude from library
float temperature = bmp280.readTemperature(); // get temperature
float pressure = bmp280.readPressure(); // get pressure
float altitude_ = bmp280.readAltitude(1013.25); // get altitude (this should be adjusted to your local forecast)
// print data on the serial monitor software
// 1: print temperature
Serial.print("Temperature = ");
Serial.print(temperature);
Serial.println(" °C");
// 2: print pressure
Serial.print("Pressure = ");
Serial.print(pressure / 100);
Serial.println(" hPa");
// 3: print altitude
Serial.print("Approx Altitude = ");
Serial.print(altitude_);
Serial.println(" m");
// display results on OLED
Serial.println(); // start a new line
display1.clearDisplay(); // Dsiplay information
display1.setTextSize(1);
display1.setCursor(0, 0);
display1.println("Heltec BMP280\n");
//display1.setCursor(0, 20);
display1.printf("Temperature %.2f\n\n", temperature);
// display1.setCursor(0, 40);
display1.printf("Pressure %.2f\n\n", pressure);
display1.display();
delay(2000); // wait 2 seconds
}
Serial monitor output
Heltec LoRa V3 OLED and BMP280
Found BMP280 sensor!
SSD1306 allocation OK
Temperature = 22.49 °C
Pressure = 1013.84 hPa
Approx Altitude = -4.91 m
Temperature = 23.89 °C
Pressure = 1013.82 hPa
Approx Altitude = -4.71 m
Temperature = 25.53 °C
Pressure = 1013.67 hPa
Approx Altitude = -3.53 m
Temperature = 26.24 °C
Pressure = 1013.62 hPa
Approx Altitude = -3.04 m
Temperature = 26.61 °C
Pressure = 1013.55 hPa
Approx Altitude = -2.49 m
Temperature = 26.88 °C
Pressure = 1013.54 hPa
Approx Altitude = -2.42 m
Temperature = 26.26 °C
Pressure = 1013.66 hPa
Approx Altitude = -3.42 m
Temperature = 25.78 °C
Pressure = 1013.71 hPa
Approx Altitude = -3.84 m