Arduino Uno, LoRa and GPS Module

Hello everyone, I am trying to work on a project in which I can build a module to send and receive data. However, when I am coding the code doesn't work, it is saying that there is no gps data. I am using the Arduino Uno, MakerFocus GT-U7 Gps and the HopeRF original sx1276 Based Rf module (this is the LoRa1276, RFM95W 915MHz). I tried to provide some info about the modules.

#include <SPI.h>

#include <LoRa.h>

#include <TinyGPS++.h>

#include <SoftwareSerial.h>

const int resetPin = 9;

const int nssPin = 10;

const int irqPin = 3;

// GPS module pins

static const int RXPin = 2, TXPin = 4;  // RX and TX pins for the GPS module

static const uint32_t GPSBaud = 9600;  // Baud rate for the GPS communication

TinyGPSPlus gps;  // The TinyGPS++ object

SoftwareSerial ss(RXPin, TXPin);  // The serial connection to the GPS device

byte msgCount = 0;

void setup() {

  Serial.begin(9600);

  while (!Serial)
    ;

  LoRa.setPins(nssPin, resetPin, irqPin);

  Serial.println("LoRa Sender Test");

  if (!LoRa.begin(915E6)) {

    Serial.println("Starting LoRa failed!");

    while (1)
      ;
  }

  ss.begin(GPSBaud);  // Begin serial communication for GPS
}

void loop() {

  // Read data from the GPS module

  while (ss.available() > 0) {

    gps.encode(ss.read());
  }

  // Extract GPS data

  if (gps.location.isValid()) {

    float latitude = gps.location.lat();

    float longitude = gps.location.lng();

    Serial.print("Latitude: ");

    Serial.println(latitude, 6);

    Serial.print("Longitude: ");

    Serial.println(longitude, 6);

    Serial.print("Sending packet: ");

    Serial.println(msgCount);

    // Send the GPS data via LoRa

    LoRa.beginPacket();

    LoRa.print("Packet ");

    LoRa.print(msgCount);

    LoRa.print(",LAT=");  //include latitude reading

    LoRa.print(latitude, 6);

    LoRa.print(",LNG=");  // include longitude reading

    LoRa.print(longitude, 6);

    LoRa.endPacket();

    msgCount++;  // Increment packet counter

  } else {

    Serial.println("No GPS data");
  }

  delay(5000);  // Delay before next transmission
}

Please help. Also I hope I formatted everything correctly when it comes to code.

first question: did you connect GPS module RX to Arduino TX, and GPS module TX to Arduino RX. if you did not, you would be the first person to make that mistake ever.

upload a schematic showing wiring and power supplies
can you read the raw GPS NMEA data?
upload the serial monitor output (as text not a screen image)

note that the UNO uses 5V logic - the majority of LoRa modules use 3.3V logic therefore require level converters to interface to a UNO

Where did you get that code from ?

The code reads one character from the GPS, checks if the location is valid yet, prints "No GPS data", then waits for 5 seconds before reading another single character from the GPS.

I basically took code from things like Tiny GPS and the gps u7 code and the Sandeep Mistry LoRa library. So I mixed them together. I also know the 5 seconds is kinda soon but I just want to try and get this working. I have also tried the SX1277 projects from StuartsProjects separately but they didn't; work.

Hello, I accidentally like put the solution button on this I didn't mean to do that sorry. I am still kinda new to this. Anyways here is the schematics of everything. Then with the raw gps data I can't see anything. Basically the serial monitor is like LoRa Sender test no gps data. Then it just keeps saying no GPS data.

For Lora to Arduino uno
Power-> 3.3V
DIO0->3
Rst-> 9
MOSI->11
MISO-> 12
SCK->13
GND->GND
NSS->10

Then GPS to Arduino Uno
TXD->4
RXD->2
GND->GND
VCC->5V

Start at the beginning.

Dont try to do too much at once.

If you want to work out what your problem is take a simple logical approach.

Using the standard examples provided in the GPS library to prove that your GPS is working.

Then use the examples in the LoRa library to prove that the LoRa devices can send and receive packets.

Do appreciate that its extremely likely that the examples provided with a library do work and if they don't for you you need to work out what you have wired wrong or which parts are faulty.

You did not say, but have you solved the logic level conversion issues mentione in post #3, waste of everyones time if you have not.

As an example of 'Start at the beginning'.

I have been working on a new Arduino board that has an ESP32S3, LoRa module, I2C OLED display, SD card, GPS.

I have so far written separate test programs for;

Blink the LED.
I2C scanner, to check if the I2C display is found.
OLED display test.
SD Card mount test.
Copy GPS output to Serial monitor.
LoRa transmit packet.
LoRa receive packet.

Now that I know all the stuff is wired correctly and working, I can start writing an application.

Hello thank you for your help I figured out what was wrong. As someone had mentioned above I had to flip my TX and RX wires. I am pretty new to this lol. So now I have confirmed that both my LoRa sender and receiver work as well as the gps. However, it is separate and I want to make it together. I have a code in which I will paste below that I think kinda mesh them together, however when I try it it doesn't get gps data I only get like the LoRa is starting up.

#include <LoRa.h>
#include <SPI.h>

const int NRESET = 9;
const int NSSPin = 10;
const int DIO0 = 3;

void setup() {
  Serial.begin(9600);
  while (!Serial)
    ;

  LoRa.setPins(NSSPin, NRESET, DIO0);

  Serial.println("LoRa Receiver Test");

  if (!LoRa.begin(915E6)) {
    Serial.println("Starting LoRa failed!");
    while (1)
      ;
  }
}

void loop() {
  int packetSize = LoRa.parsePacket();
  if (packetSize) {
    Serial.print("Received packet '");

    while (LoRa.available()) {
      Serial.print((char)LoRa.read());
    }

    Serial.print("' with RSSI ");
    Serial.println(LoRa.packetRssi());
  }
}

hello, I want to thank you for your help. I was making that mistake lol.

the code in post 10 only appears to communicate with the LoRa module
did you post the wrong code?

noted in post 1 you are using SoftwareSerial for GPS - you may find that AltSoftSerial works better