Table des matières

TNY-360 Documentation

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

A complete guide on how to modify the MG996R motors of the TNY-360 is available in the Practical Guide section of the documentation !

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.