8. Appendix - Automatic Sauté Machine


MATLAB CODE:

clear all;

theta1 = atand(25/125); % degrees
AB = 65.91; % mm
BC = 205.234; % mm
AD = sqrt(125^2 + 25^2); % mm
w2 = 10.5; % rad/s

for i = 1:361
theta2(i) = i;
theta3(i) = asind((AB*sind(theta2(i))-AD*sind(theta1))/BC);
DC(i) = AB*cosd(theta2(i)) + BC*cosd(theta3(i)) - AD*cosd(theta1);
w3(i) = (AB*w2*cosd(theta2(i))/(BC*cosd(theta3(i))));
DCdot(i) = -BC*w3(i)*sind(theta3(i)) - AB*w2*sind(theta2(i));

a3(i) = (-AB*(w2^2)* sind(theta3(i)) + BC*(w3(i)^2)*sind(theta3(i)))/(BC*cosd(theta3(i)));
DCdotdot(i) = -AB*(w2^2)*cosd(theta2(i)) - BC*a3(i)*sind(theta3(i)) - BC*(w3(i)^2)*cosd(theta3(i));

end

figure; hold on; grid on
plot(theta2, theta3);
title ('Angular Position of Link 3')
xlabel('Theta 2 (deg)');
ylabel('Theta 3 (deg)');

figure; hold on; grid on
plot(theta2, abs(DC));
title ("Length of DC")
xlabel('Theta 2 (deg)');
ylabel('DC (mm)');

figure; hold on; grid on
plot(theta2, w3);
title ('Angular Velocity of Link 3')
xlabel('Theta 2 (deg)');
ylabel('w3 (rad/s)');

figure; hold on; grid on
plot(theta2, a3);
title ('Angular Acceleration of Link 3')
xlabel('Theta 2 (deg)');
ylabel('a3 (rad/s^2)');

figure; hold on; grid on
plot(theta2, DCdot);
title ('Linear Velocity of DC')
xlabel('Theta 2 (deg)');
ylabel('V_D_C (mm/s)');

figure; hold on; grid on
plot(theta2, DCdotdot);
title ('Linear Acceleration of DC')
xlabel('Theta 2 (deg)');
ylabel('A_D_C (mm/s^2)');

ARDUINO CODE

void setup() {
 
  //Setup Channel A
  pinMode(8, OUTPUT); //Initiates Motor Channel A pin
  pinMode(7, OUTPUT); //Initiates Brake Channel A pin
 
}

void loop(){
 
  //forward @ full speed
  digitalWrite(8, HIGH); //Establishes forward direction of Channel A
  digitalWrite(7, LOW);   //Disengage the Brake for Channel A
  analogWrite(9, 100);   //Spins the motor on Channel A at full speed
 
  delay(5000);
 
  digitalWrite(7, HIGH); //Eengage the Brake for Channel A

  delay(1000);
 
  digitalWrite(7, HIGH); //Eengage the Brake for Channel A
 
  delay(1000);
 
}