Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ESP32 mqtt broker data publishing at uneven rates #6251

Unanswered
parthesh-hub asked this question in Q&A
Discussion options

Hello everyone, we are currently working on project that involves IMU sensors along with ESP32. we are trying to send sensor data to MQTT broker every 100ms(its fast because that's the need of the project)

The Serial Monitor says it is getting successfully sent on broker after 100ms. But on the broker it is getting published at uneven rate(some after 200ms or some after 2ms gap). There is uneven gap between messages which should be 100ms approx. We taught the issue might be on the MQTT broker but if we send the data per second then it is getting perfectly published on time.

But in our case we need faster speed (publish per 100ms).. here the ESP32 shows uncertain behaviour..

Did anyone ever faced such issue ?

We are using ESP32 version : 1.0.6

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Hi,

I'm not sure you can 100% rely on the broker at this data rate. I've never tried at this data rate.
Are you using QOS 0?

You must be logged in to vote
1 reply
Comment options

by default PubSub client uses QoS 0 for publishing.. there is no way to modify it.

Also we found out that it is happening because of TCP buffering. Whenever the esp32 runs the publish function it puts the message on the TCP buffer. As the publishing rate is fast (in our case 100ms) TCP buffer accumulates multiple messages together and publishes them at once on the broker, rather than publishing each one of them separately after every 100ms

image

You can see in the image when we subscribe to the topic on web client, and track it using Wireshark for debugging we can see that each TCP packet is received after 300/400ms and contains 3/4 messages together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /