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 !
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?
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 :
- turn on module
- turn on gps
- wait for gps fix
- get gps data
- connect mqtt
- publish mqtt
- back to 3.
I have so much porblems with delays and publishing via mqtt .
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.
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
What module you use , can you give little more description ?
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
Could you share your code here , so we can see whats wrong