Maksimuzz's blog View Details
Posted by Maksimuzz | Dec 09, 2018 @ 05:53 AM | 820 Views
10.1 13.10.2018

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
Posted by Maksimuzz | Dec 09, 2018 @ 05:10 AM | 810 Views
8. Thrust measurement and aligning.

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.

Name: Trust.png
Views: 0
Size: 304.6 KB
Description: The thrust measuremet.

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

Name: DragonSchem.png
Views: 0
Size: 137.3 KB
Description: Wing Gragon Sportster aligning

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
Posted by Maksimuzz | Dec 09, 2018 @ 04:49 AM | 713 Views
7.10 21.10.2017

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.

Name: Dragon_21102017.png
Views: 0
Size: 73.9 KB
Description: 49 seconds before the crash

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)

if (speed_error> 10) throtthle- = 10;
else if (speed_error> 2) throtthle- = 1;
else if (...Continue Reading
Posted by Maksimuzz | Dec 08, 2018 @ 02:22 PM | 379 Views
7.6 26.08.2017

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.

Name: Veschevo_26082017.png
Views: 1
Size: 68.1 KB
Description: Fig.25 Veschevo, Russia, abandoned airfield

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.

7.7 02.09.2017

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
Posted by Maksimuzz | Nov 17, 2018 @ 02:09 PM | 762 Views
7.4 15.07.2017

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,

Name: DYSTY.jpg
Views: 16
Size: 898.4 KB
Description: Layout of airplane

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.

7.5 09.08.2017

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
Posted by Maksimuzz | Nov 16, 2018 @ 04:07 PM | 979 Views
7.1 22.08.2009

The first flight of Mentor (fig.18 left) without GPS was complete at 22 august 2009.

Name: Mentor&Frontier.png
Views: 10
Size: 770.3 KB
Description: Mentor(My first plane at all), Senior Frontier

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.

7.2 27.09.2009

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.

Name: Frontier_27_09_2009_Log09.jpg
Views: 10
Size: 311.7 KB
Description: Black box data.

Another flight and also a record of the third flight when the autopilot was already...Continue Reading
Posted by Maksimuzz | Jul 27, 2018 @ 10:11 AM | 2,018 Views
I want present a small program ComView.(ZIP version)This program may be helpful to watch internal parameters of any controllers in graphics.

Name: ComView.png
Views: 15
Size: 87.7 KB

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.

Name: IMU_settings.png
Views: 12
Size: 27.0 KB

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.
Posted by Maksimuzz | Jul 27, 2018 @ 09:40 AM | 2,049 Views
In the project directory for the controller we will see the following files:
Cstartup_SAM7.c - from Atmel examples
fat.c - FAT functions
fat32.c - FAT32 functions
GPS.c - NMEA parser, GPS processing, time reference
main.c - main program loop
mmc.c - support SD card
twi.c - I2C interface with compass
usart.c - serial ports
Board.h - file from Atmel examples
Cstartup.s79 - startup file, asm, Atmel

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.

Name: WarmUp.png
Views: 16
Size: 24.6 KB

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:

#Paramrters: Kst_roll, Kast_roll, Kfar_roll, Kst_pitch, Kast_pitch, Kfar_pitch;
# Kst_speed, Kast_speed, Kst_hdg, Kast_hdg, Kst_alt, Kast_alt;
P 0.08, 0.0, 0.08, 0.2, 0.0, 0.2, 5.0, 1.0, 0.02, 0.2, 0.0, 2.0, 0.0,

The meaning of the parameters can be found in Sections 4.3. They are similar to...Continue Reading
Posted by Maksimuzz | Jul 27, 2018 @ 09:21 AM | 1,949 Views
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.

Name: LapMade&PPM.png
Views: 18
Size: 880.1 KB

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.
Posted by Maksimuzz | May 21, 2018 @ 01:09 AM | 1,658 Views
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.
Name: SimXplaneDia.png
Views: 20
Size: 198.2 KB
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
Posted by Maksimuzz | May 12, 2018 @ 09:55 AM | 1,431 Views
3.6 GPS module

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
Posted by Maksimuzz | May 03, 2018 @ 09:32 AM | 2,545 Views
3.3 Altimeter

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.

Name: AltitudeSpeedDrift.jpg
Views: 22
Size: 117.8 KB

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.

Name: Metro.jpg
Views: 21
Size: 228.9 KB

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
Posted by Maksimuzz | Mar 22, 2018 @ 02:09 AM | 1,864 Views
3.1 Accelerometr

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).
Name: JEUP-53_web.jpg
Views: 25
Size: 32.8 KB
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.
Name: ADXL202-Pitch.png
Views: 24
Size: 13.8 KB

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
Posted by Maksimuzz | Feb 22, 2018 @ 06:11 AM | 1,856 Views
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.
Name: FunctionalDia.png
Views: 33
Size: 42.4 KB
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
Posted by Maksimuzz | Feb 12, 2018 @ 10:42 AM | 2,686 Views
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.
Name: sam7-h256.jpg
Views: 30
Size: 51.1 KB
Description: Controller board
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.
Name: IMG_0545.jpg
Views: 30
Size: 1.61 MB
Description: At board
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