Need help with map widget

Hi! It’s been a while since I worked on my Blynk project, but currently I want to move to the next phase: GPS.
I have Blynk running on a Teensy 3.6 with a Elecrow SIM808 shield.
I’m able to connect with the App so that’s all working OK.
Unfortunately I am stuck in getting the Map widget to work properly and show the actual location. From the documentation of the Map widget I have learned and implemented the following:

  • Before the setup add
    WidgetMap myMap(V0);
  • After Blynk.begin(auth), just before the loop() I have added:
    int index = 0;
    float lat = 52.370216;
    float lon = 6.895168;
    myMap.location(index, lat, lon, “object”);

That lat and lon are random.
Adding the Map widget in the Blynk App also works and the map indeed shows the location that matched the random lat and lon defined above.
However, the location does not update to the GPS location, why??

If I run the AT command +CGNSINF in the loop, I do get a info object that does contain the correct lat and lon for the device. Furtheremore the blue led on the Elecrow shield is blinking which also confirms the GPS fix.

So my question is: How to I get the map widget to use the actual GPS data?

Is it naive to hope that the widget dan would do that for me?
Looking at the map example I tend to believe it should work that way.
Hope someone can help me out.

The map example that you linked to is simply an example of how to supply coordinates ti the map widgets so that they can be displayed. If you wanted to display the coordinates of the device sending the data to Blynk then additional hardware and code would be required, but that’s beyond the scope of the example.

In your case, you’ll need to write some code that periodically requests the data from your SIM808 , formats it correctly then pushes it out to Blynk using the code that you’ve already tested.

I’d imagine that you’d be using a timer to call a function which will issue the +CGNSINF AT command (please don’t do this in the void loop), parses the results and assigns the appropriate elements to the lat and lon variables, then calls the myMap.location command.


Thanks, I was already afraid that the Blynk was not going to to that for me on the background but still had a bit of hope.
I will look into parsing the data
Think using TinyGPS+ could be an option to get the actual lat and lon and update those to real data. I’ll dive into that. Need to get that working on hardware serial first…

Hmmm, just be careful about using this approach as advised in the TinyGPS+ link:

Repeatedly feed it characters from your GPS device:

while (ss.available() > 0)

The while will be a blocking command that you’ll want to avoid with Blynk.

Probably better to stick the


in the timed function I was talking about earlier. And, don’t go mad with how often you call it - I’d guess that unless you’re trying to track Lewis Hamilton (or maybe Max Verstappen in your case) around Monaco in real time then every 15 to 30 seconds will probably be more than enough.


1 Like