• Tree Created Project

    08/01/2016 | 4:56pm

Loading Items

About This Project

This is a DIY robotics project where you will learn how to make a robot arm. The robot arm is controlled by ArduinoComputer SoftwareServos, and Mechanical Parts. This is a must for anyone wanting to know how to build robots, interested in robotics, or an advanced electronics project.

Request Access

Project Info

Skills

  • Arduino
  • Eagle
  • Electronics
  • Matlab
  • Mechanical
  • Robotics
  • Overall

Meet The Makers

Join Team
  • Tree
    • User:Tree
    • Rank:Master Apprentice
    • Projects:7
    • Joined:2016

No Comments yet. Why don't you add one?

.

.Instructions

  Follow all steps carefully and technically

.1. Mechanical designing

Building the servo mount bracket

The servo mount bracket is made from a sheet of 2mm aluminium (I sourced a 500mm x 500mm sheet from elfa.se in Sweden, however you should be able to get similar sizes from your local hardware store). Since you will need 5 of these brackets it is a good idea to build a template and a jig to help making them easier and more consistent.

All of the parts of the robot arm are made using very similar techniques so, for this first bracket, I will show as much detail as possible for the construction.

To make the template I used a 60mm x 1000mm x 4mm aluminium bar which was cut using a mitre-saw to ensure it has a square edge. The bracket template is then printed out and cut to size using a sharp hobby knife and a metal ruler.

To line up the template on the material I first put a small amount of paper glue on the back of the template (the paper glue common for crafts is perfect such as Pritstick). This allows you to line up the edge of the template with the aluminium without it moving around too much. Once lined-up the template is then held in place by wrapping strips of sticky-tape over the template until it is completely covered:

Servo mount template positioned aluminium ready for drilling

Once prepared you then dot-punch the template at each of the marked punch points. This makes it a lot easier to drill the template accurately as without the dot-punch marks the drill tip will slip on the surface of the aluminium.

The idea of the template is to allow you to both drill through and dot-punch through (for the fold-lines) so you need to make sure that the drill-size is wide-enough for your dot-punch to go through without being too wide and making the template inaccurate. I used a 2.5mm drill bit.

Once the template is drilled you will then need to make a simple jig out of scrap wood to hold the template in place. To make the jig simply line up 4 pieces of wood around the template and fix in place using some wood screws. You will want to leave some small gaps around the jig to allow you to get the drill in place when using the template:

Servo mount bracket jig

Now that you have the jig and template you simply have to cut a piece of 2mm thick aluminium to size (I used a combination of the mitre saw, jigsaw and file to do this). Place the aluminium in the jig with the template on top and start by dot-punching the markers and fold-lines shown on the template. After that use a bench drill to drill the guide holes for the rest of the bracket.

Now take the aluminium out of the jig and drill the guide holes to the correct size as shown in the CAD drawing. When drilling thin aluminium you will find that the underside of the drill holes can burr quite a lot. To remove the unwanted burring you can either use a de-burring bit or you can use a drill-bit which is much larger than the original hole (for example an 8-10 mm drill bit for the 3 mm holes).

To make the folding easier I also used a square ruler to mark the fold-lines according to the dot-punched lines:

The servo mount bracket before folding

Before folding the aluminium you will first need to saw the two lines at the top of the bracket. Saw them down to the dot-punched marks. To fold the bracket place it into a vice (a wood-working vice works best as it doesn't mark the surface of the bracket as much as a metal vice):

Servo mount ready for bending

Line up the fold-line and then place a piece of wood over the bracket. Fold it back by pressing on the wood. This helps to keep the pressure even over the bracket and bend it without warping the shape. You can use the edges of the wood to bend back the smaller parts in a similar manner.

Once you have finished bending the bracket use the template and a ruler to mark a cut line across the front of the bracket and then saw off the unwanted material:

The servo mount after bending

With the bracket all cut and ready it's a good idea to go over the bracket with a file and smooth out any sharp or rough edges. If you want to remove any nicks or scratches from the surface of the bracket you can rub over the bracket using fairly course wire-wool. This gives the bracket a nice 'brushed' finish. The final bracket should look similar to the following:

The finished servo mount bracket

Building the C-bracket

The C-bracket is made in an almost identical manner to the servo mount bracket. Here I used 25mm x 1000 mm x 2mm aluminium bars for both the template and the brackets themselves. Just like the servo mount bracket you first cut the aluminium to size and then glue and sticky-tape the CAD template over the top. Dot-punch the material and then drill the template with 2.5mm holes (or the best size for your dot-punch to go through). The finished template and jig should look similar to the following:

C Bracket template and jig

Once the bracket is drilled in the jig take out the part and re-drill the holes to the correct sizes as shown in the CAD drawings. Take care when bending the bracket to make sure you bend each on in the same manner. You will need to make at least three of these brackets for the robot arm:

Finished C brackets

Building the turntable

As the robot arm is relatively heavy the bottom servo needs plenty of support in order to rotate the arm smoothly. To achieve this the arm is mounted on a turntable which is supported by four casters that relieve the servo of the weight placed laterally across the servo which, unsupported, could easily twist the servo apart and damage it. The base of the turntable is made in a similar manner to the brackets. The printed CAD template is placed over the sheet of aluminium and held in place using sticky-tape. The cut and drill pattern is then dot-punched into the material. Once the paper is removed use a steel ruler to mark out the cut-lines:

Turntable base uncut

The resulting shape is then cut from aluminium using a jigsaw and then filed into shape. Note the rectangular pattern in the centre of the part. This is a drill pattern for cutting out the aluminium so that the servo can be fitted through. This part is drilled and then cut out with a Dremel before being filed into shape so that the servo fits easily in the slot.To support the upper rotating part of the turntable there are four small furniture casters placed around the outside of the part. The casters are 30x17mm with 15x14mm rollers. These are pretty common items and can be purchased from most big hardware stores. The casters are attached to the base using M4 screws and nuts.Once the servo and casters are mounted the lower turntable should look like the following picture:

The completed turntable base

The turntable base is then attached to four pieces of aluminium cut from a 40mm x 1000mm x 2.5mm bar. Again the dimensions and drill pattern is included in the CAD drawings.

Assembling the robot arm

To begin assembling the arm mechanism start by bolting all the servos in place using M3 screws and nuts. As the arm requires a lot of torque to deal with the weight of the arm I used metal gear high-torque servos. The lower 5 servos (turntable, shoulder (x2) elbow and wrist) are SAVÖX SC-0252MG servos which produce 10.5kg/cm of torque at 6 Volts. The wrist-rotate servo is a Fubata S3003 standard servos which produce about 3.5kg/cm. All of the servos (except the wrist rotate) are metal-gear and dual-metal bearing to ensure that they are physically strong since the arm will place a lot of pressure on them. Once mounted in the servo brackets the servos are then connected to the C brackets. On one side the servo head is mounted using the cross shaped servo head provided with the servo. These are cut to size and then screwed/bolted in place. On the other side of the bracket a flanged bearing is fitted to the 8mm hole which is then bolted through the bracket using an M3 screw and a nylon nut to prevent the rotation from unscrewing the nut (note that the flange of the bearing is on the outside of the C bracket). If the M3 screw is a little long you can use 2-3 M3 washers on the outside of the bracket to make sure it does not dig into the back of the servo.The bearings have an inner diameter of 4mm, and outer diameter of 8mm and are 3mm thick. The bearings are flanged meaning that they have a small metal lip on one side which prevents them from being pushed through the bracket. This type of bearing is quite common in remote control car models and can be purchased either from a model shop or from sites such as Ebay. There are 4 bearings in all, 3 in the arm and one in the end-effector (see below).

Mounted servo

Once you have mounted the servo brackets to the C brackets it is a simple case of bolting together C brackets (as shown in the picture below) and the smaller L brackets to form the arm itself. The L brackets fit under the servo brackets and are secured using four M3 screws and nuts.

Two C brackets bolted together

Building the end-effector

The end-effector design is based around two counter rotating gears which use levers to make the grippers open and close laterally rather than using a pincer-action. This allows the design to use relatively small parts but still achieve a open aperture of about 65mm to allow the arm to pick up quite wide objects. The biggest issue I found when making the effector was the gears. It is quite hard to find suitable gears which are easily sourced and not too large. In the end I decided to use 20mm Lego Technics gears which can be found easily in any toy store. The first step is to drill two 3mm holes on either side of the Lego part. The gears I used had two handily placed mold markings which I dot-punched (very lightly!) and then drilled. Once the part is drilled you will need to file down either side of the gear to make it flush with the outer hub of the gear. To do this simply rub the gear up and down on a flat-file (I found this was easier as gripping the gear in a vice is likely to damage the teeth as the Lego plastic is quite soft). Once the part is filed flat you can then use some small side cutters to remove the inner hub of the part. This has to be removed to allow the gear to be mounted to the end-effector in a later step). Next, to mount the Lego gear to the servo and the second gear mount, you will need to drill two servo heads to fit the Lego parts. These are later bolted to the Lego part as you assemble the end-effector.

Drilled Lego gears

To build the end-effector you will need to print out the CAD template for the parts and cut the parts from aluminium. For the parts I used a 60mm x 1000mm x 4mm aluminium bar and cut the pieces using a combination of mitre-saw, jigsaw and a file to shape the pieces. Once the pieces are cut print out the CAD template and sticky-tape them to the parts (in the same way as making the brackets). The parts are then dot-punched and drilled. Note that, when cutting the smaller parts, having everything perfectly square is not terribly important; as long as you dot-punch and drill according to the CAD diagrams the holes will be the right distance apart and the mechanism will work. Start by cutting the servo mounting bracket. For the servo I have used a DGServo S05NF which is small and light, but still metal geared and high-torque. The servo is attached to the bracket using 2 M3 screws and nuts:

End-effector servo mount

Next cut the upper bracket. This bracket should have a flanged bearing pushed through the lower-side and two M3 screws. Each screw requires 3 nuts which act as spacers to rise the bracket from the servo mount:

End-effector upper bracket

Now assemble the servo head. This consists of the Lego gear, one of the servo heads drilled earlier and a long lever part:

End-effector servo head

Next up is the other gear and lever. This part is similar to the servo gear however it has a long M3 screw bolted though to act as the pivot. To stop this slipping around in the bearing (the bearing has an inner diameter of 4mm and the M3 screw is 3mm) there is a small slip placed over the screw 3mm long. I made the slip out of some parts which came with one of the servos, however any 4mm slip will do:

End-effector pivot gear

Now attach the pivot gear to the upper bracket using a nylon nut then attach the upper bracket to the servo mount using a further 2 M3 nuts:

End-effector bracket assembly

Now assemble the two short levers, the servo gear and the gripping arms as shown in the following picture. Note that I have added two heat-shrink tubes to the gripping arms to increase the grip a little, these are simply cut and then heated into place. Use nylon nuts on the pivot points, tighten them up completely and then turn the screw back a quarter/half turn so that the parts can freely move over each other:

End-effector arm assembly

To finish the end-effector connect the upper levers to the lower levers. Since there is a gap in between the two you can use 5 or so washers to create a spacer (see the picture below). Once this is complete attach the short L-bracket to the back of the assembly:

Finished end-effector

Now you can attach the end-effector to the arm. Don't forget to screw it in place to the wrist-rotate servo. The bracket is raised just enough so you can get a screw driver into the servo head.

.2. Electronics

  • To keep the electronics as simple as possible to build I designed the control circuit based on an Arduino UNO.
  • The UNO board has an ATmega328 AVR microcontroller with built-in USB. This allows you to build a fully USB capable device without the hassle of soldering surface-mount components.
  • Since I wanted to supply 6Vs to the servos (to get the maximum torque) the custom 'shield' simply supplies Vin to the servos.
  • The issue with hobby servos (especially high torque servos) is that, under load, the current consumption can be pretty high. Most tests performed on the web conclude that the peak draw is around 400mA per servo.
  • Allowing for a little head-room (i.e. 500mA per servo) and the fact we have 6 servos, the power supply needs to be rated at over 3 Amps in order to do the job.
  • I sourced a regulated 6-15V PSU from a local electronics store which can supply 5 Amps at 6 Volts, more than enough for the job. This supply is directly connected to the UNO power connector. It's a good idea to pick a PSU with both overload and short protection, as this will help save your electronics if (when) you make a mistake.
  • To make the shield as generic as possible I placed 7 servo output connectors on the board (one for each PWM output on the UNO). This means that you could use the shield design for any project requiring 1 to 7 servos. The schematic for the servo control shield is attached in project files. I used 7 servos compatible board because my plan is to use it with full humanoid Robot (under construction).

  • All files were attached in project files.

  • Here is a picture of the shield connected to 7 test servos during software development:

.3. Working principle

    The servo motor has some control circuits and a potentiometer (a variable resistor) that is     connected to the central axis of the servo motor. In the figure it can be seen on the right side of the circuit. This potentiometer allows the control circuitry, monitor the current angle of the servo motor. If the shaft is at the correct angle, then the engine is off. If the circuit checks that the angle is not correct, the motor will turn in the right direction until the correct angle. The shaft of the servo is capable of reaching around 180 degrees. Normally, in some reaches 210 degrees, but it varies by manufacturer. A normal servo is used to control an angular motion of between 0 and 180. The animated image show the working principle of robotic hand :

I opened one of my servo for you to show its internal structure physically

.4. Computer Software designing (Matlab based)

Open the Simulink model of the robot arm.

open_system('rct_robotarm')

The controller consists of four PID controllers (one per joint). Each PID controller is implemented using the "2-DOF PID Controller" block from the Simulink library (see PID Tuning for Setpoint Tracking vs. Disturbance Rejection example for motivation).

Typically, such multi-loop controllers are tuned sequentially by tuning one PID loop at a time and cycling through the loops until the overall behavior is satisfactory. This process can be time consuming and is not guaranteed to converge to the best overall tuning. Alternatively, you can use systune or looptune to jointly tune all four PID loops subject to system-level requirements such as response time and minimum cross-coupling.

In this example, the arm must move to a particular configuration in about 1 second with smooth angular motion at each joint. The arm starts in a fully extended vertical position with all joint angles at zero. The end configuration is specified by the angular positions: Turntable = 60 deg, Bicep = -10 deg, Forearm = 60 deg, Wrist = 90 deg. The angular trajectories for the original PID settings are shown below. Clearly the response is too sluggish and the forearm is wobbling.

Linearizing the Plant

The robot arm dynamics are nonlinear. To understand whether the arm can be controlled with one set of PID gains, linearize the plant at various points (snapshot times) along the trajectory of interest. Here "plant" refers to the dynamics between the control signals (outputs of PID blocks) and the measurement signals (output of "Robot Arm" block).

SnapshotTimes = 0:1:5; % Plant is from PID outputs to Robot Arm outputs LinIOs = [... linio('rct_robotarm/Controller/TurntablePID',1,'openinput'),... linio('rct_robotarm/Controller/BicepPID',1,'openinput'),... linio('rct_robotarm/Controller/ForearmPID',1,'openinput'),... linio('rct_robotarm/Controller/WristPID',1,'openinput'),... linio('rct_robotarm/Robot Arm',1,'output')]; LinOpt = linearizeOptions('SampleTime',0); % seek continuous-time model G = linearize('rct_robotarm',LinIOs,SnapshotTimes,LinOpt); size(G) 6x1 array of state-space models. Each model has 4 outputs, 4 inputs, and between 0 and 13 states.

The robot arm model linearizes to zero at t=0 due to the Bicep and Forearm joints hitting their mechanical limits:

getPeakGain(G(:,:,1)) Plot the gap between the linearized models at t=1,2,3,4 seconds and the final model at t=5 seconds. G5 = G(:,:,end); % t=5 G5.SamplingGrid = []; sigma(G5,G(:,:,2:5)-G5,{1e-3,1e3}), grid title('Variation of linearized dynamics along trajectory') legend('Linearization at t=5 s','Absolute variation',... 'location','SouthWest')

While the dynamics vary significantly at low and high frequency, the variation drops to less than 10% near 10 rad/s, which is roughly the desired control bandwidth. Small plant variations near the target gain crossover frequency suggest that we can control the arm with a single set of PID gains and need not resort to gain scheduling.

Tuning the PID Controllers with LOOPTUNE

With looptune, you can directly tune all four PID loops to achieve the desired response time with minimal loop interaction and adequate MIMO stability margins. The controller is tuned in continuous time and automatically discretized when writing the PID gains back to Simulink. Use the slTuner interface to specify which blocks must be tuned and to locate the plant/controller boundary.

% Linearize the plant at t=3s tLinearize = 3; % Create slTuner interface TunedBlocks = {'TurntablePID','BicepPID','ForearmPID','WristPID'}; ST0 = slTuner('rct_robotarm',TunedBlocks,tLinearize); % Mark outputs of PID blocks as plant inputs addPoint(ST0,TunedBlocks) % Mark joint angles as plant outputs addPoint(ST0,'Robot Arm')

In its simplest use, looptune only needs to know the target control bandwidth, which should be at least twice the reciprocal of the desired response time. Here the desired response time is 1 second so try a target bandwidth of 5 rad/s (bearing in mind that the plant dynamics vary least near 10 rad/s).

wc = 5; % target gain crossover frequency Controls = TunedBlocks; % actuator commands Measurements = 'Robot Arm'; % joint angle measurements ST1 = looptune(ST0,Controls,Measurements,wc); Final: Peak gain = 1, Iterations = 50 Achieved target gain value TargetGain=1.

A final value near or below 1 indicates that looptune achieved the requested bandwidth. Compare the responses to a step command in angular position for the initial and tuned controllers.

RefSignals = {'tREF','bREF','fREF','wREF'}; T0 = getIOTransfer(ST0,RefSignals,'Robot Arm'); T1 = getIOTransfer(ST1,RefSignals,'Robot Arm'); opt = timeoptions; opt.IOGrouping = 'all'; opt.Grid = 'on'; stepplot(T0,'b--',T1,'r',4,opt) legend('Initial','Tuned','location','SouthEast')

The four curves settling near y=1 represent the step responses of each joint, and the curves settling near y=0 represent the cross-coupling terms. The tuned controller is a clear improvement but should ideally settle faster with less overshoot.

Exploiting the Second Degree of Freedom

The 2-DOF PID controllers have a feedforward and a feedback component.

The graph appears as:

Validating the Tuned Controller

The tuned linear responses look satisfactory so write the tuned values of the PID gains back to the Simulink blocks and simulate the overall maneuver. The simulation results appear as:

writeBlockValue(ST2)

The responses look good except for the Bicep joint whose response is somewhat sluggish and jerky. It is tempting to blame this discrepancy on nonlinear effects, but this is in fact due to cross-coupling effects between the Forearm and Bicep joints. To see this, plot the step response of these two joints for the actual step changes occurring during the maneuver (-10 deg for the Bicep joint and 60 deg for the Forearm joint).

H2 = T2(2:3,2:3) * diag([-10 60]); % scale by step amplitude H2.u = {'Bicep','Forearm'}; H2.y = {'Bicep','Forearm'}; step(H2,5), grid

When brought to scale, the first row of plots show that a 60-degree step change in Forearm position has a sizeable and lasting impact on the Bicep position. This explains the sluggish Bicep response observed when simultaneously moving all four joints.

Refining The Design

To improve the Bicep response for this specific arm maneuver, we must keep the cross-couplings effects small relative to the final angular displacements in each joint. To do this, scale the cross-coupling terms in the tracking requirement by the reference angle amplitudes.

JointDisp = [60 10 60 90]; % commanded angular displacements, in degrees TR.InputScaling = JointDisp;

To prevent jerky transients and avoid overloading the motors, limit the control bandwidth by imposing -20 dB/decade roll-off past 20 rad/s.

s = tf('s'); RO = TuningGoal.Gain(RefSignals,'Robot Arm',20/s);

Finally, explicitly limit the overshoot to 5% and increase the desired phase margin from its default value of 45 degrees to 60 degrees.

OS = TuningGoal.Overshoot(RefSignals,'Robot Arm',5); Options = looptuneOptions('PhaseMargin',60);

Retune the controller with the additional requirements in force

ST3 = looptune(ST0,Controls,Measurements,TR,RO,OS,Options); Final: Peak gain = 1.06, Iterations = 98

Compare the scaled responses with the previous design. Notice the significant reduction of the coupling between Forearm/Wrist and Bicep motion, both in peak value and total energy.

T2s = diag(1./JointDisp) * T2 * diag(JointDisp); T3s = diag(1./JointDisp) * getIOTransfer(ST3,RefSignals,'Robot Arm') * diag(JointDisp); stepplot(T2s,'g--',T3s,'m',4,opt) legend('Initial 2-DOF','Refined 2-DOF','location','SouthEast')

Push the retuned values to Simulink for further validation.

writeBlockValue(ST3)

The simulation results appear in Figure 6. The Bicep response is now on par with the other joints in terms of settling time and smooth transient.

.5. Arduino coding

  1. Download the latest version of Arduino from https://www.arduino.cc/en/Main/Software
  2. For installation process you need to follow this link : https://www.arduino.cc/en/Guide/Windows
  3. Now, it’s finally time to open up the Arduino software. You’ll be presented with a window that looks something like this:

    Arduino IDE annotated

    1. Verify: Compiles and approves your code. It will catch errors in syntax (like missing semicolons or parentheses).
    2. Upload: Sends your code to the 101 board.
    3. New: This buttons opens up a new code window tab.
    4. Open: This button will let you open up an existing sketch.
    5. Save: This saves the currently active sketch.
    6. Serial Monitor: This will open a window that displays any serial information your 101 board is transmitting. It is very useful for debugging.
    7. Sketch Name: This shows the name of the sketch you are currently working on.
    8. Code Area: This is the area where you compose the code for your sketch.
    9. Message Area: This is where the IDE tells you if there were any errors in your code.
    10. Text Console: The text console shows complete error messages. When debugging, the text console is very useful.
    11. Board and Serial Port: Shows you what board and the serial port selections.
  4. Know download the code from project files and then upload it to Arduino UNO (Atmega328).

.6. Review

   Please download a file name check.pdf in project files ,take a print of it and mark tick. (I used this file to help you to check all steps carefully)

.Tools Needed

   A lathe is an example of a machine tool. A machine tool is a machine for shaping or machining metal or other rigid materials, usually by cutting, boring, grinding, shearing, or other forms of deformation. Machine tools employ some sort of tool that does the cutting or shaping.

.1. Mechanical designing Tools

.

  1.   Small Lathe Machine
  2. Driller
  3. CNC Machine

.2. Electronics designing Tools

You need a lab setup for proper electronics designing but as this project is not so big so you need some place for soldering purpose.

.

.

  Details Downloads Size Get it

Mechanical diagram of Robot_Arm

Last updated on 08/02/2016

by Tree

408 527.1kb

Schematic

Last updated on 08/02/2016

by Tree

464 784.9kb

PCB

Last updated on 08/02/2016

by Tree

350 111.9kb

Checker

Last updated on 08/02/2016

by Tree

409 179.1kb

Mechanical CAD drawings

Last updated on 08/02/2016

by Tree

336 36.6kb

Robot_Arm_code

Last updated on 08/02/2016

by Tree

345 4.6kb

Matlab_Code

Last updated on 08/03/2016

by Tree

342 24.3kb
Qty   Item Where to Find Est. Cost More Info
60 LM35 Temperature Sensor Item Number: TI LM35

LM35 Temperature Sensor

Item #: TI LM35

High accuracy solid state

$2.69 2 files  
 
Pinout

Pinout

Updated 12/05/2016 by swym_admin
Datasheet

Datasheet

Updated 12/05/2016 by swym_admin
60 Humidity Sensor  Item Number: DHT11

Humidity Sensor

Item #: DHT11

1,Supply Voltage: +5 V 2,

$6 1 file  
 
dht11 datasheet

dht11 datasheet

Updated 10/28/2016 by jamesshawver1
3 Soil sensor

Soil sensor

$1.03 1 file  
 
Datasheet

Datasheet

Updated 12/22/2016 by swym_admin
4 4 channel Relay

4 channel Relay

$7.69
1 LDR

LDR

$7
1 GT2 UNITTA belt 1164mm length 6mm wide

GT2 UNITTA belt 1164mm length 6mm wide

Product Features 5 Meters

$8.32
7 GT2 20 tooth Timing Pulleys

GT2 20 tooth Timing Pulleys

The GT2 x 20 Tooth timing

$9.94
7 traxxas 5347 Traxxas Rod Ends (Large) with Hollow Balls

traxxas 5347 Traxxas Rod Ends (Large) with Hollow Balls

$9.00
1 Arduino Uno

Arduino Uno

$16.06 3 links