Testing Hover Capability

After attaching motors to the copter frame, mounting the props, and calibrating the ESCs, we were ready to test if the copter could lift its weight.  To control the motors, the ESCs were wired to the Arduino Uno via a breadboard placed adjacent to the quadcopter.  Motors 1, 2, 3, 4 were attached to Uno pins 3, 5, 6, and 10 respectively.  The Uno has 6 pins which can generate pulse width modulation (PWM), however, and any could be used.

Testing Code

To test the hovering potential of the copter, a small program to control all motors simultaneously was written using the Arduino IDE v1.0.  The program allowed an operator to control the PWM signals to each individual motor or to all at once by listening to commands on a serial connection.  The Arduino code is below.

Since the Mystery ESCs can read basic servo signals, the Servo.h Arduino library was used for simplicity.  The motors were calibrated to have a low signal of 700 microseconds and a maximum signal of 2000 microseconds.

#include <Servo.h>

#define MAX_SIGNAL 2000
#define MIN_SIGNAL 700

#define M1 3
#define M2 5
#define M3 6
#define M4 10

Servo motor1;
Servo motor2;
Servo motor3;
Servo motor4;

int speed1, speed2, speed3, speed4;

void setup() {
  Serial.begin(9600);
  Serial.println("Program begin...");
  Serial.println("This program will test the 4 motors.");

  motor1.attach(M1);
  motor2.attach(M2);
  motor3.attach(M3);
  motor4.attach(M4);

  motor1.writeMicroseconds(MIN_SIGNAL);
  motor2.writeMicroseconds(MIN_SIGNAL);
  motor3.writeMicroseconds(MIN_SIGNAL);
  motor4.writeMicroseconds(MIN_SIGNAL);

  Serial.println("Sending minimum signal. Power on motor and wait for beeps.");
  delay(4000);

  Serial.println("After beeps, type a signal length terminated by m and the motor number to motor. For example,");
  Serial.print(MIN_SIGNAL);
  Serial.println("m1 to stop the motor 1. ma is for all motors.");
}

void stop() {
  Serial.println("stoping...");
  motor1.writeMicroseconds(MIN_SIGNAL);
  motor2.writeMicroseconds(MIN_SIGNAL);
  motor3.writeMicroseconds(MIN_SIGNAL);
  motor4.writeMicroseconds(MIN_SIGNAL);
  speed1 = MIN_SIGNAL;
  speed2 = MIN_SIGNAL;
  speed3 = MIN_SIGNAL;
  speed4 = MIN_SIGNAL;
}

void loop() {
  int input, number;

  // Wait for input
  if (!Serial.available()) return;

  input = Serial.read();
  // emergency stop command is ', right next to enter key
  if (input == '\'') {
    stop();
    return;
  }

  // Convert string to integer. String terminated with m (for microseconds).
  number = input - '0';
  while ((input = Serial.read()) != 'm') {    
    if (input == -1) continue;

    number *= 10;
    number += input - '0';
  }

  while ((input = Serial.read()) == -1);

  switch (input) {
   case 'a':
     speed1 = number;
     speed2 = number;
     speed3 = number;
     speed4 = number;
     break;
   case '1':
     speed1 = number;
     break;
   case '2':
     speed2 = number;
     break;
   case '3':
     speed3 = number;
     break;
   case '4':
     speed4 = number;
     break;
   default:
     break;
  }

  Serial.print("Now writing: ");
  Serial.print(speed1);
  Serial.print(" ");
  Serial.print(speed2);
  Serial.print(" ");
  Serial.print(speed3);
  Serial.print(" ");
  Serial.println(speed4);

  motor1.writeMicroseconds(speed1);
  motor2.writeMicroseconds(speed2);
  motor3.writeMicroseconds(speed3);
  motor4.writeMicroseconds(speed4);
}

The program works by sending commands over Serial to the Uno.  In the Arduino serial monitor, a user should send a command in the form <speed>m<motor> where <speed> can range from 700-2000, and <motor> can be set from 1 to 4 for each motor or ‘a’ to command all motors.  For example, a command to turn on all motors at 40% speed [0.4*(2000-700) + 700 = 1220 microseconds] would be “1220ma” without quotes.

A stop all motors command can be issued by simply sending the apostrophe (‘) character, located conveniently next to the enter key on most keyboards.

Testing

Once the program was written and verified to work correctly, we needed to tie down the copter so that it would not fly away and crash.  An ad hoc solution consisting of a large piece of cardboard, duct tape, and four small ropes easily accomplished this.  Once secured to the cardboard with a some leeway to hover, the quadcopter was ready for some basic tests.

After connecting the Arduino to a laptop vis USB and commanding all motors to stop, we connected the battery.  Once powered on, each ESC emits several tones indicating the number of battery cells detected.  To prevent injury, all present team member wore protective eyewear.

Once powered on, we began running the motors at about 15% speed (900 microseconds).  After verifying that all motors were functioning correctly, the motor speed was increased in increments of 100 microseconds until the copter lifted completely off the ground.  The picture below demonstrates this result.  To see a video of this test, visit the project demonstration video page.

Problems

While running all the motors, one appeared to stop working.  After attaching the motor to another ESC with no problems, we determined that one of our ESCs was malfunctioning.  Fortunately, other ESCs were available in the lab to replace the fault ESC, and additional ESCs were ordered in case of any future problems.

One prop blad also broke in half when the motors were run at a very high speed.  Running the motors at 60% speed caused one arm of the copter to dislodge from the frame, causing the prop to hit the ground, snap, and fly across the lab.

Results

The quadcopter successfully lifted at about 40% of the motor speed (1200 microseconds).  This was a very good result because a lower hover speed will allow the quadcopter to use higher motor speeds for more accurate control and adjustments during flight.  Therefore, the quadcopter should be able to easily maneuver itself.

2 thoughts on “Testing Hover Capability

  1. Interesting test project. I have found problems with ESC units before too. They are problematic and glitchy.

  2. Pingback: は素晴らしい万「FUN」の型の表をシンクロ以外にも、Swatch香港区開設の首の間の旗艦店を開店し、強力な販売網を構築。スーパーコピーブランドMr . Kevin Rollenhagen衆がナンシーだと、城の女

Comments are closed.