Home/Support/Support Forum/Not receiving packet with sensor data - sensor running I2C sensor and Micropython

Not receiving packet with sensor data - sensor running I2C sensor and Micropython

0 votes

I'm experimenting with sending data from an I2C pressure/temperature, specifically the BMP280, I'm following instructions from the book "Beginning Sensor Networks with XBee, Arduino and Raspberry Pi"

I have got my sensor connected to an XBee 3 with a Grove Development board, I have a working BMP280 library and I have confirmed that the XBee is receiving and processing the sensor values correctly.

I then wrote the program out as in the book, the program saves and runs fine, in the program the specific address of the coordinator is specified.

Both the coordinator and router have the same PAN ID, when I look at the network diagram I can see the coordinator and router are connected. In the frames log I can see the coordinator and router communicating.

However according to the book I should see in the the frames log Receive Packet, this does not appear at all,
In the coordinator
I get Explict RX Indicator, Transmit Status, Explicit Addressing Command Frame but no received frame.

This is my sensor code:
from machine import I2C
from bmp280 import BMP280
from time import sleep

import xbee

# BMP280 address
BMP_ADDR = 0x76
# Target address to send data
TARGET_64BIT_ADDR = b'\x00\x13\xA2\x00\x41\xBB\x4E\x49'
wait_time = 15 # seconds between measurements
cycles = 10 # number of repeats
bmp280 = BMP280(I2C(1, freq=100000), BMP_ADDR)

for x in range(cycles):
# Read temperature & baraometric pressure
temp_c = bmp280.temperature
pressure = bmp280.pressure

# Convert temperature to proper units
print("Temperature: %.2f Celsius" % temp_c)
temp_f = (temp_c * 9.0 / 5.0) + 32.0
print("Temperature: %.2f Fahrenheit" % temp_f)
print("Barometric Pressure: %.4f" % pressure)

# Send data to coordinator
message = "C: %.2f, F: %.2f, B: %.4f" % (temp_c, temp_f, pressure)
print("Sending: %s" % message)
xbee.transmit(TARGET_64BIT_ADDR, message)
print("Data sent successfully")
except Exception as e:
print("Transmit failure: %s" % str(e))

# Wait between cycles

Maybe something is missing but I can't see what.
asked Apr 12 in MicroPython by RguStudent New to the Community (2 points)

Please log in or register to answer this question.

1 Answer

0 votes
You are receiving the data. That is what the Explicit RX packet is. It just may not be in a way you are expecting. Try setting the AO command on the receiving module to 0.
answered Apr 13 by mvut Veteran of the Digi Community (14,297 points)