Introduction
This module examines how the XRP’s Raspberry Pi RP2350 microcontroller generates digital PWM control signals and commands the Texas Instruments DRV8411A Dual H-Bridge motor drivers.
Microcontroller GPIO pins cannot supply the high voltage and current required to drive DC motors directly. The XRP therefore separates the control and power paths:
- Control path — low power: The RP2350 generates 3.3 V digital control signals from its GPIO pins.
- Power path — high current: The DRV8411A receives these logic signals and switches power from the 4× AA battery pack, approximately 6 V, across the motor terminals.
- Actuator stage:Â The DC motor converts the resulting electrical energy into mechanical rotation.
Principles of PWM
Pulse Width Modulation (PWM) rapidly switches a digital output between 0 V (LOW) and 3.3 V (HIGH) to deliver variable average power to the load. It is governed by two core parameters:
- Carrier Frequency (f): The repetition rate of the complete switching cycle. The total period (T) is defined as:
- Duty Cycle: The percentage of time the signal remains in the active HIGH state during one complete period: . A 50% duty cycle delivers roughly 50% of the maximum available power to the driver stage.
H-Bridge Switching States & Current Control
An H-bridge contains four internal MOSFET switches arranged around the motor. The DRV8411A coordinates these switches to establish four distinct operational states:
Operational State | Active H-Bridge Path | Motor-Terminal State | Result |
Forward Drive | Left high-side and right low-side switches | Motor terminals connected to +6 V and GND with one polarity | Current flows in one direction; motor rotates forward |
Reverse Drive | Right high-side and left low-side switches | Motor polarity is reversed | Current flows in the opposite direction; motor rotates reverse |
Active Braking | Both low-side switches ON | Both motor terminals pulled LOW toward GND | Back-EMF produces opposing torque; motor decelerates rapidly |
Coasting | All switches OFF | Both motor terminals high-impedance | Motor spins down through inertia, friction, and electrical losses |
Dead-Time & Shoot-Through Protection: If a high-side and low-side switch on the same leg close simultaneously, raw battery power shorts directly to ground (shoot-through). The DRV8411A IC automatically inserts microsecond dead-time delays to guarantee one switch turns completely OFF before the complementary switch turns ON.
50 Hz Frequency Design
The default XRPLib library configures the RP2350 to output motor PWM at 50 Hz :
- Acoustic & Mechanical Characteristics: Industrial DC motor drivers typically operate between 1 kHz and 20 kHz to remain above human hearing. The 50 Hz carrier frequency causes motor windings to vibrate audibly, creating a physical 50 Hz hum and subtle torque ripple at low effort settings.
- MOT LED: Indicates when power is available to the motor drivers.
- LOW VOLT LED: Monitors the 5 V buck regulator's
POWER_GOODpin, turning on if heavy motor draw causes battery voltage to sag. - Logic Rail Regulation: The onboard regulator maintains the RP2350 logic rail at a steady 3.3 V until battery depletion drops below the regulator threshold and causes a system brownout.