MG996R Feedback Mod

The MG996R servo is a popular choice for robotics projects due to its affordability and decent performance.

However, it lacks built-in position feedback, which can be a limitation for applications that require precise control.

To address this, we implemented a custom position feedback mod for the MG996R servo. Here's how we did it.


Servomotor Basics

Before diving into the mod, let's briefly review how a standard servomotor works.

A servomotor is a device that can rotate to a specific angle based on a control signal. This is typically achieved using 3 components :

  1. Motor: The main component that provides the rotational force. This motor is often combined with a gearbox to increase torque and reduce speed.
  2. Position Sensor: A way of measuring the current angle of the servo horn. In standard servos, this is often a potentiometer that provides feedback to the control circuit.
  3. Control Circuit: The electronics that interpret the control signal and adjust the motor's position accordingly. This circuit uses the feedback from the position sensor to maintain the desired angle.
Generating schema ...
graph LR
    M(Motor)
    P(Potentiometer)
    C(Control Circuit)
    C ===|direction| M
    P ===|position| C

A servomotor has three wires :

  • 🔴 Power: Provides the necessary voltage to operate the motor and control circuit.
  • ⚫ Ground: Completes the electrical circuit.
  • 🟡 Signal: A pulse-width modulated (PWM) signal that indicates the desired position of the servo horn.

The control circuit compares this signal to the feedback from the position sensor and adjusts the motor's rotation until the feedback matches the desired position.

Generating schema ...
graph LR
    A["Read Signal"]
    B["Read Position Feedback"]
    C["Compare Signal and Feedback"]
    D["Adjust Motor Position"]
    A --> B
    B --> C
    C --> D
    D --> A

The core idea

In most robotics projects using MG996R servos, adding position feedback is done by attaching an external sensor, such as a rotary encoder, the the joint.

However, since a potentiometer is already present inside the MG996R for internal control, we could tap into this existing sensor to extract position feedback without needing additional hardware.

Sadly, reading the potentiometer's output directly isn't as easy as it sounds. The MG996R's control circuit is really sensitive to any external interference, and to read the potentiometer's voltage with a microcontroller generates a little voltage drop1 that causes the servo to jitter as it tries to compensate for the perceived change in position.

To solve this, we used an operational amplifier (op-amp) acting as a buffer to isolate the potentiometer from the microcontroller's input. This way, we can read the voltage without affecting the servo's performance.

schema


Modding the MG996R

When ordering a TNY-360 kit off of our website, all the motors come pre-modded with the feedback circuit. However, if you want to try it yourself, here are the steps we took to mod the MG996R:

1 - Disassemble the Servo

Carefully open the MG996R servo to access the internal PCB and components. This typically involves removing screws and gently prying open the casing.

Be carefull

Don't let the front cover fall off as it houses the servomotor's gearbox (which is a nightmare to reassemble if it falls apart). Only remove the back cover to access the PCB.

2 - Identify the Potentiometer

Locate the potentiometer's 3 output pin on the PCB, which is usually connected to the control circuit. This is the point where we will tap into for feedback.

3 - Solder the custom Op-Amp PCB

Align the 3 potentiometer output pins with the 3 holes on the custom op-amp PCB and solder them in place. This will allow the op-amp to read and buffer the potentiometer's output voltage.

4 - Solder the Output Wire

Connect a new feedback wire to the output of the op-amp, which corresponds to the big solder pad on the PCB.

The TNY-360 robot uses JST-XH connectors for motors wiring. For easier integration with the robot, remove the original connector from the servomotor and solder a 4-Pin JST-XH connector to the servo's power, ground, signal, and feedback lines.

5 - Reassemble the Servo

Carefully put the servo back together, ensuring that all components are properly aligned and secured.

Footnotes

  1. A microcontroller like the ESP32-S3 uses an analog-to-digital converter (ADC) to read a voltage level. This process can draw a small amount of current, which can cause a voltage drop if the circuit isn't designed to handle it.