Showing GPS coordinates on map using sim808 module

Hi, I am using sim808 module to get GPS coordinates. I want to show these coordinates on map using asset tracking api of cayenne. But I don’t know how to start. I am using texas instrument microcontroller. Please guide me how can I achieve this task.

which programming language are you preferring to work with?

Thanks for the response. I am using embedded C.

you have to use this publish code Cayenne-MQTT-C/SimplePublish.c at master · myDevicesIoT/Cayenne-MQTT-C · GitHub and make changes accordingly that it sends GPS data in [lat, lon, alt] format.

Sorry for asking a silly question. How is the communication is being done at low level? As i have no ehternet connection or wifi connected. I only have SIM808 module.

we have a GSM support library for GSM808 Cayenne-MQTT-Arduino/GSM.ino at master · myDevicesIoT/Cayenne-MQTT-Arduino · GitHub you can use it if you want.

Hi, how can I add map on the dashboard when connected to Cayenne Cloud. I am using SimplePublish.c example project for testing. Kindly guide me how can i add map on the dashboard?

you need to send data GPS data to cayenne using:

CayenneMQTTPublishData(&mqttClient, NULL, DATA_TOPIC, 2, TYPE_ GPS, UNIT_ GPS, GPS_data);

where GPS_data should be in [lat, lon, alt] format.

is this right?
CayenneMQTTPublishData(&mqttClient, NULL, DATA_TOPIC, 3, TYPE_GPS, UNIT_UNDEFINED, “33.69,72.00,12”)

Now it is showing a map but it does not shows the marker

it should be in this format:

CayenneMQTTPublishData(&mqttClient, NULL, DATA_TOPIC, 3, TYPE_GPS, UNIT_GPS, [33.69,72.00,12]);

including [ ]

Do I need to refresh the map every time I send a new coordinate?

no, you dont have to if you are sending correct data.

CayenneMQTTPublishData does not accepts data in this format. It gives error because the last parameter is expecting a character array.

this is the code i used with my arduino to create a map and it shows data properly on the map.

float x = 0.5;
float y = 0.4;
float z = 0.2;
  char buffer1[50];
  buffer[0] = '[';
  size_t offset = 1;
  dtostrf(x, 1, 3, &buffer[offset]);
  offset += strlen(&buffer[offset]);
  buffer[offset++] = ',';
  dtostrf(y, 1, 3, &buffer[offset]);
  offset += strlen(&buffer[offset]);
  buffer[offset++] = ',';
  dtostrf(z, 1, 3, &buffer[offset]);
  offset += strlen(&buffer[offset]);
  buffer[offset++] = ']';
  buffer[offset] = 0;
Serial.println(buffer);

Cayenne.virtualWrite(20, buffer, "gps", "m");

I am sending using the following code. It shows the coordinate only first time then it does not updates map. However in data tab I can see the live data coming. But map is not updated
#define TYPE_GPS “gps”
#define UNIT_GPS “m”
if (count == 0) {

			if ((error = CayenneMQTTPublishData(&mqttClient, NULL, DATA_TOPIC, 3, TYPE_GPS, UNIT_GPS, "[33.674119,72.996591,13]")) == CAYENNE_SUCCESS) {
				printf("Data send1\r\n");
			}
			count = 1;
		}
		else {
			if ((error = CayenneMQTTPublishData(&mqttClient, NULL, DATA_TOPIC, 3, TYPE_GPS, UNIT_GPS, "[33.695057,72.9755828,15]")) == CAYENNE_SUCCESS) {
				printf("Data send2\r\n");
			}
			count = 0;
		}

As you can see from the image I am receiving updated coordinates every 5 seconds.

i am getting the points as they move. but on refresh they wont be kept.


you are not sending the correct data format.

I have solved the problem. I have one more question that does this maps supports auto zoom in or zoom out? Like if the coordinates are out of the display shown on the screen will it take us to that point or not?

if you check on the map widget there + - for zoom in and zoom out. the map auto direct and shows the latest location point it has received.

Hi! Bumping an old conversation because it seems to be the most recent topic that mentions Location.
@qasim_zia2013 - you said “I have solved the problem.” Please share the solution!
I am using Python to read gps data from a csv file, and publish it to Cayenne. The experience seems inconsistent, but broadly similar to @qasim_zia2013 , I run my Python script, a map widget is created and with a little fluffing about I can watch the points getting added (at intervals of 1 second each).
Problem is if I refresh the page, or change to another project and back, or hold my tongue the wrong way, the pins disappear off the widget, never to be seen again. The data does still show up in Data view.
On that note @shramik_salgaonkar , what was wrong with the data in the screenshot from Feb 14 above?

you need to change the interval to 15 seconds, as it not a good practice to publish data at such rapid rate and you might hit rate limit.

once refresh the data point wont be shown for GPS data. It will show when the next data is received.

nothing is wrong, the image is to compare the data of the user with the correct data.