(LSS) - Adapter Board - Xbee communication problem

Hello,
I have been trying to communicate with my (LSS) - Adapter Board from another arduino Uno board for 2 days.
Everything works wonderfully to control my servo motors via the card if I use the software:
Here are the tests i did , control servo from different source:

  • The “LSS Config” application interface => OK
  • XCTU XBee interface with command (LSS communication protocol) => OK
  • Send command via XBee from an arduino => NOT OK

I think there must be an error in the format of the command.
I respect the command format (LSS - Communication Protocol) but there must be a problem with the line return perhaps.

Anyone have an idea please?

Here is the small code sample i use to send the command to the LSS Adapter board:

#include <XBee.h>

XBee xbee = XBee();

unsigned long start = millis();
char* data = "#1D3000\n";
char* data2 = "#1D1000\n";

// 16-bit addressing: Enter address of remote XBee, typically the coordinator
Tx16Request tx = Tx16Request(0x2001, data, sizeof(data));
Tx16Request tx2 = Tx16Request(0x2001, data2, sizeof(data2));


void setup() {
  Serial.begin(9600);
  xbee.setSerial(Serial);
}

void loop() {
   xbee.send(tx);
   delay(1000);
   xbee.send(tx2);
   delay(1000);
}
1 Like

Hi Polyminthe,

Could you explain what you are trying the do exactly ?
Do you have an XBee connected to the LSS-Adaper and another Arduino with an XBee and trying to send commands from that Arduino to the LSS’s ?

Make sure the LSS-Adapter is in XBee mode with the on-board switch.
Also, if your XBee’s are set to 9600 you will have to set that baudrate on the LSS’s as well.

All the best,

1 Like

Hi,
Thank you so much for your help so quickly .
Yes it’s exactly that !
One arduino with an Xbee try to send command to the LSS-Adapter with another Xbee.
I already check both of my Xbee module are set uop with 9600.
Does i need to set up another thing ?
I don’t think it’s a probleme about the baudrate, because it’s work well , when i send the command from an xBee connected to my computer by usb.

It’s actually more then likely the baudrate.
Unfortunately the XBee’s are not good with the default 115200 baudrate of the LSS’s.

What you can do is connect using the LSS-Config to one servo and set the Baudrate to 9600.
Once done try your Arduino with XBee communication.

1 Like

It’s a pity. Both of my servo was already set to baudrate 9600 when i check in the app.

Great - That’s something to put aside.

I’ve just did a very simple test with XBee and Arduino.
Make sure that both your XBee’s are set to 9600 as well as your LSS’s. Another thing to look for is the USB cable on your Arduino UNO as it will conflict with the serial signal.

Set the LSS-Adapter switch to “XBee” as well.

Here is the code:

void setup() {
  Serial.begin(9600);
}

void loop() {
   Serial.println("#1D900");
   delay(2000);
   Serial.println("#1D0");
   delay(2000);
}

1 Like

HI,
Thousand’s of thanks . You can not imagine how much you make me happy tonight.
As a big gift this end of year.
I juste replace my code with your’s and everything work well now.

Use Serial.println did the trick:

#include <XBee.h>

XBee xbee = XBee();

void setup() {
  Serial.begin(9600);
  xbee.setSerial(Serial);

}

void loop() {
   Serial.println("#1D900");
   delay(5000);
   Serial.println("#1D0000");
   delay(5000);
}

There are endless ways to code and I’m not a programmer myself, but I can work my way.
Using the printLn will put the carriage return at the end which sometimes solve issues.

As a test I used the LSS_Sweep example found in the LSS - Arduino Library.
In order to keep it compatible with your setup I changed two things, the Baudrate and the servo ID and it also works.

/*
 *	Author:			Sebastien Parent-Charette ([email protected])
 *	Version:		1.1.0
 *	Licence:		LGPL-3.0 (GNU Lesser General Public License version 3)
 *	
 *	Description:	Basic example of the LSS moving back and forth.
 */

#include <LSS.h>

// ID set to default LSS ID = 0
#define LSS_ID		(1)
#define LSS_BAUD	(9600)
// Choose the proper serial port for your platform
#define LSS_SERIAL	(Serial)	// ex: Many Arduino boards
//#define LSS_SERIAL	(Serial1)	// ex: Teensy


// Create one LSS object
LSS myLSS = LSS(LSS_ID);

void setup()
{
	// Initialize the LSS bus
	LSS::initBus(LSS_SERIAL, LSS_BAUD);

	// Initialize LSS to position 0.0 °
	myLSS.move(0);

	// Wait for it to get there
	delay(2000);
}

// Loops between -180.0° and 180°, taking 1 second pause between each half-circle move.
void loop()
{
	// Send LSS to half a turn counter-clockwise from zero (assumes gyre = 1)
	myLSS.move(-1800);

	// Wait for one second
	delay(2000);

	// Send LSS to half a turn clockwise from zero (assumes gyre = 1)
	myLSS.move(1800);

	// Wait for one second
	delay(2000);
}
2 Likes

When two XBees are in communication with each other, one needs to be set to a Master device and the other to a Slave device.

This may already have been done but there was no post of any reference to it between the two XBees.

When done so, the two XBees will auto link when powered and establish the communication link. Also if supported, at the Endpoints, bump up the Baud Rate to the 38400 setting. This rate produces fast and reliable communications while still providing no extensive overhead at the UARTs at the endpoints.

Hope this helps.

2 Likes

Hi, many thanks !

1 Like

I never had to set a Master or Slave when using XBee modules.
Since they can both communicate bi-directionally I don’t see the need. Maybe in a more complex mesh.

1 Like

When using a PC, no, you would not have to set the Master/Slave relationship, since the PC is the Master and any XBees are the Slaves.

But when you are using two or more XBees that are to communicate with each other, with no PC involved, one of them is set to Master and the other(s) are set to Slaves. And you also set all of the PIN Codes to the same value as the Master. The Master then can auto-link to the slaves without any interaction, once it is powered on.

In this thread, there was no reference to how the XBees were configured other then multiples were being used and the logic posts are uProcessor related, not PC related.

Since XBees are just basically UARTs in communication over a wireless signal, the UART Standard states that one device is a Master and others are Slaves. It is a something that can not and will not change in the UART Standards. Many times when Users have issues with multiple devices in communication with each other, it is because of the Master/Slave relationship and none of the devices (XBee or whatever) are set as a Master. If a device is UART in its foundation, there needs to be a Master.

In the case of XBee devices, yes, they are bi-directional, but without a Master they all start talking at the same time and even overstep each other, causing scrambled communications and errors. Having a Master ensures that it then instructions each individual Slave as to when and for how long it can send or receive its data packet across the UARTs, and also manages the spectrum hopping between itself and all the Slaves.

If a PC is in use and 2 XBees … and one is attached via wire to the PC and the other is Remote, then the one on the wire/PC is set to be the Master and the remote is the Slave. If both XBees are remote and communication is to the PC directly, the PC is the Master by default and the two remotes are Slaves. Which do not ever need to really be checked because most XBees ship from Factories in the Slave Configuration. But one should always check that, if there are issues with them not communicating properly.

In the most basic of terms, the Master is the device that controls the CTS and RTS of the signals. Without it, all the Slaves think it is clear to send or clear to receive packets and that is why they scramble up their data. The Master controls the CTS/RTS and also the hopping in the wireless spectrum and usually will have multiple Slaves under its control, assigned to an individual spectrums and then act like a wireless multiplexer and shift itself around between all the spectrums in order to have stable communication with each Slave. The reason for that is the UART Standards. One Master, One Slave. But with multiple spectrums, one Master can hop between the spectrums and talk with multiple Slaves, each in a different spectrum of the wireless signal.

1 Like

the Baud Rate to the 38400 setting was the key to solve my problem thank you !!
It’s definitly the best baudrate i found to work with arduino + xbee + LSS Adaptor

2 Likes