## Introduction: DELTABOT

Using deltabot we can automise a ball socket joint.That is we can vary the angles of ball socket joints at the same time we can vary the length of the ball socket joint.

One of the most important advantage is that the lower base is always parallel to the ground irrespective of the angles of the servos. Due to this deltabot has huge advantages.

Delta bot is used in 3d printer as well.

## Step 1: Explanation of Design

First you have to decide what are going to be your dimensions for the deltabot.

This robot has three arms of equal length. Each arm consists of two bars which are joined by a hinge.We had made the upper bar of length appx. 200mm and the lower bar consists of two bars of length appx. 420mm. The lower bars are fixed in such a way so that it can rotate about the axis it is fixed.

Each arm is connected to a servo motor ,which is placed on the top of the of a triangular base. similarly the lower end of the three arms are connected to a smaller triangular base with the help of hinges.

## Step 2: Making the Arms

We had made the upper arms of acralic ,but one could even use plywood . Always remember that the arms should have enough strength as well as should have less weight ,otherwise the servos won't be able to lift the weight.

One needs to make it sure that all the three upper arms should be of same length other wise it would interfere our mathematics latter .

We had used bars from a mini drafter to make the lower bars of the arms.

Connect the upper and lower bars using a a piece of a sheet of metal and hinges. Make sure you only tighten the screws such that the lower bars can freely rotate about it's axis.

## Step 3: Assembling the Body

Connect the three arms to the servos and fit the servos on the top of the upper triangular base at equidistance from each other. You might need to cut some slits in the upper triangular base.

NOTE if the servos have 180 angle motion make sure you set the zero angle position of the servo according to your design.

You need to make a stucture to hold the upper base.

## Step 4: Programming

Here is the code for the calculation of the angles of servo for a particular x,y,z coordinate. origin is at the center of the upper triangular base.

**import math, serial, struct, time port = ('COM4') arduino = serial.Serial(port,9600) time.sleep(2)**

**prevTheta1 = 10 prevTheta2 = 10 prevTheta3 = 10**

**def closerTo(prevTheta,theta1,theta2): if (abs(prevTheta - theta1)<=abs(prevTheta-theta2)): return theta1 if (abs(prevTheta - theta2)**

**L = 20 l = 42 wb = 8.66 up = 3 wp = 1.5 sp = 5.2**

**a = wb - up b = (sp - 1.73*wb)/2 c = wp - wb/2**

**z=-45 i=0**

**while True: if (i%4==0): x = 15 y = 15 elif (i%4==1): x = -15 y = 15 elif (i%4==2): x = -15 y = -15 else: x = 15 y = -15**

** i = i+1**

** E1 = 2*L*(y+a) F1 = 2*z*L G1 = x**2 + (y+a)**2 + z**2 - l**2 + L**2**

** E2 = -(L*(1.73*(x+b)+y+c)) F2 = 2*z*L G2 = x**2 + y**2 + z**2 +b**2 + c**2 +L**2 +2*(x*b + y*c) - l**2**

** E3 = L*(1.73*(x-b)-y-c) F3 = 2*z*L G3 = x**2 + y**2 +z**2 +b**2 +c**2 +L**2 +2*((-x*b)+y*c) - l**2**

** D1 = E1**2 + F1**2 - G1**2 D2 = E2**2 + F2**2 - G2**2 D3 = E3**2 + F3**2 - G3**2**

** if (D1<0)or(D2<0)or(D3<0): print ("Not possible")**

** else: t11 = (-F1 + (E1 ** 2 + F1 ** 2 - G1 ** 2) ** 0.5) / (G1 - E1) theta11 = int(math.atan(t11) * 180 / 3.1415) t12 = (-F1 - (E1 ** 2 + F1 ** 2 - G1 ** 2) ** 0.5) / (G1 - E1) theta12 = int(math.atan(t12)* 180 / 3.1415)**

** t21 = (-F2 + (E2 ** 2 + F2 ** 2 - G2 ** 2) ** 0.5) / (G2 - E2) theta21 = int(math.atan(t21) * 180 / 3.1415) t22 = (-F2 - (E2 ** 2 + F2 ** 2 - G2 ** 2) ** 0.5) / (G2 - E2) theta22 = int(math.atan(t22) * 180 / 3.1415)**

** t31 = (-F3 + (E3 ** 2 + F3 ** 2 - G3 ** 2) ** 0.5) / (G3 - E3) theta31 = int(math.atan(t31) * 180 / 3.1415) t32 = (-F3 - (E3 ** 2 + F3 ** 2 - G3 ** 2) ** 0.5) / (G3 - E3) theta32 = int(math.atan(t32) * 180 / 3.1415)**

** theta1 = closerTo(prevTheta1,theta11,theta12) theta2 = closerTo(prevTheta2,theta21,theta22) theta3 = closerTo(prevTheta3,theta31,theta32)**

** print(theta1,theta2,theta3) print(struct.pack('>BBB',theta1,theta2,theta3))**

** prevTheta1 = theta1 prevTheta2 = theta2 prevTheta3 = theta3**

** arduino.write(struct.pack('>BBB',theta1,theta2,theta3))**

** time.sleep(2)**

This code is written in python and the values of angles are send via the arduino to the servos. You need to write a code in arduino to receive the data and send it to the servos.For that you would require knowledge related to serial communications between python and arduino , some have some basic knowledge of computing.