Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

%% Group 1 - Abayomi Adekanmbi & Zakari Ishak-Boushaki

clear all; clc; close all;

...

Arduino Code

#include <Stepper.h> //library

const int stepsPerRevolution = 2048; //number of steps per rotation


Stepper myStepper1 = Stepper(stepsPerRevolution, 8, 10, 9, 11);

Stepper myStepper2 = Stepper(stepsPerRevolution, 3, 5, 4, 6);


void setup() {

  // put your setup code here, to run once:

 myStepper1.setSpeed(5);

 myStepper2.setSpeed(5);

  Serial.begin(9600);

}

void loop() {

  // put your main code here, to run repeatedly:

  Serial.println("clockwise");

  myStepper1.step(stepsPerRevolution);

  Serial.println("counterclockwise");

  myStepper2.step(stepsPerRevolution);

}

MATLAB Code

%% Group 1 - Abayomi Adekanmbi & Zakari Ishak-Boushaki

clear all; clc; close all;

L1=5;
L2=1;
L3=7;
L33=7;
L4=4;
L44=4;
L5=4;
L6=4;
L66=8;
L7=4;

A1=0;
A2=pi/2:0.3:6*pi+(pi/2);

A22=pi+A2;
A2=-A2; A22=-A22;

% Point B
Bx=L2.*cos(A2);
By=L2.*sin(A2);

...

[A3,A4] = fourbarpos(L1,L2,L3,L4,A1,A2);
A5=(pi-A4)+(pi/2);
[A32,A42]= fourbarpos (L1,L2,L3,L4,A1,A22);
A52=(pi-A42)+(pi/2);

% Point C
Cx=Bx+(L3.*cos(A3));
Cy=L4.*sin(A4);

C2x=B2x+(L3.*cos(A32));
C2y=L4.*sin(A42);

% Point D
Dx=L1; Dy=0;

p=2.*L4.*((L1.*cos(A1))-(L2.*cos(A2)));
q=2.*L4.*((L1.*sin(A1))-(L2.*sin(A2)));
r=(L1.^2)+(L2.^2)-(L33.^2)+(L44.^2)-(2.*L1.*L2.*cos(A1-A2));

...

A332=2.*atan((-e2-sqrt((d2.^2)+(e2.^2)-(f2.^2)))./(f2-d2));

% Point E
Ex=Dx+L5.*cos(pi-A5);
Ey=Dy+L5.*sin(pi-A5);

...

P2x=H2x+L66.*cos(A62+(pi/2));
P2y=H2y+L66.*sin(A62+(pi/2));

A4=-A4; A5=-A5;

%%% Velocity Calculation

W2=2;

W3=-(L2.*W2.*sin(A2-A4))./(L3.*sin(A3-A4));
W4=(L2.*W2.*sin(A2-A3))./(L4.*sin(A4-A3));
W5=W4;

...

A4=-A4; A5=-A5;
W6=(L5.*W5.*sin(A5-A7)-L44.*W44.*sin(A44-A7))./(L6.*sin(A6-A7));
W7=(L44.*W44.*sin(A44)-L5.*W5.*sin(A5)+L6.*W6.*sin(A6))./(L7.*sin(A7));

A4=-A4; A5=-A5;

% Acceleration

Alf2=0;

Alf3=((L2.*(W2.^2).*cos(A2-A4))+(L3.*(W3.^2).*cos(A3-A4))-(L4.*(W4.^2))-(L2.*sin(A4-A2)))./(L3.*sin(A4-A3));
Alf4=((L2.*Alf2.*sin(A3-A2))-(L2.*(W2.^2).*cos(A2-A3))-(L3.*(W3.^2))+(L4.*(W4.^2).*cos(A4-A3)))./(L4.*sin(A3-A4));
Alf5=Alf4;

...

x = A2;
link3 = A3;
link4 = A4;
link33 = A33;
link44 = A44;
link6 = A6;
link7 = A7;

plot(x,link3,'r', x,link4,'b',x,link33,'g',x,link44,'c',x,link6,'m',x,link7,'k')
legend('Link3','Link4','Link33','Link44','Link6','Link7')
grid on;
title('Jensen Links Position Analysis'); xlabel('Angle(\theta_2)')
ylabel('Position');

figure(2)

x = A2;
link3 = W3;
link4 = W4;
link33 = W33;
link44 = W44;
link6 = W6;
link7 = W7;

plot(x,link3,'r', x,link4,'b',x,link33,'g',x,link44,'c',x,link6,'m',x,link7,'k')
legend('Link3','Link4','Link33','Link44','Link6','Link7')
grid on;
title('Jensen Links velocity Analysis'); xlabel('Angle(\theta_2)')
ylabel('Velocity');

figure(3)

x = A2;
link3 = Alf3;
link4 = Alf4;
link33 = Alf33;
link44 = Alf44;
link6 = Alf6;
link7 = Alf7;

plot(x,link3,'r', x,link4,'b',x,link33,'g',x,link44,'c',x,link6,'m',x,link7,'k')
legend('Link3','Link4','Link33','Link44','Link6','Link7')
grid on;
title('Jensen Links Acceleration Analysis'); xlabel('Angle(\theta_2)')
ylabel('Acceleration');


function [T3,T4]= fourbarpos(L1,L2,L3,L4,T1,T2)
s1=-1;
s2=1;
P=2*L4*(L1*cos(T1)-L2*cos(T2));
Q=2*L4*(L1*sin(T1)-L2*sin(T2));
R=L1^2+L2^2-L3^2+L4^2-2*L1*L2*cos(T1-T2);
T4=2*atan2(-Q+(s1)*sqrt(P.^2+Q.^2-R.^2),R-P);

D=2*L3*(L2*cos(T2)-L1*cos(T1));
E=2*L3*(L2*sin(T2)-L1*sin(T1));
F=L1^2+L2^2+L3^2-L4^2-2*L1*L2*cos(T2-T1);
T3=2*atan2(-E+(s2)*sqrt(D.^2+E.^2-F.^2),F-D);
end

Bill of Materials 

...

Items

...

1 Set of 5V Stepper Motors 

...

1 Lead Screw Set 

...

# Acrylic and Wood x $? = $?

# Bolts and Nuts x $Free? = $Free?

...

4 Dowels x $Free = $Free

...

1 Arduino Uno 

...

1 Motor Shield 

...

-D);
end



Bill of Materials

Items

QuantityCostSource
Arduino Uno1$24Amazon

5V Stepper Motor & Darlington Arrays

5$14Amazon
1 Set of Jumper Wires120$6.89Amazon
Power Module1$17Amazon
Computer Cable1$2.60Amazon

Lead Screw Set 

1$12Amazon
Caster Wheels1$10.79Amazon

Dowels, Wood, and 3D Printed Material

6FreeTIW
5 Sets of Ball Bearings 50$57.4Amazon
1 Set of Sliders2$17Amazon