XBEE altering data when using pin-controlled sleep mode

Thread Starter


Joined Feb 24, 2022
Hi! I'm trying to send data from some sensors (the data is read with a PIC16F1516) and sent to an raspberry PI for processing. I use XBee Series 2 for data transmission and I do it through UART (115200 baudrate and no parity bit). I managed to send data very accurately every 4.5 s (configuring sleep mode and an awake from WDT for the MCU) but for that I need to keep the XBEE awake all time so that consumes a lot of power (the sensors and the MCU consume only about 400 uA when they are awake in comparison to the XBee that uses 40 mA but I try to minimize that since it's powered from a battery). I tried to use pin 9 and configure sleep mode: Pin Hibernate ( essentially, when the pin is pulled high, the XBEE sleeps and when it's pulled low the device is awake). I tried to keep the device awake all time and send data (shorted the pin to the ground) but the burst of data is wrong. It never sends the packet as I designed it or the XBee connected to the raspberry pi doesn't read it very accurately. The configured burst is: PRESSURE|TEMPERATURE|HUMIDITY|BATTERY_LVL|X_ACCELERATION|Y_ACCELERATION|Z_ACCELERATION and most of the times I get:
(but there are other exceptions that are random)
I'll attach 2 photos: One is when the XBEE is awake all the time and the data I've read and write to the file in raspberry pi (the long string at the end is the data that was transmitted or read) and the other one is when I configured XBee Pin Hibernate, but with the pin shorted to ground so the device is awake all the time.
Also this is how I read the serial data at raspberry pi:
ser = serial.Serial(
baudrate = 115200,
EDIT: Also, when I put it in sleep mode it seems like it's sending the last packet continuously before receiving the next one, instead of being idle. I interfaced a LED on RPI that lights when data is received. When I used the sleep mode with the pin shorted to the ground, the LED stays lit all the time.
Last edited: