Hello guys,
im facing some issues with the gps. The first time i plugged it in it worked perfectly and now it doesnt anymore. I have switched arduino’s, cable’s etc yet nothing solved the problem.
The setup now a is arduino uno with a GY-GPS6MV2 from alieexpress:
https://www.aliexpress.com/item/1550843440.html?spm=a2g0s.9042311.0.0.27424c4dQ1ZB7W
The codes and setups i tried are as followed:
the neo 6m tx to the arduinos tx pin, the neo has its own powerbank for power. I am using the following code:
/*
* This is the Arduino code Ublox NEO-6M GPS module
* this code extracts the GPS latitude and longitude so it can be used for other purposes
*
* Written by Ahmad Nejrabi for Robojax Video
* Date: Jan. 24, 2017, in Ajax, Ontario, Canada
* Permission granted to share this code given that this
* note is kept with the code.
* Disclaimer: this code is "AS IS" and for educational purpose only.
*
*/
// written for RoboJax.com
String inputString = ""; // a string to hold incoming data
boolean stringComplete = false; // whether the string is complete
String signal = "$GPGLL";
void setup() {
// initialize serial:
Serial.begin(9600);
// reserve 200 bytes for the inputString:
inputString.reserve(200);
}
void loop() {
// print the string when a newline arrives:
if (stringComplete) {
String BB = inputString.substring(0, 6);
if (BB == signal) {
String LAT = inputString.substring(7, 17);
int LATperiod = LAT.indexOf('.');
int LATzero = LAT.indexOf('0');
if (LATzero == 0) {
LAT = LAT.substring(1);
}
String LON = inputString.substring(20, 31);
int LONperiod = LON.indexOf('.');
int LONTzero = LON.indexOf('0');
if (LONTzero == 0) {
LON = LON.substring(1);
}
Serial.println(LAT);
Serial.println(LON);
}
// Serial.println(inputString);
// clear the string:
inputString = "";
stringComplete = false;
}
}
/*
SerialEvent occurs whenever a new data comes in the
hardware serial RX. This routine is run between each
time loop() runs, so using delay inside loop can delay
response. Multiple bytes of data may be available.
*/
void serialEvent() {
while (Serial.available()) {
// get the new byte:
char inChar = (char) Serial.read();
// add it to the inputString:
inputString += inChar;
// if the incoming character is a newline, set a flag
// so the main loop can do something about it:
if (inChar == '\n') {
stringComplete = true;
}
}
}
the output gives me these results (if working randomly) with many strange characters. But stops after a few seconds.
12:37:43.628 -> bn6⸮⸮⸮⒊b⸮⸮b⸮⸮I⸮⸮,1,13,01,3⸮⸮⸮S⸮7,03⸮⸮⸮⸮⸮⸮g11[⸮žKI⸮⸮⸮4⸮⸮H⸮:A1⸮ML&r⸮⸮ʂ⸮br⸮00608.39963,E,1037⸮⸮L⸮A*6B
⸮⸮,A*79
12:37:44.486 -> $GPVTG,,T,,M,0.365,N,0.677,K,A*2⸮>C⸮⸮⸮⸮b⸮⸮⸮⸮rL⸮KLb⸮⸮⸮$GPRMC,104010.00,A⸮?72⸮i⸮⸮⸮⸮b⸮⸮608.40107,E,0⸮⸮⸮
⸮⸮⸮<⸮⸮b⸮⸮⸮⸮08.40117,E,0.039⸮Q⸮⸮⸮⸮⸮⸮⸮/⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮1,2⸮I⸮b⸮⸮⸮b⸮⸮R⸮⸮j
12:40:07.898 -> $GPGLL,51⸮⸮R⸮%⸮
⸮104012.00,A,5120.33678,N,00608.40121,E,0.114,,230820,,,A*7E
12:40:08.489 -> $GPVTG,,T,,M,0.114,N,0.211,K,A*25
12:40:08.524 -> $GPGGA,104012.00,5120.33678,N,00608.40121,E,1,06,2.3?,26.8,M,46.3,M⸮GPGSV,4,1⸮⸮b01,35⸮⸮b⸮⸮b⸮⸮b⸮⸮⸮bb⸮⸮b⸮⸮b⸮⸮,29,10,⸮⸮MNi⸮R⸮⸮⸮⸮b⸮b⸮⸮b⸮⸮b⸮⸮⸮⸮⸮⸮&⸮⸮b⸮b⸮⸮R⸮⸮j
12:40:08.802 -> $GPGSV,4,3,1&I⸮b⸮⸮⸮⸮)⸮⸮b⸮⸮b⸮⸮b⸮⸮b⸮⸮⸮⸮32,⸮6,?1>⸮⸮⸮⸮r⸮⸮⸮⸮⸮br⸮p0608⸮⸮012~p
12:40:09.425 -> ⸮⸮⸮⸮4013.00,A,5120.33⸮⸮K⸮ ⸮⸮⸮⸮r⸮⸮⸮⸮⸮b*⸮0.028,,230820,,,A*70
12:40:09.494 -> $GPVTG,,T,,⸮⸮⸮r⸮0.051,K,A*2D
Post continues as it is exceeding the max amount of characters.