### Transformation from desired motor speeds to PWM signal.

Dear all!

I am a master student with background in control theory. In my project I try to implement a nonlinear controller for a custom built Hexacopter.

The controller was simulated in Matlab Simulink and it can produce control in 2 forms:

u = [u1,u2,u3,u4], where u1 is thrust force (SI: N), u2-u4 are roll, pitch, yaw torques (SI: N m).

u = [omega_1,omega_2,...,omega_6], where omega_i - angular speed of motor i, in rad/sec.(RPM)

Motor configuration is X.

I am going to use pixhawk4 autopilot and PX4 Simulink toolbox. But the problem is that motor controlling block takes only PWM signal.

The system has the following parameters:

Motor: Turnigy Multistar 3508-640Kv 14 Pole Multi-Rotor Outrunner V2

Propeller: Aeronaut Cam Carbon light 13x6 or 13x4.7

The drone will fly autonomously, executing build in trajectory. So the control method needs precise execution of motor angular speed, given by the controller.

Example:

desired motor speeds are [o1,o2,o3,o4,o5,o6].

Actual motor speeds are approximately  [o1,o2,o3,o4,o5,o6] + bias(noise, delay, motor physical restrictions).

How can I find mapping from RPM to PWM signals?

Is it possible to make motors execute desired speeds with reasonable precision?

Thank you for the attention!

#### Replies

• Where can I find some help to use PX4 Simulink tool box?

• 100KM

RC Benchmark makes a good motor/esc/prop dyno/thrust test stand, with pc data logging capability, that would let you measure and test the dynamics of your motor/esc/prop combination.

https://www.rcbenchmark.com/

However if you want to command propeller speed, you will have to sense and control it.   Hence the recommendation for the Pixhawk ESC 1.4

RCbenchmark | Tools for Drone and Robot Designers
Motion capture and thrust/torque measurement tools for robot and drone designers. Increase stability, improve the lift capacity and flight-time.
• 100KM

The Pixhawk ESC 1.4 hardware with the Sapog firmware can be configured to use the standard PPM inputs.  By default it uses the UAVCAN though(which is supported by the Pixhawk controller and the Ardupilot code).

The Sapog ESC firmware works like a conventional ESC firmware by default, with commutated voltage duty cycle applied proportional to the PPM command.    It can be configured to control the speed of the motor to be proportional to the PPM command.    Of course all the speed control feedback tuning  is up to you.

• Dear DavidJames,

I was not precise at describing my situation.

There are 6 ESCs on the drone.

The model of ESC is Turnigy AE-45A.

Batteries are Turnigy multistar 4S 6600mAh, 14.8v

Each ESC is connected to motor and all 6 are connected to PixHawk flight controller.

I want specific angular speeds for each motor but the only thing I can send to ESC is PWM signal. Thus, i need a function

PWM = f(RPM), that should be motor dependent,

to calculate PWM signal should i send.

In some scientific papers they found this function by sending PWM signal to motor controller in range [0,1] with a small step and recorded motor speed with camera.

Is it possible to find this function in a easier way?

DavidJames said:

Here is a link to the to a recent discussion for the Pixhawk ESC:

• 100KM

Here is a link to the to a recent discussion for the Pixhawk ESC:

• 100KM

There is a Pixhawk ESC that has a UAVCAN interface that can be configured to control motor speed based on the PWM signal.

Search on Pixhawk ESC.    The currently available Pixhawk ESC1.4 has a fairly limited current and voltage capability.   However it would allow you to quickly prototype your system.

### Activity

RT @chr1sa: Donkeycar 4.4 released with tons of new features, including path learning (useful with GPS outdoors), better Web and Lidar supp…
Nov 27, 2022
RT @NXP: We are already biting our nails in anticipation of the #NXPCupEMEA challenge! 😉 Did you know there are great cash prizes to be won…
Nov 24, 2022
RT @gclue_akira: レースまであと3日。今回のコースは激ムズかも。あと一歩 #jetracer https://t.co/GKcEjImQ3t
Nov 24, 2022
UC Berkeley's DIY robocar program https://roar.berkeley.edu/
Nov 24, 2022
RT @chr1sa: The next @DIYRobocars autonomous car race at @circuitlaunch will be on Sat, Dec 10. Thrills, spills and a Brazilian BBQ. Fun…
Nov 24, 2022
RT @arthiak_tc: Donkey car platform ... Still training uses behavioral cloning #TCXpo #diyrobocar @OttawaAVGroup https://t.co/PHBYwlFlnE
Nov 20, 2022
RT @emurmur77: Points for style. @donkeycar racing in @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video. https://t.co/Y2hMyj1…
Nov 20, 2022
RT @SmallpixelCar: Going to @diyrobocars race at @UCSDJacobs https://t.co/Rrf9vDJ8TJ
Nov 8, 2022
RT @SmallpixelCar: Race @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video. https://t.co/kK686Hb9Ej
Nov 8, 2022