Skip to content

nikolaslps/Motor-Control

Repository files navigation

Digital Feedback Network Control (Motor Speed Control Application)

Overview

This project focuses on designing and optimizing a digital feedback loop using a PID controller or another suitable digital filter derived from the analog equivalent via the z-transform. The practical application involves controlling the speed of a DC motor with an integrated encoder for measuring rotational speed. The NUCLEO-G474RE board generates PWM signals to regulate motor speed, which is amplified using an L298N half-bridge motor driver with an adjustable duty cycle.

A closed-loop control algorithm adjusts motor speed by comparing the measured speed (from the encoder) to the desired speed. System performance is evaluated at various target speeds, and feedback loop parameters (e.g., PID gains) are optimized for stability and rapid response. A user interface is developed for controlling speed via UART communication with a computer or mobile device.

Features

PID-based motor speed control Closed-loop feedback with real-time speed correction PWM output for precise motor control UART communication for external control System performance evaluation and optimization

System Architecture

  1. NUCLEO-G474RE: Generates PWM signals and implements the closed-loop control algorithm.
  2. L298N Motor Driver: Amplifies PWM signals to drive the motor.
  3. DC Motor with Encoder (DG01D-E): Provides real-time speed feedback.
  4. UART Communication: Facilitates interaction with external devices for speed control and monitoring.

Control Flow

  1. The NUCLEO board reads real-time speed data from the encoder.
  2. Speed data is compared with the desired speed in the PID controller.
  3. The board adjusts the PWM duty cycle to correct any error.
  4. Speed commands can be sent and monitored via UART communication.

Hardware Requirements

NUCLEO-G474RE: Microcontroller board with high-resolution timers for PWM generation (STMicroelectronics NUCLEO-G474RE)

L298N Motor Driver: Dual H-bridge module for controlling motor direction and speed

DC Motor with Encoder (DG01D-E): Provides real-time rotational speed feedback (Operating voltage: 3-9V, 90 RPM at 4.5V)

9V DC Power Supply: For motor operation

USB-UART Converter (optional for serial communication)

Software Requirements

STM32CubeIDE: For developing and debugging embedded firmware

Python 3.x (optional for external control interface)

pySerial: For UART communication with external devices

System Optimization

PID Parameter Tuning: Optimize proportional, integral, and derivative gains for improved stability and faster response.

Speed Calibration: Measure and adjust system response across different speed settings.

Error Minimization: Evaluate and minimize tracking error using real-time feedback.

Future Enhancements

Data Logging: Record system performance for further analysis.

Usage

Connect the motor, driver, and encoder to the NUCLEO-G474RE.

Upload the firmware using STM32CubeIDE.

Use a UART terminal to set and monitor speed or use directly the GUI for speed control.

Evaluate performance and fine-tune PID parameters as needed.

About

PID-based motor speed control Closed-loop feedback with real-time speed correction PWM output for precise motor control UART communication for external control System performance evaluation and optimization

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors