🔬

Bidirectional PWM Motor-Control Signal Analysis

In the main experiment, we measured the signal on GPIO 34, the left-motor Phase signal. In this extra task, we will compare both control signals used by the left motor-driver channel:
  • GPIO 34 — Left Motor Phase / IN1
  • GPIO 35 — Left Motor Enable / IN2
We will investigate how these signals change when the commanded motor effort changes from positive to negative. We already observed PWM on GPIO 34 during positive effort. What might change when the commanded effort becomes negative? Will the same signal remain active?

Materials and setup

  • XRP Robot
  • Red Pitaya (configured for LV ±1V inputs)
  • Oscilloscope probe (configured for 10x attenuation)
  • Four male-to-male jumper wires (GPIO 34, 35 and GND x2).

Measurement configuration

  1. Verify Zero-Power State: Ensure the XRP is completely disconnected from USB-C and the physical battery switch is OFF. Power off the Red Pitaya before changing its input jumpers or probe connections.
  2. Follow the measurement configuration of the main experiment, with additionally connecting a second probe (Channel 2) to GPIO35 and its ground clip attached to GND. Use the two additional male-to-male jumper wires for this step.
  3. Probe settings, timebase, and vertical scale remain the same.
  4. Enter Safe Testing State: Once the wiring and oscilloscope configuration are verified, connect the USB-C cable to the XRP and leave the battery switch OFF. In the tested setup, this powers the controller logic without battery-powered motor operation. Keep the robot secured during the test.
  5. Connection summary:
    1. Channel 1 probe tip ── GPIO 34 / Left Motor Phase
    2. Channel 2 probe tip ── GPIO 35 / Left Motor Enable
    3. Both probe ground clips ── XRP GND

Exploration and analysis

  1. Signal capture: Run the following script:
from XRPLib.defaults import * print("Left-motor direction investigation.") try: print("Positive effort: +50%") left_motor.set_effort(0.50) time.sleep(7) left_motor.set_effort(0) time.sleep(2) print("Negative effort: -50%") left_motor.set_effort(-0.50) time.sleep(7) finally: left_motor.set_effort(0) print("Motor stopped.")
  1. Observe the two channels during the positive and negative effort commands. Switch the oscilloscope trigger source to IN2 / GPIO 35 when observing the negative-effort signal.
  2. Explore the following questions:
    1. What changes between the (+50%) and (-50%) effort commands?
    2. Which GPIO carries the PWM signal in each direction, and what logic state does the other input have?
    3. How can the two motor-driver inputs control both the magnitude and direction of the motor drive?
    4. What additional measurement would be needed to verify how the H-bridge changes the voltage across the motor terminals?
âś… Check your observations
- During +50% effort, GPIO 34 carries the observed PWM signal.
- During -50% effort, GPIO 35 carries the observed PWM signal.
- The other motor-driver input remains at a fixed inactive logic level.
- The PWM period remains approximately 20 ms, corresponding to approximately 50 Hz.
Changing the sign of the effort changes which motor-driver input carries the PWM signal. The duty cycle represents the magnitude of the motor command, while the active input determines the direction of the motor drive.
The DRV8411A uses the two input signals to control the H-bridge. By activating opposite switching paths, it reverses the voltage polarity across the motor. This reverses the motor current and therefore the motor’s rotation direction.
The GPIO measurements show the control signals sent to the motor driver, not the actual voltage across the motor terminals. To verify the motor-terminal voltage, an appropriate differential measurement would be required.
Â