Heltec v3 BME280 temperature and pressure telemetry

Hello everyone, I need a temperature and pressure telemetry system for a school project. I thought it would be a good idea to use a heltec v3, but I think I’ve made a great mistake lol. I have very little experience with Arduino and from what I see this is way more complicated. Right now I can’t get any code other than the factory tests included in the library. Any other code, (even if it’s from the official library examples) makes the heltec screen black and the orange light flashes every 2 seconds. Does anyone have any idea on where to even start? My plan was to use a board with a BME280 to transmit the data and another one to receive it.

Thanks in advance in case anyone replies.

Hello friend, here are some examples of sensor readings that I hope can be helpful to you.

When I upload the example codes, the screen turns off and the orange light flashes once every 2 seconds. The only example codes that work are the basic screen demos

What do you expect the examples to do? An example to read a temperature sensor doesn’t have anything to do with a display. Tell us your expectations & requirements and we may be able to give you some hints & directions.

I wasn’t talking about sensor example codes. I’m uploading display demo codes and lora demo codes, and all of them except one display demo code do nothing (black screen and orange flashing light). What I’m trying to do is a temperature and air pressure telemetry system for a CanSat (a “satellite” the size of a soda can, which gets dropped from a drone). My intention was to use a heltec v3 with a bme280 in the “satellite” to transmit the data and another heltec to receive the data.

How did you verify that it does nothing except flash the LED? Do you have any Serial output in your code, did you look at the Serial monitor?

The other code you are uploading is working if it is not erroring while uploading. Like they said above, the example code outside of the screen examples have nothing to do with screens - so they work, you ae just not seeing them.

It sounds like what you are really trying to do is what you stated AND show it on the screen somehow? Let us know what you want to show on the screen and we can likely help…as a shortcut you could install meshtastic on them and use that to send the values…flasher.meshtastic.com

do you want to use meshtastic lora to transmit the data. If so go to the telemetry in meshtastic, it will find the bme 280 on pins , ithink 41 42. and show on screen. the display is on wire, any code looking at i2c needs to be on wire 1

try

// Heltec LoRa V3 OLED and BME280 test

// Heltek LoRa V3 SDA: 41 SCL: 42

// BME280 setup

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>


#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme; // I2C
//Adafruit_BME280 bme(BME_CS); // hardware SPI
//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI

unsigned long delayTime;

// 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();
 Serial.println(F("Heltec LoRa V3 OLED and BME280"));

  bool status;
  
  // default settings
  // (you can also pass in a Wire library object like &Wire2)
  status = bme.begin(0x76);  
  if (!status) {
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1);
  }
  Serial.println("-- Default Test --");
  delayTime = 1000;
  Serial.println();

   // 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   BME280"));
  display1.display();
  delay(2000);

}


void loop() { 
  printValues();
  delay(delayTime);
}


void printValues() {
  float temperature, pressure, humidity;
  Serial.print("Temperature = ");
  Serial.print(temperature=bme.readTemperature());
  Serial.println(" *C"); 
  // Convert temperature to Fahrenheit
  /*Serial.print("Temperature = ");
  Serial.print(1.8 * bme.readTemperature() + 32);
  Serial.println(" *F");*/
  Serial.print("Pressure = ");
  Serial.print(pressure = (bme.readPressure() / 100.0F));
  Serial.println(" hPa");
  Serial.print("Approx. Altitude = ");
  Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
  Serial.println(" m");
  Serial.print("Humidity = ");
  Serial.print(humidity=bme.readHumidity());
  Serial.println(" %");
  
  Serial.println();
  // display results on OLED
  Serial.println();         // start a new line
  display1.clearDisplay();  // Dsiplay information
  display1.setTextSize(1);
  display1.setCursor(0, 0);
  display1.println("Heltec BME280\n");
  //display1.setCursor(0, 20);
  display1.printf("Temperature %.2f\n\n", temperature);
  //  display1.setCursor(0, 40);
  display1.printf("Pressure %.2f\n\n", pressure);
  display1.printf("Humidity %.2f\n\n", humidity);
  display1.display();
  delay(2000);  // wait 2 seconds

}

serial monitor output
Heltec LoRa V3 OLED and BME280
– Default Test –

SSD1306 allocation OK
Temperature = 22.33 *C
Pressure = 1021.14 hPa
Approx. Altitude = -65.49 m
Humidity = 51.71 %

Temperature = 22.32 *C
Pressure = 1021.16 hPa
Approx. Altitude = -65.65 m
Humidity = 51.52 %

image