Hello everyone,
I’m currently working on a project involving an XBee3 module and a MAX6675 thermocouple sensor. I flashed the following MicroPython code to the XBee3 device:
python
from max6675 import MAX6675
import time
import machine
import xbee
Configure XBee3 sleep settings (Cyclic Sleep Mode)
xbee.atcmd(‘SM’, 4) # Set to Cyclic Sleep mode
xbee.atcmd(‘SP’, 1000) # Sleep period: 1000 * 10ms = 10 seconds
xbee.atcmd(‘ST’, 100) # Stay awake for 100ms (adjust if needed)
xbee.atcmd(‘WR’) # Write settings to non-volatile memory
Temperature sensor setup
thermo = MAX6675(
sclk_pin=machine.Pin(“D2”),
cs_pin=machine.Pin(“D3”),
miso_pin=machine.Pin(“D12”)
)
def send_data(temp_c, temp_f):
# Customize with your transmission method
print(“{:.2f},{:.2f},”.format(temp_c, temp_f))
try:
# Read and send temperature data
temp_c = thermo.read_celsius()
temp_f = thermo.read_fahrenheit()
send_data(temp_c, temp_f)
except Exception as e:
print(“Error: {}”.format(e))
After flashing this code, the console showed:
Parsing /flash/main.py…
Compiling /flash/main.py…
Running bytecode…
However, after this point:
The XBee3 module no longer appears in scanning mode.
I am unable to detect or communicate with the device.
I suspect the sleep configuration (SM=4, cyclic sleep) may be interfering with connectivity or causing the module to enter a sleep state too quickly. Could the timing parameters (SP and ST) be affecting serial communication or preventing proper startup?
Has anyone faced a similar issue with XBee3 and sensor integration? Any suggestions on how to recover the device or how to activate xbee so that it could be seen in the discover mode, or adjust the sleep setting to prevent this would be greatly appreciated