GOAL:
1. Learn how to use advanced computational tools to validate ideas during the design process.
2. Learn how to control the rotary speed of a motor.
3. Validate the mechanical design creating showcasing prototyping skills. 
The project  required us to create a platform, moved with a rotary motor, which would move as fast as possible without the bar on top of it falling over. This bar could not be attached to the platform in any way.
To begin, a motion analysis was conducted using SolidWorks. This allowed us to find a speed in which the platform could move forward without the bar falling. 
My estimated time using the simulation was around 20 seconds, which ended up being accurate for the actual prototype. 
The design could've been done to advance faster but I decided to keep it like this to stay on the safe side. 
The video above shows our initial trials in which we learned how to control the motor using Arduino code. 
Our design was based on the idea of pulling the platform, instead of having the motor attached to it as if it was a little car. Because of this, a small enclosure was designed, which would hold the motor, the Arduino, the amplifier and all the cable work.  
The cart/platform design was very basic. It was made of a piece of white smooth polyethylene, with some holes drilled through it and some wheels attached through them. Then a piece of black electrical tape was attached to the wheels to stop them from spinning. 
The cart was attached to the motor and reeled in using some fishing wire
A specially designed spool (shown below) was designed to allow the user to change the diameter of the spool pulling the wire, which would allow an increase and decrease in velocity even when the motor as already going at maximum speed.
What I learned:
SolidWorks motion analysis was originally more complicated than what I expected, but I was able to learn a lot. I explored a lot of different motion analysis tools that solid works has to offer and I will definitely be using it in different project in the near future. A motion analysis won't be as accurate as the real prototype testing because there is some things we didn't account for, such as floor geometry and friction generated by the materials used in real life. If we could do the project again, I would probably try adding the motor to the wheels and attached to the platform, to see if this could maybe make it more stable and also help us reduce time. 
I really enjoyed working on this project with a team because it is easier to reach the desired goals. I am not the best at coding but I'm good at manufacturing, and by working together and exchanging skills, I was able to learn more about Arduino code and further develop my skills. 
Attached below is the Arduino Code used:
void setup() {
  pinMode(2,INPUT); // Yellow encoder wire
  pinMode(3,INPUT); // White encoder wire
  pinMode(5,OUTPUT); // IN1 of Red Board
  pinMode(6,OUTPUT); // IN2 of Red Board
  
  attachInterrupt(digitalPinToInterrupt(2),change_counter,FALLING);
  Serial.begin(9600);
  delay(1000);  // Give time to open serial plotter after uploading sketch
}

volatile long int counter=0;  // Pulse counter
double target=210, vel, error=0;     // r.p.m
int v_out=0;
void loop() {
  analogWrite(6,126);
  analogWrite(5,0);
  delay(100);
  vel=get_speed(30);
  Serial.println(vel);
  Serial.println(counter);
  
  //error = abs(target-vel);
  //if (vel>target)
   // v_out=v_out-error*0.2;
  //else if (vel<target)
  //  v_out=v_out+error*0.2;
    
 
  
}

void change_counter(){
  if (digitalRead(3)==1)  // Check whether motion is CW or CCW
    counter=counter+1;
  //else
   // counter=counter-1;
if (counter >= 1000)
  analogWrite(6,170);
  analogWrite(5,0);
 
 if (counter >= 6500)
  analogWrite(6,150);
  analogWrite(5,0);
 if (counter >= 7000)
  analogWrite(6,100);
  analogWrite(5,0);
  
  
 if (counter >= 8200)
   digitalWrite(6,LOW);
   digitalWrite(5,LOW);
  
}
   
double get_speed(int milliseconds){
  unsigned long int t0, t1;
  long int c0, c1;
  double dth, dt, w;
  
  t0=micros();
  c0=counter;
  delay(milliseconds);
  t1=micros();
  c1=counter;
  dth=double(c1-c0)/240.0;  // Angle spun in rev
  dt=double(t1-t0)*1.0e-6/60.0; // Sampling time in minutes
  w=dth/dt; // Angular velocity in rev/min (r.p.m.)
  return(w);
}
Back to Top