Distributor

Xbee 868 revived?

 

xbee868.bmp

 

******************************************************

Update Aug 2011:

 

After a great deal of tests, this option for telemetry did not work for our us, I now have a working telemerty kit option which can be seen here, and you can buy the Telemetry kit from www.buildyourowndrone.co.uk

 

*********************************************************

 

The Xbee 868 how ever an older module it still has a great deal to offer and as some of you might remember this post as the original fix there has been a lot of other fixes that came to light hardware (Quick_and_Dirty) and software thanks to James and Noth666 but in A recent post of mine, we discussed the options for the UK and I came upon a new fix that seems simple yet effective enough to get the advantage of the offered 40km range as stated Here.

 

What you must do is reset your Xbee through the UART, modify the telemetry output to stop for a (guard time) amount of time, send the "escape sequence (+++), wait for another "guard time" and then send the reset command (ATFR). In this case the escape sequence is changed from the default (+++) to @@@ because the telemetry for Ardustation for example contains the +++ sequence and because of this there is great risk of putting the XBee in command mode when you don't want to.

 

I made contact with Marcus Fahlen and he was kind enough to supply a great deal of information on his work, and work around, the following information & code is the work of Marcus Fahlen, and with his permission I have added it below, I'm at this point where I need help on where and how to implement the code and from which pins, just to make sure

 

// XBee control functions by Marcus Fahlén

// sends a reset command (ATFR) through the

// UDB telemetry UART.

void xbee_reset( void) ; // This routine runs from the "servoPrepare.c" module in MatrixPilot

// main code directory. There is a flag i "options.h" for enabling or

// disabling the use of this code.

//

// This setup is for the 868 XBee PRO module which has a duty cycle

// of 10% (6minutes continuous transmission). Because of this I have written

// this piece of code that is meant to reset the XBee module at a choosen

// interval. I have done a lot of experimenting with different settings but

// I still have to find one that works 100% (count up to the guard time,

// send the escape characters, count up another guard time and then send

// the reset command. I don't bother to listen for any "OK" to check if

// the procedure was successful. That would demand bi-directional

// control code which I'm not capable of producing at the moment.

//

//

#define XBEE_PRE_GUARDTIME 25000

// XBEE_GUARDTIME : use approx 50000 for the "guard time counter"

// if your XBee is set up fo 50ms guard time.

// I have had greatest success with 50ms guardtime. I'm not sure why,

// but the shorter guardtime the more critical the timing becomes.

// Then again, longer guard times often results in a state where the

// XBee is in command mode but never recieved the reset command?

// This highly unwanted state ends when the XBee command mode "times-out"

 

// before it returns to "normal" operation. This time-out period is settable in

// the XBee and should of course be as short as possible.


//*****************************************************************************
// XBee control functions by Marcus Fahlén
// As for noe it only sends a reset command (ATFR) through the UDB telemetry UART.
// Hopefully it will be able to perform more sophisticated control functions later
// like output power management based on distance to base station and other circumstances
// that calls for a variation in output power.

void xbee_reset (void) ;

unsigned int xbee_skip = 0 ;
long guard_time = XBEE_PRE_GUARDTIME ; // XBEE_GUARDTIME : approx nnn for 10ms guard time 

void xbee_reset( void)
{
 ////// Skip every other run through this function.
 if (++xbee_skip < XBEE_RESETPERIOD) return ;
     unsigned int delay;
     for(delay=0;delay<guard_time;delay++);     // pre escape sequence guard_time 
         serial_output( "@@@" ) ;     // send escape sequence
       for(delay=0;delay<guard_time;delay++);     // post escape sequence guard_time
     serial_output("ATFR\r\n") ;
     xbee_skip = 0 ;
     return ;
}

 

// Maybe the reason for the reset routine missing is that it becomes

// "disturbed" by the interrupts running on the UDB? If an interrupt occurs between the

// the time where the "ATTENTION" command is being sent, but before the "reset" command is

// sent, I think causes the "hang state" that I have a lot of trouble with.

// The only thing to do is to calculate the timing need carefully, and maybe disable the

// interrupts all together while the "reset" command is being sent. That would assure that the

// reset is carried out as fast as possible. (50ms guard time times two + the time it takes to

// send the command characters)

//

// Use a command mode timeout of 200ms (ATCT2) which is the shortest possible.

// As described above, there is a chance that the routine "misses" and leaves

// the XBee in a non-transmitting state (comand mode), but it will only last for 0.2sec

// if setup as described. Then the XBee exits the command mode and resume normal operation.

//

// Also change the default escape character to "@" since the the telemtry

// output uses lots of "+++" in its data.

#define XBEE_POSTCOMMAND 10000

 

www.buildyourowndrone.co.uk

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Distributor

    @ Graham, I have not looked to far into the other applications or opportunities which will open up once this code is up and running, however I know that James has been using them for aircraft control for some while now, and has not had any issues. James comments can be seen here.

    @Gary, The data rate will lower as the range is increased, Johann and I have been looking at this very important factor, I believe that systems like Happy Killmore’s GCS should work without issue at the lowest speeds, 9600.

  • In my experience, if you can spare another line, it's much easier to pull the reset pin every 6 minutes. It barely affects the communication and it resets the duty cycle limit.

  • Moderator
    You won't get 40km range with high data rates.
  • Moderator

    Is this just intended for telemetry and/or can it be used for long distance aircraft control as well (both maybe)?

This reply was deleted.