This is the analyses of finding a PWM to thrust transfer function
To do modeling, simulations or to improve the flight algorithms the physical parameters of the Crazyflie system is good to know. The following test are done to find some of these parameters.
Measuring the RPM
To measure the RPM we used optical switches that we connected to a prototype board. Details can be found in this blog post. The firmware was then modified to measure the timing of the optical switches, convert them to RPM and make them available to the log subsystem. The log subsystem was also “hacked” so that more frequent samples could be taken (500Hz instead of max 100Hz)
Measuring the thrust
To measure the thrust we built a simple test fixture. We use a precision scale to measure the thrust. It is done by letting a weight hold the Crazyflie 2.X down that is standing the scale. The lift generated will show up on the scale as the total weight gets lighter. We glued a prototype expansion board to a bottle which we could attach the Crazyflie 2.X to. It is not a perfect fixture but shouldn’t be too far off.
Measuring amps and voltage
Voltage measurements is already done in firmware but amps had to be measured using an multimeter in series with the power source. Later it would be nice to add this to the RPM board so it could be measured during flight.
The firmware was adjusted to increase the trust from 0% to 93.75% in 16 steps. Each step period was set to four seconds so that thrust and amps could be manually written down. The cfclient was setup to log the PWM, voltage and RPM during the same time.
|Amps||Thrust (g)||Voltage||PWM (%)||Average RPM|
As can be seen in the graph both then RPM and voltage vs. thrust is quadratic while the Power vs. thrust is linear. Also from the figures one can see that at 93.75% PWM the trust is about 58g. Using the values some interesting plots can be made. Like estimated flight time vs. battery capacity.
What can also be plotted and estimated is the PWM to thrust transfer function. The issue is that it is not the “PWM” that drives the motors but the voltage and amps = power. With the PWM it is possible to simulate different voltage levels so we are making the assumption that 50% PWM would result in 50% voltage. Then comes the issue that the battery has an internal resistant so that the voltage level wont be constant but will drop with the size of the load. This can be seen by plotting PWM and voltage. The graph is based on the values from the table above. The voltage supply used in this setup was a power box so the “internal resistance” of the battery is not really there but instead the resistance of the cables.
So when we applying the PWM the voltage will be a percentage of the supply voltage which is based on the load which complicates things even more. Therefore two plots was made, one with voltage and one with PWM. The voltage that is applied to the motors is calculated as a percentage of the measured supply voltage. A strange thing here is that the fitting is a better match to the PWM then to the voltage. Something that has to be investigated further.
Another quite interesting curve is the rpm to thrust. The polyfit function gives the values: 1.0942e-07rpm^2 - 2.1059e-04rpm + 1.5417e-01.