Sim808 gps & mqtt

mqtt

#1

Hello to all , currently i’m working on project where i need to send data every 3-5 sec , but also i need to get GPS data from sim808 , problem is when i connect to MQTT it open connection but when i try to get GPS data it broke connection for publishing MQTT data . Anyone had same problem or have a solution . I’m open for all !


#2

You can acheive 5 second update rate using MQTT over TCP if you dont hang the code anywhere while processing AT command responses.
3 seconds is little difficult but still acheivable.
You might get better results with transparent mode, but it is much trickier compared to non transparent mode.
Yes, with SIM808 you have to read GPS data in between and that adds to the delay, but you should be able to achieve 5 second update rate without any problem.
The connection breaks if you send any packet with wrong MQTT format or if there is a long gap and server closes connection.
Are you using transparent mode or non transparent mode?


#3

Hello Ravi , thank you for response . I use non transparent mode , oh yes it took me a lot of delay while sending at commands , do i need to send commands in this order :

  1. turn on module
  2. turn on gps
  3. wait for gps fix
  4. get gps data
  5. connect mqtt
  6. publish mqtt
  7. back to 3.

I have so much porblems with delays and publishing via mqtt .


#4

Hi,
Yes,
Its the correct flow. Also add a state where you check if connection is still open.
If you get CLOSED URC you should go back to opening the TCP connection again.


#5

Ravi, I have a similar issue where I have a MQTT Connection going on and I need to get the GPS location in parallel and send it over the MQTT connection.

Is there a way of without breaking the MQTT connection, we could get the GPS location and send it over this same connection to the server? Thanks


#6

What module you use , can you give little more description ?


#7

I am using SIM800 at present with MQTT protocol for connection with the server. I just wanted to send the location of the device to the server, however when I send AT+CIPGSMLOC=1,1 the connection breaks. Though my software takes care and reconnects however breaking every 15sec is becoming a problem


#8

Could you share your code here , so we can see whats wrong