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
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!
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!
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.
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?
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