How to connect gps to WiFi LoRa 32(V3)?

I use NEO-6M GPS module GY-GPS6MV2
and i want to connect with WiFi LoRa 32(V3)
I tried connecting the RX pin of the GPS module to pin 36 and the TX pin to pin 37.And connecting the RX pin to the TX pin on the board, connecting the TX pin to the RX pin on the board.
But I couldn’t receive any GPS signal.
Which pins of the GPS module should be connected to the ESP32, or how should the code be modified?
User
#include “heltec.h”

#include <SPI.h>

#include <TinyGPS++.h>

#define BAND 915E6 //you can set band here directly,e.g. 868E6,915E6

TinyGPSPlus gps;

unsigned int counter = 0;

String rssi = “RSSI --”;

String packSize = “–”;

String packet ;

int startSec;

int currentSec;

double latitude;

double longitude;

char latitudeString[12];

char longitudeString[12];

char gpsString[33];

char hhString[4];

char mmString[4];

int sendInterval = 10; //10 seconds

void displayInfo(){

if (gps.location.isValid()) {

  latitude=gps.location.lat();

  longitude=gps.location.lng();

  dtostrf(latitude,6,3,latitudeString);

  dtostrf(longitude,7,3,longitudeString);

  strcpy(gpsString, "Latitude:");

  strcat(gpsString, latitudeString);

  strcat(gpsString, " Longitude:");

  strcat(gpsString, longitudeString);

  Serial.print("Latitude: ");

  Serial.println(latitude, 6);

  Serial.print("Longitude: ");

  Serial.println(longitude, 6);

  Serial.print("Altitude: ");

  Serial.println(gps.altitude.meters());

}

else Serial.println(“Location: Not Available”);

Serial.print("Date: ");

if (gps.date.isValid()) {

  int mm=gps.date.month();

  int dd=gps.date.day();

  int yy=gps.date.year();

  Serial.print(mm);

  Serial.print("/");

  Serial.print(dd);

  Serial.print("/");

  Serial.println(yy);

}

else Serial.println(“Not Available”);

Serial.print("Time: ");

if (gps.time.isValid()) {

  int hh=gps.time.hour();

  int mm=gps.time.minute();

  int ss=gps.time.second();

  dtostrf(hh,2,0,hhString);

  dtostrf(mm,2,0,mmString);

  if (hh < 10) Serial.print(F("0"));

  Serial.print(hh);

  Serial.print(":");

  if (mm < 10) Serial.print(F("0"));

  Serial.print(mm);

  Serial.print(":");

  if (ss < 10) Serial.print(F("0"));

  Serial.print(ss);

  Serial.print(".");

  if (gps.time.centisecond() < 10) Serial.print(F("0"));

  Serial.println(gps.time.centisecond());

}

else Serial.println(“Not Available”);

Serial.println();

Serial.println();

delay(100);

}
void setup() {

Serial.begin(115200);

Serial2.begin(9600, SERIAL_8N1, 36 , 37);
Heltec.begin(true, false, true, true, BAND);

Heltec.display->init();

Heltec.display->flipScreenVertically();

Heltec.display->setFont(ArialMT_Plain_10);

Heltec.display->clear();

Heltec.display->drawString(0, 0, “Heltec.LoRa Initial success!”);

Heltec.display->display();

startSec = int(millis()/1000);

delay(500);

}

void loop(){

currentSec = int(millis()/1000);

while (Serial2.available() > 0)

  if (gps.encode(Serial2.read()))

  displayInfo();

if ((currentSec-startSec) > sendInterval) {

   Serial.println("Sending LoRa Data..."); 
   Serial.print("Latitude: ");
   Serial.println(latitude, 6);
   Serial.print("Longitude: ");
   Serial.println(longitude, 6);
   Serial.println("Attempting to start LoRa...");
   LoRa.beginPacket(); //send packet 

/*

  • LoRa.setTxPower(txPower,RFOUT_pin);

  • txPower – 0 ~ 20

  • RFOUT_pin could be RF_PACONFIG_PASELECT_PABOOST or RF_PACONFIG_PASELECT_RFO

    • RF_PACONFIG_PASELECT_PABOOST – LoRa single output via PABOOST, maximum output 20dBm
    • RF_PACONFIG_PASELECT_RFO – LoRa single output via RFO_HF / RFO_LF, maximum output 14dBm

*/

  LoRa.setTxPower(14,RF_PACONFIG_PASELECT_PABOOST);

  LoRa.println(gpsString);

  //LoRa.println(counter);

  LoRa.endPacket();

  digitalWrite(LED, HIGH); // turn the LED on 

  delay(1000); 

  digitalWrite(LED, LOW); // turn the LED off 


  Heltec.display->clear();

  Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);

  Heltec.display->setFont(ArialMT_Plain_10);

  Heltec.display->drawString(0, 0, "Sending packet: ");

  Heltec.display->drawString(90, 0, String(counter));

  Heltec.display->drawString(0, 20, "Latitude");

  Heltec.display->drawString(60, 20, "Longitude");

  Heltec.display->drawString(0, 32, String(latitude,4));

  Heltec.display->drawString(60, 32, String(longitude,4));

  Heltec.display->display(); 

  Serial.print("Frame Counter: ");

  Serial.println(counter);

  counter++;

  startSec = int(millis()/1000);

}

}

Respectfully, why in heck’s name did you choose pin 36 and 37? What source or thought did you come across that made you do that?

Looking at the pin diagram in the documentation (https://resource.heltec.cn/download/WiFi_LoRa32_V3/HTIT-WB32LA_V3(Rev1.1).pdf), you can see that those pins are for ADC_Ctrl and Vext_Ctrl with an upward arrow next to them, meaning these pins are a pull-up pin (always connected to HIGH voltage unless an external circuit pulls this to low.
You cannot use pull-up pins for communication of any kind to any sensor, these pins are there to control the battery readout pin and Vext pin power.

From the pin diagram, pins 45 and 46 appear to be completely empty; no other functions. So I suggest you use those and alter your Serial2.begin() accordingly.
Please let us know if that solves your problem!

1 Like

Despite changing the pins to 45 and 46 as instructed and modifying the code accordingly, I am still unable to receive any data. I wonder if there’s an issue with the code.

Sending LoRa Data…
Latitude: 0.000000
Longitude: 0.000000
Attempting to start LoRa…
The output on the serial monitor looks like this

It looks to me like you’re using the wrong software for the V3 modules. Start by getting rid of the heltec.h library then, if you want to use the Heltec software, use the LoRaWan_APP.h library, or there are other libraries (discussed in various other posts on this forum) around that also support the SX1262 LoRa chip in the V3 modules.

When you’ve got the right software loaded, you should be able to see the various Heltec examples (Examples > Heltec-Example) of how to use the LoRaWan_APP.h library, if that’s the one you’re going with. It’s entirely different to the old LoRa.h library, so you’ve got a bit of work to do with your code.

Although, of course, this has nothing to do with the GPS module, if that’s where your problem lies…