The MG996R servo motor

Hardware setup

Before proceeding with the hardware setup, make sure that the FRDM-IMX93 board is powered off.

As per the MG996R datasheet, the servo motor has 3 signals that need to be connected:

  1. The ground signal, which is known as GND.

  2. The power signal, which is known as Vcc.

  3. The PWM signal, which is known as PWM.

Each of these signals uses a different color:

  1. Brown for GND.

  2. Red for Vcc.

  3. Orange for PWM.

Based on Figure 4, we can use the following 3 pins on the FRDM-IMX93 EXP GPIO header:

  1. Pin 39 (GND) for the ground.

  2. Pin 2 (VEXP_5V) for the power.

  3. Pin 7 (EXP_GPIO_IO04) for the PWM.

Therefore, you should connect the pins on the two boards as indicated below:

  1. MG996R GND pin to FRDM-IMX93 pin 39.

  2. MG996R Vcc pin to FRDM-IMX93 pin 2.

  3. MG996R PWM pin to FRDM-IMX93 pin 7.

Figure 30 highlights the aforementioned connections between the FRDM-IMX93 board and the motor.

../_images/mg996r_con_diagram.png

Figure 30 MG996R connection diagram [1].

Additionally, the MG996R datasheet specifies the value of the PWM period, which should be set to 20 ms. The rotation angle is set by adjusting the duty cycle of the PWM signal, as described below:

  1. 1ms duty cycle corresponds to 0 degrees (leftmost position).

  2. 1.5ms duty cycle corresponds to 90 degrees (center position).

  3. 2ms duty cycle corresponds to 180 degrees (rightmost position).

Note

The range of the rotation angle detailed in the datasheet was shifted from [-90, 90] to [0, 180] here.

Testing the connection

You can use the servo sample to check if the servo motor was properly connected to the development board. Instructions on how to build and run the sample are provided in the How to build and the How to run sections.

Further reading

You may find further information on the servo motor in the datasheet.