Port Adruino Sketch from UDP to MQTT

I have a bareboard ATMega328PB with a SIM800L GSM modem.
I have two sketches:

Sketch MAIN:
This sketch currently sends data to my server using a UDP connection.

Sketch MQTT:
This sketch send data to my server using MQTT.

I have found that after numerous tests that using UDP to send data to my server my failure rate is very high.
By using MQTT I have found that this is far more reliable and I have zero failures.

On my server, I have a Mosquitto Broker running and by using the "Sketch MQTT" I can see the data reliably.

I need assistance in "Porting" the MQTT sketch into my MAIN sketch - thus replacing all the UDP code with the MQTT code.

Can do. What's your budget?

Budget is only $50

Use a sequence counter on your UDP packages and send them 5 times, that will most likely solve your problem for free.

I don't know how to do that :exploding_head:
I really would like to get the MQTT running

Well, then there are two options:

  1. learn how to do it yourself.
  2. Add a 0 to your budget and get it solved.

If I were you I'd go for option 1.

@Declan UDP packets are not guaranteed to arrive at their destination. It should be a fairly simple task to switch to using TCP instead. TCP packets will arrive. Far simpler than moving to MQTT and you could probably learn how to do it in a few hours.

I have used a HTTP connection to the server and failure rate was very high, around 61% failures.
Using UDP failure rate was 82%.
Using a Test MQTT sketch, I had zero failures with 1000 transmit.

I have had the UDP to MQTT sketch done by a forum member for EU 50 and it works fantastically well - 728 transmits and zero errors.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.