Customizing Pepper Open-Source FPGA Hardware as a DC Drive Controller

Pepper, an FPGA-based open-source hardware platform, offers exceptional flexibility and performance for industrial applications. One of the most impactful customizations is converting Pepper into a DC drive controller for managing DC motors in applications like robotics, industrial automation, and electric vehicles. This blog provides a technical deep dive into the customization process, including system architecture, hardware implementation, and a detailed block diagram.

What is a DC Drive Controller?

A DC drive controller enables precise operation of DC motors by regulating speed, direction, and torque. Essential features include:

  • PWM-based speed control
  • Direction reversal
  • Current and voltage monitoring
  • Closed-loop feedback using encoders

The FPGA’s ability to handle real-time control, high-speed signal processing, and parallel computations makes it ideal for this purpose.

System Requirements

To convert Pepper into a DC drive controller, the following hardware and functional blocks are required:

Input Modules

  • Voltage and current sensors for motor monitoring.
  • Encoder interface for position and speed feedback.
  • User input through GPIOs or external communication (e.g., UART).

Processing Modules

  • Pulse Width Modulation (PWM) generation.
  • Closed-loop feedback control (e.g., PID).
  • Safety features like overcurrent protection and emergency stop.

Output Modules

  • PWM signals for motor control.
  • Control signals for an external H-bridge circuit.

External Interfaces

  • Ethernet or UART for configuration and monitoring.

Implementation Architecture

Below is the high-level architecture of the DC drive controller implemented on Pepper FPGA hardware:

FPGA Hardware Division: PL and PS Sides

The FPGA hardware is divided into the Programmable Logic (PL) and Processor Side (PS):

PL Side (Real-Time Processing)

  • PWM Generator: Produces high-frequency PWM signals for motor control.
  • PID Controller: Implements closed-loop speed and position control.
  • Quadrature Decoder: Decodes encoder signals for feedback.
  • Safety Logic: Detects overcurrent and stops motor operation.

PS Side (Configuration and Monitoring)

  • UART Interface: Allows external devices to configure motor parameters.
  • Ethernet Interface: Enables remote monitoring and control.
  • Control Application: Provides a user interface for system control.

Detailed Implementation

1. PWM Generation

The PWM module generates pulses with a variable duty cycle to control the motor speed. A 100 kHz PWM frequency is typical for industrial DC motors.

Verilog Implementation:
mmodule pwm_generator (  
input wire clk, // System clock
input wire [7:0] duty, // Duty cycle (0-255)
output reg pwm_out // PWM signal
);
reg [7:0] counter;

always @(posedge clk) begin
counter <= counter + 1;
pwm_out <= (counter < duty) ? 1 : 0;
end
endmodule odule pwm_generator (
input wire clk, // System clock
input wire [7:0] duty, // Duty cycle (0-255)
output reg pwm_out // PWM signal
);
reg [7:0] counter;

always @(posedge clk) begin
counter <= counter + 1;
pwm_out <= (counter < duty) ? 1 : 0;
end
endmodule

2. Quadrature Decoder for Encoder Feedback

Features:

This module reads encoder signals and calculates speed and direction.

3. PID Control

The PID controller ensures precise motor control by adjusting the PWM duty cycle based on feedback.

Pseudocode:

ererror = desired_speed – actual_speed;
integral = integral + error;
derivative = error – previous_error;
output = Kp * error + Ki * integral + Kd * derivative;
previous_error = error; ror = desired_speed – actual_speed;
integral = integral + error;
derivative = error – previous_error;
output = Kp * error + Ki * integral + Kd * derivative;
previous_error = error;

4. Safety and Protection Logic

Implement safety features such as:

  • Overcurrent Detection: Monitors current sensors and triggers a stop signal.
  • Emergency Stop: Processes input signals to immediately disable the PWM.

5. Communication Interfaces

  • UART: For local control and configuration.
  • Ethernet: For remote monitoring and integration with industrial systems.

External Hardware Requirements

H-Bridge Circuit
  • MOSFET-based circuit for motor direction and speed control.
Sensors
  • Voltage and current sensors for monitoring.
  • Quadrature encoders for feedback.
Power Supply
  • Ensure adequate current handling for motor operation.

Testing and Validation

Motor Speed Testing

  • Validate the PWM generation by measuring duty cycle variations.
  • Test motor response to varying speed commands.

Direction Control Testing

  • Confirm the correct operation of the H-bridge control signals.

Feedback Loop Testing

  • Use an oscilloscope to verify the encoder signals.
  • Check PID output stability and accuracy.

Safety Feature Testing

  • Simulate overcurrent conditions to validate protection logic.
  • Test emergency stop functionality.

Conclusion

Pepper’s FPGA platform is a versatile and powerful choice for building a DC drive controller. Its flexibility in real-time processing and high-speed computation enables precise motor control and integration into industrial systems. With this customization, Pepper can serve as a cost-effective solution for diverse applications in robotics, industrial automation, and more.