Motor Failure and Network Issues

Unfortunately one of the motors on the quadcopter had died. This directly affected the tuning of the PID controller and until I can get my hands on a spare one, or more specifically install one next week I can’t test.

For the moment I have focused my attention on one of the substantial problems I have encountered over the last weeks is bad network reliability, where how of the blue I would lose connection to the PI on the LAN. Considering I’m using adafruits web ide that needs a connection to bitbucket to function correctly this has caused many issues.

I initially thought the problem may be with the router I was using, however after switching it out for a newer one I have still being having same issues. So I changed my focus to the PI as the likely cause of the problem.

I have thus far been using wicd, which is a console based wireless networking client that allows easy connection to new networks. This automatically switches between the networks and monitors the connection. To rule this out I’ve switched the manual approach of entering the wireless settings manually.

I have also seen various posts and discussions about the some wireless adapters dropping their connection randomly due to power management settings. For this reason I have disabled the power management by placing “wireless-power off” in my /etc/network/interfaces.

So far so good, It seems to be working very well. However being Easter holidays the UNI is shut and I won’t be able to test this properly until it is open again next week.

PID Controller

Since the last post, I have added a PID Controller to the quadcopter in the hope of stabilizing the oscillations experienced from my last test. I have also notice that the application causes a considerable amount of CPU load which intern has an adverse effect on flight and data communication. For this reason I have spent some time optimizing code and removed one of the three threads that were running.

I have been using a PID controller for python located here, However I have been unsuccessful in tuning it, In order to ensure I have a firm grasp of how these controllers work I decided to build one in C# from scratch.


PID Test

As you can see from above the controller is fully functional, the main thing I learnt was how simple PID controllers actually are. Implementing the c# test application did not take very long at all. I have since ported the code to python for use on the quadcopter, to replace the existing one I’m using, Hopefully this will rule out external code as the problem source.

As far as tuning is concerned I have been using the Ziegler Nichols method of tuning, Where initially the Integral (Ki) and Derivate (Kd) are set to zero and the Proportional (Kp) gain is then slowly increased from zero until output of the controller oscillates at a ultimate gain (Ku), When oscillations level out. The ultimate gain and time constant (Tc) of oscillates is then used to set the gains using a table.

Thus far I have unsuccessful in tuning but intend to continue working on the problem over coming days and weeks until it solved as it is a key part of my project.

 

Flight test with Ultrasonic Sensor

Unfortunately the replacement Ardunuo board took longer than expected to arrive which delayed getting the ultrasonic sensor working considerably. Once assembled the sensor worked very well, however it was observed that when it is powered from the 5v out from the PI the values unusable, this is likely because the PI did not have enough power for the sensor and the Ardunio board, However the sensor works fine when powered from an ESC.

Additionally the control board for the quadcopter has been replaced with a smaller version which does not have a barometer, However this is not a problem as the barometer is not accurate enough the keep the quadcopter as a certain height at low altitude.

Flight Test:

For this test the Raspberry PI is controlling just throttle and attempting to keep the copter at 30cm from the ground where as the rest of the movement is controlled manually. The test is using a simple bang-bang controller so once it reaches a certain height it lowers the throttle and once is under it increases the throttle. This creates extreme oscillations in flight, which is unsuitable for a sustainable flight. However considering the obvious problems the flight was very successful in the sense of the PI being able to control the quadcopter.

The next stage is to implement a PID controller that will generate an error value which will be used to increase or decrease the throttle, hopefully creating a smooth movement.

Currently the Raspberry PI is putting a considerable amount of load on one the ESC’s which is getting pretty hot, Additionally the PI has had poor performance when connected to copter which has made it hard to test. For this reason the next step is to replace 5v power from the ESCs (Powering the control boards) with an independent BEC (battery eliminator circuit) providing higher power.