Built a quadcopter (II)

santoscasta
image1

Continuing the previous post (link), I’ll finish explaining as I finished building my quadcopter.

CONFIGURATION

Connecting PC

The IMU has access miniUSB that can connect directly to your computer.

 image57

Windows 7 should automatically recognize and install the USB drivers suitable. Otherwise, you can download from the Internet. We have to use the USB 2.0 standard, since the port of APM are not compatible with the new USB 3.0 (SuperSpeed, or «ss»). The computer will assign a specific COM port, which will be used for all interactions with the board via USB.

 image58

Load

It is recommended to disconnect the power to the APM to connect the USB , as if the battery is connected to the system while it is connected via USB, the APM can send false and put the ESC signal rotating propellers cuadcópter.

 image59

Planner Missions

After downloading the firmware ArduCopter, can download and run the latest Mission Planner (ArdupilotMegaPlanner.exe). Selecting the image of our cuadcópter, Mission Planner will handle automatically detect what type of card there, download the latest version of Internet code and upload it to the APM.

 image60

You can check it out, leaving the USB cable connected, leaving the charger firmware and changing the terminal Planner Missions. If we switch CLI ( Command Line Interpreter ) facing the RC pin should be the command line interface on the screen.
 image61

 image62

Using the CLI (Command Line Interface)

As an alternative to the GUI Planner Missions, we can use the command line interface to configure and modify parameters in the Arducopter , which is integrated both in the Mission Planner, under the name of Terminal , such as Serial Monitor Arduino .

We can not forget to give the reset every time we change the position of the switch CLI.

 image63

At the beginning, we see that typing «help» can be deployed helpful commands.

 image64

Mode Settings:
  • PID : Restore the default PID values if they have changed.
  • Radio : Join the limits of RC channels.
  • Frame : Choose the settings for cuadcópter: (x, +).
  • Play : Enable sonar sensor.
  • Compass : Enable / disable the compass.
  • Declination : Sets the value of the local declination.
Test Mode:
  • PWM : Displays the PWM value of the 8 radio channels.
  • GPS : Displays GPS data.
  • IMU : Displays the output Euler angles.
  • Batery : Indicates the analog output voltage, 0-3.
  • Waypoint : Dumps waypoints stored commands.
  • Altitude : Displays barometric pressure on board.
  • Play : Indicates whether the sensor is connected and enabled.
  • Compass : Compass in degrees (0 = north).
  • XBee : Shows the received sequence by XBee . It is used to test range.
  • Mission : Write a mission default EEPROM (null, ‘wp’). For example, ‘wp’ kicks the cuadcópter 15 meters north and back.

Radio-Control

 image65

To configure the radio-controlled RC we turn on the transmitter and move all switches to its entirety. Starting with the lever on the right, we move up to the right, then down to the right, then top left and finally down to the left, keeping fixed the lever in each position for about one second. Then we repeat the same procedure with the left stick. The order does not matter, what matters is that the levers are carried to the four corners. We will do the same for any switch that is used with channels 5-7.

When finished, click on OK and the screen will look similar to the results of the previous figure.

Note: Figures do not need to appear accurate, but in a range between minimum and maximum 900/1200 1800-2100. If there is no difference between the minimum and the maximum, mean that the channel is not connected. In the picture above, were not connected channels 7 and 8.

Sonar

Since the sonar is an optional element, you have to enable it in the program code of the plate with Arduino , entering CLI in configuration and type «sound on».

XBee Telemetry Modules

The first thing to note is that the modules Xbee should work in a frequency range different from the radio-control. 900Mhz modules are recommended but in some countries the frequency is not approved. In our case, we use one module 2.4GHz XBee-Pro Wireless.

Modules Xbee need adapters to work with the board ArduPilot Mega . We chose the option of using two adapters XtreamBee for both Xbee , the airborne side and «earth».

Modules Xbee have a default speed of 9600 bps, there will be changed to match the speed of the APM , at 57600 bps. If you want to change the rate of speed, it can be done with the #define SERIAL3_BAUD { desired speed } in the APM_Config.h.

It is also advisable to give the modules unique network IDs (VIDs), so they are paired, and see if there is anyone in the area flying UAVs, which does not use the same VIDs.

A configuration box will appear like the picture below. We will check that everything is correct.

 image66

Connection Test

You can test the connection by opening the HyperTerminal or using the Windows command window Arduino .

Select the appropriate COM port and baud rate you have previously elected to the APM and adapters XtreamBee (the default is 57600 bps). Once this is done, it will show telemetry data received in the command window. When you receive a «Serial3.println» means that the data is being sent from the quadrotor to the ground station to the computer.

In addition, if you want to test the scope of the bond Xbee can be connected together the RX and TX pins to create a circuit loopback and use the field tests X-CTU test range. It should receive a range of about 1.5 km.

Note : If you have a Xbee connected to APM , the USB cable from the APM probably not provide enough energy for both. It is therefore recommended to have a ESC and LiPo battery connected to the pins of radio control to provide additional power.

Test code

The project ArduPilot Mega provides a test code to test the serial ports. The APM has four serial ports, so all the usual Arduino commands now take a specifier to decide which port you want to read or write. For example: Serial1.print () , Serial2.print () etc. The USB port is connected to Serial0 and the port connected to pins of Telecom is the Serial3 .

Following these instructions can ensure that all ports are working.

     
  1. We connect the Xbee on port USB and APM to another. Open Arduino to load the demo , and configure the serial port is assigned the same as the APM . Then we open the serial monitor, setting speed to 115200 bps. You should see «Port 0» repeatedly, displaying the output port of the APM.
  2.  image67

  3. Now put the serial port that is assigned to the XBee and re-open the serial monitor. Establish this time the transmission speed 57600 bps (Xbee speed). We will see the message «Port 3» repeated, showing the output of the XBee port.

 image68

Magnetometer

There are two options for implementing the magnetometer. It can be done through the CLI or by modifying the file APM_Config.h software Arduino , or directly from the Mission Planner.

#define MAG_ORIENTATION AP_COMPASS_COMPONENTS_UP_PINS_FORWARD

// This is default solution for ArduCopter
// #define MAG_ORIENTATION AP_COMPASS_COMPONENTS_UP_PINS_BACK

// Alternative orientation for ArduCopter
// #define MAG_ORIENTATION AP_COMPASS_COMPONENTS_DOWN_PINS_FORWARD

// If You Have soldered Magneto to IMU shield as shown in the Wiki

Decline

To help the GPS to work properly and accurately, you can correct the difference between magnetic north and true north, decline.

Going through the process of installing the Mission Planner, the following dialog appears.

 image69

When you click OK, this website open

http://www.ngdc.noaa.gov/geomagmodels/Declination.jsp

 image70

Where we simply write the latitude and longitude of where we are, and give « Compute Declination «.

The result we introduce the Mission planner.

Calibrating the ESC

The most complex work is to calibrate the four ESC ( Electric Speed Controllers ) so that all four engines respond the same way to the APM and radio control. Calibration can be done manually or automatically.

Automatic Calibration

This method works once you have all the ESC connected to the power distribution board that have made us, and the radio-controlled connected as above. It is what we followed.

For this part of the system, we set the Terminal Mission Planner and we have to look to the slide switch on the IMU is in the CLI position – towards the RC pins .

We remove the propeller and follow the following steps:

  1. In the command line enter the setup menu, and type «esc».
  2. We disconnected the USB and battery. This will turn off the APM, causing skip safe mode will restart in « ESC Setup» .
  3. Move the slide switch CLI to the FLY position (contrary to the RC pin position).
  4. We turn on the radio-controlled transmitter and place the throttle lever in the High position . We connect the battery and see what the ABC lights come on in sequence.
  5. We leave the throttle in Low position.
  6. We disconnected the battery. The ESC already calibrated.
Calibration Manual

It is a safer way to do it, but it takes more time to calibrate each ESC separately. It also would remove the propellers and would follow the following steps:

  1. Without the battery connected, we wanted would connect the ESC calibration, channel 3 receiver radio control.
  2. Encenderíamos transmitter and would put the throttle to the max.
  3. Now would connect the battery directly to the CSS.
  4. When a series of beeps are heard, soltaríamos the throttle to the lowest position. When you begin to be different beeps you hear when we could connect the battery and ESC already be calibrated.
  5. the procedure for the other three ESC repeat itself.

We check the calibration by a little test. We CLI FLY mode switch and connect the battery. When you turn on the APM, push lever yaw to the right for 2 seconds and accelerate a little to see that the motors turn and start at the same time.

Notes

  • If after calibration, the motors do not rotate at the same speed or not start at the same time, repeat the calibration process. If made automatic calibration has failed, we must try to manual, which should always work.
  • If after 2 or 3 attempts to not get the engines started at the same time, have to recalibrate the radio control.

Testing sensors

 image73

We can connect wirelessly to pc cuadcópter and watch from the Mission Planner, the Raw Sensor. If we move the cuadcópter, should be shown on the screen all the changes in raw , pitch and roll and you want to show on the graph (acceleration or turning on the X, Y or Z).

 image74

Testing the Radio-Control

 image75

We can also go see the values that are taking channel radio control to be moving the levers of it.

FLIGHT

Check LEDs

Before testing the flight we check the LEDs of the plates.

 image76

Flight Modes

In addition we know that there are various modes of flight:

  • ACRO: Frequency Control only. Not recommended for beginners.
  • STABILIZE: The cuadcópter be maintained between -45 ° and 45 °, with the throttle in manual mode.
  • SIMPLE: The cuadcópter remember its orientation when entering this mode, allowing the user to fly in a more intuitive way. Hand throttle.
  • ALT_HOLD: Maintaining altitude. Altitude is controlled by the throttle.
  • Loiter: When selected, the current altitude, position and orientation is maintained. Yaw can be controlled by the user.
  • RTL: The cuadcópter try to fly back home to the current height.
  • AUTO: Will Fly the loaded Planner Missions Mission.
  • .

Ground Control Station

Opening the software ground station can transmit data through the XBee and display them on a plane in 3D.

A GCS (Ground Control Station) can display real-time data about the performance and position of the UAV, and can serve as a virtual cockpit. It can also be used to scroll the images if our UAV carry a built in camera.

 image77

With the GCS can also upload new commands mission and change parameters in flight or route-map Waypoint .

PID Controller Parameters

If you wish you can also change the parameters of PID control:

In a PID , the P is the proportional response to the incorrect address. If you have a particular inclination when it should have a zero slope, is making a mistake. This error value is converted to PWM values and the engines are commanded to correct the angle.

The D is the force that opposes, directly proportional to the rate of change. When it is spinning too fast, D will be used to counteract the rotation and slow.

The I is a value that corrects the error over time. It accumulates the error, which is multiplied by the term comprehensive iTerm to scale it. The iTerm determines how long it takes to climb to its maximum (or minimum) value.

 image78

In the cuadcópter, stabilizer ( stabilize ) is used in all modes unless the stunt, which is for advanced riders. The values of Pitch and roll should be symmetrical, but are left uncoupled for a multirotor supporting extra load on any axis, can be handled well.

We look for both proportional and STABILIZE_PITCH_P STABILIZE_ROLL_P values, which represent the amount of energy that must be applied to achieve the desired angle. The less powerful engines require higher P values.

With the integral values and STABILIZE_PITCH_I STABILIZE_ROLL_I balance is adjusted; higher value, the faster it fits. It’s not worth it takes much change.

With STABILIZE_PITCH_D STABILIZE_ROLL_D and derivatives can be made slower rotations to avoid oscillations.

Making several flight tests, we decided to change a little the PID parameters, reducing both the proportional and the derivative values to a more comfortable flight.

WAY FORWARD

For the future we propose to use flight tracking option Waypoint , which have not yet tested.

Add a chamber at the base of the structure, changing the legs of the same to improve cuadcópter support during landings and prevent damage to the camera.

Implement control through WIFI to manage it from an iPhone / iPad without requiring the RC.

Send telemetry data over the Internet, or WIFI.

Proposing a joint activity, coordinating several cuadcópters at a time, to make monitor or cover a specific area.

.

[/ video]

Deja un comentario