Making a Cart to Learn DC Motor Control

Conception and Analysis

As part of my Electromechanical Design course, me and a team of two others designed, coded, and tested a variable distance cart, capable of moving a vertical 80/20 aluminum bar that was not adhered with fasteners, without it tipping. The challenge was to do this as fast as possible.
Motor Control Solutions

By utilizing a bang-bang control system, I gained practical experience with implementing mathematically optimal solutions into reality. While effective, it presented several issues that had to be adjusted. Primarily, a true bang-bang solution requires for it to move with maximum acceleration and deceleration, here, dictated by the tipping moment of the aluminum bar, and found to be gravitational acceleration multiplied by the base distance divided by the height of the bar. However, utilizing this solution failed when it came to our motor. The Arduino Uno connected to our brushed DC motor via an L298N motor driver did not supply sufficient voltage via PWM to move the motor at lower speeds. This meant the code had to be adjusted to account for sudden stoppage on either end.
​
This was solved by implementing a non-linear decrease in speed from a variable distance to either end to allow for a more gradual approach. We combined this with a slight delay on the far end, to allow for the bar to settle, so that the car would not kick backwards too quickly due to a minimum PWM setting.Â
​
The design process began with ideation, taking our assigned project and determining maximum theoretical accelerations, and modeling that via a simple SolidWorks assembly. With this acceleration, we then did calculations for maximum velocity for a given distance, in our case, 10ft, which we then used to optimize our wheel circumference via our motor's tested max RPM. We then implemented our design into a quick prototype to allow for rapid iteration, lasercutting the base, and 3D printing axle brackets and an elliptical semicylinder to improve the force of our motor's hose clamp fasteners. This allowed us to spend ample time developing the code behind our project, and to optimize it to a greater degree, improving consistency and control throughout.


Further Reading & Resources
Code Documentation, and Calculations: https://github.com/erispil/DC-Motor-Control-with-Controlled-Acceleration.git