Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By MM596
#69270 Hello!

I am using a NodeMCU with the Arduino IDE to send some real time data, via UDP packets.

I am sending these packets every 50ms (I've checked this, every 50ms the UDP.beginPacket, ... endPacket are executed), but if I am using wireshark to see the packets arriving, I can see that there are delays of about 150ms, sometimes 200ms.

Is there a possibility to speed this up?

Thank you very much
Regards
User avatar
By MM596
#69280 I have only one WiFi network in the near area, so I don't think it's an interference problem.

Has some ever checked the transmission times of the ESP8266?
Or does anyone run "real time" transmissions with this µC and can give me some hints or suggestions?
User avatar
By rudy
#69281
MM596 wrote:Has some ever checked the transmission times of the ESP8266?


I didn't think what you are seeing is anything relating to a problem with the UDP routines, so I performed the following test.

I used two ESP-12 boards. One as a sender, the other as a receiver.

Sender code
Code: Select allvoid loop()
{
  digitalWrite(led4, LOW);
 
  wifiUdp.beginPacket(RemoteIpadr, RmoteUdpPort);
  wifiUdp.write("from ESP8266");   
  wifiUdp.endPacket();
 
  digitalWrite(led4, HIGH); 

  Serial.println(counter);
  delay(50);
  counter=counter+1;
}


Receiver code
Code: Select allvoid loop() {
  int packetSize = udp.parsePacket();

  if (packetSize > 0)
  {
  digitalWrite(led15, LOW);
   
    Serial.print("  Data was - ");
    int len = udp.read(packetBuffer, 255); 
    Serial.println(packetBuffer);   

  digitalWrite(led15, HIGH);   
  }
}


I used a logic analyzer to measure the delay between the send and the receive. I typically get about 1mS delay, max of 2mS. I am not seeing any significant delays.

The routines are good. You did not post your code so it is either you are doing something wrong in your code or your problem is elsewhere.