
Motor Speed Control
Project for ME360: Electromechanical Design
Designed and prototyped a motor-controlled cart to safely transport a dynamically unstable vertical bar, using theoretical modeling, motion analysis, and Arduino-based speed control to prevent tipping over variable distances.
Project Overview:
The goal of this project was to design and prototype a system capable of transporting a dynamically unstable 1-foot vertical bar across a variable distance (5–10 ft) and back, stop-to-stop, without tipping, while minimizing transit time. My primary contributions included performing theoretical modeling, motion analysis, CAD design, and writing Arduino code for motor speed control.

Theoretical Dynamic Model:
We began by calculating the theoretical maximum acceleration of the bar to prevent tipping, determining the time to reach peak velocity, and selecting an appropriate wheel radius (0.165 ft). Using SolidWorks motion analysis, we modeled the cart and monitored the reaction force at the front corner of the bar. When the reaction force dropped to zero, the bar would tip, helping us identify safe acceleration limits.
Our analysis showed that the maximum safe acceleration was 2.683 ft/s² (930.97°/s² in SolidWorks units), occurring at 1.93 seconds. We also calculated that the cart would reach maximum velocity after traveling 5 ft, allowing for smooth deceleration before changing direction.
Prototype Design & Motion Analysis:
Brackets for axles and the motor, as well as 0.165 ft radius wheels, were 3D printed. The cart was assembled, ensuring all wheels were parallel, and prepared for testing.

Arduino Implementation & Control Strategy:
I wrote the Arduino code to execute the acceleration/deceleration profile for the 10 ft forward and backward motion. The code calculates theoretical velocity and adjusts motor speed in real time using feedback, maintaining the bar’s stability. During testing, the acceleration values were fine-tuned to prevent tipping due to motor limitations, floor unevenness, and imperfect wheel alignment.
Experimental Testing & Results:
- 5 ft forward/backward: ~9 seconds
- 10 ft forward/backward: ~14 seconds
Video demonstrations of the cart in motion validate the successful implementation of the theoretical model and control strategy.
5 Ft Test:
10 Ft Test:
//motor control pins
const int motorPWM1 = 5; //controls speed in one direction
const int motorPWM2 = 6; //controls speed in the opposite direction
//motion parameters
const float accel = 2.678; //ft/s² (constant acceleration)
const float distance = 10.0; //total travel distance (ft)
const float halfDistance = 5.0; //distance to peak velocity (ft)
const float wheelRadius = 0.165; //ft
const float pi = 3.14159265;
const float tMax = sqrt((2 * halfDistance) / accel); //time to reach peak velocity
const float Vmax = accel * tMax; //peak velocity in ft/s
unsigned long t0; //start time
bool movingForward = true;
bool motionComplete = false;
void setup() {
pinMode(motorPWM1, OUTPUT);
pinMode(motorPWM2, OUTPUT);
Serial.begin(9600);
analogWrite(motorPWM1, 0); //grounded, no motion
analogWrite(motorPWM2, 0); //grounded, no motion
t0 = millis();
}
void loop() {
if (motionComplete) {
analogWrite(motorPWM1, 0); //stop motor
analogWrite(motorPWM2, 0);
return;
}
float elapsedTime = (millis() – t0) / 1000.0; //time in seconds
float velocity;
if (elapsedTime <= tMax) {
//acceleration (0-5ft)
velocity = accel * elapsedTime;
}
else if (elapsedTime <= 2 * tMax) {
//deceleration (5-10ft)
velocity = Vmax – (accel * (elapsedTime – tMax));
}
else {
//reverse direction after reaching 10 feet
movingForward = !movingForward;
t0 = millis();
//stop after completing the return trip
if (!movingForward) {
motionComplete = true;
}
return;
}
//convert velocity to RPM
float motorRPM = (velocity / (2 * pi * wheelRadius)) * 60;
//map motor speed to PWM
int pwmValue = map(motorRPM, 0, 255, 0, 255);
pwmValue = constrain(pwmValue, 0, 255); //ensure valid PWM range
//set motor speed & direction based on forward/backward motion
if (movingForward) {
analogWrite(motorPWM1, pwmValue); //forward motion
analogWrite(motorPWM2, 0); //ground other pin
} else {
analogWrite(motorPWM1, 0); //ground one pin
analogWrite(motorPWM2, pwmValue); //reverse motion
}
}
Key Skills Developed
Technical Skills:
- Multibody dynamic simulation and motion analysis (SolidWorks)
- Theoretical dynamic modeling and acceleration profiling
- Mechanical design, CAD modeling, and 3D-printed prototyping
- Arduino programming for motor speed control and feedback-based adjustment
- Experimental testing and validation of dynamic systems
Professional Skills:
- Translating theoretical models into physical prototypes
- Iterative design refinement based on real-world constraints
- Debugging and troubleshooting electromechanical systems
- Communicating technical results through analysis, code, and testing data