Robotic Arm¶

Description¶
The robotic arm is a mechanical device that is programmed to move by using hydraulic systems made up of regular medical syringes.
Learning Objectives¶
The Robotic is a project that helps students learn and apply the following:
- Volume and area
- Fundamentals of hydraulics
- The implementation of the engineering design process
- Application of theoretical concepts to real life situations
- Coding, electronics, and physical science through a hands-on application that can be directly related to real life situations
Materials Needed¶
- Raspberry pi with micro SD card and Raspbian
- Jumper wires
- Breadboard
- 4x L293D (H-Bridge)
- 4x 9v Battery
- 2x Resistors
- 7x DC-GearMotors
Setup and Functionality¶
The basic concept of the hydraulics:

While one syringe is filled with water and connected to another empty syringe, if pressure is applied, the empty syringe would start to receive the water.
The above process is illustrated in the figure below:

A DC motor with rotational movement is used to transform it into linear movement to apply the pressure on the syringe. As the crank rotates, the link favors the movement of the slider in a linear path.

For the syringes pistons to be pushed in or out of the syringe, a screw turns in the bolt. This will cause the piston to be pushed in or out of the syringe. Pictures below:

The screw is attached to the axis of a 6V gear motor. This is clear in the image below.


The body of the arm is made up of Plexiglas. However, it could be made of any other rigid material like hard cardboard or thin plywood.

Two screws with two bolts were used with two motors on each syringe to ensure efficiency.
Circuitry and Electronics:¶
The second diagram below shows the connections and the circuitry of the ultrasonic sensor that controls the movement of the syringe at its limit points:

Programming¶
Due to the large number of python code files, they were uploaded separately in the folder of this documentation. Thinking about how to control the arm, old Wii Remote control is used. There is an online support availavle; cwiid- a python package for using Wii Remote with Raspberry Pi. The accelerometer on the remote unit was used to control the wheels of the robot.

import RPi.GPIO as io
import time
import cwiid # Wii Remote library to control the robot
#m1, m2 --> arm1
#m3, m4 --> arm2
#m5, m6 --> wheels
#m7 --> claw
#declaring the gpio pins of the motors
m1_e = 3
m1_a = 5
m1_b = 7
m2_e = 8
m2_a = 10
m2_b = 12
m3_e = 11
m3_a = 13
m3_b = 15
m4_e = 16
m4_a = 18
m4_b = 22
m5_e = 19
m5_a = 21
m5_b = 23
m6_e = 29
m6_a = 31
m6_b = 33
m7_e = 40
m7_a = 38
m7_b = 36
io.setmode(io.BOARD)
#setting up the gpio pins of the motors
io.setup(m1_e, io.OUT)
io.setup(m1_a, io.OUT)
io.setup(m1_b, io.OUT)
io.setup(m2_e, io.OUT)
io.setup(m2_a, io.OUT)
io.setup(m2_b, io.OUT)
io.setup(m3_e, io.OUT)
io.setup(m3_a, io.OUT)
io.setup(m3_b, io.OUT)
io.setup(m4_e, io.OUT)
io.setup(m4_a, io.OUT)
io.setup(m4_b, io.OUT)
io.setup(m5_e, io.OUT)
io.setup(m5_a, io.OUT)
io.setup(m5_b, io.OUT)
io.setup(m6_e, io.OUT)
io.setup(m6_a, io.OUT)
io.setup(m6_b, io.OUT)
io.setup(m7_e, io.OUT)
io.setup(m7_a, io.OUT)
io.setup(m7_b, io.OUT)
def m1_forward():
io.output(m1_e, True
io.output(m1_a, True)
io.output(m1_b, False)
def m1_backward():
io.output(m1_e, True)
io.output(m1_a, False)
io.output(m1_b, True)
def m1_stop():
io.output(m1_e, False)
def m2_forward():
io.output(m2_e, True)
io.output(m2_a, True)
io.output(m2_b, False)
def m2_backward():
io.output(m2_e, True)
io.output(m2_a, False)
io.output(m2_b, True)
def m2_stop():
io.output(m2_e, False)
def m3_forward():
io.output(m3_e, True)
io.output(m3_a, True)
io.output(m3_b, False)
def m3_backward():
io.output(m3_e, True)
io.output(m3_a, False)
io.output(m3_b, True)
def m3_stop():
io.output(m3_e, False)
def m4_forward():
io.output(m4_e, True)
io.output(m4_a, True)
io.output(m4_b, False)
def m4_backward():
io.output(m4_e, True)
io.output(m4_a, False)
io.output(m4_b, True)
def m4_stop():
io.output(m4_e, False)
def m5_forward():
io.output(m5_e, True)
io.output(m5_a, True)
io.output(m5_b, False)
def m5_backward():
io.output(m5_e, True)
io.output(m5_a, False)
io.output(m5_b, True)
def m5_stop():
io.output(m5_e, False)
def m6_forward():
io.output(m6_e, True)
io.output(m6_a, True)
io.output(m6_b, False)
def m6_backward():
io.output(m6_e, True)
io.output(m6_a, False)
io.output(m6_b, True)
def m6_stop():
io.output(m6_e, False)
def m7_forward():
io.output(m7_e, True)
io.output(m7_a, True)
io.output(m7_b, False)
def m7_backward():
io.output(m7_e, True)
io.output(m7_a, False)
io.output(m7_b, True)
def m7_stop():
io.output(m7_e, False)
button_delay = 0.1 # used for the sleep function between each reading from the wii remote
print 'Press 1 + 2 on your Wii Remote now ...'
time.sleep(1)
# Connect to the Wii Remote. If it times out
# then quit.
try:
wii = cwiid.Wiimote()
except RuntimeError:
print "Error opening wiimote connection"
quit()
print 'Wii Remote connected...\n'
print 'Press some buttons!\n'
print 'Press PLUS and MINUS together to disconnect and quit.\n'
wii.rpt_mode = cwiid.RPT_BTN
while True:
buttons = wii.state['buttons'] # get the state of the buttons
# If Plus and Minus buttons pressed
# together then rumble and quit.
if (buttons - cwiid.BTN_PLUS - cwiid.BTN_MINUS == 0):
print '\nClosing connection ...'
wii.rumble = 1
time.sleep(1)
wii.rumble = 0
exit(wii)
if (buttons & cwiid.BTN_LEFT): # if left button is pressed -> motor1 moves forward
print 'Left pressed'
m1_forward()
time.sleep(button_delay)
if (buttons & cwiid.BTN_RIGHT): # if right button is pressed -> motor1 moves backwards
print 'Right pressed'
m1_backward()
time.sleep(button_delay)
if (buttons & cwiid.BTN_UP): # if up button is pressed -> motor2 moves forward
print 'Up pressed'
m2_forward()
time.sleep(button_delay)
if (buttons & cwiid.BTN_DOWN): # if down button is pressed -> motor2 moves backwards
print 'Down pressed'
m2_backward()
time.sleep(button_delay)
if (buttons & cwiid.BTN_1): # if button 1 is pressed -> motor4 moves forward
print 'Button 1 pressed'
m4_forward()
time.sleep(button_delay)
if (buttons & cwiid.BTN_2): # if button 2 is pressed -> motor4 moves backwards
print 'Button 2 pressed'
m4_backward()
time.sleep(button_delay)
if (buttons & cwiid.BTN_PLUS): # if (+) button is pressed -> motor3 moves forward
print 'Plus Button pressed'
m3_forward()
time.sleep(button_delay)
if (buttons & cwiid.BTN_MINUS): # if (-) button is pressed -> motor3 moves backwards
print 'Minus Button pressed'
m3_backward()
time.sleep(button_delay)
if (buttons & cwiid.BTN_A): # if button A is pressed -> motor5 and motor6 moves forward
print 'Button A pressed'
m5_forward()
m6_forward()
time.sleep(button_delay)
if (buttons & cwiid.BTN_B): # if button B is pressed -> motor5 and motor6 moves backwards
print 'Button B pressed'
m5_backward()
m6_backward()
time.sleep(button_delay)
if (not buttons): # if there are no buttons pressed -> turn off all motors
m1_stop()
m2_stop()
m3_stop()
m4_stop()
m5_stop()
m6_stop()
io.cleanup()
Science Concepts and Skills¶
A Hydraulic pressure system was in this project to make it move like a real creature.
Blaise Pascal and Daniel Bernoulli were two physicists that came out with of hydraulics principles which are still used in today’s technology.
Pascal’s law states “pressure in a liquid is transmitted equally in all directions” that is the application of pressure at any point will be transmitted equally to all sides of the container. In the hydraulic press, which is an example of a syringe, Pascal’s law is used to create a pressure on a liquid that will be transmitted to another syringe if connected through a plastic tube. The pressure will be equal throughout the system.
In the robotic arm application, the same concept is applied when the pressure exerted on one syringe is transmitted to another syringe as they are connected with a tube and all the system is filled with water. The work applied on one side of the syringes is transmitted to the other syringe causing the arm to move, rotate, and the clamp to open and close.
Pressure can be calculated using the formula:
P = F/A
Where:
P is pressure in Pascal
F is the force applied in Newton
A is the surface are where the force is applied
The robotic arm application is programmed to operate on a Raspberry Pi where motors are used to control the movement of the pistons of the syringes. You can refer to the video tutorial below to learn more about hydraulics.
Flex your brain! How can you apply this concept to real life situations to design car brakes?