0

I am using a Raspberry Pi Pico with SIM800l and NEO6M to make a GPS tracker. But it takes about 8s (from recording the GPS signal) to make a http request to the the server.

I'm using this library as a base for the drivers https://github.com/pythings/Drivers/blob/e4a45741aad16b026b1a4ea02dc9b486367805b7/SIM800L.py

My complete code: https://github.com/BT-P1C0/BT-Hardware

How can I reduce the request time to make the tracker more real-time.

1 Answer 1

0

Use UDP instead of HTTP/TCP. Create a simple message block with the position data, and send it twice, and get the server to send an acknowledgement. If 2 attempts fail, then you are probably in an area with poor wireless coverage, so there is no point in more retries; just store the failed data, and add it to the next transfer.

The reason TCP can be slow is that it involves a lot of to-and-fro traffic to set up & tear down the connection (11 datagrams for a short message: syn, syn-ack, ack, data, ack, data, ack, fin, ack, fin, ack) with each of these incurring a round-trip delay that may be over 1 second, plus one or more retries if there are errors. Compare that with UDP (2 datagrams for a short message: data, ack).

TCP is incredibly inefficient for short messages over potentially-unreliable wireless links.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.