billygr / arduino-aprs-tracker

An Arduino APRS Tracker
http://www.billy.gr/arduino-aprs-tracker/
59 stars 31 forks source link

SmartBeaconing is sending invalid packets after long time continuous working #10

Closed kovalroma closed 8 months ago

kovalroma commented 4 years ago

Hello, We have tested new SmartBeaconing feature (tested on 2 devices) during long time (few days) continuous work. We found very strange issues.

During first several days all sending correctly. But later we found that trackers send invalid data -9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=5036.75N/02614.07E>/A=000746Arduino APRS Tracker Should be UR5KSH-9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=5036.75N/02614.07E>/A=000746Arduino APRS Tracker

And the second tracker UR5KHL-9>APZMDM,UR5KSH-1,WIDE1*,WIDE2-2,qAO,UR5KDK-2:=5044.37N/02603.18E>-16/60/A=000670Arduino APRS Tracker Screenshot_230

To fix invalid behavior I restarted device.

I think this error someway connected with buffer overload.

billygr commented 4 years ago

Still checking it, thanks for reporting it

kovalroma commented 4 years ago

Was it possible to reproduce the error?

billygr commented 4 years ago

Nope, i reset it today and will let it there running for 48h again (stationery)

kovalroma commented 4 years ago

In our case bug appears after 7 days. So, maybe 48h would be not enough.

kovalroma commented 4 years ago

Hello @billygr Any news? Does only our setup has such kind of problem? If yes maybe we need to try to change Arduino board.

billygr commented 4 years ago

Hi,

It is software related for sure but i cannot trace it. What is the Arduino IDE version you are using ? Can you please try with the latest ?

kovalroma commented 3 years ago

Good morning, hope you are doing well. After long time we found what's cause problem of irregular distance (it was our second problem). Definitely something wrong with GPS data.

Please look here, this is Arduino terminal:

Screenshot_335 Screenshot_334

Sometimes GPS send incorrect coordinates (putting zero) to Arduino:

Sometimes like this> Lat: correct_data Lon: 0.00000
Sometimes like this> Lat: 0.00000 Lon: 0.00000

In theory any object could be in such position, but in practice this is almost impossible. Maybe it's good idea to add additional check ? I will explain what I mean. For instance if distance between 2 coordinates more than 100 km, it's mean that something wrong with GPS data, and in this case just ignore such packet ? Almost all our tracker (3 pieces) has such type of bug.

In additional. The same hardware (Arduino, GPS) works create in previous firmware, without SmartBeacon, where only interval beaconing send. Maybe this problem somehow connected with continuous data transmission between Arduino and GPS in case of SmartBeaconing and interval data transmission in case of interval beaconing ?

Today we are going to upload firmware with latest Arduino and library. I'll let you know about the results.

billygr commented 3 years ago

Got it , it looks like the invalid is always 0.0000 let me work with it over the weekend and drop this type of location when they arrive from the GPS

kovalroma commented 3 years ago

This is packet from aprsdirect.com. I think at least Lat or Lon is 0.0000 when it failed.

UR5KSH-9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=0000.00N/00004.00E>-48/03/A=000662Arduino APRS Tracker

Also this string -48/03/ is very strange

-48/03/A=000662Arduino APRS Tracker

In additional to manuall validate coordinates maybe we shoud also validate that temp variable from https://github.com/billygr/arduino-aprs-tracker/blob/de4ff6c1971c3560d853e6b98d39e82cd3298869/arduino-aprs-tracker/arduino-aprs-tracker.ino#L218 is correct before sending packet APRS_sendLoc()
Or even check that variable APRS_comment started from /A= .

billygr commented 3 years ago

Thank you, and the code is from the SmartBeacon branch ?

kovalroma commented 3 years ago

Thank you, and the code is from the SmartBeacon branch ?

Yes. It's from SmartBeacon branch. Master branch works without bugs.

kovalroma commented 3 years ago

Please take a look on this packet

UR5KHL-9 to APZMDM-0 via WIDE1-1,WIDE2-2 UI  PID=F0 5037.58N/02614.70E>-22/23./A=004200Arduino APRS Tracker. V=13.5

This is decoded APRS packet. After 6 hours we have lot's of packet's with incorrect course and speed data. This -22/23./ should be represented as 000/000 or .../... or VVV/VVV

APRS reference:

The 7-byte CSE/SPD Data Extension can be used to represent the course and 
speed of a vehicle or APRS Object. 
The course is expressed in degrees (001-360), clockwise from due north. The 
speed is expressed in knots. A slash / character separates the two. 
For example: 
 088/036 represents a course 88 degrees, traveling at 36 knots. 
If the course and speed are unknown or not relevant, they can be set to 
000/000 or .../... or VVV/VVV. 

I found that this data are based on following expressions https://github.com/billygr/arduino-aprs-tracker/blob/de4ff6c1971c3560d853e6b98d39e82cd3298869/arduino-aprs-tracker/arduino-aprs-tracker.ino#L127

https://github.com/billygr/arduino-aprs-tracker/blob/de4ff6c1971c3560d853e6b98d39e82cd3298869/arduino-aprs-tracker/arduino-aprs-tracker.ino#L125

Where the problem is ? Is it because of incorrect Arduino calculation or incorrect data received from satellite ?
gps.f_course() calculated on Arduino with TinyGPS or this is just received data from satellite ?

kovalroma commented 3 years ago

This is from TiniGPS

case COMBINE(_GPS_SENTENCE_GPRMC, 8): // Course (GPRMC)
      _new_course = parse_decimal();

Can you confirm that speed_kt is received from GPS module. So, Arduino received speed and course in GPRMC message which had calculated on GPS module compute system ?

billygr commented 3 years ago

Hi,

Let's try to fix it one step at a time. I have added a small check for lat if 0 it will be ignored Can you please confirm that it is working as expected ?

kovalroma commented 3 years ago

Hi,

Let's try to fix it one step at a time. I have added a small check for lat if 0 it will be ignored Can you please confirm that it is working as expected ?

Hey, thanks! I will test new code and let you know.

BTW, we use Neo-6m GPS module. This is quite similar, to Adafruit Ultimate GPS. But much more cheaper.

Also I found this library dedicated to work with our hardware.

billygr commented 3 years ago

Hi,

I am waiting for a one Neo-6m. Use whatever is available, there is a chance that are fake (if coming from china) but still they work . I will look over this code maybe it will help to reduce the ram usage (needed for LibAPRS)

Billy

kovalroma commented 3 years ago

Hi,

I am waiting for a one Neo-6m. Use whatever is available, there is a chance that are fake (if coming from china) but still they work . I will look over this code maybe it will help to reduce the ram usage (needed for LibAPRS)

Billy

We bought Neo-6m on Aliexpress, so definitely fake. But nevertheless they correctly work with U-Center.

Here is our APRS log with new firmware after 8 hours. For example randomly 10 minutes from 9:30 to 9:40. We got 16 packet.

Problem with incorrect coordinates not found.

Problem with incorrect course/speed is found.
11 packet are correct, 5 packet are not correct.

All the time Arduino is connected and doesn't move.

26.01.2021 09:30:10+01:00: UR5KHL-9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=5037.59N/02614.71E>/A=004200Arduino APRS Tracker

26.01.2021 09:30:40+01:00: UR5KHL-9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=5037.59N/02614.71E>-31/35/A=004200Arduino APRS Tracker

26.01.2021 09:30:43+01:00: UR5KHL-9>APZMDM,UR5KSH-1,WIDE1,UR4PWJ-1*,WIDE2-1,qAS,UR3PDA-9:=5037.59N/02614.71E>-31/35

26.01.2021 09:31:09+01:00: UR5KHL-9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=5037.59N/02614.70E>/A=004200Arduino APRS Tracker

26.01.2021 09:31:58+01:00: UR5KHL-9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=5037.59N/02614.69E>/A=004200Arduino APRS Tracker

26.01.2021 09:33:28+01:00: UR5KHL-9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=5037.59N/02614.71E>/A=004200Arduino APRS Tracker

26.01.2021 09:34:35+01:00: UR5KHL-9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=5037.58N/02614.69E>/A=004200Arduino APRS Tracker

26.01.2021 09:35:39+01:00: UR5KHL-9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=5037.58N/02614.70E>/A=004200Arduino APRS Tracker  [Duplicate]

26.01.2021 09:36:29+01:00: UR5KHL-9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=5037.58N/02614.70E>/A=004200Arduino APRS Tracker  [Duplicate]

26.01.2021 09:37:13+01:00: UR5KHL-9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=5037.59N/02614.70E>/A=004200Arduino APRS Tracker

26.01.2021 09:38:12+01:00: UR5KHL-9>APZMDM,UR5KSH-1,WIDE1*,WIDE2-2,qAR,UR4PWJ-1:=5037.59N/02614.70E>138/001/A=004200Arduino APRS Tracker

26.01.2021 09:38:36+01:00: UR5KHL-9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=5037.58N/02614.70E>/A=004200Arduino APRS Tracker  [Duplicate]

26.01.2021 09:39:03+01:00: UR5KHL-9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=5037.59N/02614.70E>183/002/A=004200Arduino APRS Tracker

26.01.2021 09:39:33+01:00: UR5KHL-9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=5037.59N/02614.70E>/A=004200Arduino APRS Tracker

26.01.2021 09:40:10+01:00: UR5KHL-9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=5037.59N/02614.70E>173/001/A=004200Arduino APRS Tracker

26.01.2021 09:40:54+01:00: UR5KHL-9>APZMDM,WIDE1-1,WIDE2-2,qAR,UR5KSH-1:=5037.59N/02614.70E>/A=004200Arduino APRS Tracker

We will continue to monitor.

kovalroma commented 3 years ago

Problem with incorrect coordinates appears again (approximately after 18 hours continuously work ).

Screenshot_346

Here is the bug Lot: 00000.39E :)

My personal opinion. After few days of thinking I believe that the problem is in Arduino, maybe lack of RAM or buffer overhead.

I will try to explain my thoughts.

  1. When we connect GPS module and run this https://github.com/mikalhart/TinyGPS/blob/master/examples/test_with_gps_device/test_with_gps_device.ino we never saw incorrect coordinates.
  2. We never saw incorrect coordinates when we use arduino-aprs-tracker master branch (without smart beaconing).
  3. Lack of RAM or buffer overhead could explain issue with inconsistent speed/course. Restart helps.

All of the above shows that GPS works correctly and problem is not in incorrect NMEA sentences, but with operation in Arduino.

billygr commented 3 years ago

Hi,

  1. This is the reason that it is difficult to trace it What worries me is that the altitude is WAY wrong and this value is reported directly from the GPS

Did you ever seen a correct altitude ?

kovalroma commented 3 years ago

Did you ever seen a correct altitude ?

Hm, good question. We tested GPS using this example https://github.com/mikalhart/TinyGPS/blob/master/examples/test_with_gps_device/test_with_gps_device.ino

Screenshot_351

Altitude shows correctly.

But with your firmware altitude always the same. m/ft: 1000000.00/4200

What is the most interesting. According to code https://github.com/billygr/arduino-aprs-tracker/blob/b32518e5d32f26526903e803a8dba6900cd4fa45/arduino-aprs-tracker/arduino-aprs-tracker.ino#L161

First should be falt and than ialt. But https://github.com/billygr/arduino-aprs-tracker/blob/b32518e5d32f26526903e803a8dba6900cd4fa45/arduino-aprs-tracker/arduino-aprs-tracker.ino#L124 https://github.com/billygr/arduino-aprs-tracker/blob/b32518e5d32f26526903e803a8dba6900cd4fa45/arduino-aprs-tracker/arduino-aprs-tracker.ino#L125
ialt should be always bigger then falt. In our case falt = 1000000.00 and ialt = 4200

kovalroma commented 3 years ago

I tried to run code but without your library, https://github.com/billygr/LibAPRS .

Here is result Screenshot_352

Everything is ok with altitude. So something wrong with https://github.com/billygr/LibAPRS definitely.

billygr commented 3 years ago

Hi,

Not sure if it will make a big difference, i reduced a bit the memory usage on the latest update by 31 bytes...

I will also check with the altitude is not displayed correctly

kovalroma commented 3 years ago

bit the memory us

We've checked your new firmware. Here is result Screenshot_370 Screenshot_369 Screenshot_368

In short, after 15-20 seconds, Arduino starting continuously transmitting UPDATE packets.

billygr commented 3 years ago

i see also altitude is completely wrong, i am waiting for a NEO-6m to be delivered (hopefully this month...) i will be able to understand what is going wrong when i receive the hardware

kovalroma commented 3 years ago

Hello, @billygr How is your success ? Have you received NEO-6m ?

kovalroma commented 3 years ago

For information. I bought Neo-M8N and checked. Founded that this GPS module not working with TinyGPS. There is new library TinyGPS++ for new GPS module. I would appreciate if you use this library.

billygr commented 3 years ago

Hi,

NEO-6m never arrived, dispute is open. You are right about the TinyGPS++ i will try to convert it to this. Expect an update till the weekend

B

kovalroma commented 3 years ago

During this week I made some tests. I have 2 GPS module. 1 coming from Aliexpress. Which shows incorrect altitude and in general working very buggy with APRS firmware, but works ok with GPS test firmware. 2 branded GPS module "Velleman VMA430 " coming from local shop. It shows correct altitude and seems to work good.

For now I have only one question. What's wrong with Aliexpress GPS module.... Would be very interesting to test it after you implement TinyGPS++ library.

By the way, if you are interesting I can send you my chines version of GPS.

billygr commented 3 years ago

Hi,

I am working on using the TinyGPS++, there is a bigger issue because it's not compatible with the previous version, mainly the lat/long that the library provides is TinyGPS 3802ABCD/2385ABCD TinyGPS++ 38.02ABCD,23.85ABCD and uses also more memory, in any case i am working on it on a different branch

As for the version reading on the internet i found out that they are clones and not real NEO modules

I will update you if i need a module THANKS for the offer !!!

billygr commented 3 years ago

Give it a try static test displays the correct location, don't know how stable it is or it will run out of memory (TinyGPSPlus needs more memory) https://github.com/billygr/arduino-aprs-tracker/tree/TinyGPSPlus

kovalroma commented 3 years ago

Hello, Have tested on Velleman VMA430 GPS and Arduino Uno. At first glance, it seems to work. Screenshot_446

Tomorrow will try to use chines GPS module from Aliexpress.

kovalroma commented 3 years ago

Chinese GPS module Neo-M8N. Seems to work

Screenshot_448

kovalroma commented 3 years ago

Unfortunely bug again appears. Chinese GPS module Neo-M8N. After 30 minutes. Screenshot_449

Time without 2 numbers. This code changed to show Course data.

 Serial.print(static_cast<int>(day)); Serial.print(F("/")); Serial.print(static_cast<int>(month)); Serial.print(F("/")); Serial.print(year);
    Serial.print(F(" ")); Serial.print(static_cast<int>(hour)); Serial.print(F(":")); Serial.print(static_cast<int>(minute)); Serial.print(F(":")); Serial.print(static_cast<int>(second));
    Serial.print(F(" "));
    Serial.print(F("LAT="));Serial.print(lat);
    Serial.print(F(" LON="));Serial.print(lon);
    Serial.print(F(" "));
    Serial.print(deg_to_nmea(lat, true));
    Serial.print(F("/"));
    Serial.print(deg_to_nmea(lon, false));
   // Serial.print(F(" Altitude m/ft: ")); Serial.print(altm);Serial.print(F("/"));Serial.println(ialt);
    Serial.print(F("Course: ")); Serial.print(currentcourse);Serial.print('\n'); 
kovalroma commented 3 years ago

Here full log from second attempt :) . Chinese GPS module Neo-M8N.

aprs-log-chines-module-gps.txt

billygr commented 3 years ago

i think that you have got fakes, the position jumps as i can see it on the log.

Is it always after 30 minutes ? I mean you can reproduce it ?

kovalroma commented 3 years ago

Is it always after 30 minutes ? I mean you can reproduce it ?

Not sure, will check again. Meanwhile attached log from smartbeaconing tree with branded Velleman VMA430. aprs-log-Velleman VMA430.txt

The same bug after 25/3/2021 17:3:58. The last digit here 25/3/2021 17:4:4 LAT=52150757 LON=21056484 5209.04N/02103.38E Altitude m/ft: 104.80/225 is currentcourse.

kovalroma commented 3 years ago

This log after I press reset button on arduino

25/3/2021 18:8:48 LAT=52150762 LON=21056485 5209.04N/02103.38E Altitude m/ft: 120.40/0
25/3/2021 18:8:49 LAT=52150761 LON=21056483 5209.04N/02103.38E Altitude m/ft: 120.60/0
25/3/2021 18:8:50 LAT=52150761 LON=21056481 5209.04N/02103.38E Altitude m/ft: 120.70/0
25/3/2021 18:8:51 LAT=52150761 LON=21056480 5209.04N/02103.38E Altitude m/ft: 120.90/0
25/3/2021 18:8:52 LAT=52150760 LON=21056479 5209.04N/02103.38E Altitude m/ft: 121.10/0
25/3/2021 18:8:54 LAT=52150760 LON=21056476 5209.04N/02103.38E Altitude m/ft: 121.10/0
25/3/2021 18:8:55 LAT=52150760 LON=21056475 5209.04N/02103.38E Altitude m/ft: 121.50/0
25/3/2021 18:8:56 LAT=52150760 LON=21056475 5209.04N/02103.38E Altitude m/ft: 121.60/0
25/3/2021 18:8:57 LAT=52150760 LON=21056474 5209.04N/02103.38E Altitude m/ft: 121.70/0
25/3/2021 18:8:58 LAT=52150761 LON=21056473 5209.04N/02103.38E Altitude m/ft: 121.80/0
25/3/2021 18:8:59 LAT=52150761 LON=21056473 5209.04N/02103.38E Altitude m/ft: 122.00/0
25/3/2021 18:9:0 LAT=52150761 LON=21056473 5209.04N/02103.38E Altitude m/ft: 122.10/0
25/3/2021 18:9:1 LAT=52150762 LON=21056473 5209.04N/02103.38E Altitude m/ft: 122.10/0

Take a look to time stamp.

After I press reset 3 times, it changed to normal

25/3/2021 18:11:41 LAT=52150802 LON=21056440 5209.04N/02103.38E Altitude m/ft: 128.30/0
25/3/2021 18:11:42 LAT=52150803 LON=21056439 5209.04N/02103.38E Altitude m/ft: 128.20/0
25/3/2021 18:11:43 LAT=52150803 LON=21056438 5209.04N/02103.38E Altitude m/ft: 128.10/0
25/3/2021 18:11:44 LAT=52150803 LON=21056437 5209.04N/02103.38E Altitude m/ft: 128.00/0
kovalroma commented 3 years ago

Yes, I can reproduced with Velleman VMA430 and smartbeaconing tree.

billygr commented 3 years ago

i did a long run while displaying the free memory , no mem leaks, of course that doesn't solve you problem

Can you please check this ? https://portal.u-blox.com/s/question/0D52p00008HKEEECA5/psa-fake-ublox-modules-and-potential-ways-to-identify-them mainly the GPTXT

kovalroma commented 3 years ago

From Velleman VMA430

$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50
$GPTXT,01,01,02,HW  UBX-G70xx   00070000 FF7FFFFFo*69
$GPTXT,01,01,02,ROM CORE 1.00 (59842) Jun 27 2012 17:43:52*59
$GPTXT,01,01,02,PROTVER 14.00*1E
$GPTXT,01,01,02,ANTSUPERV=AC SD PDoS SR*20
$GPTXT,01,01,02,ANTSTATUS=OK*3B
$GPTXT,01,01,02,LLC FFFFFFFF-FFFFFFFF-FFFFFFFF-FFFFFFFF-FFFFFFF9*51
kovalroma commented 3 years ago

Chinese module

$GNTXT,01,01,02,u-blox AG - www.u-blox.com*4E
$GNTXT,01,01,02,HW UBX-M8030 00080000*60
$GNTXT,01,01,02,EXT CORE 3.01 (d189ff)*68
$GNTXT,01,01,02,ROM BASE 3.01 (107888)*25
$GNTXT,01,01,02,FWVER=ADR 4.11*53
$GNTXT,01,01,02,PROTVER=19.10*11
$GNTXT,01,01,02,MOD=NEO-M8L-0*65
$GNTXT,01,01,02,FIS=0xEF4015 (100111)*58
$GNTXT,01,01,02,GPS;GLO;GAL;BDS*77
$GNTXT,01,01,02,SBAS;IMES;QZSS*49
$GNTXT,01,01,02,GNSS OTP=GPS;GLO*37
$GNTXT,01,01,02,LLC=FFFFFFFF-FFFFFFFF-FFFFFFFF-4FFFFF7E-FFFFFF49*20
$GNTXT,01,01,02,ANTSUPERV=AC *00
$GNTXT,01,01,02,ANTSTATUS=OK*25
$GNTXT,01,01,02,PF=3F7*3A
billygr commented 2 years ago

Just an update.

The issue is not related on your GPS but on the code it self. Yes it reproduce on my NEO-6M also, but only on this device type

It was traced down to the ADC interrupt killing the software serial so it was missing GPS data. I have updated it for the smartbeaconing branch will do the same also here.

billygr commented 8 months ago

Merged the smartbeaconing branch to master including the fixes