Monthly Archives: January 2014

Alfa2test. Introducing PID

This Alfa2 test has the scope to introduce in the code the part dedicated to the PID control loop  (see here an introduction of the PID Concept). So I included a new module Here the complete code  alfa2test

The used layout is stille the same as alfa1test so only one motor, mounted on the frame, the frame has got only one degree of freedom arounf the roll axis.

The  software includes two new elements:

  1. The PID control that can calculate the motor speed according the current roll and a target roll . Please note that in the code thare 2 parameters used to limite the pid effect in order to keep it under control. They are the maxW allowed on the motor and the  maxCorrection each  loop.
  2. The opportunity to change the target roll by the user  using the buttons a (increesing ) and z (decreesing).

The main targets were:

  1. pure debugging and code verification
  2. verification of the generated log
  3. first analysis of the log.

Below the roll and the motor speed W with a fixed roll target=0.


The most important thing to me was to see that the correction was correct according to the roll position.As you can see it is correct.

Two  comments:

  1. in this test I did not work on the PID parameters. That’s appear clearly in the graph, with this periodical behavior or the system.
  2. In the phase when there is the riduction of the motor speed , the contrast to the inertia is now done only by the gravity. this cause the overshooting at every period.

With the scope to recreate now a more realistic behaviour of the system , in the next alfa3test i will adda new motor, and I will start to do some PID tuning.

Alfa1test. Conclusions

In order to consider this first test session closed I had to do some additional verifications.
1) In previous post I reported an improvement of the cycle time along time.I verified that in fact as I suspected , it was related to the increasing dimension of the log data.So i need to keep this log as little as possible. In future I also have to check that It will not be a problem.
2)one of the target was to verify the relation between hover speed and arm weight. I didn’t investigate too much. Just measued a couple of conditions and store info for the future, in order to compare real results and theory.
The arm of the current system is measured 105grams. In this case the wh = 17% .
If I add an additional weitgh up to 300 grams , wh = 40%.
During those test the battery pack was charged ( measured11.4 volts).
With those info I could in theory also calculate the Kprop (the relation between thrust and motor speed)
3)One of the target was to verify if I can measure the real motor speed using a sound spectrum analyser app. I forgot this point. I ll postpone it for the first occasion.

I can finally introduce you that I also start to test , the module that include the pid control.I already collected some data but yet not have time to analyse it.In next post Ill add more details.