I'm working on a project that involves two Arduino Uno boards, two XBee S2C modules, two SparkFun XBee shields, and a soil moisture sensor. My goal is to have one Arduino read the soil moisture sensor's value and transmit it to another Arduino using XBee modules. I want to display the received value on the serial monitor of the second Arduino.
So far, I've successfully set up the XBee modules in XCTU, establishing one as the coordinator and the other as a router. I can send messages from XCTU console to the Arduino serial monitor, and they show up correctly. However, I'm facing an issue when trying to send messages from the Arduino serial monitor to the XCTU console.
I'd appreciate it if someone could help me generate the code that will enable this communication between the Arduino boards using XBee modules. Any guidance or examples would be highly appreciated!
if your module is configured correctly and connected then it's all transparent
On your SparkFun XBee shield, the serial pins (DIN and DOUT) of the XBee are connected through an DPDT switch, which allows you to select a connection to either the UART pins (D0, D1) or any digital pins on the Arduino (D2 and D3 default).
Say you connected your xBee to pin 2 and 3 and selected the switch appropriately
Upload that code and open the Serial Monitor at 115200 bauds
Hello, thank you for your input! I'm relatively new to this field, and this is my first experience working with these boards, XBees, and the shield. I have a follow-up question: Is the DPDT switch on the SparkFun XBee shield the one labeled "UART/Dline"? I'll attach a picture for better clarity. Additionally, regarding the provided code, should it be uploaded to both Arduinos? Thanks a lot!
Thank you for your response and assistance. Despite following all the instructions provided, I am still encountering an issue where nothing is being displayed on the serial monitor when I connect both XBee modules to the Arduinos. However, within XCTU, I am able to send a message from the console and it appears in the serial monitor. The problem arises when attempting to send from the Arduino serial monitor back to the console. Could you please advise on potential reasons for this issue? From there, I hope to diagnose why the two devices are not communicating via the Arduinos.
Additionally, I am curious if there is an alternative method to connect the XBee modules and communicate with Arduino without using the shield, opting instead to connect them directly.
the shield helps you adjust the voltage for your xBee and offers extra benefits.
There are simpler shields like the Xbee Explorer Regulated which provides just the voltage adapter.
Hello, J-M-L... apologies o the late response, it worked!! thanks alot. the issue was i had not installed the XBee libraries and in the code i was calling them.. silly me
I appreciate the help.
thanks a lot.