Evolutionary Altitude Control for a Helicopter Using Atmega644

Overview

For our ECE 4760 project, we developed a self learning 1 degree of freedom (DOF) helicopter using a neural network learning algorithm and infrared (IR) distance measurement. The primary goal is to increase the helicopter height to a desired level in the quickest amount of time and with the least amount of learning trials.

High Level Design

Rationale

The purpose of our project is to learn how to wirelessly apply a neural net learning algorithm to an indoor helicopter. Iniitially, we intended on applying horizontal position control and vertical height control using phototransistors as distance measurement devices. However, the SYMA S107 Helicopter is sensitive to weighting due to IR LEDs . As a result, we constrained our experiment to a boom. All the user has to do is start the program and it will perform runs to maintain a particular height in the quickest amount of time possible. Readouts on the controllers fitness or performance can be provided through the UART interface and displayed on the Putty console.

Logical Structure

The helicopter initially sits on a landing pad. At the start of the program, the microcontroller plans out a sequence of neural net commands to be performed over the period of 10 s corresponding to a neural net run. It then begins its first neural net run. It increases its height to a desired value in the quickest amount of time possible and hovers at that location. After 10 seconds the neural net run is over and the helicopter drops back down slowly. The microcontroller then adjusts the control parameters using the neural network and initiates the launch task again. The range of heights that we expect the helicopter to be able to reach are from 5 cm to 25 cm. Within each run, the program reads the voltages from the IR phototransistors, determines the next command to be sent to the helicopter, builds the command for the IR protocol and then sends the command via the the helicopters IR protocol. This process is repeated every 120 ms since the IR inter-packet period is 120 ms. When the run is over this cycle is stopped until the next sequence of neural net commands have been built.

Experimental Design

We trained the helicopter to reach a particular distance in the fastest possible time and also to hover at that distance. We implemented this training with a 10 second test and reference points as shown in Figure 1. The objective is for the helicopter to start at Point A, reach Point C, and hover there. Each test starts with a fitness of 0. The fitness is incremented or decremented throughout the 10 second test according to the following piecewise fitness function.

The highest fitness goes to those who hover at Point C ± Δr for the longest amount of time. The fitness increment is decreased proportional to the distance from Point C. If the helicopter reaches Point D, the run is terminated. At this height, it is likely that any further throttle will pull the helicopter back and break the boom. This fitness function inherently evolves the condition of fastest ascent to Point C because fast individuals will have more time at Point C and thus will accrue more fitness points.

We can choose the points as well as Δr by using the voltages read by the phototransistor network at each height. Adjusting the value of Δr will likely affect how good the hover is in a fully evolved network. For a very large Δr, the helicopter will have noticeable oscillations around Point C. For a very small Δr, the helicopter will appear to stay in a steady hover. However, smaller values of Δr will result in longer evolution times as the network needs to be better tuned. The following table shows the voltage values and the sensory inputs corresponding to each point. These were found through experimentation and trial and error.

The vehicle used is a SYMA S107R5 Helicopter. The helicopter is constrained to 1 DOF via a wooden boom. To send commands to the helicopter we use an Atmega644 hooked up to an infrared emitter circuit. The helicopters multicolored LED was replaced with an IR LED to output a constant IR signal. This IR signal is received by an IR phototransistor circuit. The voltages at the output of the phototransistors correspond to the distance between the helicopters IR LED and the phototransistors. The microcontroller used is an Atmel Atmega 644. This is used with an RS232 module to output serial communication to the Putty Interface.

Boom

The boom was designed to reduce the system from 6 DOF to 1 DOF. The boom was easy enough to build. We made a hinge at the bottom by using two pieces of wood with a pin going through the center. The lever was a 12 inch balsa wood dowel was attached to the hinge. The other end was attached to the front supports of the helicopter using balsa wood spacers and another pin. The tail was constrained to prevent the pitch DOF by attaching the tail to the lever using balsa wood spacers and tape.

Helicopter Modification

The purpose of the IR Led on the helicopter is to output a continuous IR signal to be used by the phototransistor circuit to determine the distance from the helicopter to the ground. To hook up the IR LED we removed the multicolored LED from the helicopter to reduce power draw, and wired up the IR LED directly to the helicopters power supply in series with a 330 Ω resistor. The output voltage of the helicopters battery is 4.2 Volts which when using a 330 Ω resistor, provides about 12.7 mA of current to the IR Led. Originally, we used a 100 Ω resistor, since it would result in about 42 mA flowing through the IR led and we would therefore increase the range. However, we found that when we did so the helicopter would not respond to commands. This indicated that the current draw was too large for the helicopter to handle, leading us to increase the resistance. Via testing we found that with the LTE4208 IR LED and 12.7 mA, we obtained a maximum readable distance of about 25 cm and a minimum of about 2 cm.