Proportional control of a brushed DC motor in Arduino

版本 1.0.2 (76.3 KB) 作者: David Bombara
Block diagrams for closed-loop position control via Arduino commands.
104.0 次下载
更新时间 2022/1/9

查看许可证

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.

引用格式

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. 检索来源 .

MATLAB 版本兼容性
创建方式 R2021b
兼容 R2021b
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
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