Which Arduino pins are used for communications with the Xbee? Can I change those pins and if so how? Reason being I got a Seeeduino Xbee shield that lets me choose any pair of digital pins.
Thanks
RoboBill
XBee 2 data pins
Hi RoboBill, MegunoLink talks to the modules using their API packet format natively so you can plug them straight into an xbee adapter with a COM port and talk to them using our xbee visualiser. If you are using it through an arduino you would need to read the xbee using software serial or a second serial port and mirror that data out the main serial port to MegunoLink.
What exactly are you trying to do?
Cheers
Phil
What exactly are you trying to do?
Cheers
Phil
Hi Phil,
I'm trying to control and visualize data remotely on an Arduino 2560. I've set up a Dragino to upload sketches remotely. Do you have any examples of using an XBee i.e. the XBee Arduino sketch that works with a Megunolink program?
Thanks
RoboBill
I'm trying to control and visualize data remotely on an Arduino 2560. I've set up a Dragino to upload sketches remotely. Do you have any examples of using an XBee i.e. the XBee Arduino sketch that works with a Megunolink program?
Thanks
RoboBill
We don't have any xbee examples and I don't have easy access of the hardware currently. I'll try my best to outline a scenario that I believe I have seen working.
If you take two xbees and put them in serial adapters like these
https://www.sparkfun.com/products/11812
And connect megunolink to both of them. First remembering to configure the xbees using xctu as outlined on this page (one as a coordinator and one as an endpoint or router).
http://www.megunolink.com/documentation/xbee-manager/
See the "Things to note" at the bottom of the page. The xbees must be series 2 and must be configured as outlined (API mode etc).
Then you can send messages over the network from one xbee to another and MegunoLink can display the packets and visualise the data as if it was any other serial connection.
I tested this by sending a message in one monitor windows and seeing that it appeared out the other monitor window (proving that it went out over the radio link).
Then you could take that second xbee and put it back with your micro and get it to send the messages back to the computer.
Hope this was helpful
Phil
If you take two xbees and put them in serial adapters like these
https://www.sparkfun.com/products/11812
And connect megunolink to both of them. First remembering to configure the xbees using xctu as outlined on this page (one as a coordinator and one as an endpoint or router).
http://www.megunolink.com/documentation/xbee-manager/
See the "Things to note" at the bottom of the page. The xbees must be series 2 and must be configured as outlined (API mode etc).
Then you can send messages over the network from one xbee to another and MegunoLink can display the packets and visualise the data as if it was any other serial connection.
I tested this by sending a message in one monitor windows and seeing that it appeared out the other monitor window (proving that it went out over the radio link).
Then you could take that second xbee and put it back with your micro and get it to send the messages back to the computer.
Hope this was helpful
Phil
Hi Phil,
OK I got the two XBees to communicate and have the robot XBee mounted on a Seeeduino shield with the pins 12 for receiving and 8 for transmitting.
Here is a bit of my code added to your Blink2.0 :
#include "CommandHandler.h" // The serial command handler is defined in here.
// We'll use SoftwareSerial to communicate with the XBee:
#include <SoftwareSerial.h>
// XBee's DOUT (TX) is connected to pin 12 (Arduino's Software RX)
// XBee's DIN (RX) is connected to pin 8 (Arduino's Software TX)
SoftwareSerial XBee(12, 8); // RX, TX
CommandHandler<> SerialCommandHandler;
Can I modify your command handle file to recognize XBee as defined by the SoftwareSerial function?
Thanks
RoboBill
OK I got the two XBees to communicate and have the robot XBee mounted on a Seeeduino shield with the pins 12 for receiving and 8 for transmitting.
Here is a bit of my code added to your Blink2.0 :
#include "CommandHandler.h" // The serial command handler is defined in here.
// We'll use SoftwareSerial to communicate with the XBee:
#include <SoftwareSerial.h>
// XBee's DOUT (TX) is connected to pin 12 (Arduino's Software RX)
// XBee's DIN (RX) is connected to pin 8 (Arduino's Software TX)
SoftwareSerial XBee(12, 8); // RX, TX
CommandHandler<> SerialCommandHandler;
Can I modify your command handle file to recognize XBee as defined by the SoftwareSerial function?
Thanks
RoboBill
Hi, this example shows our command handler using multiple sources
https://github.com/Megunolink/MLP/blob/ ... andler.ino
I think you could replace CommandProcessor<> Serial2CommandHandler(CommonCommands, Serial2);
with CommandProcessor<> Serial2CommandHandler(CommonCommands, Xbee);
Phil
https://github.com/Megunolink/MLP/blob/ ... andler.ino
I think you could replace CommandProcessor<> Serial2CommandHandler(CommonCommands, Serial2);
with CommandProcessor<> Serial2CommandHandler(CommonCommands, Xbee);
Phil
Hi Bill, that code is in one of our examples. The arduino program is called MultiSourceCommandHandler.ino.
It allows you to have multiple sources triggering a single set of commands. Our library is typically installed inside the libraries folder of your Arduino IDE. In my case it is in "\arduino-1.8.1\libraries\MegunoLinkPro\examples\InterfacePanel\MultiSourceCommandHandler".
Use that example to transfer the relevant bits over to your program so that your software serial can be used to call commands.
Cheers
Phil
It allows you to have multiple sources triggering a single set of commands. Our library is typically installed inside the libraries folder of your Arduino IDE. In my case it is in "\arduino-1.8.1\libraries\MegunoLinkPro\examples\InterfacePanel\MultiSourceCommandHandler".
Use that example to transfer the relevant bits over to your program so that your software serial can be used to call commands.
Cheers
Phil
Hi Phil,
Sorry, but since I'm not a programmer, I don't understand your explanation. So I took on a much simpler example like Sparkfun's XBee_Serial_Passthrough.ino. I modified it a little. I'm able to transmit from the Xbee (series 2) to the serial but not from the serial to the xbee. Here is my sketch....
/*****************************************************************
XBee_Serial_Passthrough.ino
*****************************************************************/
//#include <XBee.h>
//#include <MegunoLink.h>
// We'll use SoftwareSerial to communicate with the XBee:
#include <SoftwareSerial.h>
// XBee's DOUT (TX) is connected to pin 9 (Arduino's Software RX)
// XBee's DIN (RX) is connected to pin 11 (Arduino's Software TX)
SoftwareSerial nss(11, 9); // RX, TX
void setup()
{
// Set up both ports at 9600 baud. This value is most important
// for the XBee. Make sure the baud rate matches the config
// setting of your XBee.
nss.begin(19200);
Serial.begin(19200);
}
void loop()
{
if (Serial.available())
{ // If data comes in from serial monitor, send it out to XBee
nss.println(Serial.read());
}
if (nss.available())
{ // If data comes in from XBee, send it out to serial monitor
Serial.println(nss.read());
}
}
What am I doing wrong?
Thanks
RoboBill
Sorry, but since I'm not a programmer, I don't understand your explanation. So I took on a much simpler example like Sparkfun's XBee_Serial_Passthrough.ino. I modified it a little. I'm able to transmit from the Xbee (series 2) to the serial but not from the serial to the xbee. Here is my sketch....
/*****************************************************************
XBee_Serial_Passthrough.ino
*****************************************************************/
//#include <XBee.h>
//#include <MegunoLink.h>
// We'll use SoftwareSerial to communicate with the XBee:
#include <SoftwareSerial.h>
// XBee's DOUT (TX) is connected to pin 9 (Arduino's Software RX)
// XBee's DIN (RX) is connected to pin 11 (Arduino's Software TX)
SoftwareSerial nss(11, 9); // RX, TX
void setup()
{
// Set up both ports at 9600 baud. This value is most important
// for the XBee. Make sure the baud rate matches the config
// setting of your XBee.
nss.begin(19200);
Serial.begin(19200);
}
void loop()
{
if (Serial.available())
{ // If data comes in from serial monitor, send it out to XBee
nss.println(Serial.read());
}
if (nss.available())
{ // If data comes in from XBee, send it out to serial monitor
Serial.println(nss.read());
}
}
What am I doing wrong?
Thanks
RoboBill
OK I just found Paul Martinsen's XBee 2 article which will be a great help. I now have the XBee 2's talking to Megunolink. I did go back to XBee series 1 and successfully hooked them up as a simple serial connections, but my series 2 xbees have the mini ufl's for external antennas where as my series 1 were on board antennas... and I need external antenna
Thanks
RoboBill
Thanks
RoboBill