Notification texts go here Contact Us Buy Now!

Zigbee/Xbee as Receiver and Transmitter - missing packets on receiver side

Missing Packets on Receiver Side: Zigbee/Xbee as Receiver and Transmitter

Problem:

In a Zigbee/Xbee setup, packets sent from the transmitter are not being fully received on the receiver. The receiver only processes a portion of the transmitted packets, resulting in missing data.

Analysis:

The issue is caused by a delay inside the while loop on the receiver. This delay limits the receiver's processing speed, causing it to miss incoming packets. Specifically, the delay allows the receiver to process only one character every 200 milliseconds, while the transmitter is sending seven characters every 400 milliseconds.

Solution:

To resolve the problem, move the delay outside of the while loop. This will allow the receiver to process incoming packets continuously without being hindered by the delay. By doing this, the receiver will be able to keep up with the transmission rate and receive all the packets sent by the transmitter.

Additional Information:

It's important to note that the baud rate does not need to be the same on both ends of the wireless link. The XBee modules buffer requests, so different baud rates can be used on each end. The XBee baud rate determines the line speed of the serial connection between the host and the radio module. However, all data is sent "over the air" at 250kbps.

Code Example:

//(Receiver Code)
void loop() {
  while (Serial.available()) {
    char msg = Serial.read();
    Serial.write(msg);
  }
}

By eliminating the delay within the while loop, the receiver can continuously process incoming packets, ensuring complete reception of data from the transmitter.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.