After a long break, a new test. When studying all previous flights, it was concluded that the undulating change in flight speed and altitude, the instability of the retention of these parameters is associated with an unrecorded factor . This is the acceleration and deceleration of the aircraft, and the effect of this parameter on the holding of pitch. Indeed, it is easy to calculate that when the aircraft accelerates along the runway, it picks up speed of 50 km / h in 3 seconds, which corresponds to an acceleration of up to 0.5G, which means that this should be taken into account . The smallest effect of this was seen in picture. But even there, the height of the aircraft was typed “steps”. When the climb begins, the speed drops, while the autopilot has false data that it’s as if the plane is dropping its nose, trying to compensate for it, gaining altitude even more, and again losing speed. When the speed finally stabilizes, the plane begins to level off in pitch, and at the same time the speed increases, since there is no climb. And then a deceiving autopilot component appears, as if the plane is flying with a positive large pitch, and the autopilot compensates for it, thus preventing height gaining, and thus, it leads to even greater acceleration. This is how positive feedback arises, which ruined the plane in the past. To begin with, half of the exact settlement was compensated. Acceleration for compensation is calculated by...Continue Reading

So, we change the motor to brushless. In picture this is it already made up. But now, when it became necessary to replace the engine, it was time to discuss and share the know-how of calculating the centering and its changes when equipping the aircraft. In the folder of the chapter you can find the pictures as weighed. The weight of the original aircraft turned out to be 750 g, (according to the documentation of 650 g) the weight of the aircraft with autopilot is 840 g, the weight of the autopilot itself is 160 g. It is also interesting to know the thrust-weight of the aircraft. Traction motor EMAX 2812, depending on the type of screw presented in the next picture.

When replacing the motor, I decided to figure out how to calculate the centering. The next picture presents the layout of the aircraft.

Suppose that initially the plane is correctly centered, and has Cmac(middle aerodynamic chord) = 25%, then by adding a load of mass G at a distance l from the center of the wing (mac) we get a new value of centering Сnew,%.
Cnew = G * x * 100 / (G + G0) * Bmac, where:
G is the weight of the new load, g
G0 is the initial weight of the aircraft, g
Bmac, cm - the length of the average aerodynamic chord;
x = l - S = l - ((50-C0) / 100) * Bmac, where
l, cm - the distance of the new cargo from the center of the wing (mac);
S, cm - the distance from the center of the wing to the center of gravity;
C0,% - initial...Continue Reading

Unsuccessful flight. It was already cold. There are no videos. Takeoff is normal, further, as in flight 08.26.2017 - rising magnitude of oscillation, then the first time the plane crashed, just crashing into the ground. I had cannot control of the plane because distance was too big. Motor was lost. It burned off. The graph is shown in picture. Someone just changed the algorithm for holding the speed again and increased the gain in the pitch channel (because the altitude task was not fulfilled in the previous flight). As seems of the graph, the plane had entering the ground at a speed of 10 m / s (36km / h). And the accelerometer mockingly noted a huge negative pitch on 49 second. What ideas can be, after replacing the engine - remember how to fly on a piston aircraft, and how to control the speed.

Conclusions about the causes of the crash:
• too much pitch gain
• center alignment too front, because the battery has become heavier
• An error was found in the motor control formula.
• Motor control gain too high
• programmatic reduction of the required speed upon reaching point 1
Of course, real programmer will immediately see an error. It is childish. But for an example we will see it. At an each step of the program, the throttle value is corrected. The error is this: (in a real program, the code was slightly different, this is just an example)

It was the first test with a full autopilot - this time the motor was driven by the autopilot itself. And it was a bad mode. (See the next picture) Let's look at the full video of the test.

The plane began swaying, therefore and I seized control and began to control it myself. Apparently from schedules, the autopilot coped better than me. I too vigorously ruled the aileron. (Actually, for the first time (!) I flew this aircraft manually). However, the problem is not only in the wind. It is seen that the motor control channel worked incorrectly, and the plane entered into swaying with rising magnitude of oscillation. It was decided to significantly change the motor control algorithm, significantly increase the time constant and reduce the gain on this channel. This was done for the next flight.

It was one of the most beautiful flights. Video recording was made slower in 2 times. Since the gain was reduced in the throttle channel, the plane picked up speed very slowly, but it took off very nicely, but ... it was flew not by right route. It should be noted that an incident occurred in this trial due to which the check card was created. As shown by TRACK002.LOG, when turned on, the throttle transmitter knob remained warm in the middle position (value 48, the fourth parameter in the line after the character J). The plane did not take off, but it went to the bushes. It took some time to repair it. The flight path is shown in picture....Continue Reading

I had return to work on the autopilot by 2016 only. I decided to finish the job and install the GPS. So, when GPS processing was written, it was necessary to check everything. Now I want to introduce my Dusty. The layout is made on the basis of the Dusty toy. The ailerons and rudder were already moving,

I had to cut only the elevator. In the layout 3 micro-servos and one ESC are installed. What is it for? To debug the work of the controls, I did control races on the car and walks with the layout, to test the flight algorithms using GPS. It is very difficult to understand if everything works correctly, and the layout immediately shows how exactly the steering gears work out and how the planes of the aircraft move. Also recorded a short video demonstrating the work of Dusty. After debugging on the layout, the autopilot was installed on the aircraft. In the test dates directory, you can also find a log of the journey on the Dvinskaya-Scottish-Nevelskaya route, and the route from the Michurinskoe-Dvinskaya. The latter contains 25 waypoints, and this route was passed correctly, which showed quite an acceptable system for deciding whether to reach the next waypoint.

It was the first flight of the "Dragon" with the GPS module, 5 years after the first flight. The battery was the same. A fragment of the flight can be viewed on the video. On this day there was a strong south wind about 20-30 km / h. The approximate flight...Continue Reading

Unfortunately, the log was not received. Aircraft control was manual from console. Most likely, during a long flight with a large positive pitch, the autopilot tried to prevent too much pitch and accumulated data for this, and when the signal from the transmitter disappeared for a short time, it immediately brought the elevators to a decline, but since it did not work for some time, applied too much effort on the elevators. This is seen in the video. After this flight, the controller was shielded and when switching the autopilot modes, the trimmed data is zeroed. Since I did not restore the plane, I flew as follows with the Senior Super Frontier (Fig. 18 right), with a wingspan of 2.08 M and a 5 sm3 engine.

Having broken one plane, I immediately wanted to break another one. The plane made 3 flights on an abandoned airstrip in the Pomyalovo village. On the third flight the plane was broken. On the first two flights the autopilot modul was not activated. There was manual control and data collection was in progress. During the second flight at the time of landing the plane hit a canister by front landing gear because the canister was forgotten exactly in the middle of the airstrip. This strike at 229 seconds is clearly visible on the black box data shown in Fig. 19.

I want present a small program ComView.(ZIP version)This program may be helpful to watch internal parameters of any controllers in graphics.

The program is designed to visually graphically display the data stream coming through the RS232 com port or its analogs such as USB converters. To display the flow, it is enough for the programmer to output up to 16 parameters from his device through com port with comma (,) delimiter. If autocalibrate is enabled the program itself will make it so that the data will be displayed in the graphics window. Then you can turn off auto-calibration and find convenient gains and shifts of graphs. After that, you can save the parameters in Your ini-file so that You does not need calibrate channels again. This is the main mode of the program - data display. The First checkbox of channel is intended to switch on-switch off channel, the second checkbox is intended to enable autoscale. Next field is gain koefficient, the next - offset from zero. Parameters of stream may be any. (float or integer) Comma is required for delimit. Many parameters (exclude colors) may be saved to the disk to user ini-file. The program will save all detected data to log-file.

For demonstration purposes, the data visualization mode for the horizon and compass with the ability to display static rolls on the accelerometer and two modes of dynamic roll calculation in the IMU tab is provided.

Here you can configure which channels will be used for the calculation and select or measure the coefficients include Kalman-filter. This feature need more detailed guidance. It will be made in the little later.

The folow Figure shows the algorithm for starting the autopilot. After the power is turned on, all necessary controller registers are initialized first. Then there is a pause of 20 seconds, although it should be longer. Practice has shown that it takes about 10-15 minutes to warm up the height sensor. If there is no SD card, the autopilot parameters are set from the code structure. If SD card present the autopilot parameters are initialized from SD.

Autopilot parameters and route must be written according to rules in a hard-coded file named gpspoint.txt. The rules are as follows: the line of parameters begins with the symbol P, the line of the route is G. The symbol # indicates the comment and this string ignored. The autopilot parameter string looks like this:

As it was said early I used a ready to use debug board for at91sam7 controller. In Figure you can see the prototype version, which still flies.

Over time, after connecting GPS, I had to increase the memory size, and I switched from SAM7S64 version to SAM7S256. The electrical schematic diagram is drawn in two versions - the first including the AT91SAM7S256 controller, and the second for using the finished controller board. Here I will only talk about some elements of the scheme, because it is simple. I will take the positional notation of second option. The board is powered by a voltage source in the range 3.6 - 12V. The current consumption at a voltage of 5 V is approximately 0.3 A. In a real model, the voltage of 5V can be taken directly from the ESC control. (I do so) When using the ICE, the 4.8V battery. For high-quality power, a U4 LM2577 boost converter up to 5.9 V is first used, and then a step-down converter up to 5 V (U5 LT1963). The down converter 5В-3.3В in the controller board. Voltage 5.9V is used for the driver of the reference voltages V-REF and + 5VREF (U6 REF195, U13 AD823). V-REF - reference voltage for the built-in ADC controller, + 5VREF - reference voltage for the op-amp signals of the sensors. To prevent the controller from reaching more than 3.3 V on the ADC, protective diodes VD1 to VD4 are provided. Still it is possible to say what signal is expected at the input of the PPM-IN, from the receiver. My circuit variant expects the oscillogramm shown in the figure next to photo of the board. It has the 6 channels. This requiresdiscussion, since this is the only non-standard place in the project - a modification of the standard PPM receiver is required. In addition, in the case of modern remotes, all pulses on all channels begin simultaneously. It will be best to use one pulse per controller port, and the timer mode for measuring the duration of these pulses is changed. This solution is verified, and is present in the software, but not debugged. Here is a PDF for all the components used.

As mentioned earlier, it is easy to assume that a longitudinally placed gyroscope can be used to hold the roll. But I would like to check this before the plane is crashed. And I would also like to check the aircraft control algorithms. This feature is provided by the XPLANE flight simulator(Ask me if needed). Since I bought the version of XPLANE-6 in due time, I use it. Why XPLANE? It allows you to output data from the simulated aircraft sensors to other programs or computers by various means. I have chosen the UDP protocol for this. The picture shows a block diagram of the simulation complex.
An example of one flight and an explanation of the simulator configuration and the autopilot program can be seen in the video. The video shows the various modes of flight of the aircraft and contains instructions for setting up the X-Plane simulator and the autopilot program.

4.1 PPJOY and VSPE.

To control the aircraft in the simulator usually a joystick is used. For training in the management of radio-controlled aircraft, the corresponding simulators are also used. To interface standard remote controllers with simulators, there is a PPJOY program that converts the input data stream of the RS232 interface, created according to certain rules, to virtual joystick control signals. The program also contains a driver, which is defined in the system as a joystick. Description of the program PPJOY can be found in free access on the Internet. Here you can find an application that can work...Continue Reading

A GPS module with a built-in antenna is used. This is a small modul, located outside the shielded box of autopilot. (See previous Fig. with Pitot). The documentation for the module can be found in the GPS folder. The module S3126 is applied. The GPS module is connected to the controller via one of the UARTs. Communication with the module follows the standard protocol NMEA0183. In the 2017_09_02 test, before the launch of the aircraft, the GPS did not work properly, and the aircraft flew very beautifully... but with a wrong course. As it was possible to see from the data of the "black box" TRACK005.LOG GPS "thought" that it is a kilometer from the given point. This can be seen in the flight data from 2017_09_02. It should be noted that in this test I could not yet control the distance to the next flight point before the flight(i.e., the autopilot was turned off). Therefore, the distance of 134 M in the log file did not indicate that the place of the aircraft was correctly determined. The distance to the next point should be about 100 m, the offset is about 0, and the course is 323. However, as you can see, real data appeared only at the moment of takeoff at 14:10:33. And the course turned out to be 150, the distance is 1012M, the displacement is 121M (deviation from the axis, according to which the aircraft must fly in accordance with the task). After this test, a change was made to the program so that the routing data is displayed in...Continue Reading

As an altimeter an absolute pressure sensor is usually used. The MPXA4115A6U sensor is used in this project. The sensor outputs a voltage that is measured by the controller. Before the flight it must be warmed up. The warm-up time is 10-15 minutes. As the atmospheric pressure changes, the altimeter is calibrated automatically before each flight. The sensor has a significant temperature drift. Figure shows the graph of the altimeter drift. Since the speed sensor is also a pressure gauge, the drift is the same.

The most interesting test of the pressure sensor is undoubtedly a trip to the underground. The data of the black box of the trip is shown in next Figure. About this graph it can be said that the autopilot is switched on on the 12th floor, (about 36 m). Further descent on the elevator, then I went by bus, and then by underground train. The final point of my journey, when I got off the subway, is really on the hill.

3.4 The air speed sensor (Pitot).

The speed of aircraft is usually measured with a Pitot tube. These things are usually calculated. But it is clear that if you blow to the tube (without touching it with your lips), then the pressure in it will increase. Measuring the pressure in the tube you can estimate the speed of flight. The tube is usually placed either on the wing or on the fuselage (if there is't the pulling screw). For correct measurement, it is necessary that the engine does not pump air directly into the tube. Being...Continue Reading

The sensor is designed to measure of a linear acceleration. As an accelerometer a device ADXL202E (Analog Devices) is used. This is a two-axis accelerometer with output in the form of pulses, the duration of which is proportional to the acceleration. The pulse width is measured by a timer. Only one of the axes (X) is used to measure of the aircraft inclining. The Y axis can be used to calculate the lateral acceleration and its compensation by trimming the rudder position. This feature while is not implemented. This axis(Y) shows the position of the "ball" in the corresponding angular velocity sensor and airplane sliping (For example, Yak-18T, EUP-53).
When turning (under the turn of the pilots is understood any course change of the aircraft), the pilot to reduce the slip usually levitates the pedals and holds the ball in the center position. The drift of the accelerometer when measuring the slope is shown in picture. As you can see, when drifting into the refrigerator for 15 minutes, the drift was -5 degrees.

3.2 Gyroscope

The key element of the panel of any aircraft is the horizon. It is usually built on the basis of a mechanical gyroscope. It shows the roll and pitch of the aircraft in the instrumental flight mode. This project uses the MEV-50A semiconductor gyroscope to measure aircraft roll. However, unlike the classical gyroscope, semiconductor gyroscopes measure not absolute roll, but its derivative - angular velocity. This...Continue Reading

The functional diagram of the autopilot is shown on a picture. The heart of the autopilot is the LEVEL1 block. This module is a high-priority function and is executed independently of other events every (15.625 ms tested version) 46.875 ms. Its task is to keep the aircraft in the correct flight position.
The input data for the module is the FSSi structure, which contains the parameters Roll, Pitch and Air Speed. A correct flight position we will name roll = 0 and pitch = 0, when Ref signals are absent. Also this module controls the engine controller of the aircraft and ensures the holding of the speed received from the LEVEL2 unit in accordance with the flight task. The Level2 module disturbs the LEVEL1 module by the Ref signals and thus forces it to hold non-zero roll and pitch values that calculated in accordance with the flight task. The speed parameter is directly transmitted from the flight task. The output of the module is a data structure that contains the current position of ailerons, elevator, rudder and rudder (Throttle). This structure in the program is called FSSo, the Module has the name FltStSys (flight stabilization system). It can be fed into the PWMC (Pulse Wide Modulation Controller) if the autopilot mode is activated. Otherwise, a structure filled with a timer is sent to the PWMC according to the measured values received from the HF receiver. This is a traditional control mode for radio-controlled models. The Level2 module is slower, it generates...Continue Reading

1. Introduction
I started interest RC-planes at 2002 I made , when I had living in Prague. The first aircraft was with a wingspan of 1.2 m, engine 2-stroke ICE. Here is a fragment of a video recording of those times. Once in 2008, I got an accelerometer ADXL202E. Having experience developing devices on the MCS-51 family controller (it was Rubidium frequency standard and data acquisition system), I decided to make an autopilot for the Mentor radio controlled model. First of all, I connected the accelerometer to the controller. For simplicity, I chose a debug card with the AT91SAM7 controller, for the convenience and ease of handling it. It should be noted that I decided not to study anything about autopilots on the Internet, but to do everything myself with "0", so that it would be more interesting.
So, by chance of the case in 2008, I happened to fly by plane and have the opportunity to use a laptop and my controller with an accelerometer on board. Today, any owner of a tablet or smartphone can carry out such an experiment independently, since accelerometers are available in almost all devices.
That's where I made the first "discovery" for myself, that you can use the accelerometer to stabilize the pitch (since the aircraft cannot gain speed too fast or slow down), but for stabilizing the roll it is not good. Since with a correct turn without slip, the side accelerations are compensated by the aircraft's roll, and the accelerometer does...Continue Reading