This project aims to explore Model Based Design (MBD) to accelerate the project development speed. TI C2000 Launchpad was used with Simulink to control DC motors. Some simple experiments were conducted.
Demo:
Click following picture to watch video:
Hardware platform: LAUNCHXL-F28027
Software: Matlab (2017a and above versions)
Required Matlab packages:
- Simulink
- Embedded Coder
- MATLAB Coder
- Simulink Coder
- Embedded Coder Support Package for Texas Instruments C2000 Processors
- Select Processor Family: TI Piccolo F2802x (based on your hardware)
- Install Third-Party Software
- Install Third-Party Software
Here is a diagram showing how the connections were made.
LAUNCHXL-F28027 image source: https://www.ti.com/lit/ml/sprz376/sprz376.pdf?ts=1702445097824&ref_url=https%253A%252F%252Fwww.ti.com%252Ftool%252FLAUNCHXL-F28027
TB6612 image source: https://www.sparkfun.com/products/14451
I designed one breakout board used for this project. The breakout board was designed by Altium Designer, all design files are in Lpad_28027_connect_Project _v1.1 folder.
- Battery: 12V, power the motor
- DC motor with encoder
- Control board: LAUNCHXL-F28027 + TB6612 module + Breakout board
- Desired Velocity (rpm)
- Actual Velocity: The eCAP module outputs pulse interval time. Divide the distance by the time to get the actual velocity.
- PID controller: Incremental PID module.
- PWM module: Change the power voltage of the DC motor.
- Direction
GPIO0 and CPIO1 are used to control the rotation direction.
The related code 'dc_motor_pid_control' is in the main directory.
Suitable PID parameters:
D parameter turns higher:
I parameter turns lower:
P parameter turns Higher:
Finally, thanks to my friend Wenbo Ning for his contribution and help.