[SOLVED] Arduino or NodeMCU GPS tracking system on Map widget

whats SM ?

Serial Monitor

[263] Connecting to MikroTik Home
[1292] Connected to WiFi
[1293] IP: 10.5.50.234
[1295] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.8 on NodeMCU

[5001] Connecting to 192.168.1.104:8442
[5057] Ready (ping: 3ms).
Started reading GPS data at 5079
Finished reading GPS data at 5082 and it took 4ms.
-----------------------------------------------------------

My SM in simulation mode with reading set at 5s intervals and 4800ms delay to “read” GPS data.
All works fine, no disconnects and no ESP resets.

Started reading GPS data at 246356
.
LAT:  30.000122
LONG: 30.000986
Finished reading GPS data at 251162 and it took 4806ms.
-----------------------------------------------------------

Started reading GPS data at 251356
.
LAT:  30.000122
LONG: 30.000986
Finished reading GPS data at 256159 and it took 4803ms.
-----------------------------------------------------------

Started reading GPS data at 256356
.
LAT:  30.000122
LONG: 30.000986
Finished reading GPS data at 261162 and it took 4806ms.
-----------------------------------------------------------
1 Like

which sketch you use ?

The last sketch you posted but with the following changes:

bool simulation = true;
Only set this as true for test purposes, change back to false afterwards

In setup() change the 30000L to 5000L and this readGPS()

void readGPS(){
  ESP.wdtFeed();  // feed the ESP WDT, not needed in simulation mode at 4800ms delay but included just in case it's needed
  long startTime = millis();
  long counter = 0;
  Serial.print("Started reading GPS data at ");  
  Serial.println(startTime); 
   
  if(simulation == true || IranHack == true)
  {
    //long loopmax = 100L;  // max 2,147,483,647 or double this if usigned
    long loopmax = 1L;      // doesn't need to be a long variable
    while (counter < loopmax)   
    { 
      counter++;
      Serial.print(".");
      delay(4800);           // e.g. pause, 4800 seems ok 
    }
    Serial.println();
    //counter = 0;   // not required as counter is redefined each time readGPS() is called
    displayInfo();  
  }
  else
  {
    while (ss.available() > 0)  // sketch displays information every time a new sentence is correctly encoded.
      if (gps.encode(ss.read()))
        displayInfo();
  }
  Serial.print("Finished reading GPS data at ");
  Serial.print(millis());
  Serial.print(" and it took ");
  Serial.print(millis() - startTime);
  Serial.println("ms.");
  Serial.println("-----------------------------------------------------------");
  Serial.println();   
}

Post your SM with the changes above and later we can try to work out why the sketch is not pulling down your actual GPS data.

1 Like
[263] Connecting to MikroTik Home
[1288] Connected to WiFi
[1290] IP: 10.5.50.234
[1291] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.8 on NodeMCU

[5001] Connecting to 192.168.1.104:8442
[5012] Ready (ping: 6ms).
Started reading GPS data at 5015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 9861 and it took 4846ms.
-----------------------------------------------------------

Let SM run for a little longer and paste a bigger section. I just want to see time closer to 4800ms.

1 Like
[263] Connecting to MikroTik Home
[1288] Connected to WiFi
[1290] IP: 10.5.50.234
[1291] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.8 on NodeMCU

[5001] Connecting to 192.168.1.104:8442
[5012] Ready (ping: 6ms).
Started reading GPS data at 5015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 9861 and it took 4846ms.
-----------------------------------------------------------

Started reading GPS data at 10015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 14832 and it took 4817ms.
-----------------------------------------------------------

Started reading GPS data at 15015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 19831 and it took 4816ms.
-----------------------------------------------------------

Started reading GPS data at 20015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 24862 and it took 4847ms.
-----------------------------------------------------------

Started reading GPS data at 25015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 29830 and it took 4815ms.
-----------------------------------------------------------

Started reading GPS data at 30015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 34860 and it took 4845ms.
-----------------------------------------------------------

Started reading GPS data at 35015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 39829 and it took 4814ms.
-----------------------------------------------------------

Started reading GPS data at 40015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 44860 and it took 4845ms.
-----------------------------------------------------------

Started reading GPS data at 45015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 49829 and it took 4815ms.
-----------------------------------------------------------

Started reading GPS data at 50015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 54861 and it took 4846ms.
-----------------------------------------------------------

Started reading GPS data at 55015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 59829 and it took 4814ms.
-----------------------------------------------------------

Started reading GPS data at 60015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 64862 and it took 4847ms.
-----------------------------------------------------------

Started reading GPS data at 65015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 69839 and it took 4824ms.
-----------------------------------------------------------

Started reading GPS data at 70015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 74860 and it took 4845ms.
-----------------------------------------------------------

Started reading GPS data at 75015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 79829 and it took 4814ms.
-----------------------------------------------------------

Started reading GPS data at 80015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 84861 and it took 4846ms.
-----------------------------------------------------------

Started reading GPS data at 85015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 89829 and it took 4814ms.
-----------------------------------------------------------

Started reading GPS data at 90015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 94861 and it took 4846ms.
-----------------------------------------------------------

Started reading GPS data at 95015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 99831 and it took 4816ms.
-----------------------------------------------------------

Started reading GPS data at 100015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 104860 and it took 4845ms.
-----------------------------------------------------------

Started reading GPS data at 105015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 109829 and it took 4814ms.
-----------------------------------------------------------

Started reading GPS data at 110015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 114870 and it took 4855ms.
-----------------------------------------------------------

Started reading GPS data at 115015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 119829 and it took 4814ms.
-----------------------------------------------------------

Started reading GPS data at 120015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 124869 and it took 4854ms.
-----------------------------------------------------------

Started reading GPS data at 125015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 129829 and it took 4815ms.
-----------------------------------------------------------

Started reading GPS data at 130015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 134869 and it took 4854ms.
-----------------------------------------------------------

Started reading GPS data at 135015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 139829 and it took 4814ms.
-----------------------------------------------------------

Started reading GPS data at 140015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 144859 and it took 4844ms.
-----------------------------------------------------------

Started reading GPS data at 145015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 149830 and it took 4815ms.
-----------------------------------------------------------

Started reading GPS data at 150015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 154869 and it took 4854ms.
-----------------------------------------------------------

Started reading GPS data at 155015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 159829 and it took 4814ms.
-----------------------------------------------------------

Started reading GPS data at 160015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 164869 and it took 4854ms.
-----------------------------------------------------------

Started reading GPS data at 165015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 169826 and it took 4811ms.
-----------------------------------------------------------

Started reading GPS data at 170015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 174859 and it took 4844ms.
-----------------------------------------------------------

Started reading GPS data at 175015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 179829 and it took 4814ms.
-----------------------------------------------------------

Started reading GPS data at 180015
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 184869 and it took 4854ms.

It’s noticeable that every 10s you have an extra 40ms more processing time than I have.
This is either something to do with the Blynk 10s hearbeat or the fact you actually have a GPS device connected and I don’t.

If it’s the former I am surprised as you are using a local server and I am using a cloud server i.e. my processing time should be longer but it can vary from system to system.

1 Like

OK. now it’s from Blynk Cloud

___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
    /___/ v0.4.8 on NodeMCU

[5001] Connecting to blynk-cloud.com:8442
[5658] Ready (ping: 0ms).
Started reading GPS data at 5972
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 13748 and it took 7776ms.
-----------------------------------------------------------

Started reading GPS data at 13748
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 21530 and it took 7782ms.
-----------------------------------------------------------

Started reading GPS data at 21968
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 29722 and it took 7754ms.
-----------------------------------------------------------

Started reading GPS data at 29723
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 37300 and it took 7577ms.
-----------------------------------------------------------

Started reading GPS data at 37300
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 45108 and it took 7809ms.
-----------------------------------------------------------

Started reading GPS data at 45492
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 53479 and it took 7987ms.
-----------------------------------------------------------

Started reading GPS data at 53480
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 60980 and it took 7501ms.
-----------------------------------------------------------

Started reading GPS data at 60985
.
LAT:  30.000122
LONG: 30.000986

Finished reading GPS data at 68634 and it took 7649ms.
-----------------------------------------------------------

Did you change the 4800ms?

Strange that yours now takes 7500ms.
My cloud server is not Blynk’s server, it’s a “local” server thousands of miles away.
What Blynk server are you connecting to from Iran i.e. what does ping blynk-cloud.com show as the IP?

1 Like

I dont change 4800

Pinging blynk-cloud.com [139.59.206.133] with 32 bytes of data:
Reply from 139.59.206.133: bytes=32 time=159ms TTL=54
Reply from 139.59.206.133: bytes=32 time=149ms TTL=54
Reply from 139.59.206.133: bytes=32 time=151ms TTL=54
Reply from 139.59.206.133: bytes=32 time=145ms TTL=54

Looks like that is in Germany. Probably same distance from me to my cloud server as Iran to Germany. Perhaps poor routing from Iran but I guess you are the Network Engineer :slight_smile:

2 Likes

the routing problem is from ISP.

1 Like

@ErfanDL Nice thing about a physical GPS device is that you get a free clock thrown in too.

QR code for Android / iOS plus Android Smartphone url are:


http://tinyurl.com/yd4dqal8

Change email address from user@home.com to your actual email address.
Change the timezone, unless you are in Cyprus (or GMT + 3). Project uses GMT at present.
Notification widget should be left as ON, 1min, DEFAULT RINGTONE and HIGH.

Project will send you a PUSH message with the initial Satellite fix and further PUSH messages if the fix is lost for more than 15s.

Some of these PUSH messages are actually to help me debug a few issues. Please keep a record of the “First fix” and “Lost fix” times.

You will have a fixed red LED until you have the first satellite fix and the green LED will flash as long as you are connected to the server.

@Dmitriy couple of questions:

  1. Is the 15s minimum wait period between messages applicable to any type of message (PUSH / EMAIL) or do they have independent 15s wait periods? Think I might have offended Google :frowning:
  2. Please confirm the map doesn’t actually track i.e. we have keep clicking the Google “lollipops” to see where we are in the world.

Send me a PM if you want the associated bin file.

3 Likes

Independent.

Sorry, didn’t get it.

2 Likes

If we drive the map will not move along our route without keep pressing the “show where I am” icon within the Google Map?

We are creating a “trace” with the index so we can see where we have been but I don’t think the map refreshes without our intervention, right?

1 Like

My wife and I returned tired and weary yesterday from a mammoth road trip from one side of the country to the other.

We went to meet up with one of her cousins and his wife who normally live in Moscow.

I thought this road trip would be an excellent opportunity to test out the Blynk server running on a Pi ZeroW wireless AP and an external GPS device hooked up to a WeMos.

So everything running locally but accessing the satellites wherever they are located in the atmosphere.

Running everything locally was my first mistake as I searched feverishly for the Blynk data files on our return. Finally I realised the Pi was running with a system date of May rather than August. Must remember to set time and date on the Pi before the next trip or mod the system to use GPS time.

My second mistake was running the WeMos from a databank but running the Pi from the cigarette lighter connection. I realised that if I turned off the engine at any time during the road trip the whole system would go to pot. Pulling the power on a Pi without a formal shutdown is not a good idea. I do have SSH access from my phone to the Pi but it’s too easy to forget to use it if you stop for petrol etc.

We had a scheduled stop to meet up with a friend along the way and the system worked almost flawlessly until this stop. The clock time appears to have jumped back about 8 minutes for one of the minute interval data points. Having stopped and restarted the engine several times during this scheduled stop I disconnected the system for the rest of the journey as I didn’t want to trash the SD card.

The third mistake was simply not remembering the motorway junction exits correctly. So point 34 on the map should have gone South West to point 57 rather than West to point 46 and then South to point 57. Not a major detour but my wife was starting to question my sanity.

I was busy driving @Dmitriy so I never got to see whether the Google Map in the Blynk app “followed” us along out trip. Just as we were arriving at our scheduled stop I did manage to see a “slug like” trail on the map. This was caused by all the data points from our efforts driving up and down the main road in search of a particular hotel in “Little Moscow”.

All in all a satisfactory test of the system and we are fortunate that it’s only a couple of hours from one side of the country to the other.

2 Likes

:joy:

1 Like