Wednesday, May 19, 2021

First Flight and Watch Dog Timer

Overview

To verify that the system could be safely flown in manual through the microcontroller I set out to have a first test flight. However, before flying, I added one last safety feature.

First flight controlled through microcontroller


Watchdog Timer

My main concern was the aircraft falling out of the sky. I'd say that that was a reasonable concern to have for a system you were writing from scratch. Through ground testing, I found that when the servos pulled too much current, the microcontroller would freeze. This happened only when the system was being powered off of the computer and not off of the battery. That behavior makes sense since the batteries are designed for large current output, the computer's USB port is not. However, if it were to happen in flight, the plane would simply freeze up and glide/fall whichever direction it was pointing.

In order to avoid this, I added a watchdog timer. The main loop of the program that read the receiver values and wrote to the servos operated at 20Hz. Therefore, I set the watchdog timer to 60ms. This meant that if the main loop took 10ms longer than it was supposed to, the entire system would be reset. There was very little setup code in this file so upon a reset, control was maintained almost immediately.

First Flight

The first flight was very simple and successful. It flew for about 5 minutes, all completely in control with no concerns. This validated that the microcontroller could be trusted to control manual flight.

No comments:

Post a Comment