Displaying two lots of Serial data

Morning all

I am trying to get a GPS unit (GT-U7) and a BME888 (temp and pressure) unit on the same program but am running into issues. I can get they both working individually but when I combine the programs they stop functioning. Could anyone suggest what I might be doing wrong, from what I can work out it is when I add in the second Serial call for data for the GPS.
Program below, thanks.

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BME680.h"
#include <SPI.h>
#include <SD.h>
#include <SoftwareSerial.h>
#include <FuGPS.h>
#define SoftTX 2
#define SoftRX 3

SoftwareSerial SerialSoft(SoftRX, SoftTX); // RX, TX
FuGPS fuGPS(SerialSoft);
 
#define SEALEVELPRESSURE_HPA (1013.25)
 
Adafruit_BME680 bme; // Create a BME680 sensor object for I2C
 
void setup() {
  Serial.begin(9600);
  while (!Serial);
  Serial.println(F("BME680 test"));
     if (!bme.begin()) {
    Serial.println("Could not find a valid BME680 sensor, check wiring!");
    while (1); // Stay in a loop if the sensor is not found
    
    //delay(1000);
    //Serial.println("");
   //  
//SerialSoft.begin(9600);
//delay(5000);
  }
 
  // Configure sensor settings
  bme.setTemperatureOversampling(BME680_OS_8X);
  bme.setHumidityOversampling(BME680_OS_2X);
  bme.setPressureOversampling(BME680_OS_4X);
  bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
  bme.setGasHeater(320, 150); // 320°C for 150 ms
}
 
void loop() {

delay(2000);
pressure();
//GPS();
}

void pressure(){
  // Check if the BME680 sensor reading was successful
  if (!bme.performReading()) {
    Serial.println("Failed to perform reading :(");
    return;
  }
 
  // Display temperature in degrees Celsius
  Serial.print("Temperature = ");
  Serial.print(bme.temperature);
  Serial.println(" °C");
 
  // Display pressure in hPa (hectopascals)
  Serial.print("Pressure = ");
  Serial.print(bme.pressure / 100.0);
  Serial.println(" hPa");
 
  // Display humidity in percentage
  Serial.print("Humidity = ");
  Serial.print(bme.humidity);
  Serial.println(" %");
 
  // Calculate Dew Point
  float dewPoint = bme.temperature - ((100 - bme.humidity) / 5);
  Serial.print("Dew Point = ");
  Serial.print(dewPoint);
  Serial.println(" °C");
 
  // Display gas resistance in KOhms
  Serial.print("Gas = ");
  Serial.print(bme.gas_resistance / 1000.0);
  Serial.println(" KOhms");
 
  // Calculate and display approximate altitude
  Serial.print("Approx. Altitude = ");
  Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
  Serial.println(" m");
 
  // Print a blank line for better readability
  Serial.println();
  
 
  // Delay for 2 seconds before the next reading
  delay(2000);
  
  GPS();
}

void GPS(){
if (fuGPS.read())
{
Serial.print("Quality: ");
Serial.println(fuGPS.Quality);

Serial.print("Satellites: ");
Serial.println(fuGPS.Satellites);

if (fuGPS.hasFix() == true)
{
 //Data from GGA message
Serial.print("Accuracy (HDOP): ");
Serial.println(fuGPS.Accuracy);

Serial.print("Altitude (above sea level): ");
Serial.println(fuGPS.Altitude);

Serial.println("Date:"+String(fuGPS.Days)+"-"+String(fuGPS.Months)+"-20"+String(fuGPS.Years)+" "+String(fuGPS.Hours)+":"+String(fuGPS.Minutes)+":"+String(fuGPS.Seconds));

Serial.println("Latitude: " + String(fuGPS.Latitude, 6) + ", Longitude: " + String(fuGPS.Longitude, 6));

}
}
}

how is the sensor connected to the Arduino and which board are you using ?

I am using a custom made PCB. The sensors are:

GooouuuTech GT-U7 for the GPS
BME688 for temp and pressure

Both working fine in the board independently.

I think it is due to the Serialsoft command but not sure what I can do about it?

Which processor pins does the BME688 use ?

Have you tried a different GPS library ?

I have the BME688 connected to A4 and A5 SDA and SCL.

I haven't tried a different GPS library yet. I will see if that makes any difference.

Post your annotated schematic that sound like a hardware problem. Be sure to show all power sources and links to the technical information on the hardware devices.

Directly from the FuGPS github webpage

Please, don't use SoftwareSerial

yet, here we are. The examples on that page use NeoSWSerial.h

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.