SX1278 Lora Module and Neo 6m gps failing to work together on Arduino uno

Hello engineers, may you kindly assist.

When i connect both the GPS module (Neo 6M) and the LoRa module (SX1278) to the Arduino Uno, the LoRa module fails to initialize. However, when I connect only the LoRa module, it initializes successfully.

Components:

  • Arduino Uno
  • Neo 6M GPS module
  • SX1278 LoRa module

below is the code and I have also attached an image. Your assistance will be greatly appreciated :smile:.

#include <SoftwareSerial.h>
#include <TinyGPS++.h>
#include <SPI.h>
#include <LoRa.h>


SoftwareSerial gpsSerial(14, 15); // RX, TX pins for NEO-6M GPS module
TinyGPSPlus gps;

#define LORA_SS_PIN 10 // LoRa module's NSS pin
#define LORA_RST_PIN 9 // LoRa module's RESET pin
#define LORA_DIO0_PIN 2 // LoRa module's DIO0 pin

void setup() {
  Serial.begin(9600); // Set up Serial library at 9600 bps

  gpsSerial.begin(9600);

  SPI.begin(); // Initialize SPI for LoRa module
  LoRa.setPins(LORA_SS_PIN, LORA_RST_PIN, LORA_DIO0_PIN);

  
  if (!LoRa.begin(433E6)) {
    Serial.println("LoRa initialization failed!");
    while (1);
  }
  else
  {
    Serial.println("LoRa initialization successful!");
  }
}

void loop() {
  while (gpsSerial.available() > 0) {
    if (gps.encode(gpsSerial.read())) {
      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);

        String coordinates = String(latitude, 6) + "," + String(longitude, 6);
        LoRa.beginPacket();
        LoRa.print(coordinates);
        LoRa.endPacket();
      }
    }
  }

}

Can you show us how you have it wired up ?

There are a few potential issues using a SX1278 module and a GPS on a UNO, which can cause damage to the components.

Ok let try to explain how i connected everything

Now
Lora module connections to arduino
Sck-D13
Miso-D12
Mosi-D11
Nss-D10
Rst-D9
IDO-D2
Vcc-3.3v
Gnd-Gnd

Gps connections to arduino
Rx-D0
Tx-D1
Gnd-Gnd
Vcc-3.3v

I hope it helps.

Well, there are issues with that setup.

First the UNO is a 5V logic device and the LoRa module and GPS will be 3.3V logic devices so you need to use logic level conversion circuits to connect them.

Second a lot of UNOs can only supply 50mA on the 3.3V pin, and that is just not enough current to power the LoRa module and GPS.

Basically the UNO is unsuited to be used directly with the devices you are using. A 3.3V logic Arduino makes the setup a lot easier.

There are also issues using softwareserial with SPI devices such as the LoRa, the softwareserial can interfere with the SPI. The real solution is to use an Arduino that has a second hardware serial port, although there are workarounds.

The code you posted had the GPS on pins 14,15

Thank you very much especially on those current issues. I will implement all the solutions mentioned ASAP and get back to you

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