Following on from last week, we wanted to give the Arduino some love and make a GPS guide for it as well. We use C++ and an Uno R4 (but you could easily use an R3 or even an ESP32), to get our live location with the module. We then bring it all home by combining it with a magnetometer and OLED screen to build a nifty little project that gives us distance and direction to any targe location on earth! “How to add GPS to Your Arduino | Add Real-Time Location to Your Project!”
That depends on what your indoors is. We often struggled to get it to work inside of our big metal roofed warehouse, but if we were close to a window we could get our location to about 5 meters of accuracy.
You wouldn’t be able to find your exact location inside the building, but you would probably be able to tell which building you are in if that makes sense.
It is probably going to vary a lot and hard to tell unless it is tested. If you got any more questions let us know!
It depends a lot on your antenna. The smaller rectangular ones (~22mx8mm) pretty much require direct line of sight to the satellites. The larger square ones (25mmx25mm) are much better and will work in many indoor conditions. I have had good success with re-purposed WiFi antennae, although technically they are not properly matched. There are also many ideas around for making your own antenna.
c:\Users\bob\Documents\Arduino\libraries\GPSParser\GPSParser.cpp: In function ‘GPSData parse_gps_data(String)’:
c:\Users\bob\Documents\Arduino\libraries\GPSParser\GPSParser.cpp:108:43: error: ‘GPSData GPSReader::_process_nmea_data(String)’ is private within this context
return tmp._process_nmea_data(nmea_chunk);
^
In file included from c:\Users\bob\Documents\Arduino\libraries\GPSParser\GPSParser.cpp:2:0:
c:\Users\bob\Documents\Arduino\libraries\GPSParser\GPSParser.h:50:13: note: declared private here
GPSData _process_nmea_data(String nmea_data);
^~~~~~~~~~~~~~~~~~
c:\Users\bob\Documents\Arduino\libraries\GPSParser\GPSParser.cpp: In member function ‘GPSData GPSReader::_process_nmea_data(String)’:
c:\Users\bob\Documents\Arduino\libraries\GPSParser\GPSParser.cpp:125:30: error: no match for ‘operator=’ (operand types are ‘String’ and ‘void’)
sentence = sentence.trim();
^
In file included from C:\Users\bob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/Arduino.h:232:0,
from c:\Users\bob\Documents\Arduino\libraries\GPSParser\GPSParser.h:8,
from c:\Users\bob\Documents\Arduino\libraries\GPSParser\GPSParser.cpp:2:
C:\Users\bob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/WString.h:86:11: note: candidate: String& String::operator=(const String&)
String & operator = (const String &rhs);
^~~~~~~~
C:\Users\bob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/WString.h:86:11: note: no known conversion for argument 1 from ‘void’ to ‘const String&’
C:\Users\bob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/WString.h:87:11: note: candidate: String& String::operator=(const char*)
String & operator = (const char cstr);
^~~~~~~~
C:\Users\bob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/WString.h:87:11: note: no known conversion for argument 1 from ‘void’ to 'const char’
C:\Users\bob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/WString.h:88:11: note: candidate: String& String::operator=(const __FlashStringHelper*)
String & operator = (const __FlashStringHelper str);
^~~~~~~~
C:\Users\bob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/WString.h:88:11: note: no known conversion for argument 1 from ‘void’ to 'const __FlashStringHelper’
C:\Users\bob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/WString.h:90:11: note: candidate: String& String::operator=(String&&)
String & operator = (String &&rval);
^~~~~~~~
C:\Users\bob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/WString.h:90:11: note: no known conversion for argument 1 from ‘void’ to ‘String&&’
C:\Users\bob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/WString.h:91:11: note: candidate: String& String::operator=(StringSumHelper&&)
String & operator = (StringSumHelper &&rval);
^~~~~~~~
C:\Users\bob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/WString.h:91:11: note: no known conversion for argument 1 from ‘void’ to ‘StringSumHelper&&’
exit status 1
Compilation error: exit status 1
"compilation problem…using uno R4 board , IDE vers.2.3.5
all libraries are up to date …incl…your gps parser …Can you help?
Sorry to hear you are having issues with this library. I have given this a spin on my end and it looks like some of that code is a little outdated now.
I have updated a few lines to get it working from my Arduino IDE. Would it be possible for you to try on your end with this version of the library to see if the changes I have made work for your setup?
hi Jaryd, I have a Leonardo r3 and a GPS module and 320x240 colour screen, I bought from Jaycar in 2018. They had a project to make a GPS speedometer. I checked all the project links seemed to have disappeared. I recall it had
#include <NeoHWSerial.h> //enables hardware interrupts on gps serial port
#include <GPSport.h> //switches on the above
#include <NMEAGPS.h> //GPS library
#include <UTFTGLUE.h> //we are using UTFT display methods
as sketches, but I never got it to compile for work at all. I was wondering if I could learn from your sketch and find updated sketches for the above and maybe compile it,
Can you see any issues with getting it to work, oh 7yrs later than planned?
The sketch is still in my IDE, where I found the above.
I had a look around as well and can’t find anything about the project, bit unwise for them not to at least whack it on GitHub or anything like that .
Not a gaurentee, but chances are the output string from your GPS module may work with the guide! If I recall correctly the library is just looking for specific characters in the large string that the GPS returns, and chances are the string that your module returns will have the same standardised structure.
If not, LLMs like ChatGPT and Claude are also great at writing code for mystery modules like these. Many times I have picked up niche parts from china and gotten them to help me decode and start using them.
I am having a bit of an issue with parsing and outputting the data from the Neo 6M GPS module to an OLED screen. I am following the “Adding GPS to your Arduino” project, and using the latest GPS Parser version posted in the comments underneath, the data isn’t being processed right it looks like.
The parser outputs the latitude and longitude to the serial monitor / OLED screen just fine, but every other piece of data like altitude and the number of satellites is zero. Possibly related is when the GPS LED flashes indicating it has a lock, the parser output sometimes says that there is no lock, which is weird.
I have wired everything up the same as in the project article, except I am using an arduino nano eveyr instead of an Uno R3 / R4. Does anyone have any ideas on how to remedy this?
Can you run the raw UART reading code and let us know what it is outputting? Here is that code:
from machine import Pin, UART
import time
# Set up UART connection to GPS module
uart = UART(0, baudrate=9600, tx=Pin(0), rx=Pin(1))
# Main loop
while True:
# Check if data is available from GPS
if uart.any():
# Read the available data
gps_reading = uart.read().decode('utf-8')
print(gps_reading)
It Is funky that the red LED saying it has a lock, but let’s just double check with this. Here is also a breakdown of the NMEA message:
The yellow-highlighted A in the first line will be V if there is no lock, and the red number in the 3rd line lets us know how many satellites it sees. If you could let us know what you are seeing on your end that would help a lot.
PLEASE DO NOT POST THE FULL OUTPUT, IT WILL HAVE YOUR EXACT LOCATION.
Thanks so much for the responses. For some additional context, I am using an arduino nano every as the board.
Yes, it it the U-blox NEO-6M GPS module, and in terms of the parser I am using, I am using the GPSParserV3.zip posted on 20 June by Samuel, as it did not produce an error when compiling.
@Jaryd , The raw output is pretty consistent once the GPS has a lock and looks pretty much identical to what you have posted. However, when I try and parse it, the output is less consistent, in that all the data except the number of satellites and altitude comes through fine.
I had a quick blokes look at the code in the zip file from above assuming your posted data was in the uart buffer and it seemed ok to me. things seemed to align (on a visual walk through, not actually running any code).
In your application, how does it call this class to get its new data ?
(While i assume its in the guide your following, I have not read it, so being a bit lazy I thought I would just ask )
I am calling the struct in the GPSParser library like in the project, so that is with the line: GPSData gps_data = gps.get_data(). I tested it an hour or so ago and i was able to print out all the data except the satellite number and altitude pretty reliably. So hdop, pdop, vdop, velocity, time, date and lat/long are all fine but for some reason satellite number is more often that not 0, and altitude is pretty much always a 0.
Looking at that section in the GPSParser version I am using, it is identical to what you have posted. In terms of how I am calling it, I am using the second demo code in the guide.