top of page

Making a Cart to Learn DC Motor Control

Video of DIY CNC Machine cutting a Dinosaur blockprint
00:00/00:00

Conception 

IMG_0423.jpg

Together with two friends, I designed, coded, and tested a variable distance cart to enter a student competition. The cart had to be capable of transporting a vertical 80/20 aluminum bar that was not adhered with fasteners, back and forth across a fixed distance without it tipping. The challenge was to do this as fast as possible.

Motor Control Analysis

By utilizing a bang-bang control system, I gained practical experience with translating mathematically optimal solutions into reality. We determined the maximum theoretical accelerations, and modeled that via a simple SolidWorks assembly. With this acceleration, we then did calculations for maximum velocity for a given distance, which we then used to optimize our wheel circumference via our motor's tested max RPM. We then converted our design into a quick physical prototype to allow for rapid iteration, laser cutting 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.

​

Video of DIY CNC Machine cutting a Dinosaur blockprint

Refinement

IMG_0424.jpg

A true bang-bang solution requires the cart to move with maximum acceleration and deceleration, here, dictated by the tipping moment of the aluminum bar (in this particular instance, determined by the 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 we had to adjust the code to account for sudden stoppage on either end. We implemented 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 cart would not kick backwards too quickly due to a minimum PWM setting. 

Video of DIY CNC Machine cutting a Dinosaur blockprint
00:00/00:00

Further Reading & Resources

bottom of page