Hi,
I am trying to work with these two modules and i am not able to make the esp32 receive any valid
gps data, at all. The code i run:
#include <TinyGPS++.h>
#include <HardwareSerial.h>
static const int RXPin = 25, TXPin = 26;
static const uint32_t GPSBaud = 9600;
TinyGPSPlus gps;
HardwareSerial GPSSerial(2);
void setup()
{
Serial.begin(9600);
GPSSerial.begin(GPSBaud, SERIAL_8N1, RXPin, TXPin);
}
void loop()
{
while (GPSSerial.available() > 0)
if (gps.encode(GPSSerial.read()))
displayInfo();
if (millis() > 5000 && gps.charsProcessed() < 10)
{
Serial.println(F("No GPS detected: check wiring."));
while(true);
}
}
void displayInfo()
{
Serial.print(F("Location: "));
if (gps.location.isValid())
{
Serial.print(gps.location.lat(), 6);
Serial.print(F(","));
Serial.print(gps.location.lng(), 6);
}
else
{
Serial.print(F("INVALID"));
}
Serial.print(F(" Date "));
if (gps.date.isValid())
{
Serial.print(gps.date.month());
Serial.print(F("/"));
Serial.print(gps.date.day());
Serial.print(F("/"));
Serial.print(gps.date.year());
}
else
{
Serial.print(F("INVALID"));
}
Serial.println();
}
.And the output:
20:41:39.448 -> Location: INVALID Date 0/0/2000
20:41:39.495 -> Location: INVALID Date 0/0/2000
20:41:40.218 -> Location: INVALID Date 0/0/2000
20:41:40.251 -> Location: INVALID Date 0/0/2000
20:41:40.298 -> Location: INVALID Date 0/0/2000
20:41:40.343 -> Location: INVALID Date 0/0/2000
20:41:40.384 -> Location: INVALID Date 0/0/2000
20:41:40.417 -> Location: INVALID Date 0/0/2000
20:41:40.451 -> Location: INVALID Date 0/0/2000
...
From the pinout of the board i can see that the only default uart pins are IO1, IO3, which is the usual UART0 and cannot directly be used for serial communication.
(Note that this is the Firebeetle 1st revision and not the 2nd one, that is available on DFRobot's website)
The first thing i suspect, is that i got the serial communication wrong and there is something i am missing. Maybe some restricted pins, or lack of UART.
Also, here are the specs of the GPS module according to the retailer.
- GPS Chip parameters:
- Receiver type 72-channel u-blox M8 engine
- GPS/QZSS L1 C/A, GLONASS L10F, BeiDou B1
- SBAS L1 C/A: WAAS, EGNOS, MSAS
- Galileo-ready E1B/C (NEO-M8N)
- Nav. update rate1 Single GNSS: up to 18 HZ
- Concurrent GNSS: up to 10 Hz
- Position accuracy2 2.0 m CEP
- Acquisition2 Cold starts: 26 s
- Aided starts: 2 s
- Reacquisition: 1.5 s
- Sensitivity2 Tracking & Nav: –167 dBm
- Cold starts: –148 dBm
- Hot starts: –156 dBm
- Assistance AssistNow GNSS Online
- AssistNow GNSS Offline (up to 35 days)3
- AssistNow Autonomous (up to 6 days)
- OMA SUPL & 3GPP compliant
- Oscillator TCXO (NEO-M8N/Q),
- Crystal (NEO-M8M)
- RTC crystal Built-In
- Noise figure On-chip LNA (NEO-M8M). Extra LNA for
- lowest noise figure (NEO-M8N/Q)
- Anti jamming Active CW detection and removal. Extra
- onboard SAW band pass filter (NEO-M8N/Q)
- Memory ROM (NEO-M8M/Q) or Flash (NEO-M8N)
- Supported antennas Active and passive
- Odometer Travelled distance
- Data-logger For position, velocity, and time (NEO-M8N)
- Operating temp. –40° C to 85° C
- Storage temp. –40° C to 85° C (NEO-M8N/Q)
- 40° C to 105° C (NEO-M8M)
- RoHS compliant (lead-free)
- Qualification according to ISO 16750
- Manufactured and fully tested in ISO/TS 16949 certified production sites
- Uses u-blox M8 chips qualified according to AEC-Q100
- Supply voltage 1.65 V to 3.6 V (NEO-M8M)
- 2.7 V to 3.6 V (NEO-M8N/Q)
- Power consumption4 23 mA @ 3.0 V (continuous)
- 5 mA @ 3.0 V Power Save Mode
- (1 Hz, GPS mode only)
- Backup Supply 1.4 to 3.6 V
- NEO-M8N-0 u-blox M8 Concurrent GNSS LCC Module,
- TCXO, flash, SAW, LNA,
- Timepulse Configurable 0.25 Hz to 10 MHz
I am powering the module with a 18650 3.6 volt battery, using a 15 Ohm resistor, restricting the voltage to about 3.3 Volts which falls in the normal supply voltage range.
I really dont believe the module is faulty, since it searches for satellites just fine and connects to one, every time there is a chance(I can tell by the blinking light next to the antenna, which it signifies the current status).
What do you think?
As requested by aarg, here is roughly a schematic: