Pages: [1]   Go Down
Author Topic: Configuring XBee without XCTU  (Read 260 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, I am quite new to arduino and I would like to configure my Xbee S1 (which is pluged into my arduino with a Bees Shield v2.12 from seedstudio) without having to use XCTU. More precisely I would like to put the power down to minimum level which is command ATPL 0 if I am not wrong. Could this be done automatically by programming it in the setup() function without going through XCTU? if so, how would i do it? how could I send the +++ to enter command and then configure the ATPL 0 and check its been done?

Thank you very much  smiley
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48556
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I would like to configure my Xbee S1 (which is pluged into my arduino with a Bees Shield v2.12 from seedstudio) without having to use XCTU.
Why?

Quote
Could this be done automatically by programming it in the setup() function without going through XCTU?
Yes.

Quote
how could I send the +++ to enter command
Code:
Serial.print("+++");
Assuming that the XBee is on the serial port.

Quote
and then configure the ATPL 0
Code:
Serial.print("ATPL=0");

Quote
and check its been done?
In a while loop, while there has not been a complete response, see if there is serial data to read. If so, read it. A complete response generally ends with a carriage return and line feed.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to do this because I have to configure 3 arduinos and I think its faster to add a few lines of code to the setup than configuring each one individually with XCTU right?

I have a software serial library, which uses pins 8 and 9 to tx/rx. Therefore the default Serial i use to read and print info on the monitor serial screen while the SoftwareSerial mySerial i use to tx/rx data from the Xbee. If i'm not wrong there should also be a delay of 1 sec before and after the +++ correct¿? something like:
delay(1000);
mySerial.print("+++");
delay(1000);
mySerial.print("ATPL=0");
...
a while loop that waits for =="\r\n"

Thanks for your help smiley
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48556
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I want to do this because I have to configure 3 arduinos and I think its faster to add a few lines of code to the setup than configuring each one individually with XCTU right?
You have to configure other things, too, right? Like MY, DL, etc.

You need to read the existing configuration, and then rewrite it, right?

You need to perform error checking on the parameter and value, right?

I think that using X-CTU will be easier. But, that might be just me.

Quote
If i'm not wrong there should also be a delay of 1 sec before and after the +++ correct¿?
If the XBee doesn't receive a command every second or less while in command mode it exits command mode. So, a one second delay after entering command mode hardly seems like a good idea. The delay before entering command mode is plain useless. It simply wastes a second.

Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 93
Posts: 3970
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

XBees can also be configured by connecting them to a terminal program and issuing the required AT commands. Set the desired parameters, then issue the ATWR command to save them to non-volatile memory. Personally I prefer X-CTU but whatever floats your boat.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Pages: [1]   Go Up
Jump to: