Home › Forums › Mayfly Data Logger › XBee RF / Mayfly Communication Troubleshooting
Tagged: Mayfly 0.5b, Serial1, Xbee
- This topic has 1 reply, 2 voices, and was last updated 2023-11-22 at 3:27 PM by Shannon Hicks.
-
AuthorPosts
-
-
2023-11-20 at 12:27 PM #18177
Hi,
A bit frustrating, as this was working last week, but something (hardware or software) seems to have happened. Regrettably, I do not have git VCS in place for my workflow on this, so can’t say exactly what is was that worked before. But it wasn’t overly complicated or much different from anything I’m trying now.
The basic setup is a Mayfly 0.5b with a DH22 temp/humidity sensor wired in and an XBee XB24CZ7WITB003 transmitter in the Bee socket. Last week, I was able to walk my PC downstairs with the Mayfly upstairs on LiPo power transmitting temperature readings back to the serial terminal on my PC. Great.
This week I feel like I’ve tried everything but can’t get an XBee signal from the Mayfly doing the same. In trying different things, I can still get my two XBee transmitters to communicate via USB breakout boards, including from one on one PC to one on another. So that tells me the config on the two XBees is at least nominally correctly configured for communication. But this week, whenever I put the Router/Endnode (alternately configured) in to the Mayfly, nothing transmits via Serial1.
Very basic sketch from another thread:
1234567891011121314151617181920212223242526272829303132333435363738394041424344#include "Arduino.h"#include "DHT.h"#define XBEE_SleepPin 23void setup(){//Initialise the serial connectionSerial.begin(57600);Serial1.begin(9600); //this is the Xbee UART, default Xbee speed is 9600 baudpinMode(8, OUTPUT); //Green LEDpinMode(9, OUTPUT); //Red LEDdigitalWrite(8, HIGH); //turn on the Green LED and leave it ondigitalWrite(9, LOW); //turn off the Red LED, we'll use it later to indicate Xbee wakepinMode(XBEE_SleepPin,OUTPUT); // Set the Xbee "wake-up pin" (D23) to outputdigitalWrite(XBEE_SleepPin,LOW); // wake-up XBee to start withSerial.println("Xbee Testing Sketch");delay(2000);}void loop(){wakeXbee();delay(3000); //give the Xbee a few seconds to wake up and be seen by the networkSerial1.println("This_is_the_"); // this is the text that gets sent via the Xbee RF moduledelay(3000); //give the Xbee a few seconds before putting it back to sleepsleepXbee();delay(10000); // wait 10 seconds, then do it all over again}void sleepXbee(){Serial.println("Putting the Xbee to sleep");delay(100);pinMode(XBEE_SleepPin,INPUT_PULLUP); // Set "wake-up pin" to input and enable the internal pullupdigitalWrite(XBEE_SleepPin,HIGH); //put the Xbee to sleepdigitalWrite(9, LOW); //turn off the RED LED when the Xbee is asleep}void wakeXbee() {Serial.println("Wake up the Xbee");delay(100);pinMode(XBEE_SleepPin,OUTPUT); // Set the "wake-up pin" to outputdigitalWrite(XBEE_SleepPin,LOW); // wake-up XBeedigitalWrite(9, HIGH); // turn on the RED LED when the Xbee is awake}Then with the Mayfly plugged into a PC via USB, I can get serial messages at 57600 over USB. But my XBee coordinator reads nothing at 9600. Then, if I pull the XBee from the Mayfly and remount it on a USB breakout connected to a PC I can run:
1picocom --echo --baud 9600 --imap crcrlf,delbs /dev/ttyUSB0and then type messages that get transmitted to my coordinator node. Almost suggesting a hardware issue with the Mayfly.
I’ve checked and I’m mounting the XBee in the correct alignment with all the pins seated… Any suggestions as to what the problem may be, or how to troubleshoot further?
-
2023-11-22 at 3:27 PM #18178
It’s been a while since we’ve used Xbee modules with our Mayfly boards, so I don’t remember all the tricks to configuring the routers and coordinators, but your Mayfly code looks correct to me. Have you tried removing the wake and sleep commands and just leave the Xbee module constantly powered to see if that helps? Are you using the Mayfly v.05b board for all your tests? There were some significant design changes when we migrated to the v1.0 board, some of which affect how the Mayfly’s Xbee socket behaves.
-
-
AuthorPosts
- You must be logged in to reply to this topic.