logo elektroda
logo elektroda
X
logo elektroda

ESP32 - How to improve UDP transmission at 500 Hz sampling?

chudek123 978 3
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 16974291
    chudek123
    Level 7  
    Good day,
    I have an esp32 module from Sparkfun, I take readings from the adc, put the measurements in 1 kilobyte frames(single for now, one reading into the frame and the rest empty or rubbish) and send over UDP. With sampling every 2 ms (500 Hz), every 4th sample arrives. Only from an interval of 15 ms can it be said that everything arrives. The application with which I am communicating correctly receives the data, likewise the application which is transmitting correctly takes the measurements and packs them into frames. Can anything be done to improve the transmission?
  • ADVERTISEMENT
  • #2 16974359
    rb401
    Level 39  
    chudek123 wrote:
    1 kilobyte frames(single for now, one reading into the frame and the rest empty or rubbish) and I send over UDP. With sampling every 2 ms (500 Hz) every 4th sample arrives. Only from an interval of 15 ms can it be said that everything arrives.


    Packet size matters quite a bit.
    I used to do UDP tests on the ESP8266 and there was also this loss.
    But I noticed a correlation that shorter packets can be transmitted more densely.
    My example results of the transmission frequency limit without packet loss are:
    packets of 30 bytes - 800 packets/s
    packets of 300 bytes - 430 packets/sec.
    As for the larger packets, I don't remember the results, so that I don't know if your result of 67 1KB packets matches the conditions under which I obtained these my results.
    So that now I can't tell you if your results are typical or if you have some other bottleneck.

    That is to say, try to determine what minimum packet length you will ultimately need and then measure practically whether you will fit within your assumptions.
  • ADVERTISEMENT
  • #3 16975447
    JacekCz
    Level 42  
    UDP by its very principle does not guarantee delivery. Any sensible utility algorithm must assume this.
    A specific rule of thumb has to be defined: in measurements it will probably be "forgiving" for missing some samples.
  • #4 17135235
    RomanFilipecki
    Level 18  
    UDP is a connectionless protocol and can therefore be more efficient. As JacekCz wrote, the programme must assume the loss of frames and possibly ask for repetition.
ADVERTISEMENT