Arduino controlling micromaestro via xbee

Hi
I have strange problem, and I hope I am just overlooking something simple…
I have an arduino based remote control set to call sequences on a micro maestro 12ch.
The maestro controls 6 servos that animate a tortoise for a theatrical prop.
If I wire the rx tx lines direct from the arduino to the maestro… no problem and all works as needed.
I can call any of the maestro sequences and feedback is received and displayed on an LCD connected to the arduino.
Now if I send the serial via the xbee link… nothing… the xbees will connect briefly then the arduino freezes and the watchdog kicks in and resets the arduino.
The xbee link is has been tested multiple times and is good… and this is what perplexes me.
If I then connect the SAME arduino remote via the SAME xbee link with all the SAME power conections to ANOTHER 6ch micro maestro with a simplified script… NO PROBLEM All talking an working as it should.
I have set both maestros with identical serial connections.
I have also simplified the arduno script as much as I can.
Please all comments graciously received…I am pulling my hair out!!

[code]# when the aestro script is not doing anything else,

this loop will listen for button presses. When a button

is pressed it runs the corresponding sequence.

sub main
begin
buttonA if eat endif
buttonB if walk endif
buttonC if rest endif
buttonD if look endif
buttonE if eat endif
repeat

sub buttonA
7 get_position 500 less_than
return

sub buttonB
8 get_position 500 less_than
return

sub buttonC
9 get_position 500 less_than
return

sub buttonD
10 get_position 500 less_than
return

sub buttonE
11 get_position 500 less_than
return

Sequence subroutines:

eat

sub eat
500 0 8064 8192 8384 8212 9664
6944 frame_0…6 # rest
500 6464 6848 frame_2_3 # frbl
500 9073 10240 frame_1_4 # flbr
1000 2176 frame_5 # head out
500 8925 6573 6915 10090 frame_1…4 # Frame 18
600 9073 6464 6848 10240 9216 frame_1…4_6 # head left
500 4672 frame_6 # head right
2000 2866 5091 frame_5_6 # eat
2000 3484 4738 frame_5_6 # eat
500 8472 6807 frame_1_2 # Frame 16
2000 9073 6464 2575 5157 frame_1_2_5_6 # eat
500 8725 7012 9385 frame_1_3_4 # Frame 17
2000 9073 6848 10240 3266 5466 frame_1_3…6 # eat
2000 2176 4672 frame_5_6 # eat
500 9216 frame_6 # head left
500 9664 frame_5 # head in
500 6944 frame_6 # head right
500 8384 8192 frame_3_4 # back leg sit
500 8064 8192 frame_1_2 # front leg sit
main

look

sub look
500 0 8064 8192 8384 8192 9664
6944 frame_0…6 # rest
500 9238 6464 frame_1_2 # front legs
1600 2176 frame_5 # head out
1500 4672 frame_6 # head right
1200 2793 9216 frame_5_6 # head left
1100 3157 4672 frame_5_6 # head right
1200 2721 9216 frame_5_6 # head left
900 4066 4672 frame_5_6 # head right
700 6966 frame_6 # centre
700 9664 frame_5 # head in
500 8064 8192 frame_1_2 # rest
main

rest

sub rest
500 0 8064 8192 8384 8192 9664
6944 frame_0…6 # rest
main

walk

sub walk
500 0 8064 8192 8384 8192 9664
6944 frame_0…6 # rest
900 9856 6464 6848 10240 frame_1…4 # stand
100 8707 7453 frame_1_2 # Frame 2
800 9856 6464 7548 8530 frame_1…4 # Frame 3
200 6848 9752 frame_3_4 # Frame 4
1000 8629 7437 frame_1_2 # Frame 5
1000 9856 6464 7630 8530 frame_1…4 # Frame 6
1000 6848 10240 frame_3_4 # Frame 7
1000 8472 7537 frame_1_2 # Frame 8
1000 7727 8947 frame_3_4 # Frame 9
1000 9856 6464 frame_1_2 # Frame 10
1000 8384 8192 frame_3_4 # Frame 11
1000 8064 8192 frame_1_2 # Frame 12
main

sub frame_0…6
6 servo
5 servo
4 servo
3 servo
2 servo
1 servo
0 servo
delay
return

sub frame_2_3
3 servo
2 servo
delay
return

sub frame_1_4
4 servo
1 servo
delay
return

sub frame_5
5 servo
delay
return

sub frame_1…4
4 servo
3 servo
2 servo
1 servo
delay
return

sub frame_1…4_6
6 servo
4 servo
3 servo
2 servo
1 servo
delay
return

sub frame_6
6 servo
delay
return

sub frame_5_6
6 servo
5 servo
delay
return

sub frame_1_2
2 servo
1 servo
delay
return

sub frame_1_2_5_6
6 servo
5 servo
2 servo
1 servo
delay
return

sub frame_1_3_4
4 servo
3 servo
1 servo
delay
return

sub frame_1_3…6
6 servo
5 servo
4 servo
3 servo
1 servo
delay
return

sub frame_3_4
4 servo
3 servo
delay
return
[/code]

[code]
#include <PololuMaestro.h>
#include <LiquidCrystal.h>
#include <avr/wdt.h>

#ifdef SERIAL_PORT_HARDWARE_OPEN
#define maestroSerial SERIAL_PORT_HARDWARE_OPEN
#else
#include <SoftwareSerial.h>
SoftwareSerial maestroSerial(2, 3); // RX, TX
#endif

LiquidCrystal lcd(8, 9, 4, 5, 6, 7); // select the pins used on the LCD panel

// define some values used by the panel and buttons
int lcd_key = 0;
int adc_key_in = 0;

#define btnRIGHT 0
#define btnUP 1
#define btnDOWN 2
#define btnLEFT 3
#define btnSELECT 4
#define btnNONE 5

int scriptStatus = 0; // variable for reading if the maestro script is running
int servoPosition = 0; // variable for reading servo position

int read_LCD_buttons(){ // read the buttons
adc_key_in = analogRead(0); // read the value from the sensor

if (adc_key_in > 1000) return btnNONE; 
if (adc_key_in < 50)   return btnRIGHT;  
if (adc_key_in < 250)  return btnUP; 
if (adc_key_in < 450)  return btnDOWN; 
if (adc_key_in < 650)  return btnLEFT; 
if (adc_key_in < 850)  return btnSELECT; 

return btnNONE;                // when all others fail, return this.

}

// create a Maestro object using the serial port.
MiniMaestro maestro(maestroSerial);

void setup(){

lcd.begin(16, 2); // start the lcd library
lcd.setCursor(0,0); // set the LCD cursor position
lcd.print(“Arcadia Tortoise”); // print a simple message on the LCD
delay(1000);
lcd.setCursor(0,1);
lcd.print("-- CONNECTING --");
delay(1000);
lcd.clear();

// Set the serial baud rate.
Serial.begin(9600);
delay(1000);
maestroSerial.begin(9600);
delay(1000);

wdt_enable(WDTO_2S); // enable watchdog timer at 2 seconds

}

void loop(){

wdt_reset();

scriptStatus = maestro.getScriptStatus();
delay(100);
if (scriptStatus == 0){
lcd.setCursor(0,0);
lcd.print("Tortoise READY “);
}else{
delay(100);
lcd.setCursor(0,0);
lcd.print(“Arcadia Tortoise”);
lcd.setCursor(0,1);
lcd.print(” RED to RESET ");
}

lcd_key = read_LCD_buttons(); // read the buttons
switch (lcd_key){ // depending on which button was pushed, we perform an action

   case btnSELECT:{
     maestro.restartScript(0);
         break;
   }
   case btnLEFT:{
         maestro.restartScript(6);
         delay(10);
         lcd.setCursor(0,1);
         lcd.print("... feed me ...");
         wdt_reset();
         delay(1800);
         lcd.clear();
         break;
   }
   case btnRIGHT:{
         maestro.restartScript(6);
         delay(10);
         lcd.setCursor(0,1);
         lcd.print("... head in ...");
         wdt_reset();
         delay(1800);
         lcd.clear();      
         break;
   }    
   case btnUP:{
         maestro.restartScript(8);
         delay(10);
         lcd.setCursor(0,1);
         lcd.print("... head out ...");
         wdt_reset();
         delay(1800);
         lcd.clear();      
         break;
   }
   case btnDOWN:{
         maestro.restartScript(9);
         delay(10);
         lcd.setCursor(0,1);
         lcd.print("... sit ...");
         wdt_reset();
         delay(1800);
         lcd.clear();      
         
         break;
   }
   
   /*case btnNONE:{
         lcd.print("NONE  ");  //  No action  will show "None" on the screen
         break;
   }*/

}
}[/code]

Hi,

I would check the power, wireless requires more power.

Hi
Thanks for the reply.
The situation I describe occurs even when I provide the Xbee with its own regulated power supply.
I must reinforce… All works as needed if I replace the 12ch maestro with a 6ch maestro!!
Alex

I am not sure which XBee module you are using, but I suspect it might be using 3.3V serial signals. If that is the case, please note that the Maestro is a 5V device and is not guaranteed to work with 3.3V signals. This could explain why one Maestro works and the other does not. You might consider using something like a logic level shifter to interface between the XBee module and Maestro.

If that does not solve the problem, can you give me more information about your system? How many servos are you using? When you switch to the Maestro that works in your system, do you still have all of the servos connected?

-Brandon

Hi
The xbee are the pro series 900, they are connected to the maestro via a sparkfun regulated explorer that takes care of the level shifting.
The problematic 12ch maestro has 6 servos and 5 buttons connected… the buttons are held high via pull ups to the maestro 5v out.
the 6ch maestro is unpopulated.
Today I pulled another 12ch maestro… unpopulated… and hooked it up as follows…sketch/scripts on the maestro and arduino are as above
All power supplies/wires are the same for each test

Arduino - xbee+sparkfun explorer — xbee+sparkfun explorer - unpopulated 12ch maestro
NO SERIAL COMMUNICATION

Arduino - direct tx/rx connection - unpopulated 12ch maestro
ALL GOOD AND TALKING

Arduino - xbee+sparkfun explorer — xbee+sparkfun explorer - unpopulated 6ch maestro
ALL GOOD AND TALKING

WTF! that is 2 different 12ch maestro that will connect direct via serial to the arduino…but not via the xbees…
The xbee connection is good… tested with the xbee software and in the system with the 6ch maestro
The serial settings for all the maestros are exactly the same… and anyway they are good as it will connect with a direct tx/rx

I have tried to simplify the test to the base level… apart from looking for button presses arduino is only asking if the maestro script is running or not, and both the maestros are not connected to anything but power and serial.

Has anyone had success using xbee with the 12ch maestro?

I am also running out of time and may have to forgo 12ch maestro for the smaller 6ch…
Just means I have no extra channels available to add a direct trigger for the sequences on the tortoise itself… not the end of the world but not ideal.
cheers
alex

We have heard of customers in the past using an XBee module and SparkFun XBee Explorer with a 12-channel Maestro successfully (here is one example of another forum member).

From the information you have provided, I do not see anything obvious that would cause a problem. What is the behavior of the indicator LEDs on the Maestro (specifically the yellow one)? You can try to compare that behavior to the description in the “Indicator LEDs” section of the Maestro user’s guide to try to decipher what is happening.

-Brandon