Micro Maestro and Arduino FIO for 3 Servos and an ESC

I am using a Tx-Rx setup as follows for controlling an RC airplane:
Arduino Uno (ATMega328 + xBee Pro RPSMA at 2.4 GHz, 57600 bps) - runs at 5V
Arduino FIO (ATMega328 + Joysticks + xBee Pro Wired Antenna at 2.4 GHz, 57600 bps) - runs at 3.3V with a LiPo.
3 Servos and a Brushless DC Motor with an ESC - I have an 11.1V LiPo.

Now, my question is - I want to use the Micro Maestro with the 11.1V LiPo to control the 3 Servos and the ESC -> BLDC. It will take input from the microcontroller (over Serial, i guess!).
Arduino FIO can be programmed to receive data serially via xBees (wireless). Now, after data is received, how to send it to the Micro Maestro?
Or, is it possible to bypass the microcontroller (here, FIO) and directly use the Micro Maestro with the xBee Pro?
Thanks,
Abhimanyu Singh Udawat
Explore Labs

Hello, Abhimanyu.

Thank you for your interest in our products.

This question is a little too broad for my to answer it effectively. Is there something specific you need help with, such as programming the Arduino FIO, figuring out what connections to make, or configuring the Maestro?

Yes, it is. If you connect the XBee’s ground to the Maestro’s GND and connect the XBee’s TX to the Maestro’s RX, that should work. Technically the Maestro’s UART needs a minimum of 4 V on its RX line to read the line as high, but 3.3 V should work too (and if it doesn’t you can use a level shifter).

–David

Hello David,
I have done my homework by reading some of the older posts here and Pololu’s Maestro Documentation.
Now, i will be going with the following set up for the receiver side:
xBee Pro sends control commands at 3.3V Tx-> Step up DC - DC converter to 5V (Maxim IC, MAX1703 or any other suggestions?) -> Maestro’s Rx then controls servo movements.

I want to achieve the following:
Arduino Uno as a transmitter sends joystick movements via xBee Pro to the receiver. Then the receiver controls 3 Servos and an Electronic Speed Controller (which, as i read on this forum, can be similarly controlled like a servo by the Maestro and i was able to test it with USB on my PC).

I will post the results as soon as i finish the above targets.
Thanks

Hello.

The DC-DC converter you mentioned is intended be used for power lines, not rapidly-changing signal lines like RX and TX. As I said before, you probably don’t need any circuitry between the XBee’s TX and the Maestro’s RX for the system to work. However, if this system needs to be reliable and/or you want to be extra sure that the serial connection will work under a wide variety of conditions, it would be good to use a level-shifter. You could build your own using some resistors and transistors or buy one like this (which I have not tried):
sparkfun.com/products/8745

–David

I know that it needs Level shifting but as i mentioned in the first post, i have two different power sources with me. One 3.7V Single-Cell LiPo battery and a 3-cell battery at 11.1V

Now, Level shifting requires its own supply at both ends (low as well as high). That is why i wanted to go for Maxim solutions as they step up the voltage without any external supply at the other end.

Since weight is a consideration, and i have already bought 1-cell and 3-cell batteries, what do you think as a plausible solution? Also, can we use a simple voltage regulator (7805) to convert the 11.1V into 5V and then use level shifting instead?

Thanks

If you power the Maestro correctly (from the 11.1V battery), then you can get 5 V from its +5V (out) pin. The Maestro has a built-in regulator that will regulate the 11.1V down to 5 V, so you don’t need to add another regulator to the system just to do level shifting.

–David

Thanks Pololu for such a wonderful product. It seems it has just been made for my specific needs. I have connected the 11.1V battery to the Vin supply and am successfully getting 4.80V from the +5V out pin.

Now, as my servos need 5V for their supply, can these +5V and GND pin be directly connected to Vservo and GND?
If yes, then i have my xBee ready with its voltage regulated breakout board (5V to 3.3V and vice-versa) to do the necessary level shifting.

I think i am soon gonna fly!

Hello,
I have connected my 11.1V battery to Vin and GND of Maestro. I am also supplying the +5V out to the Vservo pin and the grounds are connected. Now the servo is on Channel 1 and it is working fine with the Windows GUI Maestro control centre. I also have the datasheet of the servo (Power HD 1900A) which says its Pulse width range is 800 usec - 2200 usec.

Now when i connect the Tx pin (here, pin 4) of the Arduino Uno to the Maestro’s Rx pin with the following code uploaded in the Arduino:

#include <NewSoftSerial.h>
#define txPin 4 
#define rxPin 3

NewSoftSerial mySerial(rxPin, txPin);
void setup()// run once, when the sketch starts
{
 mySerial.begin(9600);
  delay(1000);  
}

void set_target(unsigned char servo, unsigned int target)
{
    mySerial.print(0xAA,BYTE); //start byte
    mySerial.print(0x0C,BYTE); //device id
    mySerial.print(0x04,BYTE); //command number
    mySerial.print(servo,BYTE); //servo number
    mySerial.print(target & 0x7F, BYTE);
    mySerial.print((target >> 7) & 0x7F,BYTE);
}

void loop()
{
   delay(1000);
   set_target(1, 8000);
   delay(1000);
   set_target(1, 4000);
}

with the Maestro set at UART Fixed Baud Rate (9600) as well as in Auto Detect Mode. I can not get it to work. I also tried this code i found in other similar posts:

#include <NewSoftSerial.h>
#define RxPin     10 // digital pin connected to Maestro TX
#define TxPin     9  // digital pin connected to Maestro RX

NewSoftSerial MaestroSerial =  NewSoftSerial(RxPin, TxPin);
#define MAESTRO_BAUDRATE         9600  // set to the baudrate used.

void setup(){
  pinMode(RxPin, INPUT);
  digitalWrite(TxPin, HIGH); // keeps pololu board from getting spurious signal. Serial is idle high.
  pinMode(TxPin, OUTPUT);
  MaestroSerial.begin(MAESTRO_BAUDRATE); // init the serial communication to the board
}

void loop() {
  MaestroSerial.print(0x84, BYTE);
  MaestroSerial.print(1, BYTE);
  MaestroSerial.print(8000 & 0x7f, BYTE); 
  MaestroSerial.print((8000 >> 7) & 0x7f, BYTE); 
  delay(1000);

  MaestroSerial.print(0x84, BYTE);
  MaestroSerial.print(1, BYTE);
  MaestroSerial.print(4000 & 0x7f, BYTE); 
  MaestroSerial.print((4000 >> 7) & 0x7f, BYTE);
  delay(1000);
}

No change in Servo movement.
And the last code was uploaded from the Arduino IDE beta v1. So, it does not allows the use of BYTE command. Instead it forces us to use the Serial.write() method. So, here is the modified code:

void setup()
{
  Serial.begin(9600);   // set up Serial communication with Maestro Micro 6-channel Servo Controller
                         // Serial Port #3 on Arduino Mega 2560
}

void set_target(unsigned char servo, unsigned int target){

  //Send a Pololu Protocol command
  Serial.write(0xAA); //start byte
  Serial.write(0x0C); //device id
  Serial.write(0x04); //command number
  Serial.write(servo); //servo number
  Serial.write(target & 0x7F);  
  Serial.write((target >> 7) & 0x7F);
}

void loop()
{
  set_target(1,4000);
  delay(1000);
  set_target(1,8000);
  delay(1000);
}

The point is - I am not able to run any sample sketch to test the Serial connection of my Maestro with the Arduino.

The Maestro’s +5V out line can not supply enough current to power servos, so I recommend finding a better power source for your servos.

The first two sketches you posted both use the BYTE argument to serial.print. Were you actually able to upload either of those to your Arduino?

The third sketch you posted uses hardware serial, which uses the pins labeled RX and TX on the board. Did you connect TX to the Maestro or were you still using pin 4?

Did you remember to connect the GND of the Maestro to the GND of the Arduino?

–David

Hello David,
When i checked from the Maestro control centre, i was able to play with the servo.
Will the 11.1V at 800mAh be not enough for those tiny hungry servos?

Yes, the first two sketches were uploaded using Arduino 0022 version and they are running fine because i can see some data scrolling repeatedly in the Serial Monitor.

Yes, I was conscious to change the wiring from my Tx pin on the Arduino relevant to the sketches being uploaded. :slight_smile:

Lastly, this is where i made a mistake!!
I did not tie the Grounds together…
And guess what? I am seeing the servo move back and forth with the last sketch. Thank you so much.

I will keep the updates coming as i go through this project. Enjoy the day

I’m glad you were able to get things working after you connected the grounds.

Do you know how much current your battery can provide? Do you have link to a datasheet or product website for it? More information about battery current and capacity can be found in our company president’s blog post:
pololu.com/blog/2/understand … h-is-not-a

–David