• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Esp32 TTGO LoRa with BMP280 SDA/SCL

Q&A Forum › Category: ESP32 › Esp32 TTGO LoRa with BMP280 SDA/SCL
1 Vote Up Vote Down
Ross Satchell asked 4 years ago

Hi, I am trying to set up my ESP32 TTGO LoRa module with a BME280 I2C sensor.
First I tested the BME280 on its own with the TTGO LoRa module and confirmed it worked correctly, sending data to the serial terminal.
Then I tested the TTGO module with the LoRa sender/ receiver code and confirmed the packets were being sent to my other TTGO LoRa module.
Then I tried to combine the code to send temperature, etc data across LoRa. This is where I am having problems. It does not find the BMP280 sensor.
I get the following error message:
Could not find a valid BME280 sensor, check wiring, address, sensor ID!
SensorID was: 0xFF
ID of 0xFF probably means a bad address, a BMP 180 or BMP 085
ID of 0x56-0x58 represents a BMP 280,
ID of 0x60 represents a BME 280.
ID of 0x61 represents a BME 680.
I noticed the TTGO LoRa module uses OLED_SCL and OLED_SDA pins rather than the normal SDA & SCL pins. I tried connecting the BMP280 to the OLED_SCL and OLED_SDA pins with no change (still not finding BMP280).
I’m not sure how to proceed from here. Any advice would be greatly appreciated.

Here is my current code:  https://pastebin.com/ziqr8KHC

 

 

Question Tags: TTGO LoRa BMP280 ESP32
5 Answers
0 Vote Up Vote Down
Best Answer
Ross Satchell answered 4 years ago

Somehow, I missed this tutorial:
https://randomnerdtutorials.com/esp32-lora-sensor-web-server/
which fixes my problem!
 
If nothing else it was good troubleshooting practice!

1 Vote Up Vote Down
Ross Satchell answered 4 years ago

I just made a new sketch in which I just successfully tested the BMP280 and (and I added a ) DS3231 together on I2C. I excluded everything else.
Here is the code for reference: https://pastebin.com/TvbhdwGg
Now I’m back to trying to send sensor data over LoRa, hopefully I’ll make some progress!
 

0 Vote Up Vote Down
Ross Satchell answered 4 years ago

Ok, now I have LoRa working (only using display on receiver, not using display on the sender yet) and sending the BMP280 and DS3231 data to the LoRa Receiver. 

For reference, here is my current code: https://pastebin.com/aQ4P5nA3

Next, Ill try to get the senders display working.

0 Vote Up Vote Down
Ross Satchell answered 4 years ago

Ok, I have run into my original problem again. 

https://pastebin.com/Qd7PB0pb
Line 76, where I call Wire.begin(OLED_SDA, OLED_SCL); 
prevents the sender from being able to do Serial.print and also prevents LoRa packets being sent.

I suspect its something to do with I2C. I think maybe since the OLED is using software defined SDA and SCL (OLED_SDA and OLED_SCL) , that may be causing the problem.

Can anyone advise of how I should proceed?

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi Ross.
 
I’m sorry for taking so long to answer.
 
Can you try using the BME280 on the pins suggested on this tutorial: https://randomnerdtutorials.com/esp32-lora-sensor-web-server/ and use the TwoWire instance to initialize the sensor as shown in the tutorial? I see that in your code, you’re using the default I2C pins.
 
So, you would use the following snippets to initialize the sensor
 

TwoWire I2Cone = TwoWire(1);
Adafruit_BME280 bme;

…

void startBME(){
  I2Cone.begin(SDA, SCL, 100000);
  bool status1 = bme.begin(0x76, &I2Cone);
  if (!status1) {
    Serial.println("Could not find a valid BME280_1 sensor, check wiring!");
    while (1);
  }
}

 
Let me know if this helps.
Regards,
Sara
 

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.