Proportional control of a brushed DC motor in Arduino

Block diagrams for closed-loop position control via Arduino commands.
109 Descargas
Actualizado 9 ene 2022

Ver licencia

This code enables control of brushed DC motors using two types of driver control schemes: (1) PWM-DIR and (2) IN2-IN2.
Below is a schematic of the overall system for both driver control schemes. The system is a single-input-single-output closed-loop proportional control system. The "plant" subsystem contains the lower-level functions that depend on if the motor driver is manipulated using PWM-DIR logic or IN1-IN2 logic.
PWM-DIR:
For this scheme, the PWM pin on the driver outputs a pulse-width modulated (PWM) voltage signal whose duty cycle varies between 0% and 100%. The Arduino PWM pins are controlled using 8-bit values, so in the Arduino code, a PWM value of 0 corresponds to 0% duty cycle whereas a PWM value of 255 corresponds to 100% duty cycle. The DIR pin receives a Boolean voltage value from the Arduino digital pin. This value changes the direction of the motor.
An example of a motor driver that uses PWM-DIR logic is the MAX14870.
IN1-IN2:
This scheme is similar to PWM-DIR. Both IN1 and IN2 receive a PWM signal from the Arduino. However, IN1 turns the motor in one direction, whereas IN2 turns the motor in the opposite direction. The Simulink block diagram is designed such that when IN1 is on, IN2 is off, and vice versa.
An example of a motor driver using IN1-IN2 logic is the DRV8871.

Citar como

David Bombara (2024). Proportional control of a brushed DC motor in Arduino (https://www.mathworks.com/matlabcentral/fileexchange/104805-proportional-control-of-a-brushed-dc-motor-in-arduino), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2021b
Compatible con R2021b
Compatibilidad con las plataformas
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versión Publicado Notas de la versión
1.0.2

Added image of block diagram of overall system.

1.0.1

Added images of Simulink block diagrams to the Description.

1.0.0