Hi,
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)
try:
xbee.transmit(TARGET_64BIT_ADDR, message)
print("Data sent successfully")
except Exception as e:
print("Transmit failure: %s" % str(e))
# Wait between cycles
sleep(wait_time)
Maybe something is missing but I can’t see what.