6.1 Composer Panel

The Composer Panel includes all the configurations related to the library functionality, while the Pin Grid Panel contains the exact pin functionality and position.

Taken individually, each sector in the Motor Control library has the following options:

  1. General Settings

    The general settings keep the control settings for drive and feedback modes while allowing the user to generate a demonstration example.

    • Commutation Feedback: A choice for motor synchronization source between sensors or sensorless feedback algorithm

    • Feedback Source: Allows to change the source of the feedback itself

      For Sensorless feedback, the option is grayed out, as only BEMF is accepted as a source in this version. It is fixed to Hall for the current version (if Sensored), but the Quadrature Encoder and the Inductive sensors will be among the selection options in future versions.

    • Drive Mode: The actual PWM Low-Frequency Drive Modulation mode can be selected from Trapezoidal drive, also known as six-step commutation, and Sinusoidal drive

      Sinusoidal drive modulation has three different Look-up Tables (LUT) generating options: normal Sinus, Space Vector Modulation (SVM) or Saddle mode

    • Generate Example: This option enables the generation an example application that uses the necessary APIs to spin the motor with a potentiometer-controlled speed. The initialization and loop logic functions are called in the main.c file demo.

  2. Motor Specifications

    In this section, the user can customize the motor-related characteristics used for control and speed measurement.

    • Pole pairs: This value is taken from the Number of Poles section in the Motor data sheet – divide that value by two to get the pole pairs value. As the pole pair information is used for speed measurement, the motor will spin even if this is written wrong, but the measured speed will not be accurate.

    • Phase Advance: Can range from 0 to 90 electrical degrees. The sensing algorithm estimates the rotor’s position and then calculates the difference between the stator (driving field) and the rotor (motor field). The result (in electrical degrees) represents how much the drive field is out of phase with the motor field. Based on this difference, the drive speed is updated to keep a constant phase shift between the stator and rotor. If the phase shift is too small, the torque might not be enough to keep the synchronization. If the phase shift is too big, the synchronization is also lost. An optimal value is determined to ensure sufficient torque is produced and power consumption is efficient.

    • Start-up Current: The voltage supplied to the motor phases during the start-up phase is given in volts. Based on the voltage supplied, this is transformed into a duty cycle in software. If the supply voltage is below the start-up voltage, the application will show an error message, and the motor ramp-up will fail.

    • Kv [V/RPM]: In the library, it represents the inverse of the motor Speed Constant (also known as BEMF constant) and it is measured in volts per revolutions per minute (RPM). You can find this value in the motor data sheet. It can be measured when the motor is driven as a generator without load. The voltage measured on the terminals is perfectly proportional to the RPM per the Kv of the motor/generator.

      E.g.: Measuring 1V while spinning the motor at 100 RPM results in Kv = 100, while in the library, it is 1/100, so the user has to enter 0.01.

    • Phase-to-Phase Resistance: The electrical resistance (in Ohms) measured between any two phases of the motor.

      When Sensored mode is selected in General Settings>Commutation Feedback, more options are available in the Motor Specification settings.

  3. Start-up Specifications

    In this section, the user can customize the time it takes for the drive voltage (identified by the PWM duty cycle) to ramp up from 0 to the value dictated in the Motor Start-up Voltage parameter and back to 0 in a ramp down situation. The parameters are linked to the motor start-up routine and include switch-over speed transition from forced commutation to Drive and Motor synchronization.

    • Ramp-up Time: The time, in milliseconds, provided to the start-up algorithm to ramp up the voltage from 0V to the desired value and to ramp up the drive speed from 0 RPM to the desired switchover speed

    • Ramp-down Time: The time, in milliseconds, provided to the motor-stopping algorithm to ramp down the voltage from the current value to 0V and also to ramp down the drive speed from the current RPM to 0 RPM

    • Start-up Speed: Used as target RPM speed by the ramp-up algorithm, spinning up from zero to the target speed. This is the speed at which the switchover between forced commutation and synchronization loop starts. If Sensorless mode is used, this parameter must be set to at least 15-20% of the nominal speed of the motor.
    • Forced Commutation: When this function is enabled, the drive will not synchronize with the motor feedback. Instead, it will stay forced to a desired voltage and speed.

  4. Pulse-Width Modulation Settings

    In this section, the user can customize the driving PWM signals, starting from the main frequency, dead-time insertion to the output pair configuration. This allows for a low-level peripheric configuration to the abstract motor control.

    • Frequency: The PWM frequency for any drive mode, user selectable from 15.0 to 45.0 kHz

    • Low-Side and High-Side Dead-time: The complementary signals that drive the High-Side and Low-Side MOSFETs need a dead time, when both signals are low, to prevent current shoot-through and hardware damage. The value is in nanoseconds, and the step is dependent on the MCU main clock period (e.g., for a 20 MHz main clock, there will be a 50 ns dead time step).

    • Output Pair [A, B, C]: The library allows the driving complementary pair signals to be placed at different port pins. This option permits the change of a given pair on the MCU Input/Output (I/O). The capability to change the position of the driving signals provides flexibility during the hardware design of the control board.

  5. Sensing Settings

    In this section, the user can customize the physical values of the components for the sensing layer.

    • Shunt Resistor: The current sense shunt resistance, given in ohms, dependent on the power board
    • Current Amplifier Gain: The current sense amplifier gain, dependent on the power board
    • Voltage Reference: The ADC voltage reference value must be the VDD value of the microcontroller. It is used for ADC measurement computation and interpretation. Changing this value will not change the ADC reference because it is set to VDD.

    • Voltage Divider: The VBUS measuring resistor ladder dividing factor
    • Temperature Offset: The added ADC measurement point offset for the temperature sensor, dependent on the power board
    • Temperature Sensitivity: The used temperature sensor sensitivity as provided by the device data sheet

  6. Control Settings

    In this section, the user can customize the control layer wrapper and the input for the dynamic speed requirement.

    • Loop Control: This option allows the user to switch between the Open Loop Control (Drive and Motor synchronization without speed regulation) and Closed Loop Control (where a slower control layer is added for speed control besides the drive and motor synchronization control). When the Forced Commutation option is enabled, this option is unavailable.

    • Regulator Min Speed [RPM]: The minimum speed allowed to be achieved when the potentiometer is at 0%

    • Regulator Max Speed [RPM]: The maximum speed allowed to be achieved when the potentiometer is at 100%

    • External Control: The selected input source for PWM amplitude (duty cycle). This option is unavailable now and is locked on “Potentiometer” input, meaning that the user can change the motor voltage amplitude (by doing this, the rotational speed is increased or decreased) only from the on-board potentiometer. The user can add their own source, such as a PWM input or a different analog source.

  7. Safety Settings

    In this section, the user can customize the fault events and stop the motor when needed to prevent irreversible damage.

    • Fault Enable: An activation switch for the Fault Handling layer. The Fault options are hidden when this option is disabled.

    • Fault State: The state of the driving signals during a Fault condition. If unchecked, it means that the I/O will be set to 0, if checked, then the the I/O will be set to 1.

    • Over-Voltage Threshold: The voltage bus limit given in volts. It serves to protect the hardware setup from any irreversible damage
    • Over-Voltage Return: The voltage bus restore value given in volts. When reaching this value, the OVP fault is cleared.
    • Under-Voltage Threshold: The minimum voltage bus limit given in volts. If this value is not reached, the motor will not start.
    • Under-Voltage Return: The minimum voltage bus restore value given in volts. When reaching this value, the UVP fault is cleared.
    • Over-Heating Threshold: The temperature limit given in degrees Celsius. It serves to protect the MOSFETs or Motor from irreversible damage.
    • Over-Heating Return: The temperature restore value given in degrees Celsius. The fault can be cleared, and the motor drive can restart when reaching this value.
    • Over-Current Peak Threshold: The peak current limit given in amperes. It serves to protect the MOSFETs from irreversible damage.
    • Over-Current Average Threshold: The continuous average current limit given in amperes. It is used for overload protection or if the phase advance difference between the stator and the rotor is too big.

  8. Communication Settings

    In this section, the user can customize the communication type. The library supports two communication interfaces: serial interface and Data Visualizer Run Time (DVRT). When enabling any of the communication methods, the USART module is added to the used project resources.

    • Communication Support>printf: The serial interface is enabled with a default of 460800 baud rate. The reading can be done with any tool, including the MPLAB Data Visualizer extension. The terminal depicts the motor speed in RPM, average current consumption, input voltage, temperature sensor, and the potentiometer value in percentage.

    • Communication Support>DVRT: The MPLAB Plug-in Data Visualizer has a run-time option that can plot real time in a graph the desired variables. The generated DVRT option allows for depicting the potentiometer variable and the motor speed variable.