design and control of compact legged- wheeled robot spicar · developed – term “spicar” is...
TRANSCRIPT
pg. i Zeeshan Ansari (s09466807)
BEng (Hons) Electronic Engineering
Faculty of Computing, Engineering and the Built Environment
School of Engineering and Built Environment
Student Number: s09466807
Submission Date:
Supervisor:
Design and control of compact legged-
wheeled robot "Spicar"
May / 2017
Dr Mohamed Kara-Mohamed
pg. ii Zeeshan Ansari (s09466807)
pg. iii Zeeshan Ansari (s09466807)
Acknowledgements
I wish to express my sincere gratitude to Dr Mohamed Kara Mohamed for his
unflinching encouragement, support and guidance during this project. Very special
thanks to Sir Alan Pendry whose lectures and support on “Project Management” led
me to the completion of this project.
Also special thanks to senior demonstrator Mr Chris Evans for his good help
with Legs 3D printing and other hardware assembly. Also would senior demonstrator
Mr Ishver Patel for his valuable help with the technical details and problem solving of
the Spicar robot’s wheels and axles. Special thanks to all classmates, indeed.
I would dearly like to thank my Dear Parents who were always a pillar of support
throughout my education and all my respected tutors especially Sir Jagjit Sehra, Sir
Gurvinder Dubb and Dr Tony Wilcox for all their support throughout this degree. I
would also like to extend my very special thanks to Syeda F.Z and Mr. M Ejaz
Mughal for motivation and moral support.
pg. iv Zeeshan Ansari (s09466807)
Abstract
In the past, robots were usually raised on a fixed platform and locomotion was
not required. But in the last two decades their transition from fixed to mobile robots
has extended their operations to open air spaces and busy hubs like airports,
hospitals, shopping malls, metro stations etc. These are called field and service
robots. Robots that use both legs and wheels for locomotion are called hybrid. A
hybrid robot can switch between different modes of locomotion namely walking with
legs, rolling on wheels and “rolking” which means using wheels and legs
simultaneously.
This project has targeted at creating a hybrid robot possessing a six-legged
walking system and a four-wheeled locomotion system.
Out of many walking machines, hexapod with 12 DOF (degree of
freedom) is chosen to perform legged locomotion as it offers best stability
on uncertain surfaces. Operations include walking forward, backward,
right and left turn.
For rolling locomotion, four wheels are added under the chassis. This
locomotion would perform forward and backward rolling.
This project has developed a generalised legged-wheeled robotic platform that
can manually be switched between legs’ and wheels’ mode. It fully demonstrates
walling and rolling locomotion.
In future this platform can be modified and programmed to an autonomous
robot to perform increasingly complex motions and functions. Typical applications
include Search & Rescue, reconnaissance, extra-terrestrial explorations etc.
pg. 1 Zeeshan Ansari (s09466807)
Table of Contents
1 Introduction ........................................................................................................ 6
1.1 Scope of the project ...................................................................................... 6
1.2 Rationale ....................................................................................................... 7
1.3 Motivation ...................................................................................................... 8
1.4 Aim and objectives ........................................................................................ 8
2 Review of existing knowledge ........................................................................ 10
2.1 Background ................................................................................................. 10
2.2 Locomotion systems ................................................................................... 13
2.2.1 Walking locomotion: ............................................................................. 14
2.2.2 Rolling locomotion: ............................................................................... 14
2.2.3 Hybrid locomotion: ............................................................................... 15
3 Project Specification ........................................................................................ 16
3.1 Non-functional Requirements ...................................................................... 16
3.1.1 Product Requirements ......................................................................... 16
3.1.2 Organisational Requirements............................................................... 16
3.1.3 External Requirements ........................................................................ 17
3.2 Functional Requirements ............................................................................ 17
3.2.1 Category 1 ........................................................................................... 17
3.2.2 Category 2 ........................................................................................... 17
4 Design Considerations .................................................................................... 18
4.1 Gait planning ............................................................................................... 19
4.2 Spicar Robot Control ................................................................................... 19
4.3 Spicar Design Flowchart ............................................................................. 21
5 Hardware and Software ................................................................................... 23
5.1 Hardware .................................................................................................... 23
5.1.1 Robot Chassis ...................................................................................... 23
pg. 2 Zeeshan Ansari (s09466807)
5.1.2 Micro-controller .................................................................................... 27
5.1.3 Servos .................................................................................................. 30
5.1.4 DC motors ............................................................................................ 34
5.1.5 Power Source ...................................................................................... 35
5.2 Software ...................................................................................................... 38
6 Methodology ..................................................................................................... 39
6.1 Software and Spiral methodologies............................................................. 39
6.2 Waterfall ...................................................................................................... 39
6.3 Chosen methodology .................................................................................. 40
6.3.1 Methodology Flowchart ........................................................................ 41
7 Project Planning – Gantt chart ........................................................................ 43
7.1 Main milestones of the project .................................................................... 43
7.2 Deliverables of the project ........................................................................... 44
7.3 Safety Assessment ..................................................................................... 45
7.4 Ethical Considerations ................................................................................ 45
8 Spicar Control .................................................................................................. 46
8.1 PWM Signal Generation .............................................................................. 46
8.2 Controlling the Servos and DC motors ........................................................ 46
8.3 Spicar Open-Loop Control .......................................................................... 48
8.3.1 Programme Flow chart ......................................................................... 48
8.4 Dagu Spider Robot controller ...................................................................... 49
9 Hardware Implementation ............................................................................... 50
9.1 Design and Assembly ................................................................................. 50
9.1.1 Legs design.......................................................................................... 51
9.1.2 Spicar Assembly .................................................................................. 56
9.2 Hardware Block Diagram ............................................................................ 57
10 Software Implementation ............................................................................. 58
pg. 3 Zeeshan Ansari (s09466807)
10.1 Walking Locomotion .................................................................................... 58
10.1.1 Inverse and Forward kinematics .......................................................... 58
10.1.2 Spicar Gaits ......................................................................................... 59
10.1.3 Analysis of the Walking Gaits............................................................... 60
10.1.4 Tripod, the Chosen Gait Implementation ............................................. 61
10.2 Rolling Locomotion...................................................................................... 69
11 Testing, Results and Evaluation ................................................................. 72
11.1 Unit Testing ................................................................................................. 72
11.2 Function Testing.......................................................................................... 72
11.3 Evaluation ................................................................................................... 73
11.3.1 Final Functionality ................................................................................ 73
12 Discussion and Conclusion ......................................................................... 74
13 Future Work .................................................................................................. 76
13.1 Autonomous Control ................................................................................... 76
13.1.1 Sensor Configuration ........................................................................... 77
14 References .................................................................................................... 82
15 Bibliography .................................................................................................. 85
16 Appendix A – Walking Locomotion Code ................................................... 86
17 APPENDIX B – Rolling Locomotion Code .................................................. 98
18 APPENDIX C – Hardware Components and Prices .................................. 101
19 APPENDIX D – Project Proposal ............................................................... 102
20 APPENDIX E – Future Work Further Research ........................................ 103
20.1 Sensor Implementation Code: ................................................................... 103
20.2 Research for Further Useful Improvements .............................................. 107
pg. 4 Zeeshan Ansari (s09466807)
List of Figures
Figure 1 Old Spider Robot Projects ........................................................................... 11
Figure 2 Pros and Cons ............................................................................................ 13
Figure 3 Scheme for preliminary layout design of Spicar .......................................... 18
Figure 5 Legs Description & Gates (Tedeschi and Carbone, 2014) .......................... 19
Figure 6 Hierarichal control architecture for Spicar ................................................... 20
Figure 7 Spicar Design Flowchart (Tedeschi and Carbone, 2014) ............................ 22
Figure 8 mBot-Blue Educational Programmable Robot (Bluetooth Version)
(Robotshop.com, 2017) ...................................................................................... 23
Figure 9 LEGO® MINDSTORMS® EV3 (EU Version) (Robotshop.com, 2017) ........ 24
Figure 10 Lynxmotion AH2 Hexapod Robot Kit (BotBoarduino) (Robotshop.com,
2017) .................................................................................................................. 25
Figure 11 DIY Six Feet Robot 6-Legged 6DOF Hexapod4 Spider Robot with Servo
(banggood.com, 2017) ....................................................................................... 26
Figure 12 The Axon II (Societyofrobots.com, 2017) .................................................. 28
Figure 13 Dagu Spider Robot Controller (cdn.sparkfun.com, 2017) .......................... 29
Figure 14 Tower Pro Micro Servo 9g (micropik.com, 2017) ...................................... 30
Figure 15 Servo Motor Block Diagram (Robotplatform.com, 2017) ........................... 31
Figure 16 PWM Process (Daware, 2017). ................................................................. 32
Figure 17 DC Motor (Pololu.com, 2017) .................................................................... 35
Figure 18 NiMH battery structure (Skylightupower.com, 2017) ................................. 35
Figure 19 LiPo battery structure (Skylightupower.com, 2017) ................................... 36
Figure 20 (LiPo) 7.4 V 450 mAh 40 C Conrad energy Stick (produktinfo.conrad.com,
2017) .................................................................................................................. 37
Figure 21 Waterfall Method (Bowes, 2017) ............................................................... 40
Figure 22 Methodology Flowchart ............................................................................. 42
Figure 23 Project Gantt chart .................................................................................... 44
Figure 24 Servo's High Pulse Width determines the Angle Position (Johns, 2017) ... 47
Figure 25 Program Flow chart ................................................................................... 49
Figure 26 Robot parts ................................................................................................ 50
Figure 27 Robot ......................................................................................................... 50
Figure 28 Leg (TIBIA design in Thomas, 2014)
Figure 29 Tibia drawing and 3D print ........................................................................ 52
Figure 30 Leg Brackets ............................................................................................. 53
pg. 5 Zeeshan Ansari (s09466807)
Figure 31 Femur and “Femur Support” ...................................................................... 54
Figure 32 Spicar Base Measurements ...................................................................... 55
Figure 33 Brackets, Wheels / Axle fitting for rolling locomotion ................................. 56
Figure 34 System Integration .................................................................................... 56
Figure 35 Hardware Block Diagram .......................................................................... 57
Figure 36 Wave Gait (Do, 2017). ............................................................................... 59
Figure 37 Tripod Gait (Do, 2017). .............................................................................. 60
Figure 38 Gait Selections (Pairs), (Liang, 2017) ........................................................ 61
Figure 39 Common (Tripod) Gait and Stepping Sequence (McComb, 2017) ............ 62
Figure 40 Legs’ Servos attached to Pins on Microcontroller ..................................... 64
Figure 41 Top View of Spicar .................................................................................... 65
Figure 42 Legs in loop motion ................................................................................... 65
Figure 43 Leg Motion ................................................................................................ 66
Figure 44 Loop of leg1 & leg4 when walking towards right ....................................... 67
Figure 45 Movement of each leg in their loop for Rightwards’ Walking ..................... 68
Figure 46 Forward Logic (APPENDIX B – Rolling Locomotion Code) ....................... 69
Figure 47 Backward Logic (APPENDIX B – Rolling Locomotion Code) .................... 70
Figure 48 Right Turn Logic (APPENDIX B – Rolling Locomotion Code) ................... 71
Figure 49 Left Turn Logic (APPENDIX B – Rolling Locomotion Code) ...................... 71
Figure 50 Autonomous Spicar Closed Loop Feedback Control ................................. 77
Figure 51 Devantech SRF08 UltraSonic Ranger (coecsl.ece.illinois.edu, 2017) ....... 78
Figure 52 Using the I2C Bus, SCL & SDA (Robot-electronics.co.uk, 2017) .............. 80
Figure 53 Start and Stop Sequences (Robot-electronics.co.uk, 2017) ...................... 80
Figure 54 Data Transfer (Robot-electronics.co.uk, 2017) .......................................... 81
pg. 6 Zeeshan Ansari (s09466807)
1 Introduction
A robot can be defined as a machine designed to perform one or more tasks
automatically through interaction with its own brain (called a controller) and the
outside world. Increasing trend of developing autonomous mobile robots is replacing
humans in some of their activities. This is true especially in situations where human
lives are endangered due to the amount of risks attached to them, or because of
significant personal or industrial requirements where human operators should
perform tasks. Therefore, there is a high demand of developing highly robust and
multi-functional robots for different tasks, situations and missions (Jakimovski et al.,
2017).
In this work, design and control of compact legged-wheeled robot “Spicar” is
developed – Term “Spicar” is coined from Spider and car; as it is a hexapod spider
robot to walk with additional features of wheels where it drives like a toy car. “Spi”
and “car” makes the word “Spicar”. Legged and wheeled robots use two different
mechanisms for their operations. Usually, legged robots are slow that make them
more applicable for uncertain territories where wheeled robots are unsuitable. On the
other hand wheeled robots provide best mobility on both even or hard surfaces
because of rolling locomotion, locomotion is the physical ability to move from one
place to another.
An important characteristic that has been introduced within this hybrid robot is
that it is capable of executing both walking and rolling locomotion. Also kinematic
analysis is used to develop the most stable gait for walking the robot and finding out
the location of the robot in the world coordinate frame for mapping and driving it. For
rolling locomotion Proportional Control Strategy is developed for forward and
backward rolling. Product (autonomous hybrid robot) would have many robotic
applications such as Search & Rescue, reconnaissance, extra-terrestrial exploration
etc.
1.1 Scope of the project
Hybrid robots are gaining great amount of recognition due to the characteristics
they offer and their better performance and efficiency over different terrains. This
project has primarily aimed at more generalised legged-wheeled robotic platform that
can manually be switched between legs’ and wheels’ mode. Finally, walking and
rolling locomotion can be modified with sensors and control strategy to an
pg. 7 Zeeshan Ansari (s09466807)
autonomous robot that can demonstrate the combined capability of legs and wheels
with respect to terrain types they operate on. It will automatically switch between
legs’ mode for smooth stroll on even surfaces and wheels’ mode to maximise the
speed on approaching uneven surfaces.
1.2 Rationale
Robots are taking over humans in some of the activities where human life is
endangered or in situations/missions where human operators have become
unavailable to perform tasks. Physical ability to move from one place to another
(locomotion) defines the core operation of robots. Locomotion in even and uneven
terrains is important for wide range of robotic applications including Search& Rescue
operations and extra-terrestrial exploration etc. A robot that can roll over even
terrains to maximise the speed and walk on uneven terrains to surmount obstacles
must be operated by rolling and walking locomotion.
One of the fundamental problems of mobile robotics is locomotion. Three
primary types of locomotion include legged, wheeled and articulated bodies. Factors
that normally effect locomotion are environment, stability, systems complexity and the
cost. Keeping in mind the higher indices of stability, efficiency and increased payload
rolling locomotion is employed in the first place. However rolling locomotion still
prevents its efficient operation on unstructured environments. Despite the significant
effort to overcome the problem of smooth rolling over unstructured terrains wheels
are still far from being perfect for locomotion in all types of environments
(Saudabayev et al., 2017).
Inspired from the nature, walking locomotion offers robust mechanism to tackle
the difficulties of rough terrains. Legs ability of efficient navigation on even terrains
alongside uneven terrains in walking locomotion could have claimed to be a universal
solution for mobile robot locomotion. However, static and dynamic stability is still one
of the major challenges for legged systems. Hybrid robots have emerged offering
combined capabilities of rolling and walking locomotion. With hybrid locomotion, a
robot would be able to maximise the speed on even terrains using wheels and step
over obstacles on uneven terrains using walking locomotion (Saudabayev et al.,
2017).
pg. 8 Zeeshan Ansari (s09466807)
1.3 Motivation
Motivation behind undertaking this project was the development of knowledge
and skills that this project offers for a graduate electronics engineer. Required
knowledge and skills for this project include programming skills, electronics circuit
design, mechanical design, simulation software, mathematical modelling, control
strategy and dynamic knowledge.
Author wanted to get together, all the knowledge and skills gained previously, in
one place to implement using a new platform and develop something that can be
called innovative, while further polishing his skills to a higher level and gaining in-
depth theoretical knowledge. As most of the major modules studied in previous years
are pre-requisites for this project which was also a major reason to choose this
project.
To summarise, this project in its entirety will demonstrate 80% of the knowledge
and skills acquired and yet-to-be acquired until the end of the graduate degree; it is a
massive step into the world of robotics; hardware, locomotion systems and control
strategies. Although it’s a challenging project but hard work and dedication would
provide good practice for prospective electronics engineer.
1.4 Aim and objectives
Aim is to design and control an autonomous robot with compact legged/wheeled
capabilities to maximise the speed of the robot. Robot must have the capacity to
perform two functions; it will switch to wheels’ mode on even surfaces to amplify the
speed and manual/automatic change to legs mode for smooth stroll on drawing
closer to uneven surfaces.
After a research and literature review has been carried out, the following
objectives shall be achieved:
Determine suitable hardware for robot structure; i.e. Microcontroller, legs,
wheels, sensors and so forth.
Mechanical design of legs, wheels and sensors to further assemble the
components into a robot.
Electronic circuit design and configuration of wheels, legs and sensors to
aid performance.
Develop block diagram of system hardware to write program for system
and algorithm(s) (high-level description) of the system software.
pg. 9 Zeeshan Ansari (s09466807)
Derive equations to obtain mathematical model of robot.
Program the microcontroller to implement a suitable control strategy.
Basically implementing manual switch between legged and wheeled
modes.
Finally adding sensors to switch it to autonomous control between two
modes (Optional Objective).
Develop appropriate test plans for circuit simulation and to check the
functionality of the control strategy and robot as a whole.
Evaluate final product as an autonomous robot (Optional Objective).
pg. 10 Zeeshan Ansari (s09466807)
2 Review of existing knowledge
2.1 Background
Robotics is a field of science that develops robots which have hardware and a
software side. Robotics is a technology that amalgamates computer, electronics,
electrical and mechanical engineering. It involves a broad spectrum of activities like
design, construction, application and various operations of robots. It also involves
designing computer systems for sensory feedback, information processing and
control.
This idea of developing machines that can operate independently was present
as early as the classical times and efforts were being made to improve such
machines. But it was not until the twentieth century that research into the potential
uses and functions of robots gained momentum. Scientists have been increasingly
interested in artificial intelligence (AI) as well which is the technology that is trying to
make robots think like humans and make logical decisions when provided with a
difficult situation. Behind it is the thought that robots will one day have the ability to
copy human behaviour and look much like a human in outward appearance. This is
the most inspiring field of robotics today.
Robots are machines that have vast applications in practical life. They can be
used for services in dangerous situations or an emergency that calls for quick action
where situation is life threatening for humans e.g. in diffusing bombs, work in mines,
space exploration, deep sea research for history or search for something like
shipwreck etc. They have numerous applications in assembly lines in factories and
assist in packaging, labelling etc. They reduce the cost of production while increasing
efficiency for the business. Bio-tech or bio-engineering also employs robots. Some
robots are designed from inspiration from nature and life around us, so they are
called bio-inspired robots.
Robotics is fast growing in research and applications. It is being adapted as the
technology of the future. They are being built today for use in commercial
applications, as a household aid, space exploration and military uses.
In the 1950’s, movement of a spider robot was controlled manually by an
operator. The motion of early robots was fed into their system beforehand by
scientists and their applications on the ground were not possible.
These are the earliest researches carried out on spider robots in history:-
pg. 11 Zeeshan Ansari (s09466807)
University of Rome’s hexapod.
MASHA hexapod.
OSU hexapod.
ODEX I hexapod.
ASV hexapod.
Figure 1 Old Spider Robot Projects
In 1972, University of Rome developed the first hexapod robot that worked. It
was a walking machine with electric drives that was controlled by a computer. The
Russian Academy of Sciences in the mid 70’s in Moscow developed a six-legged
walking robot applying a mathematical model of motion control. Masha hexapod
walking robot was the name of the robot developed in 1976 at Moscow State
pg. 12 Zeeshan Ansari (s09466807)
University (Figure 1b). Masha was able to overcome obstacles using contact on the
feet and a proximity sensor. Then came the “OSU Hexapod” that was developed by
Ohio State University in 1977, OSU could cover short distances and cross hurdles in
the process. It was a success. ODEX I was the first commercially prepared walking
robot developed in 1983. Then came the Adaptive Suspension Vehicle (ASV) in 1986
by the United States. It was a walking vehicle that was large in size and driven by a
human rider. How the robots operate depends on the locomotion system they use,
some important locomotions are discussed below:
In the past, robots were usually raised on a fixed platform and locomotion was
not required. They were used mostly in factories to assist in the assembly lines. But
the last two decades have seen their transition from fixed to mobile robots. Their area
of work extends to open air spaces and busy hubs like airports, hospitals, shopping
malls, metro stations etc. These are called field and service robots. Electric motors
are installed at the joints for mobility. These motors use their maximum torque ability
for robot locomotion and sometimes reach the saturation point especially under
conditions where critical mass and power constraints put limitations on the actuator’s
size. Algorithms for robot motion optimization are used for locomotion with maximum
saturation margin.
Robots that use both legs and wheels for locomotion are called hybrid. A hybrid
robot can switch between different modes of locomotion namely walking with legs,
rolling on wheels and “rolking” which means using wheels and legs simultaneously.
Now the ground on which the robot moves is of different types. It can be smooth,
hilly, slope, muddy, filled with ice, slippery or mushy. A hybrid robot chooses its
locomotion mode after judging the type of terrain through its sensors. This system of
automatic locomotion mode control through sensors runs on measuring and judging
the various characteristics of the ground when the vehicle interacts with it. These
characteristics include slipping and drawbar force of wheel, energy usage and
various terrain parameters. This project is about creating a hybrid robot possessing a
six-legged walking system and a four-wheeled locomotion system. Also kinematic
analysis is used to develop the most stable gait for walking the robot and finding out
the location of the robot in the world coordinate frame for mapping and driving it. For
rolling locomotion Proportional Control Strategy is developed for forward and
backward rolling. Pros and Cons of Wheeled and Legged Robots are given below in
the figure 2.
pg. 13 Zeeshan Ansari (s09466807)
Figure 2 Pros and Cons
2.2 Locomotion systems
The word locomotion means the act or power of moving from place to place.
The capability of locomotion is a natural feature of humans and animals. Without the
capabilities of locomotion everyday life becomes complicated and tasteless.
Handicapped people have long been taken into account to develop locomotion
systems.
Locomotion system drives the vehicle, decides its mode if provided i.e. compact
legged/wheeled mode, and reaches its goals when executed to perform a certain
task. A good locomotion is critical to the successful operations of a robot. Generally a
robot should be able to perceive the surface (terrain), plan the path, navigate and
obviously avoid the obstacles to reach its destination.
Requirements are to be taken into account in the design process of a
locomotion system for a robot. The main factor is the environment where the robot
needs to operate. Typical design factors include speed, stability, mode switch
pg. 14 Zeeshan Ansari (s09466807)
between surfaces based on i.e. sensor system and overall control. Locomotion on
even/uneven surfaces can be realised using the principles of rolling, walking,
running, crawling, jumping or wriggling. This project focuses on rolling for even
surfaces and walking/running for uneven surfaces (Leppänen, 2017).
Basically the locomotion system involves the conversion of some source of
energy i.e. electricity, air pressure, noise, sunshine, nuclear power etc. into a
mechanical action that moves a vehicle (a robot). Variety of techniques can be used
to achieve motion. Most common source of energy used is electricity or a battery
power that operates an electric motor.
This robot will also consume battery power for its operation. Direction of the
motors can be changed to achieve forward or backward motion. Similarly motors can
be fed less or more power to slow down or maximise the speed of the robot. Different
kinds of control strategies can also be implemented for variety of robot movement’s
e.g. dancing, turning etc. This project aims to achieve walking and rolling locomotion
which can be further combined to achieve hybrid locomotion.
2.2.1 Walking locomotion:
Walking locomotion is most suitable for uneven surfaces, especially in soft
grounds or grounds with obstacles where wheels locomotion becomes almost
impossible. Legs can be used to provide better mobility when robot approaches
uneven surfaces, they can step over obstacles and move up and down the stairs.
Again the legs’ mode mobility will also depend on the size, type, structure of legs and
the motors driving them as well as the structure of the main robot body. Flexibility can
be introduced in robots body to maximise the motion of legs, while maintaining
stability and to improve its ability to surmount obstacles. The realisation of legged
locomotion is normally based on two mechanisms which are slide and level.
2.2.2 Rolling locomotion:
Wheels locomotion is one of the most common methods of locomotion. Wheels
provide best mobility on even or hard surfaces depending on its structure, type, size,
surface, type of motor driving them and other factors. The wheels can also carry
more load in comparison to walking or other locomotion systems. Two-wheel robot is
sometimes hard to balance. Four and six wheeled robot is a better option for this
project.
pg. 15 Zeeshan Ansari (s09466807)
2.2.3 Hybrid locomotion:
In hybrid locomotion; wheeled and legged locomotion can be combined as
hybrids to obtain maximum mobility for greatly varying ground conditions. Hybrid
locomotion can guarantee a high speed on wheels and good negotiating capabilities
of legged locomotion (Leppänen, 2017). Locomotion is performed by wheels while
adapting to slow terrain’s changes to legs. In other words on approaching obstacles
bigger than the wheels size or when obstacles prevent driving the robot switches to
walking locomotion. The idea is to make best use of both the locomotion capabilities
for greater mobility.
pg. 16 Zeeshan Ansari (s09466807)
3 Project Specification
3.1 Non-functional Requirements
3.1.1 Product Requirements
3.1.2 Organisational Requirements
pg. 17 Zeeshan Ansari (s09466807)
3.1.3 External Requirements
3.2 Functional Requirements
3.2.1 Category 1
The application is intended to control motion of legged-wheeled robot “Spicar”.
3.2.2 Category 2
Following requirements should be not met under given priorities:
pg. 18 Zeeshan Ansari (s09466807)
4 Design Considerations
It’s not easy to design a hybrid robot “Spicar”. Design of Spicar involves
decisions to be made about the features depending on the technicalities and
operations required. Following are some of the design constraints of Spicar:-
The mechanical structure of the Spicar body
Leg architecture
Wheel and Bracket design
Actuators and drive mechanisms
Control architecture
Power supply
Walking gaits and rolling locomotion
Autonomy
Operation features
Cost
Sensors (Obstacle avoidance capability - (it is secondary objective))
These design issues can be categorized as design inputs (or key features) and
design outputs (or main design characteristics) as illustrated below in figure 3.
Spicar can be designed in various configurations and every design has its own
specifications, criteria, benefits and drawbacks. Each robot design is unique.
Design Inputs Design Outputs
Key Features Main Design Characteristics
Walking gaits and rolling
locomotion
Autonomy
Operation features
Cost
Obstacle avoidance
capability
Preliminary
Layout
Design
Mechanical structure
Legs architecture
Actuators and drive
mechanism
Control architecture
Power supply
Figure 3 Scheme for preliminary layout design of Spicar
pg. 19 Zeeshan Ansari (s09466807)
4.1 Gait planning
A gait is a defined as the sequence of leg motions which is coordinated with a
sequence of body motions of the robot to move the robot in the required direction and
to change its place. When similar states of the same leg occur at the same interval of
time for all legs during sequential strokes, then these gaits are called periodic gaits.
They are suitable to use over smooth territory. In Figure 5 below, the scheme of
some periodical hexapodal gaits are exhibited. In these diagrams, white colour
shows that the foot of the robot is in contact with ground while the black colour shows
that it’s off ground.
Figure 4 Legs Description & Gates (Tedeschi and Carbone, 2014)
Figure 5(a) shows the robot’s legs description. Figure 5(b) shows the
mechatronic gait which the robot adopts when its speed is slow. When it starts
moving, it starts with its rear-most leg and then all the rest of the legs are moved
forward in sequence. Same gait is repeated on the other side’s set of legs. The
posture of the hexapod remains stable because only one leg is raised at a time while
the other five are grounded.
Figure 5(c) shows the ripple gait which is used for medium speed. Figure 5(d)
shows tripod gait which is a regular periodic gait in which the front and back legs on
one side raise with the contralateral middle leg within the time frame thus forming
alternating tripods. This gait is most appropriate for walking in high speeds over
smooth ground.
4.2 Spicar Robot Control
In figure 6 given below, the control system of this robot is a hierarchical system.
pg. 20 Zeeshan Ansari (s09466807)
It consists of a host computer, a controller and required actuators and sensors. The
user of the Spicar robot will provide the input for the gait generation for trajectory
which is walking and rolling locomotion in Spicar. This input determines the required
position for legs to conduct walking locomotion and proportional control calculation
for forward or backward rolling locomotion. The trajectory generator sends leg
coordinates to forward kinematic model for each leg. The forward kinematic model
then calculates the leg coordinates into angular coordinates for all the joints. The joint
angles will then enter the control loop. The control at the joint is executed by a PID
open-loop control.
Figure 5 Hierarichal control architecture for Spicar
pg. 21 Zeeshan Ansari (s09466807)
4.3 Spicar Design Flowchart
The flowchart given below describes the flow of design process.
pg. 22 Zeeshan Ansari (s09466807)
Figure 6 Spicar Design Flowchart (Tedeschi and Carbone, 2014)
pg. 23 Zeeshan Ansari (s09466807)
5 Hardware and Software
In-depth research has been conducted on hardware and software requirements
for this project. Hardware options considered were wheeled and legged; humanoid,
quadruped and hexapod robots. Microcontrollers included Dagu spider robot
controller with ATmega2560 processor and The Axon II with ATmega640 processor.
Hardware section also includes detail about Servos, DC motors and Power Source.
Software options involved any software that’s compatible for C/C++ programming.
Hardware and software is justified below:
5.1 Hardware
Hardware part discusses different options for hardware and justifies the most
appropriate ones for this project. Hardware Parts covered here are Robot chassis,
Micro-controllers, Servos, DC Motors and Power Source.
5.1.1 Robot Chassis
Three different robot chassis that were analysed to a great extent for this project
are given below:
5.1.1.1 Wheeled-robots
Re-visiting, aim is to design and control an autonomous robot with compact
legged/wheeled capabilities to maximise the speed of the robot. Keeping aim in mind,
wheeled robots have been researched and studied in detail but results revealed that
their hardware is very hard to be modified to include legs and to further build it to
meet the aim of this project.
Figure 7 mBot-Blue Educational Programmable Robot (Bluetooth Version)
(Robotshop.com, 2017)
pg. 24 Zeeshan Ansari (s09466807)
The first model is a wheeled-robot called mBot (shown above), mBot comes
with electronics based on arduino open source platform; a blue tooth version for
wireless connections can be used for projects like wall avoidance, line following,
games with other mBots etc. The major disadvantage is that mbot does not offer
enough room to add legs to it, adding legs seems very hard on this robot.
5.1.1.2 Humanoid (Legged-robots)
Humanoid (legged) robot kits like “Mindstorm” (given below in figure 9) were
considered but detailed study on these found out that it is not very suitable for a robot
that needs to switch between wheeled and legged locomotion on approaching even
and uneven surfaces. Adding wheels to humanoid robot is of course possible but as
robot needs switching between two modes its stability on wheels while maximising its
speed becomes a big challenge for a graduate project. Humanoid robots are not
even a good economical option as they are more expensive than the Spider robots.
Figure 8 LEGO® MINDSTORMS® EV3 (EU Version) (Robotshop.com, 2017)
Second model under research was humanoid robot “LEGO® MINDSTORMS® EV3
(EU Version)”. This robot is a comprehensive robotics construction kit with powerful
ARM9 processor. It comes with a programmable brick with an intuitive user interface
and sound, 3 interactive servo motors to move the robot in multiple directions, and it
also includes infrared, touch and colour sensors and everything to build a different
but more humanoid-like robot (Robotshop.com, 2017)
pg. 25 Zeeshan Ansari (s09466807)
Mindstorms EV3 could have been used to perform excellent walking locomotion
but its biggest drawback is that adding wheels to it restricts the speed to almost zero
because its structure is such that it compromises on its dynamic stability.
5.1.1.3 Spider (Legged-robots)
Spider (legged) robots were found to be the best for this project. Quadruped
and Hexapod can be first programmed to walk/crawl and then two wheels can be
added for wheeled locomotion. Hardware of Spider robots give enough space to add
and fix two big wheels to it. Spider robot is small and has no problem of dynamic
stability (while in operation) as long as the control strategy is well implemented.
Considering its small body and legs’ movements (degree of freedom) and overall
control makes two wheeled locomotion possible and efficient. Hexapod robot can be
best designed, modified, controlled and implemented to meet the aims and objectives
of this project.
5.1.1.3.1 Lynxmotion AH2 Hexapod Robot
Keeping aims and objectives in mind, variety of hexapod and quadruped robots
were then searched in robust depth and consequently the third model considered
was Lynxmotion AH2 hexapod robot kit as shown below in figure 10.
Figure 9 Lynxmotion AH2 Hexapod Robot Kit (BotBoarduino)
(Robotshop.com, 2017)
Lynxmotion AH2 Hexapod Robot kit comes with advanced mechanical
advantage leg design with 2DOF (degree of freedom), supports forward, reverse,
pg. 26 Zeeshan Ansari (s09466807)
gradual and in place turning. It also includes BotBoarduino microcontroller and SSC-
32 servo controller. The robot uses 12 HS-422 servos for legs (Robotshop.com,
2016). This kit includes everything to build the robot except the wheels which can be
bought or requested to be made from BCU’s Mechanical Workshop. Price is £393.61,
on top buying wheels and sensors add up to £450, which is not an economical
option.
5.1.1.3.2 DIY Six Feet Robot 6-Legged 6DOF Hexapod4 Spider Robot
with Servo
Similar robot in hardware/software specification was then searched for cheaper
price. One of the best resembling option found out to be “DIY Six Feet Robot 6-
Legged 6DOF Hexapod4 Spider Robot with Servo” and it is shown below in figure
11.
Figure 10 DIY Six Feet Robot 6-Legged 6DOF Hexapod4 Spider Robot with
Servo (banggood.com, 2017)
This hexapod robot comes with even more options i.e. 6DOF (Degree of
freedom) instead of 2DOF in Lynxmotion AH2 Hexapod Robot; it offers flexible
control, more movements and joy. It is light weight and comes with servos but circuit
plate and its battery needs to be installed. Size is about 24(L)*18(W)*12(H) cm
(banggood.com, 2017). Pack at a price of £47.94 includes 1*Hexapod Robot Frame
and 12*9g Servos. One drawback is that it does not include microcontroller which
can be bought separately. This robot has been chosen as the final option based on
pg. 27 Zeeshan Ansari (s09466807)
its hardware structure, features and price. Then further research for microcontrollers
made the author to decide the best economical microcontroller especially designed
for spider robots.
5.1.2 Micro-controller
Two micro-controllers Axon 2 and Dagu spider robot controller were mainly
compared based on their processors and other features i.e. FLASH, SRAM,
EEPROM, USB interface, I/O pins, number of servos support, analogue inputs,
PWM, serial communication, external interrupt pins and boot-loader etc.
5.1.2.1 Axon II
Axon II micro-controller (shown below in figure 12) has been developed for
robotics hobbyists including beginners and experts. It comes with many great
features for different operations of robots. It uses the powerful ATmega640 as its
processor. A number of important features are given below:
58 I/O Total
16 ADC
25+ Servos
I2C, SPI
3 UART + USB
Up to 8 external interrupts
15 PWM Channels
64KB Flash, 4KB EEPROM, 8KB SRAM
16 MIPS throughput at 16 MHz
6 Timers (four 16-bit, two 8-bit)
pre-programmed with a bootloader - no programmer required
numerical LED display
built in 3.3V, 5V, and unregulated power buses
external memory support (port A)
all software is free
100% open source, large support community
Windows, Mac, and Linux compatible
pg. 28 Zeeshan Ansari (s09466807)
(Societyofrobots.com, 2016)
Figure 11 The Axon II (Societyofrobots.com, 2017)
5.1.2.2 Dagu Spider Robot controller
Chosen microcontroller; Dagu spider robot controller (shown below in figure 13)
priced at £35.30 is shown below in figure 3.6. It is an Arduino compatible robot
controller designed specifically for robots that uses a large number of servos such as
humanoids, hexapods and serpents. Dagu uses a very powerful ATmega1280 as its
processor with 128K FLASH, 8K SRAM and 4K EEPROM, its drives are up to 48
servos, it has 3A, 5V switch mode power supply and input voltage is from 7V TO
30V. Detailed features are given below:
70 I/O pins terminated with a servo compatible 3 pin male header and a
female header
USB interface and ISP socket
Power switch and reset button
Pin spacing allows custom shields to be made using standard prototype
PCB's
Comes with Arduino bootloader installed
16x 10 bit analogue inputs
Up to 15x PWM outputs (depends on the number of servos in use)
pg. 29 Zeeshan Ansari (s09466807)
4x serial ports (1 used by USB interface)
1x I²C interface
Can drive up to 48 servos using the Arduino servo library
(Robotshop.com, 2017)
Figure 12 Dagu Spider Robot Controller (cdn.sparkfun.com, 2017)
The Dagu controller has twice the processing power of the axon 2, and its other
features have almost twice the capability of those of the axon two. Dagu is way more
powerful than axon 2, its powerful features will especially aid in walking and rolling
locomotion and other control strategies.
The reason for selecting this controller is its powerful features (given above)
that allow optimum operations and excellent control of a robot with maximum servos.
Data sheets can be used later on for detailed implementation. Once walking and
rolling locomotion is achieved, sensors can then be researched in detail to modify the
robot to an autonomous compact legged-wheeled robot. Sensor selection is left to
the end of the project.
pg. 30 Zeeshan Ansari (s09466807)
5.1.3 Servos
Servo motor is a motor which is designed according to specifications for use in
making robots and other control applications. Servo motor is used at high torque for
locating position and controlling speed. Either AC or DC motor is controlled by
servomechanism. So the two major types of servo motors are called AC servo motor
and DC servo motor. The power of servo motor ranges from a fraction of a watt to a
few 100 watts. The rotor of the servo motor is long lengthwise but its diameter is
small. That way its inertia is kept low (Circuitdigest.com, 2017).
The servo motor that this Spicar used is Tower Pro SG90 Micro Servo which is
shown below in figure 14. This servo is a good choice for people who are new in
building electrical gadgets and devices and want to use a motor controller which is
compact in size yet comes with full functionality as it is fitted with gears and feedback
mechanism based on sensors.
Although the SG90 servo is small in size and doesn't weigh much still its motor
generates high power to produce the desired output. Its weight is 9g and the
dimensions are about 22.2 x 11.8 x 31 mm. The voltage needed to operate it is about
5V (4.8V to be exact). The operating speed is 0.1s/60 degree with a stall torque of
1.8kgf.cm. The range of temperature while operating is 0 - 55 degree centigrade and
dead bandwidth is 10 microseconds. This servo motor is available with its 3 horns
and the related hardware for feedback and gearbox (micropik.com, 2017).
Figure 13 Tower Pro Micro Servo 9g (micropik.com, 2017)
pg. 31 Zeeshan Ansari (s09466807)
5.1.3.1 Servomechanism
In a simple servo motor, only position is controlled but mostly these days servo
motors are used to control both position and speed. The mechanism of servo is a
closed loop system which comprises of a controlled device along with a controller,
output sensor and feedback system. In this project open loop control is used because
sensors are still not implemented which are left for future work discussed in the
section at the end. Following is the block diagram of a servo motor and the logical
servo circuit. It shows what is a servo made up of and how it works (Daware, 2017).
Figure 14 Servo Motor Block Diagram (Robotplatform.com, 2017)
The various parts that make up a servomechanism are discussed below:
(Robotplatform.com, 2017)
(Daware, 2017)
1) Power supply: Just like all electric devices, a servo needs power to operate.
Usually the voltage ranges from 4.8V to 6V but some servos are designed to operate
at lower than 4.8V and higher than 6V. Servos that use more than 6V to operate are
called heavy duty servos. Maximum voltage of a particular servo is written on its
datasheet and it should not be exceeded otherwise the motor will burn.
2) Signal line: A servo has three wires fitted with it. These are a ground wire, a
positive wire and a control wire/line. Two of these wires i.e. positive wire and
pg. 32 Zeeshan Ansari (s09466807)
negative wire will be used for power supply while the control wire will be used for
sending signals. Signal line is also called the control line of a servo motor because it
sends a pulse with a code which makes the shaft move at a certain angle according
to the code. The pulse has a voltage range of 3V to 5V and this gives a signal to the
shaft. This process is called “Pulse Width Modulation” or PWM. The PWM is sent
through the control wire. These pulses are generated from either a microcontroller or
a timer IC. The servos maximum movement as a result of the electronic pulses is
from 0 degree to 180 degrees. If needed, the servo rotation can be achieved to be
depending on the manufacturing features. It cannot move further from 180
degrees because a mechanical stopper prevents it. The pulse is sent at an interval of
every 20 milliseconds (ms). The width of the pulses sent varies. It can be 1.0ms,
1.5ms or 2.0ms. A pulse of 1.0ms will rotate the shaft in an anticlockwise direction at
- , a pulse of 1.5ms will bring the shaft back at neutral position or and a pulse
of 2.0ms will rotate the shaft in a clockwise direction at + . This is the plane in
which the shaft will move. The following figure 16, illustrates the process of PWM.
Figure 15 PWM Process (Daware, 2017).
The shaft when applied the pulse will move to the required angle and hold its
position. The pulse must be repeated every 20ms for the shaft to keep its position. If
some other force is applied to the servo motor externally along with the pulses, it
pg. 33 Zeeshan Ansari (s09466807)
resists that force to take its position. A servo is never idle and continuously keeps a
check to sense the input signals so that it can rotate accordingly.
3) Voltage converter: This is also called a voltage decoder. It is a circuit which
decodes the input pulse and then converts it into its corresponding voltage. As soon
as the circuit receives the input pulse, it charges the capacitor at a constant rate and
keeps charging it until the pulse is high. When the pulse goes low, the capacitor
discharges through the buffer amplifier and this negative feedback is then sent to the
error amplifier.
4) Error amplifier/voltage comparator: This is a negative feedback operational
amplifier and it receives input voltage from potentiometer and voltage converter and
compares it. The difference between these two input voltages is then amplified and
sent as feedback to the servo motor. The motor in turn rotates the pot shaft and the
servo shaft. When this voltage difference is more, motor will drive faster and when
difference is low, motor will be slower in speed. In the same way, direction of motor
will be controlled by the fact that if voltage difference is positive then it will move in
one direction and if the difference is negative then it will move in the opposite
direction.
5) Potentiometer: A potentiometer is used to sense the mechanical position of
the shaft through pot in the servo. The pot is the position sensor which senses the
rotational position of the servo shaft. Shaft of the pot is attached to motor shaft with
gears. Drive shaft and pot shaft rotate together thus changing its resistance.
Resistance at every angle that the shaft moves generates a corresponding voltage
which is then given as feedback to the error amplifier to decode and compare the
voltage.
6) Motor and Gear set: The servo motor receives the data about angle with its
polarity (positive/negative) from the error amplifier and then drives as a result of this
input. In servos available these days, sensors are used to sense the position of the
shaft. The gear assembly in a servo is used to reduce speed/ RPM (Revolutions per
minute) and simultaneously increase torque of the servo motor for rotation. The high
speed force of a servo motor is changed into torque by application of gears. In
physics, as a law; Work = Force x Distance. So, in servo motor when the force is less
than the distance (speed) is high and when the force is high then the distance is less.
The potentiometer calculates and stops the servo motor at the desired angle as
discussed earlier (Daware, 2017) (Robotplatform.com, 2017).
pg. 34 Zeeshan Ansari (s09466807)
5.1.3.2 Applications of servos in today’s world
Servos can be used where a task needs to be performed repeatedly and in a
specific pre-defined way. Servo motors are a very useful device and they have found
vast applications in the fields of commercial applications as well as industrial
manufacturing. Servos are used to find cost-effective solutions to products so that
they are affordable for the end user. They make life in the twenty first century more
convenient and increase our quality of life. Some of the examples of their
applications are computers, robotics, mars rover, CD/DVD players, conveyor belts in
factories for product packaging/labelling, camera auto-focus, metal cutting and metal
forming machines, antenna positioning, automatic door openers, printing press or
printers, textile spinning and weaving machines, woodworking mechanisms, solar
tracking system for solar panels and robotic vehicles etc. (Tigertek.com, 2017)
5.1.4 DC motors
Micro Metal Gear motor MP 6V with Extended Motor Shaft
It is a small DC motor with a voltage of 6V with a 248.98:1 metal gearbox. It is
medium powered. The physical specifications of the micro metal gear motor are as
follows:
The gearbox is D-shaped.
Its cross section is 10 x 12 mm.
Its length is 9 mm.
Its diameter is 3 mm.
The gear motor has an extended shaft of 4.5 x 1 mm
The micro metal gear motor (shown below in figure 17) operates at 90 RPM and
40 mA with no load, 41 oz-in (3.0 kg-cm) and 0.7A at stall. These small brushed gear
motors are available in various gear ratios in a range of 5:1 to 1000:1. This gear
motor will be used for running the wheels of the Spicar hexapod.
pg. 35 Zeeshan Ansari (s09466807)
Figure 16 DC Motor (Pololu.com, 2017)
5.1.5 Power Source
(Skylightupower.com, 2017)
(produktinfo.conrad.com, 2017)
For developing Spicar, two types of batteries were explored namely NiMH and
Lipo. NiMH battery (Nickel-metal hydride battery) was developed by upgrading NiCd
battery. NiMH is a cylindrical shaped battery as shown in figure below. It is filled with
hydrogen as its energy storage medium. The battery is closed with a lid made up of
an alloy of nickel with one more sturdy metal e.g. titanium, as shown below in figure
18.
Figure 17 NiMH battery structure (Skylightupower.com, 2017)
Lipo battery (Lithium polymer battery) is made up of Carbon element and
Lithium which has the chemical property of being highly reactive. This battery has a
flat shape which allows minimal resistance. This battery has the capacity to store a
lot of energy due to its properties. Lipo battery is shown below in figure 18.
pg. 36 Zeeshan Ansari (s09466807)
Figure 18 LiPo battery structure (Skylightupower.com, 2017)
Now the two batteries were studied and the eight differences noted in the
following respects:
1. Cost: Presently NiMH battery is cheaper than LiPo in the market.
But if LiPo is produced in large numbers, the economies of scale
bring its price down.
2. Weight: In all radio control devices, the weight and size of battery
is a critical matter. As compared with NiMH, LiPo batteries are
smaller in size and less heavy.
3. Voltage: The voltage for each cell of LiPo battery is 3.7V so it
comes in 7.4, 11.1V, 14.8V etc. while NiMH battery has 1.2V for
each cell. NiMH is available in 3.6V, 7.2V etc.
4. Charge/Discharge: LiPo battery has an added advantage that it
can be charged / discharged in a short period of time. But it also
has the disadvantage that it can burst if over charged/discharged
so it has a safety hazard. NiMH is relatively safer in this regard.
5. Safety concern: LiPo batteries have a soft casing so they are
prone to physical damage while NiMH are better in this regard
because they have a strong hard casing.
6. Battery capacity: LiPo cell's battery capacity is much better than
NiMH. The capacity for Lipo is from 3.7V 800 mah to 3.7V 22AH.
Whereas the capacity of NiMH battery is from 2500 mAh to 3000
mAh only.
pg. 37 Zeeshan Ansari (s09466807)
7. Battery charger: To make every LiPo cell balanced, LiPo battery
has its own specific chargers. But there are chargers available in
the market that can charge both LiPo and NiMH batteries e.g.
iMax B6.
8. Memory effect: LiPo batteries have zero memory effect while
NiMH can have voltage depression similar to that of NiCD
batteries.
Keeping all these factors in mind, LiPo batteries are much better than NiMH for
use in radio control cars, helicopters and robots. So, for “Spicar” robot also LiPo
battery was the obvious choice for its better performance. As Spicar was powered
using a “Rechargeable Li-Ion Polymer Battery”. It provides nominal voltage of 7.4 V
and nominal capacity of 450 mAh.
Figure 19 (LiPo) 7.4 V 450 mAh 40 C Conrad energy Stick
(produktinfo.conrad.com, 2017)
The Lithium-ion Polymer Battery (shown above in figure 20) can be stored for
short as well as long term. If the battery needs to be stored for longer than 3 months,
pg. 38 Zeeshan Ansari (s09466807)
then it needs to be recharged from time to time to preserve it. It’s recommended to
store it at a temperature range of -10 degrees to +40 degree centigrade and a 45 to
85% RH if its stored for 3 months. But if it needs to be stored for a period longer than
3 months then the temperature range recommended is from 0 degree to +35 degree
centigrade. The voltage that needs to be maintained for this long time storage is in a
range of 3.7V to 4.2V for each cell in the battery. After storage when the battery is
used, its capacity recovery rate is 80% or even more sometimes when in the delivery
state which consumes 50% capacity of the fully charged battery
(produktinfo.conrad.com, 2017).
Table of Hardware components with their Specifications and Prices is given in
“APPENDIX C – Hardware Components and Prices”.
5.2 Software
Arduino is an open-source electronics prototyping platform based on flexible,
easy-to-use hardware and software. It’s intended for artists, designers, hobbyists,
and anyone interested in creating interactive objects or environments (Bruce, 2017).
All arduino boards are completely open-source, empowering users to build them
independently and eventually adapt them to their particular needs (Arduino.cc, 2017).
Ardunio, as a piece of hardware can be either used independently in a robot,
connected to a computer, or connected to other arduinos, or other electronics
devices and controller chips. In this project it will be connected to the Atmega2560
processor embedded in Dagu spider robot controller. Thousands of people and
organizations use it for smaller and larger level projects. The language that it
normally uses is Java or similar langugaes i.e C/C++. Based on previous experience
in C language, it has been chosen to be the language for this project.
pg. 39 Zeeshan Ansari (s09466807)
6 Methodology
This section discusses the various suitable methods available to design
engineers and selection of most appropriate method for this project that ensures
reliability, efficiency and viability.
Methodology for this project must encompass developing the concept of the
product, research and literature review, design and development of mechanical,
electronics and software components, final testing and evaluation before release. A
number of relevant existing project methodologies are discussed below:
6.1 Software and Spiral methodologies
These methodologies when read and understood in greater detail, found out to
be more specifically designed for detailed software development (cms.gov, 2017).
Elaborating methodologies above and some other project methodologies i.e. agile
development, rapid application development, lightweight methodologies seem
irrelevant here. These methodologies do not fulfil all the requirements of this project
as this project is not a pure software development one; it involves development of a
physical product through hardware and software implementation.
6.2 Waterfall
Waterfall methodology is a sequential (non-iterative) design process which
demands that one task be completed before going to the next. This methodology
progresses through the phases of conception, initiation, analysis, design,
construction, software implementation, testing, integration, deployment (installation)
and maintenance as shown below in figure 21.
pg. 40 Zeeshan Ansari (s09466807)
Figure 20 Waterfall Method (Bowes, 2017)
This methodology originated in the manufacturing and construction industries;
it’s basically a hardware-oriented model which has also been adopted for software
development.
6.3 Chosen methodology
As per the requirements of this project given above, this waterfall methodology
with flowchart approach and with slight modifications, to meet the requirements of
this project, is chosen to be the best. Methodology made for this project ensures
reliability, efficiency and viability of the project. It is summarized in bullet points
below:
Research the available locomotion systems for different robotic vehicles.
Set the required specification of the vehicle.
Design the vehicle in software and prove its functionality.
Build the actual system.
Test the robot.
Evaluate construction, design processes and functionality.
Write the final report of the project.
Flowchart given below provides a deep insight into project methodology:
pg. 41 Zeeshan Ansari (s09466807)
6.3.1 Methodology Flowchart
pg. 42 Zeeshan Ansari (s09466807)
Figure 21 Methodology Flowchart
After methodology this leads to the Control of Spicar robot which is given below.
pg. 43 Zeeshan Ansari (s09466807)
7 Project Planning – Gantt chart
Gantt chart given below in figure 23, illustrates the estimated times to complete
the tasks within the project. Timing deadlines have been followed closely as there
were good number of tasks and activities encapsulated in the project. Ideally, tasks
were emphasized on their completion before the deadlines and the next task was
started as soon as possible to compensate the time for any particular task (i.e.
software implementation) that took a little longer than its scheduled time on the Gantt
chart. Although hardware arrived more than a month late but still other tasks were
started to avail the time that’s why the original Gantt chart designed was not
modified.
Log book/e-log was kept up to date and the literature review was prepared as
the project progressed through each task. Although the time for report writing was
allocated towards the end of the project but draft report writing was carried out at the
end of each task/activity. Draft report writing along with Log book/e-log definitely
proved out to be very useful towards the final report writing.
Meetings with the supervisor took place every week except in last month when
the weekly meetings were not required. Draft work (Progress summary) was sent to
the supervisor before every meeting for feedback and it was further discussed in the
one-to-one meeting. Minutes, tasks discussed and next week actions of each
meeting were recorded in logbook on weekly basis. Main milestones and
Deliverables of the project are listed below:
7.1 Main milestones of the project
Logbook / e-logbook
Meetings with supervisor
Project Research
Project Registration
Project Proposal
Interim Presentation Upload
Project Design and Development
o Walking locmotion
o Rolling locomotion
Testing & Evaluation
Project Report
Presentation and Poster
Final Product
pg. 44 Zeeshan Ansari (s09466807)
7.2 Deliverables of the project
Project Registration & Project Proposal
Interim Report / Presentation
Log book
Physical product (Robot)
Project Report Gantt chart given below can be maximised, using zoom options, for clear view.
Figure 22 Project Gantt chart
pg. 45 Zeeshan Ansari (s09466807)
7.3 Safety Assessment
Safety and other important assessments were fully conducted in “Project
Specification” chapter but some more technical safety assessments are also
elaborated here. Although this project does not involve any kind of serious risks, a
couple of safety measures, were defined and some were later observed during the
implementation stages, for better work execution towards the end of the project, are
given below:
To avoid eye strain and tiredness, frequent breaks were taken which were
important while looking at the PC for long periods of time.
To avoid battery leakage, the battery was always kept at room temperature.
Proper wires were used to avoid any burning or small fire explosions.
While testing the robot, keeping eye contact at least a foot away from the
robot was always maintained.
While drilling holes in the robot frame, don’t apply extra force as it breaks the
frame.
7.4 Ethical Considerations
Qualitative research conducted with friends, colleagues and lecturers is
completely anonymous; no names or any kind of personal data is kept for any
reason.
pg. 46 Zeeshan Ansari (s09466807)
8 Spicar Control
To start with, it can be said that whole control relies on how efficiently the
servos and DC motors are controlled as these are driving the walking and rolling
locomotion respectively. Servos’ details and their mechanism are fully discussed in
section “5.1.3 Servos” & “5.1.3.1 Servomechanism”. DC motors are also discussed in
section “5.1.4 DC Motors”.
PWM has been discussed in detail in section “6.1.1 Servomechanism”. This
leads to PWM signal generation.
8.1 PWM Signal Generation
All microcontrollers have the ability to generate PWM (pulse-width-modulated)
signals. This process of PWM signal generation can be either engaging most of the
processor resources or less of it. When the microcontroller engages less of the
processor then it’s more costly to purchase because of the added hardware features
used for signal generation that in turn allow the processor to run other tasks. An
example of least processor using method is the type of microcontroller that is used in
Spicar. These microcontrollers have a PWM module embedded in them. There is a
chip on the microcontroller in which reside the control registers that carry information
regarding the duty cycle and period of the PWM signals that are created when the
PWM module is executed. Some electrical devices need a very large period e.g. a
servo motor which typically has a period requirement of 20ms. Now the PWM module
which comes with the microcontroller might not be able to produce a large sized
period because of the speed or type of microcontroller being used (Johns, 2017).
In order to produce a longer PWM signal, a more processor-intensive method
may be used. In this method, a pulse width variable is pre-set and a "count" is
manually compared to that variable and that determines the length of the pulse width.
If that count is higher than the variable then the pulse width signal is low. And if the
count is lesser than the variable then the signal is high. This PWM period will take the
same time as it takes to run the code. So loops are used to increase the time which
will in turn increase the length of the period. This whole process can be restarted by
resetting the count when the PWM period has passed.
8.2 Controlling the Servos and DC motors
(Johns, 2017)
pg. 47 Zeeshan Ansari (s09466807)
Mostly servos, including the Tower Pro SG90 Micro Servo for Spicar, come with
three pins namely power pin, ground pin and a control signal pin. The control signal
is a PWM input signal and its high pulse width determines the angle which the servo
will take as a result as shown below in figure 24.
Figure 23 Servo's High Pulse Width determines the Angle Position (Johns,
2017)
The mechanism of the servo motor is such that the potentiometer creates an
internal signal and its pulse width is compared with the PWM control signal and as a
result of that the shaft angle is set. This angle will rotate the motor shaft. The chip on
the microcontroller controls the signal. This is the advantage of using the servo
motors. The servos are connected to the chip through current amplifying device
because these motors usually require 25mA of current to run.
The specifications that are usually needed to run a servo motor are such that
they need a pulse width between 0.9-2.1ms and the mean position is 1.5ms. That is
the average pulse width. The output shaft of the servo is positioned according to the
pulse width supplied. Typically a servo's maximum angle that can be reached is 180
degrees. Servos can change its position to a finite amount of angle in each cycle so
multiple cycles need to be sent for servo to take the desired position. If the servo
needs to cover more distance, its speed will be faster. So the relationship between
pg. 48 Zeeshan Ansari (s09466807)
servo speed and target distance is directly proportional. The speed slows down as it
approaches its target location and finally stops when reaches the target.
As long as signal is sent, the servo will resist any change to detour from target
location. So a servo is controlled through signals and in their absence, it can be
moved freely in any direction. So, microcontrollers are an effective solution for
controlling servos while creating electrical devices, machines and robots. These
microcontrollers run on a relatively simple mechanism and they are not very costly.
Now through this concept of PWM signals, the servo motor shaft can be rotated at
different angles and thus employed in electrical projects. These PWM signals are
used in controlling analogue devices effectively (Johns, 2017).
8.3 Spicar Open-Loop Control
For the time being the Spicar cannot move on its own because it does not have
sensors that can provide immediate feedback about the type of soil or terrain that it’s
traversing. It is not provided with any kind of vision abilities either. While rolling on
wheels, it does not have a means to know whether its wheels will be stuck in the mud
or sand. As it does not have a feedback system yet, it needs to be told exactly what
to do. The Spicar does that by executing open loop control for a pre-set walking gait
and for rolling locomotion. This follows the programme flowchart for demonstration of
Spicar robot.
8.3.1 Programme Flow chart
The programme flowchart to demonstrate the walking and rolling locomotion is
given below in figure 25. The program was designed for Spicar to first perform
walking locomotion, starting with forward, backward, right and left movements
respectively. Then it stops for 5 seconds and legs then retract in slowly, lowering
Spicar onto wheels for rolling locomotion. In rolling locomotion it rolls forward, turns
left, rolls backward, turns right respectively and finally stops and here the Program
ends.
pg. 49 Zeeshan Ansari (s09466807)
Figure 24 Program Flow chart
The ability of Spicar to gain feedback through sensors and thus become more
autonomous in its locomotion will be achieved in future work which is discussed at
the end. Spicar will be improved by the use of sensors. For the programming
purposes, microcontroller used in Spicar is Dagu spider robot Controller with
(ATMega2560 processor)
8.4 Dagu Spider Robot controller
Dagu Spider Robot controller has been used to implement walking and rolling
locomotion. How it implements these locomotions and controls the legs and wheels
of Spicar is given in their related sections “10.1 Walking Locomotion” and “10.2
Rolling Locomotion” respectively.
pg. 50 Zeeshan Ansari (s09466807)
9 Hardware Implementation
Following the development of Control strategy, the hardware implementation
starts which includes design, assembly and hardware block diagram.
9.1 Design and Assembly
Since this project involved overseas manufacturers and suppliers, there was
delay due in shipping and delivery received was incomplete. Parts of the frame that
were ordered are given below in figure 26 and 27:
Figure 25 Robot parts
Figure 26 Robot
pg. 51 Zeeshan Ansari (s09466807)
Important features of the frame:
6 DOF: flexible control, more movements.
Light weight: 250g (without servo).
Material: Imported acrylic, laser cutting, not easy broken.
Size: About 24(L)*18(W)*12(H) cm/
Durability: Safe and non-toxic.
Product delivered was incomplete with legs’ part (Tibia) and nuts & bolts were
missing. Legs’ “Tibia” part which was then designed in CAD software (Thomas, 2014)
is given below.
9.1.1 Legs design
9.1.1.1 Tibia
Tibia is also known as shinbone on the shank bone and it is one of the larger
and stronger portions of the leg which is situated below the knee joint. It bears most
of the weight of the robot body.
Tibia was designed after careful analysis of the test terrain and clearance of the
materials testing. The thickness of the leg is kept at 3 mm. This thickness was tested
on SolidWorks and cleared. This tibia is connected to the body with a femur and
bracket that fits into the robot body. The servo test revealed that the servos will have
enough torque to lift and balance the required weight at 90 degrees angle. So when
the leg is made at a 90 degrees angle, it will give 87.620 mm clearance space from
the servo to the ground on the leg. Our legs are built with 2 DOF. The centre of the
servo is kept in line with the centre of the foot of the leg so that the leg will be able to
evenly press down during its gait.
Tibia design including its dimensions, hole size (3mm) and final print out of leg
is shown below in figure 28 and 29.
pg. 52 Zeeshan Ansari (s09466807)
Figure 27 Leg (TIBIA design in Thomas, 2014)
Figure 28 Tibia drawing and 3D print
pg. 53 Zeeshan Ansari (s09466807)
9.1.1.2 Brackets
Brackets (shown below in figure 30) are used for joining the legs of the hexapod
to its body. Brackets allow the horizontal movements (forward and backward) of the
legs. The brackets came with package were designed in a way that even the thinnest
part is of 3mm thickness which is the safe limit for the resin being used. This also
provides space for the actuators to be easily joined or removed without opening other
parts of the hexapod. The mounting holes in the brackets are made such that an M3
screw can be placed in it and tightened with a nut at the back. M3 screws are the
size provided by the manufacturer to fix the horn of the actuator through its centre
slot.
Figure 29 Leg Brackets
9.1.1.3 Femur
The femur (shown below in figure 31) which is also known as thighbone is the
most proximal (closest to the centre of the body) portion of the leg. It is the strongest
portion of the body and is to connect the legs to the brackets and because of femur
the leg can move up and down (vertical movements) during its gait locomotion. The
actuator is the motor that is joined to the bracket and femur and due to this actuator
the femur and legs move in the desired gait. The femur is the support that holds the
weight of the hexapod and legs. The length of the femur is 4.2 cm. The torque rating
of the actuator depends on the length of the femur. e.g. if the torque rating is 9.5
kg/cm then the femur length of 4.2 cm will alter the torque rating to 2.3 kg-4.2 cm as
calculated below:
Torque rating =
= 2.3 kg-4.2 cm
pg. 54 Zeeshan Ansari (s09466807)
Figure 30 Femur and “Femur Support”
Once the all the parts for walking locomotion were ready the rolling locomotion
implementation took place. For Rolling locomotion four wheels / brackets were added
based on the measurements taken for the base of the frame as shown in Figure 32
given below.
pg. 55 Zeeshan Ansari (s09466807)
Figure 31 Spicar Base Measurements
At the base of the Spicar robot frame, back wheels were made active which
were fit with motors and two front wheels were made passive which were fit using an
pg. 56 Zeeshan Ansari (s09466807)
axle and bracket. The base of the frame was fixed on plastic board using a white
tape in order to drill holes for brackets as shown below in figure 33.
Figure 32 Brackets, Wheels / Axle fitting for rolling locomotion
9.1.2 Spicar Assembly
It was now time to put all the parts together and complete the assembly. Spicar
was then assembled by placing and fixing all the componenets to their appropriate
places. Final assembly of Spicar is shown below in figure 34.
Figure 33 System Integration
pg. 57 Zeeshan Ansari (s09466807)
Now the assembly was completed so that Hardware Block Diagram could be
drawn for Software Implementation to begin. Block Diagram is shown below in figure
35.
9.2 Hardware Block Diagram
Figure 34 Hardware Block Diagram
Diagram above elaborates the communication between Microcontroller and
other hardware components. Micrcontroller gives output signals to actuators. Instead
of using one servo for each wheel motor, only two servos are used in back wheels.
Front wheels are left passive and are driven by back wheels in order to save
resources. In processing part, Arduino (IDE) shows two way communications with
microcontroller. Two ways communication is because of sensors’ mechanism which
was an optional objective and is not achieved yet. In output section, Microcontroller
executes walking and rolling locomotions which included Forward and Backward
movements and Right and Left rotations. Sensors’ part is to feedback the output into
microcontroller for terrain navigation which is left for future work. Hardware
implementation follows software implementation given below.
pg. 58 Zeeshan Ansari (s09466807)
10 Software Implementation
Following the hardware implementation, the software implementation was
started and gaits were made, analysed and finalised for walking locomotion. Then
open-loop control was developed for rolling locomotion.
10.1 Walking Locomotion
This locomotion, as previously talked about in Literature review, is most suitable
for uneven surfaces, especially in soft grounds or ground with obstacles where
wheels locomotion almost fails. This locomotion is achieved by using Forward or
Inverse kinematics. This section talks about Forward and Inverse kinematics,
discusses suitable gaits, analyses gaits, justifies a gait and develops kinematic logic
for its implementation in Spicar robot.
10.1.1 Inverse and Forward kinematics
Walking locomotion can be achieved using Inverse and Forward kinematics. In
inverse kinematic things are controlled on three levels:
1. The position (rotation) of each servo.
2. The position of the foot of the leg.
3. The movement of the robot’s body as a whole.
The command is given first at the highest level such as “Move Spicar Forward”
or “Rotate Spicar Left” and then each level below that does the right thing to
implement this command. For example the “Move Spicar Forward”, this means that
assuming a tripod gait in which first pair of three legs currently in the air move their
feet (tibia) forward and second pair of three legs touching the ground move their feet
backwards, this is how one step movement is performed.
The Forward kinematics is the complement of Inverse kinematic. It is operated
by answering, given the position of the joints in this leg, where is the foot? Whereas
Inverse kinematic is the opposite i.e. “given the position where I WANT the foot to be,
what position SHOULD the leg’s joints be in?” Inverse Kinematics involves a lot of
geometry and is suitable for implementation of different gaits at higher level. Forward
kinematic is easy and completely fine for this Spicar robot which at this stage does
not involve implementation of many different gaits.
pg. 59 Zeeshan Ansari (s09466807)
10.1.2 Spicar Gaits
A hexapod robot (Spicar) can employ different types of gaits. Two basic types of
hexapod gaits are tripod gait and wave gait. These gaits are employed depending
upon the environment and the related requirements of the Spicar robot (Do, 2017).
10.1.2.1 Wave Gait
In the wave gait pattern of locomotion (shown below in figure 36), the Spicar’s
only one foot is raised in the air while the rest of the feet are firmly on the ground. In
wave gait, all the legs on one side of the robot are moved forward one by one,
starting the movement from the rear-most leg which is L3 or R3. The same
movement pattern is then repeated on the other side of the Spicar. Wave gait works
best for locomotion on rough surface (Do, 2017).
There are some disadvantages of the wave gate. Firstly, its speed is slow
because even if the programmer decreases the time of the robot’s leg lift, that will in
turn decrease the step. So speed will remain slow. Similarly if the speed of the
actuator is increased, then that will require increased amount of power which will put
extra load on battery and the control boards. If the delay phases are shortened, this
may result in colliding of the adjacent legs and collapse of part of the hexapod’s
body.
Figure 35 Wave Gait (Do, 2017).
10.1.2.2 Tripod Gait
Tripod gait is best suited for high speed of robot. In our robot “Spicar”, speed is
crucial for success in its missions. So tripod gait will be used mainly in it for
locomotion. In tripod gait (shown in figure 37), the set of front and hind legs move at
one side and on the other side the middle leg moves right opposite to it (L1, R2, and
pg. 60 Zeeshan Ansari (s09466807)
L3). In the very next cycle, the pattern repeats in an alternating manner. In the tripod
cycle firstly three of the legs lift in the air to move forward and the rest of the feet
push the ground in the backward direction for support and moving forward. When
the next cycle starts, the Spicar will then shift its weight on the remaining feet and
then the movement pattern is repeated. In the tripod gait, the Spicar remains stable
because three of its feet are touching the ground all the time and it maintains this for
support (Do, 2017).
Figure 36 Tripod Gait (Do, 2017).
10.1.3 Analysis of the Walking Gaits
While developing walking locomotion, the main goal is to achieve smooth
locomotion and stable standing movement. Another problem is handling multiple
actuators at the same time when coding the prototype build.
It has been observed that the Spicar cannot stand properly or hold its position
when multiple actuators are run at the same time. It causes the actuators to shake.
Also the Arduino microcontroller has the drawback that it cannot run parallel
computing. It executes the commands one line at a time.
To take care of all these problems, creative coding should be applied. An
example of such coding is the use of for-loops which although do have a call for each
actuator that needs to be made, but they also have with it an incrementing variable
that adjusts their position. So when the call is made, all the actuators don’t act
simultaneously but with a slight time gap. Each actuator will keep adjusting itself
continuously independent of each other and their actions will be delayed from each
other by a time gap of milliseconds. In this way of working of the actuators, the Spicar
pg. 61 Zeeshan Ansari (s09466807)
will be able to maintain a stable position and smooth locomotion. Consequently out of
these two gates, tripod gait is implemented as it offers best stability and locomotion.
10.1.4 Tripod, the Chosen Gait Implementation
This gait selection is a process (based on leg structure) for single leg to put
up and down according to a certain order or trajectory. Tripod Gait is a famous gait,
chosen for continuous stable walking motion. Legs are divided into two pairs of three
legs as shown in the picture below in figure 38.
Figure 37 Gait Selections (Pairs), (Liang, 2017)
When 1st pair lifts off the ground, the 2nd pair supports the robot body and
provides forward driving force for movement. Both pairs touch ground alternatively
(Liang, 2017). In order to understand how the walking takes place using this gait, let’s
analyse the figure given below in figure 39.
pg. 62 Zeeshan Ansari (s09466807)
Figure 38 Common (Tripod) Gait and Stepping Sequence (McComb, 2017)
As shown in the figure 39 above, in its first sketch, black circle represents the
left middle legs on ground and white circle represents the right middle leg lifted off
the ground. Only one leg is on the ground at any time which makes the Spicar tilt to
the side opposite to the middle leg that is on the ground.
In power sweep sketch, Power drives the black circles (number 1s) legs’ pair
which is in contact with the ground. This sweep consequently propels the Spicar
forward.
In non-power sweep sketch, power does not drive white circles (number 2s)
legs’ pair which is lifted off the ground. Basically Spicar does not move in this step as
it merely positions the legs’ pair for the next sequence (McComb, 2017).
pg. 63 Zeeshan Ansari (s09466807)
To summarise in power sweep mode legs’ pair (numbered 1s) does not make
movements, instead it stabilizes the Spicar on the ground and in the meantime in
non-power sweep mode, the legs’ pair (numbered 2) positions itself for the next
sequence and then this pair comes in contact with the ground when the other pair is
lifted at the same time which makes the Spicar finish one step movement.
There are 4 different kinds of walking operations that are achieved using these
pairs which are given below:
a. Walking forward
b. Walking backward
c. Walking clockwise (Right)
d. Walking Anticlockwise (Left)
10.1.4.1 Gait configuration and Pin selection for each Leg’s servos to Implement
Tripod gait:
Leg A: Fixed with servo 1 & 2 which are attached to pins 31 & 32
respectively.
Leg B: Fixed with servo 3 & 4 which are attached to pins 34, 35
respectively.
Leg C: Fixed with servo 5 & 6 which are attached to pins 37, 38
respectively.
Leg D: Fixed with servo 7 & 8 which are attached to pins 40, 41
respectively.
Leg E: Fixed with servo 9 & 10 which are attached to pins 43, 44
respectively.
Leg F: Fixed with servo 11 & 12 which are attached to pins 46, 47
respectively.
Entire logic developed in this section including Gate configuration and Pin
selection was used to develop the Code given in “Appendix A – Walking Locomotion
Code”. Picture of Pins attached to specified pins on microcontroller is given below in
figure 40.
pg. 64 Zeeshan Ansari (s09466807)
Figure 39 Legs’ Servos attached to Pins on Microcontroller
Robot legs’ structure
~Front~
A=leg3, D=leg0
B=leg4, E=leg1
C=leg5, F=leg2
~Back~
Leg Pairs for Tripod Gate
1st pair: A, C & E or leg3, leg5 & leg1
2nd pair: D, F & B or leg0, leg2 & leg4
Movements
For Coxa = Shoulder
CCW = Counter clockwise
CW = Clockwise
For Femur = Knee
UP
DOWN
After studying and testing some code on Spicar robot, logic is developed on
which Spicar moves. There are two loops of two different phases as the Tripod Gait
works in a way that the two legs on one side and one leg on the other side move in
pg. 65 Zeeshan Ansari (s09466807)
the same phase, while the other three legs move in the other phase at the same
time. Consider the graph shown below in figure 41.
Figure 40 Top View of Spicar
For instances, leg3, leg5 & leg1 are of the same phase (yellow circle) and leg0,
leg2 & leg4 are of the other phase (green circle). Let’s consider the leg on two
different sides in the graph shown below in figure 42.
Figure 41 Legs in loop motion
pg. 66 Zeeshan Ansari (s09466807)
This graph is a draft of how the legs should move in the loop. The graph on the
left is the leg on the right side of the robot, which is viewing from the right side of the
body. The graph on the right is the leg on the left side of the robot, which is viewing
from the left side of the body. Axes directions are drawn in grey colour. The red dots
are end points of the leg and the black arrow indicates how the endpoint of the leg
should move in order to achieve the desired movement. A diagram of the actual
Spicar Robot moving its leg in loop A → B → C is shown below in figure 43 is as
follow:
Figure 42 Leg Motion
In this design, point B is the natural position of the leg, where point D is
vertically above the point B and point C & A are horizontally aligned with point D. In
other words, point B is standing position and point A and C are forward and
backward movement position respectively.
Walking Forward
So by analysing the graph shown above, we then figure out that we need two
different loops of steps to make this movement feasible. They are as follows:
Phase 1 (leg0, leg2, leg4): A → B → C → D → A
Phase 2 (leg3, leg5, leg1): C → D → A → B → C
The two different phases are assigned to the legs. The loop is a complete loop
which goes through every point as stated in the graph.
D
B A C
pg. 67 Zeeshan Ansari (s09466807)
Walking Backward
It is basically the inverse of sequence of walking forward.
Phase 1 (leg0, leg2, leg4): C → B → A → D → C
Phase 2 (leg3, leg5, leg1): A → D → C → B → A
Walking Clockwise (Right)
For this case, it is pretty different from the above two directions. We can
consider the following graphs for design idea.
Figure 43 Loop of leg1 & leg4 when walking towards right
In this graph, shown above in figure 44, the loop of leg1 and leg4 when walking
towards right. The two legs are walking in the same direction. For the overview of all
the legs’ movements see the graph given below in figure 45.
pg. 68 Zeeshan Ansari (s09466807)
Figure 44 Movement of each leg in their loop for Rightwards’ Walking
This graph above illustrates that how each leg should exactly move in their own
loop in order to walk rightwards. Therefore, deriving from this graph, we have the
following different loops.
Right side Phase 1 (leg1): A → B → C → D → A
Right side Phase 2 (leg0, leg2): C → D → A → B → C
Left side Phase 1 (leg3, leg5): C → B → A → D → C
Left side Phase 2 (leg4): A → D → C → B → A
Walking Anticlockwise (Left)
For walking leftwards, we can just invert the flow of walking rightwards.
Right side Phase 1 (leg1): A → D → C → B → A
Right side Phase 2 (leg0, leg2): C → B → A → D → C
Left side Phase 1 (leg3, leg5): C → D → A → B → C
Walking locomotion is complete now and this takes us to develop rolling
locomotion which starts below.
pg. 69 Zeeshan Ansari (s09466807)
10.2 Rolling Locomotion
This method uses wheels for its locomotion, it’s a most common method of
locomotion used to maximise the speed of robot on even surfaces. In comparison
rolling locomotion (wheels) can carry extra load than walking or any other kind of
locomotion. Keeping the long rectangular frame of Spicar in mind, fixing two wheels
to its base became an impossible option for its locomotion. Four wheels were then
introduced for its smooth and fast rolling. Two wheels at the back of the base of the
frame were made active and two wheels at the front of the base were left passive.
Back wheels using high torque can drive front wheels efficiently enough.
Two back wheels were made active which drove the Spicar. One DC motor is
attached to each back wheel. Each Motor has its two “Positive” and “Negative”
terminals. “Positive” terminal when set to “HIGH” drives the motor in clockwise
(Forward) direction and Negative terminal when set to “HIGH” drives the motor in
anticlockwise (backward) direction. This helps develop logic for forward, backward,
right and left movements of Spicar using two back wheels. Movements are
elaborated below:
Rolling Forward
As shown below in figure 46, the code that positive terminals of both (left and
right) motors (“motor1_pos” and “motor2_pos”) are set to “HIGH” and negative
terminals of both motors (“motor1_neg” and “motor2_neg”) are set to “LOW”. This
drives the wheels in clockwise direction which means the Spicar moves “Forward”.
Figure 45 Forward Logic (APPENDIX B – Rolling Locomotion Code)
Rolling Backward
pg. 70 Zeeshan Ansari (s09466807)
It is the inverse of Forward rolling, so for backward rolling negatives terminals of
both motors (“motor1_neg” and “motor2_neg”) are set to “HIGH” and positive
terminals of both motors (“motor1_pos” and “motor2_pos”) are set to “LOW”. This
logic drives the wheels in anticlockwise direction which means the Spicar moves
“Backwards”, as given below in figure 47.
Figure 46 Backward Logic (APPENDIX B – Rolling Locomotion Code)
Right Turn
In figure 48, shown below, the logic for Right and Left rotations is developed for
Forward movement only. So, in order to rotate Spicar in Right or Left direction, one
motor’s negative terminal and other motor’s positive terminal is made “HIGH” or
“LOW” and vice versa.
As shown in code given below, for Right Turn to take place while moving
Forward the positive terminal (motor1_pos) of Right Motor (which would be defined
as “motor1” in this case) is set to “LOW” and negative terminal (motor1_neg) is set to
“HIGH”, and for Left motor (which would be defined as “motor2” in this case) the
positive terminal (motor2_pos) is set to “HIGH” and negative terminal (motor2_neg) is
set to “LOW”.
When Spicar is moving backwards the motors would be defined the opposite
way, the Right Motor in forward movement becomes the left motor in backward
movement and vice versa for the Left Motor. So the negative terminal (motor2_neg)
of right motor (which would be defined as “motor2”) is set to “LOW” and positive
terminal (motor2_pos) is set to “HIGH”, and for left motor (which would be defined as
“motor1”) the negative terminal (motor1_neg) is set to “HIGH” and positive terminal
(motor1_pos) is set to “LOW”. This is how the Right Turn is achieved in backward
movement.
pg. 71 Zeeshan Ansari (s09466807)
Figure 47 Right Turn Logic (APPENDIX B – Rolling Locomotion Code)
Left Turn
As shown in figure 49, given below, for Left Turn to take place while moving
forward, the logic used is exactly opposite to the logic used in Right Turn for Forward
movement or exactly same as the logic used in Right Turn for Backward movement.
And for the Left Turn to take place while moving backward, the logic adopted is
exactly opposite to the logic used in Right Turn for Backward movement or exactly
same as the logic used in Right Turn for Forward movement. The logic developed for
Left Turn is shown below.
Figure 48 Left Turn Logic (APPENDIX B – Rolling Locomotion Code)
pg. 72 Zeeshan Ansari (s09466807)
11 Testing, Results and Evaluation
Thorough testing was focused through-out the design and implementation
phase. While testing, some difficulties were faced especially in the coding part. It was
hard to develop logic for gait; the movement of legs while maintaining stability of
Spicar.
Two types of testing were done for this project. First each instrument was tested
alone to check that it is functioning or not which is called as unit testing. Then comes
the combined testing after the system was integrated. This final testing was called
function testing. Now both types of testing are described in stages below:
11.1 Unit Testing
Each module in the application was tested while being developed to confirm its
adherence to the related requirements. This testing was done to check the working of
the components; unit testing was performed on servo motors, DC motors and
microcontroller.
11.2 Function Testing
The function testing was conducted to see the response of the whole system
which would further be demonstrated in Final Project presentation. Some functional
testing results are given below in Table 1.
COMPONENTS
CYCLE 1
CYCLE 2
FINAL
STATUS
Test for Atmega2560 Microcontroller
ports
OK
OK
OK
Test for Hardware Connections Failed OK OK
Test for Servo motors Failed OK OK
Test for DC motors Failed OK OK
Table 1 Function Testing Results
Hardware Connections, Servo motors and DC motors first tests failed because
hardware connections were wrong which were then figured out and made right.
pg. 73 Zeeshan Ansari (s09466807)
11.3 Evaluation
Hardware assembly was a little challenging, at one point base of the Spicar
robot’s frame was cracked because of applying extra force while drilling a hole into it.
Luckily it was fixed perfectly to avoid any disappointments of ordering or designing a
new hardware. Final assembly came out to be perfect fix for rolling locomotion on
hexapod robot.
Software part included developing Algorithms and writing programmes in C/C++
language. This was the toughest part for the author. Finally author was able to
produce a code for walking locomotion and then the rolling locomotion which was a
lot easier than the code for walking legs.
11.3.1 Final Functionality
Spicar has demonstrated the walking and rolling locomotion as per the
designed program flowchart given in section “9.3.1 Programme Flow chart”. The
Spicar first performed walking locomotion, started with forward, backward, right turn
and left turn movements respectively. Then it stopped for 5 seconds and legs then
retracted in slowly, lowered Spicar onto wheels for rolling locomotion. In rolling
locomotion it rolled forward, turned left, rolled backward, turned right respectively and
finally stopped, here it terminated its demonstration. As per the objectives of this
project the Spicar is fully functional, although it can be improved to implement many
more gaits gates and other functions.
pg. 74 Zeeshan Ansari (s09466807)
12 Discussion and Conclusion
The design and control of compact legged-wheeled robot has successfully been
accomplished. Spicar is a hexapod robot that looks like a bug. It’s was a fascinating
mix of hardware and software skills including aspects of mechanical engineering,
electrical engineering, robotics and control. This project was about developing a
hybrid robot that can perform walking and rolling locomotion depending on the
surface on which it navigates on.
All the objectives are met for the Spicar robot. First of all, extensive literature
review was carried out for legged, wheeled and hybrid robots that included hardware
components, the software and IDE (Integrated development environment for software
implementation).
- Suitable hardware for designing and developing the robot structure (chassis)
was determined that includes microcontroller, legs, wheels, sensors etc. Software
part was also determined which included Arduino as IDE for software
implementation.
- Legs of the robot were designed in CAD. Wheels were selected based on their
size and specification keeping in minds the dimensions of the robot. Robot chassis
was modified to include wheels for rolling locomotion.
- Electronic circuits were designed in which wheels, legs, actuators and
microcontroller were configured along with the other components. Then the hardware
was assembled to build and control a complete walking and rolling locomotion
system.
- Based on Spicar’s final assembly, the hardware block diagram was developed
in order to make algorithms (high-level description) to write final programs for the
software implementation.
- The Logics for Control Strategy of Spicar were then developed for walking and
rolling locomotion respectively.
- The microcontroller was then programmed with control strategy for manual
switch between walking and rolling modes.
- Now when the control has been achieved, the test plans were carried out. Two
types of testing were carried out for this project. Firstly unit testing was done in which
each module in the application was tested whether it fulfils the requirements or not.
pg. 75 Zeeshan Ansari (s09466807)
Unit testing was done on Servo motors, DC motors and microcontroller. Then
function testing was carried out in which test plans were made to check functionality
of walking and rolling locomotion for the entire system integration. The robot was
then evaluated based on these tests.
In walking locomotion, the Spicar moves forward and backward at a speed of
one body length per second. It balances it's body mass and maintains a firm posture
with balance while moving forward, backward or sideways in rolling or walking
locomotion. It has provided with more generalised legged-wheeled robotic platform
that can manually be switched between legs’ and wheels’ mode. Spicar is made such
that it can be programmed easily for adding more types of movements depending
upon its functionality needed for any specific purpose. In future, this platform will be
modified to an autonomous robot by adding sensors. Sensors will be attached to map
the precise location of the Spicar and to navigate it to the desired position or location.
From there that work can be further expanded to include increasingly complex
motions (Gaits) and other interesting features. Due to its hybrid functionality, Spicar
can effectively be used for search and rescue, spying or space exploration missions.
pg. 76 Zeeshan Ansari (s09466807)
13 Future Work
This project has developed a generalised legged-wheeled robotic platform that
can manually be switched between legs’ and wheels’ mode. It fully demonstrates
legged and wheeld locomotion.
In future this platform can be modified and programmed to an autonomous
robot to perform increasingly complex motions and functions. The Spicar project can
be improved in a number of ways. Firstly, it can be made autonomous by the use of
sensors. Making an autonomous robot was an optional objective for this project. One
week after the completion of this project, the author will work towards making Spicar
fully autonomous in a month's time. This can be done by the use of sensors that will
send feedback to judge the type of terrain that it’s going to traverse. This way Spicar
will be able to determine based on the feedback that which type of gait is best suited
for that surface or if required change its mode from legs to wheels or vice versa. E.g.
it should use tripod gait for strolling on smooth land while waive gait is suitable for
little uneven (rough) surface and on approaching complete flat surfaces i.e. roads it
can simply change it locomotion type from walking to rolling to maximise its speed.
Detailed research, given below, has been done on implementation of sensors to
make Spicar an autonomous vehicle.
13.1 Autonomous Control
Here the manual control will be upgraded to autonomous control. Walking and
rolling locomotion will be operated automatically using the range finder sensor(s).
When it’s fully implemented, the Spicar would roll on even surfaces to maximise the
speed and on approaching uneven surfaces (obstacles), as sensors will constantly
be sensing its path for obstacles, it will automatically switch to walking mode for
smooth stroll. Number of sensors can be used for Spicar that would improve the
precision and autonomous transition between its two locomotion systems. Closed
loop sensor feedback control system, as shown below in figure 50, will be used so
that the Spicar “know” what functions (movements) it is executing at all times.
pg. 77 Zeeshan Ansari (s09466807)
Figure 49 Autonomous Spicar Closed Loop Feedback Control
This system uses the voltage sent into the controller as its input. The controller
then converts this voltage into a signal that will drive the motors on the robot, making
it perform locomotion. Sensors, encoders or vision system can be used to give
feedback to the controller that will keep Spicar aware of its surrounding, including its
direction and speed at all the times. Spicar at the movement is being executed
without any feedback system which makes it an open loop control system. This
follows the sensor configuration, selection and its implementation.
13.1.1 Sensor Configuration
13.1.1.1 Ultrasonic Range Finder Sensor
An ultrasonic range finder sensor is a very useful device for sensing sound to
measure distances. It is used to detect precise distances to an object or just to detect
when something is in range of sensor i.e. motion detectors. Best applications of this
sensor includes robotic navigations, object avoidance or for home/office security. Its
ability to use sound to find distances does not restrict it to find distances in darkness;
it equally works in light and dark.
This sensor utilises the propagation of high-frequency sound waves to detect
obstacles in its path. When sensor emits the sound waves, it hits the object
(obstacle) and its reflected off the object and back to the sensor. It then uses the
amount of time it takes for the wave to return back to the sensor and the speed of
sound to measure the distance of the object (obstacle) away from the sensor.
Formula used is: Speed = Distance / Time.
Re-arranging gives: Distance = Speed * Time.
pg. 78 Zeeshan Ansari (s09466807)
The time variable (total time to of sound wave starting from leaving the sensor
and returning back to the sensor after bouncing back from the object) is calculated by
the ultrasonic range finder. Actually the time is divided into two parts as it is required
to only measure the distance from the sensor to the object and not the distance from
the sensor to the object and back to the sensor. The speed variable is the speed of
the sound wave at which it travels through the air.
The speed variable depends on temperature and humidity. Therefore, local
ambient temperature and humidity factor must be considered for accurate and
precise distance measurements. The formula for speed of sound in air with
temperature and humidity factor is given below:
C = 331.4 + (0.606 * T) + (0.0124 * H)
“C” is speed of sound in meters per second (m/s), “331.4” is speed of sound at
temperature 0 degree Celsius and at humidity 0%, “T” is temperature in degree
Celsius and “H” is % humidity (relative humidity).
13.1.1.2 SRF08 Ultrasonic Ranger
The SRF08 (shown in figure 51, is one of the advanced models of Ultrasonic
distance rangers. It comes with an excellent width-of-field detection, requires less
power to operate, its range to measure distances is wide enough from 3cm to 6m
and it can also be fitted with an LDR to measure light levels. This is one of the perfect
devices that can be used for projects requiring accurate ranging information. SRF08
uses I2C bus to communicate with microcontrollers.
Figure 50 Devantech SRF08 UltraSonic Ranger (coecsl.ece.illinois.edu, 2017)
pg. 79 Zeeshan Ansari (s09466807)
As it uses I2C interface which means that 16 sensors can be chained up in a
single string. SRF08 comes with configurable addresses which makes it possible to
hook more than one address at a time in the same chain. Detailed specifications are
given below:
Range: 3 to 600cm (1.18" to 19.7')
Power: 5V, 15mA (typ), 3mA standby
Frequency: 40kHz
Size: 43mm x 20mm x 17mm tall (1.69" x 0.79" x 0.67 tall)
Connections: I2C
Analogue gain: Variable - 94 to 1025 in 32 steps
Light Sensor: Front Facing, value read/stored at each ranging request
Timing: Autonomous - no host controller timing required
Echo: Multiple echo - keeps looking after first echo
Units: Reports back range in microseconds (uS), mm, or inches
(coecsl.ece.illinois.edu, 2017).
This follows the I2C bus protocol that is used as a protocol to communicate
between the SRF08 sensor and microcontroller.
13.1.1.3 I2C Bus Protocol
I2C which stands for Inter-Integrated Circuit and pronounced as “I-squared-C”
or “I-two-C” is a serial protocol for two-wire interface, to further describe, it’s a multi-
master, multi-slave, single ended computer bus. It is used to connect low-speed
peripherals i.e. ICs to microprocessors and/or microcontrollers within short distances.
Implementation of I2C protocols requires no fees, however to obtain I2C slaves
addresses, one has to pay to NXP which allocates them.
The physical I2C bus has two wires SCL (Clock line) and SDA (Data line). SCL
is used to synchronise all data transfers over the I2C bus. SCL and SDA lines are
attached to all devices on the I2C bus. Third wire is also used here which is the
ground or 0 volts. Originally both SCL and SDA only give low output, to obtain high
output pull-up resistors must be attached with the lines to the 5V supply as shown
below in the figure 52.
pg. 80 Zeeshan Ansari (s09466807)
Figure 51 Using the I2C Bus, SCL & SDA (Robot-electronics.co.uk, 2017)
If SCL and SDA lines are missing pull-up resistors, the outputs will always be 0
volts and consequently I2C bus will be non-functional. I2C bus has either masters or
slaves devices. Only master device(s) can drive the SCL clock line whereas slave
devices respond to the master. In this project, Atmega2560 is master and SRF08 is
slave device. Master and slave(s), both devices can transfer data over the I2C bus
whereas it is only controlled by the master.
In I2C physical protocol (shown below in figure 53), the master device
communicates with slave by issuing a start sequence on the I2C bus. I2C bus has
started and stop sequences (shown below in the figure). This is where SDA is
allowed to change while SCL is high. And when the data is being transferred, SDA
has to remain stable and not change whilst the SCL is high. The start and stop
sequences also mark the end and beginning of a transaction within the slave device.
Figure 52 Start and Stop Sequences (Robot-electronics.co.uk, 2017)
Data transfer (shown below in figure 54), takes place in sequences of 8 bits.
Every time the 8 bits are transferred to a device, it sends back an acknowledge bit
which shows that there are actually 9 SCL clock pulses to transfer each 8 bits of
data. How it further operates is that when receiving device sends back a low ACK bit
it means data is received and its ready to accept more data and if it sends back a
high ACK bit then it indicates that no more data can be accepted and the master
should stop the transfer by sending a stop sequence.
pg. 81 Zeeshan Ansari (s09466807)
Figure 53 Data Transfer (Robot-electronics.co.uk, 2017)
I2C has a standard clock speed of up to 100 KHz. It has addresses which are
either 7 bits or 10 bits. This project uses 7 bits addresses which means that it will
allow up to 128 devices on the I2C bus as a 7 bit number can be from 0 to 127. To
send a 7 bit address, 8 bits are sent and this extra eighth bit is used to inform the
slave if the master is writing to it or reading from it. If the bit is 0, then the master is
writing to the slave and vice versa when the bit is 1.
The code researched for sensor implementation is also given in “APPENDIX E
– Future Work Further Research” This appendix also include a little bit more research
about further improvement on Spicar robot.
Another interesting feature that can be incorporated in Spicar is interfacing with
Android/ Apple iOS telephones through Arduino Mega 2560 board. This way Spicar
robot can be controlled through android/Apple iOS telephones by using their WI-FI or
Bluetooth technologies. Typical applications include would then include robust
Search & Rescue, reconnaissance, extra-terrestrial explorations etc.
pg. 82 Zeeshan Ansari (s09466807)
14 References
[1] Jakimovski, B., Hoerenz, M., Kotke, M. and Maehle, E. (2017). Design of a
hybrid wheeled-legged robot - WheeHy - IEEE Xplore Document. [online]
Ieeexplore.ieee.org. Available at:
http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=5756943 [Accessed 24
Mar. 2017].
[2] Saudabayev, A., Kungozhin, F., Nurseitov, D. and Varol, H. (2017).
Locomotion Strategy Selection for a Hybrid Mobile Robot Using Time of Flight Depth
Sensor. [online] Available at: https://www.hindawi.com/journals/js/2015/425732/
[Accessed 4 Feb. 2017].
[3] Leppänen, I. (2017). Automatic locomotion mode control of wheel-legged
robots. [online] Aaltodoc.aalto.fi. Available at:
https://aaltodoc.aalto.fi/handle/123456789/2915 [Accessed 6 Mar. 2017].
[4] Tedeschi, F. and Carbone, G. (2014). Design Issues for Hexapod Walking
Robots. Robotics, 3(2), pp.181-206.
[5] Robotshop.com. (2017). Makeblock mBot v1.0 Blue Educational
Programmable Robot (Bluetooth). [online] Available at:
http://www.robotshop.com/uk/makeblock-mbot-blue-educational-programmable-
robot-bluetooth-version.html [Accessed 9 Feb. 2017].
[6] Robotshop.com. (2017). LEGO® MINDSTORMS® EV3 (EU Version).
[online] Available at: http://www.robotshop.com/uk/lego-mindstorms-ev3-eu-
version.html [Accessed 11 Feb. 2017].
[7] Robotshop.com. (2017). Lynxmotion AH2 Hexapod Robot Kit
(BotBoarduino). [online] Available at: http://www.robotshop.com/uk/lynxmotion-ah2-
hexapod-robot-kit-botboarduino.html [Accessed 10 Apr. 2017].
[8] banggood.com. (2017). DIY SIX FEET ROBOT 6-LEGGED 6DOF
HEXAPOD4 SPIDER ROBOT WITH SERVO. [online] Available at:
http://www.banggood.com/DIY-Six-Feet-Robot-6-Legged-6DOF-Hexapod4-Spider-
Robot-with-Servo-p-1029370.html [Accessed 7 Mar. 2017].
[9] Societyofrobots.com. (2017). How to Build a Robot Tutorials - Society of
Robots. [online] Available at: http://www.societyofrobots.com/axon2/ [Accessed 13
Feb. 2017].
[10] Robotshop.com. (2017). Dagu Spider Robot Controller. [online] Available
pg. 83 Zeeshan Ansari (s09466807)
at: http://www.robotshop.com/uk/dagu-spider-robot-controller.html [Accessed 8 Apr.
2017].
[11] cdn.sparkfun.com. (2017). Red Back Spider Robot Controller. [online]
Available at: http://cdn.sparkfun.com/datasheets/Robotics/SpiderControllerDagu.pdf
[Accessed 10 Feb. 2017].
[12] Circuitdigest.com. (2017). Servo Motor Basics, Working Principle & Theory.
[online] Available at: https://circuitdigest.com/article/servo-motor-basics [Accessed 2
Feb. 2017].
[13] micropik.com. (2017). SG90 9g Micro Servo. [online] Available at:
http://www.micropik.com/PDF/SG90Servo.pdf [Accessed 6 Apr. 2017].
[14] Daware, K. (2017). How does a servo motor work?. [online]
Electricaleasy.com. Available at: http://www.electricaleasy.com/2015/01/how-does-
servo-motor-work.html [Accessed 7 Feb. 2017].
[15] Robotplatform.com. (2017). Robot Platform | Knowledge | How Servo
Works?. [online] Available at:
http://www.robotplatform.com/knowledge/servo/what_makes_a_servo.html
[Accessed 5 Mar. 2017].
[16] Tigertek.com. (2017). Servo Motor Applications - List of Common Industrial
Applications for Servos. [online] Available at: http://www.tigertek.com/servo-motor-
resources/common-servo-motor-applications.html [Accessed 9 Mar. 2017].
[17] Pololu.com. (2017). Pololu - 250:1 Micro Metal Gearmotor MP 6V with
Extended Motor Shaft. [online] Available at: https://www.pololu.com/product/2384
[Accessed 3 Mar. 2017].
[18] Skylightupower.com. (2017). 8 Difference Between Nimh vs Lipo Battery.
[online] Available at: http://www.skylightupower.com/8-difference-of-nimh-vs-lipo-
battery [Accessed 7 Feb. 2017].
[19] produktinfo.conrad.com. (2017). Conrad Energy. [online] Available at:
http://www.produktinfo.conrad.com/datenblaetter/225000-249999/239029-si-01-en-
7_4_V_LIPO_FLUGAKKU_450_MAH___30_C.pdf [Accessed 24 Feb. 2017].
[20] Bruce, J. (2017). What Is Arduino & What Can You Do With It? [Technology
Explained]. [online] MakeUseOf. Available at:
http://www.makeuseof.com/tag/arduino-technology-explained/ [Accessed 22 Mar.
2017].
pg. 84 Zeeshan Ansari (s09466807)
[21] Arduino.cc. (2017). Arduino - Introduction. [online] Available at:
https://www.arduino.cc/en/Guide/Introduction [Accessed 17 Feb. 2017].
[22] cms.gov. (2017). SELECTING A DEVELOPMENT APPROACH. [online]
Available at: https://www.cms.gov/research-statistics-data-and-systems/cms-
information-technology/xlc/downloads/selectingdevelopmentapproach.pdf [Accessed
19 Feb. 2017].
[23] Bowes, J. (2017). Agile vs Waterfall - Comparing project management
methods. [online] Manifesto. Available at: https://manifesto.co.uk/agile-vs-waterfall-
comparing-project-management-methodologies/ [Accessed 16 Mar. 2017].
[24] Johns, B. (2017). DESIGN AND CONTROL OF A NEW
RECONFIGURABLE ROBOTIC MOBILITY PLATFORM. [online]
Smartech.gatech.edu. Available at:
https://smartech.gatech.edu/bitstream/handle/1853/14632/johns_byron_e_200705_m
ast.pdf?sequence=1&isAllowed=y [Accessed 15 Apr. 2017].
[25] Thomas, T. (2017). What is Solidworks CAD Software?. [online]
ShoutMeTutorials.com. Available at: http://shoutmetutorials.com/solidworks-basics/
[Accessed 26 Apr. 2014].
[26] Do, A. (2017). Hexapod Gait Analysis – Arxterra. [online] Arxterra.com.
Available at: http://www.arxterra.com/hexapod-gait-description/ [Accessed 1 Mar.
2017].
[27] McComb, G. (2017). Build a 12-Servo Hexapod. [online] Robotoid.com.
Available at: http://www.robotoid.com/appnotes/project-build-12-servo-hexapod.html
[Accessed 7 Mar. 2017].
[28] coecsl.ece.illinois.edu. (2017). Devantech SRF08 UltraSonic Ranger.
[online] Available at:
http://coecsl.ece.illinois.edu/ge423/DevantechSRF08UltraSonicRanger.pdf
[Accessed 5 Feb. 2017].
[29] Robot-electronics.co.uk. (2017). I2C tutorial. [online] Available at:
http://www.robot-electronics.co.uk/i2c-tutorial [Accessed 4 Apr. 2017].
pg. 85 Zeeshan Ansari (s09466807)
15 Bibliography
[1] Nehmzow, U. (2003). Mobile robotics. 1st ed. London: Springer, pp.7-11, 25-
30.
[2] Bekey, G. (2005). Autonomous robots. 1st ed. Cambridge, Mass.: MIT
Press, pp.185-188, 199-203.
3 Br unl, T. (2008). Embedded robotics. 1st ed. Berlin: Springer.
[4] Van Sickle, T. (2001). Programming microcontrollers in C. 1st ed. Eagle
Rock, Calif.: LLH Technology Pub., pp.123-137.
[5] Predko, M. (2003). Programming robot controllers. 1st ed. New York:
McGraw-Hill, pp.42-47.
[6] Jones, J., Seiger, B. and Flynn, A. (1999). Mobile robots. 1st ed. Natick,
Mass.: A.K. Peters.
pg. 86 Zeeshan Ansari (s09466807)
16 Appendix A – Walking Locomotion Code
// Fresh Code for 12 Servos Operation - Tripod Gate
// Author Zeeshan Mustafa Latif Ansari
// Institution: Birmingham City University
// BEng (Hons) Electronic Engineering
// Project: Design and Control of compact legged-wheeled robot "Spicar"
#include <Servo.h>
// #define TIBIA 45
#define DELAY 300
#define COXA_CCW 70 // CCW = counter clockwise
#define COXA_CW 100 //CW = clockwise
/*
~front~
A D
B E
C F
~back~
*/
#define UP1 92
#define DOWN1 125
int UP = UP1;
int DOWN = DOWN1;
Servo A_coxa;
Servo A_femur;
Servo B_coxa;
Servo B_femur;
pg. 87 Zeeshan Ansari (s09466807)
Servo C_coxa;
Servo C_femur;
Servo D_coxa;
Servo D_femur;
Servo E_coxa;
Servo E_femur;
Servo F_coxa;
Servo F_femur;
void setup()
{
digitalWrite(31, OUTPUT);
digitalWrite(32, OUTPUT);
digitalWrite(34, OUTPUT);
digitalWrite(35, OUTPUT);
digitalWrite(37, OUTPUT);
digitalWrite(38, OUTPUT);
digitalWrite(40, OUTPUT);
digitalWrite(41, OUTPUT);
digitalWrite(43, OUTPUT);
digitalWrite(44, OUTPUT);
digitalWrite(46, OUTPUT);
digitalWrite(47, OUTPUT);
pinMode(31, OUTPUT);
pinMode(32, OUTPUT);
pinMode(34, OUTPUT);
pinMode(35, OUTPUT);
pinMode(37, OUTPUT);
pg. 88 Zeeshan Ansari (s09466807)
pinMode(38, OUTPUT);
pinMode(40, OUTPUT);
pinMode(41, OUTPUT);
pinMode(43, OUTPUT);
pinMode(44, OUTPUT);
pinMode(46, OUTPUT);
pinMode(47, OUTPUT);
// pinMode(49, OUTPUT);
A_coxa.attach(31);
A_femur.attach(32);
// E_tibia.attach(33);
B_coxa.attach(34);
B_femur.attach(35);
// B_tibia.attach(36);
C_coxa.attach(37);
C_femur.attach(38);
// C_tibia.attach(39);
D_coxa.attach(40);
D_femur.attach(41);
// D_tibia.attach(42);
E_coxa.attach(43);
E_femur.attach(44);
// E_tibia.attach(45);
F_coxa.attach(46);
F_femur.attach(47);
// F_tibia.attach(48);
}
pg. 89 Zeeshan Ansari (s09466807)
void loop() {
for (int i=0; i<=6; i++){
walkfwd();
}
for (int j=0; j<=6; j++){
walkbwd();
}
for (int l=0; l<=2; l++){
turnright();
}
for (int k=0; k<=2; k++){
turnleft();
}
}
void walkfwd()
{
// tibia();
f1();
f2();
f3();
f4();
};
void walkbwd()
{
// tibia();
b1();
b2();
pg. 90 Zeeshan Ansari (s09466807)
b3();
b4();
};
void turnright()
{
// tibia();
r1();
r2();
r3();
r4();
};
void turnleft()
{
// tibia();
l1();
l2();
l3();
l4();
};
/* void tibia()
{
A_tibia.write(TIBIA);
B_tibia.write(TIBIA);
C_tibia.write(TIBIA);
D_tibia.write(TIBIA);
E_tibia.write(TIBIA);
F_tibia.write(TIBIA);
}
*/
// ~~~~~~~~~~fwd~~~~~~~~~~ //
pg. 91 Zeeshan Ansari (s09466807)
void f1()
{
// [COXA] changed
A_coxa.write(COXA_CW);
C_coxa.write(COXA_CW);
E_coxa.write(COXA_CCW);
D_coxa.write(COXA_CW);
F_coxa.write(COXA_CW);
B_coxa.write(COXA_CCW);
delay(DELAY);
};
void f2()
{
// [FEMUR] changed
A_femur.write(DOWN);
C_femur.write(DOWN);
E_femur.write(DOWN);
D_femur.write(UP);
F_femur.write(UP);
B_femur.write(UP);
delay(DELAY);
};
void f3()
{
// [COXA] changed
A_coxa.write(COXA_CCW);
C_coxa.write(COXA_CCW);
E_coxa.write(COXA_CW);
D_coxa.write(COXA_CCW);
pg. 92 Zeeshan Ansari (s09466807)
F_coxa.write(COXA_CCW);
B_coxa.write(COXA_CW);
delay(DELAY);
};
void f4()
{
// [FEMUR] changed
A_femur.write(UP);
C_femur.write(UP);
E_femur.write(UP);
D_femur.write(DOWN);
F_femur.write(DOWN);
B_femur.write(DOWN);
delay(DELAY);
};
// ~~~~~~~~~~bwd~~~~~~~~~~ //
void b1()
{
// [COXA] changed
A_coxa.write(COXA_CCW);
C_coxa.write(COXA_CCW);
E_coxa.write(COXA_CW);
D_coxa.write(COXA_CCW);
F_coxa.write(COXA_CCW);
B_coxa.write(COXA_CW);
delay(DELAY);
};
void b2()
{
pg. 93 Zeeshan Ansari (s09466807)
// [FEMUR] changed
A_femur.write(DOWN);
C_femur.write(DOWN);
E_femur.write(DOWN);
D_femur.write(UP);
F_femur.write(UP);
B_femur.write(UP);
delay(DELAY);
};
void b3()
{
// [COXA] changed
A_coxa.write(COXA_CW);
C_coxa.write(COXA_CW);
E_coxa.write(COXA_CCW);
D_coxa.write(COXA_CW);
F_coxa.write(COXA_CW);
B_coxa.write(COXA_CCW);
delay(DELAY);
};
void b4()
{
// [FEMUR] changed
A_femur.write(UP);
C_femur.write(UP);
E_femur.write(UP);
D_femur.write(DOWN);
F_femur.write(DOWN);
B_femur.write(DOWN);
pg. 94 Zeeshan Ansari (s09466807)
delay(DELAY);
};
// ~~~~~~~~~~right~~~~~~~~~~ //
void r1()
{
// [COXA] changed
A_coxa.write(COXA_CW);
C_coxa.write(COXA_CW);
E_coxa.write(COXA_CW);
D_coxa.write(COXA_CCW);
F_coxa.write(COXA_CCW);
B_coxa.write(COXA_CCW);
delay(DELAY);
};
void r2()
{
// [FEMUR] changed
A_femur.write(DOWN);
C_femur.write(DOWN);
E_femur.write(DOWN);
D_femur.write(UP);
F_femur.write(UP);
B_femur.write(UP);
delay(DELAY);
};
void r3()
{
// [COXA] changed
pg. 95 Zeeshan Ansari (s09466807)
A_coxa.write(COXA_CCW);
C_coxa.write(COXA_CCW);
E_coxa.write(COXA_CCW);
D_coxa.write(COXA_CW);
F_coxa.write(COXA_CW);
B_coxa.write(COXA_CW);
delay(DELAY);
};
void r4()
{
// [FEMUR] changed
A_femur.write(UP);
C_femur.write(UP);
E_femur.write(UP);
D_femur.write(DOWN);
F_femur.write(DOWN);
B_femur.write(DOWN);
delay(DELAY);
};
// ~~~~~~~~~~left~~~~~~~~~~ //
void l1()
{
// [COXA] changed
A_coxa.write(COXA_CCW);
C_coxa.write(COXA_CCW);
E_coxa.write(COXA_CCW);
D_coxa.write(COXA_CW);
F_coxa.write(COXA_CW);
pg. 96 Zeeshan Ansari (s09466807)
B_coxa.write(COXA_CW);
delay(DELAY);
};
void l2()
{
// [FEMUR] changed
A_femur.write(DOWN);
C_femur.write(DOWN);
E_femur.write(DOWN);
D_femur.write(UP);
F_femur.write(UP);
B_femur.write(UP);
delay(DELAY);
};
void l3()
{
// [COXA] changed
A_coxa.write(COXA_CW);
C_coxa.write(COXA_CW);
E_coxa.write(COXA_CW);
D_coxa.write(COXA_CCW);
F_coxa.write(COXA_CCW);
B_coxa.write(COXA_CCW);
delay(DELAY);
};
void l4()
{
// [FEMUR] changed
A_femur.write(UP);
pg. 97 Zeeshan Ansari (s09466807)
C_femur.write(UP);
E_femur.write(UP);
D_femur.write(DOWN);
F_femur.write(DOWN);
B_femur.write(DOWN);
delay(DELAY);
};
pg. 98 Zeeshan Ansari (s09466807)
17 APPENDIX B – Rolling Locomotion Code
// Date: 08th of May 2017
// Title: How to Control DC Motors Using Arduino
// Code by HackARobot in Arduino
// URL: http://www.instructables.com/id/How-to-control-DC-motors-using-
Arduino/
// Pins Controller Motors
#define motor1_pos 3 // Control pin 3 for motor 1_pos
#define motor1_neg 10 // Control pin 10 for motor 1_neg
#define motor2_pos 6 // Control pin 6 for motor2_pos
#define motor2_neg 9 // Control pin 9 for motor2_neg
#define motor_en A2 // Enable motor driver using anologue pin A2
void setup()
{
Serial.begin(57600); // opens serial port, sets data rate to 57600 bps
setupMotor();
}
void loop()
{
robotForward(1000); // Move Forward
robotLeft(1000); // Move Left
robotBackward(1000); // Move Backward
robotRight(1000); // Move Right
robotStop(500); //Stop for 5 seconds
}
void setupMotor() {
pinMode(motor1_pos,OUTPUT); // Configures motor1_pos (Pin) as output
pg. 99 Zeeshan Ansari (s09466807)
pinMode(motor1_neg,OUTPUT); // Configures motor1_neg (Pin) as output
pinMode(motor2_pos,OUTPUT); // Configures motor2_pos (Pin) as output
pinMode(motor2_neg,OUTPUT); // Configures motor2_neg (Pin) as output
pinMode(motor_en,OUTPUT); // // Configures motor_en (Pin) as output
enableMotor();
robotStop(50);
}
//-----------------------------------------------------------------------------------------------------
// motor
//-----------------------------------------------------------------------------------------------------
void enableMotor() {
//Turn on the motor driver chip : L293D
digitalWrite(motor_en, HIGH);
}
void disableMotor() {
//Turn off the motor driver chip : L293D
digitalWrite(motor_en, LOW);
}
// Stop Robot //
void robotStop(int ms){
digitalWrite(motor1_pos, LOW);
digitalWrite(motor1_neg, LOW);
digitalWrite(motor2_pos, LOW);
digitalWrite(motor2_neg, LOW);
delay(ms);
}
// Move Robot Forward //
pg. 100 Zeeshan Ansari (s09466807)
void robotForward(int ms){
digitalWrite(motor1_pos, HIGH);
digitalWrite(motor1_neg, LOW);
digitalWrite(motor2_pos, HIGH);
digitalWrite(motor2_neg, LOW);
delay(ms);
}
// Move Robot Backward //
void robotBackward(int ms){
digitalWrite(motor1_pos, LOW);
digitalWrite(motor1_neg, HIGH);
digitalWrite(motor2_pos, LOW);
digitalWrite(motor2_neg, HIGH);
delay(ms);
}
// Move Robot Right //
void robotRight(int ms){
digitalWrite(motor1_pos, LOW);
digitalWrite(motor1_neg, HIGH);
digitalWrite(motor2_pos, HIGH);
digitalWrite(motor2_neg, LOW);
delay(ms);
}
// Move Robot Left
void robotLeft(int ms){
digitalWrite(motor1_pos, HIGH);
digitalWrite(motor1_neg, LOW);
digitalWrite(motor2_pos, LOW);
digitalWrite(motor2_neg, HIGH);
delay(ms);
}
pg. 101 Zeeshan Ansari (s09466807)
18 APPENDIX C – Hardware Components and Prices
Sr.
No
.
Componen
t
Function
Specification
Quanti
ty
Price
1 Robot
Chassis
DIY Six Feet Hexapod4 robot 6-
legged
6DOF (Degree of freedom)
Size: 24(L)*18(W)*12(H)
1 £27
2 Micro-
controller
Provide
control on
the Spicar
robot
ATmega2560 16MHz CPU
128K FLASH, 8K SRAM and 4K
EEPROM
70 I/O pins with male and female
headers
16 x 10bit analog inputs
15 x 8bit PWM outputs
1 £54
3 Servo
motors
For
movement
of Leg joints
Tower Pro Micro Servo 9g –
SG90
Dimensions: 22.2*11.8*31mm
approx.
Operation speed: 0.1 s/60 degree
Operating Voltage: 4.8 V (~5V)
Dead Band Width: 10 μs
Temperature range: 0°C - 55 °C.
12 £20
4 DC motors For
movement
of wheels
Size: 10 × 12 × 26 mm1
Weight: 9.5 g
Shaft diameter: 3 mm2
Gear ratio: 9.96:1
Free-run speed @ 6V: 2200 rpm
Free-run current @ 6V: 40 mA
Stall current @ 6V: 700 mA
Stall torque @ 6V: 3 oz·in
Extended motor shaft?: Y
2 £30
pg. 102 Zeeshan Ansari (s09466807)
Motor type: 0.7A stall @ 6V (MP
6V)
5 Wheels and
brackets
Wheels for
rolling
forward &
backward
Wheels Diameter: 2.8mm 4 £2
6 Axle Rod for
wheels
Size: M5 1 £1
7 M3 nuts
and bolts
To tighten
robot parts
and wheel
brackets
Size: M3 20 £6
8 Battery To supply
power
1 £7
TOTAL
£147
19 APPENDIX D – Project Proposal
Project proposal is attached as a separate document because it was not copying
here properly; it was damaging the format of this report. Please refer to separate
document.
pg. 103 Zeeshan Ansari (s09466807)
20 APPENDIX E – Future Work Further Research
20.1 Sensor Implementation Code:
///////////////////////////////////////////////////////////////
// Arduino ROBOT v0.1 //
// //
// http://www.educ8s.tv //
/////////////////////////////////////////////////////////////
#include <AFMotor.h>
#include <NewPing.h>
#include <Servo.h>
#define TRIG_PIN A4
#define ECHO_PIN A5
#define MAX_DISTANCE 200
#define MAX_SPEED 190 // sets speed of DC motors
#define MAX_SPEED_OFFSET 20
NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE);
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(3, MOTOR12_1KHZ);
Servo myservo;
boolean goesForward=false;
int distance = 100;
int speedSet = 0;
void setup() {
myservo.attach(9);
myservo.write(115);
pg. 104 Zeeshan Ansari (s09466807)
delay(2000);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
}
void loop() {
int distanceR = 0;
int distanceL = 0;
delay(40);
if(distance<=15)
{
moveStop();
delay(100);
moveBackward();
delay(300);
moveStop();
delay(200);
distanceR = lookRight();
delay(200);
distanceL = lookLeft();
delay(200);
if(distanceR>=distanceL)
{
turnRight();
moveStop();
}else
pg. 105 Zeeshan Ansari (s09466807)
{
turnLeft();
moveStop();
}
}else
{
moveForward();
}
distance = readPing();
}
int lookRight()
{
myservo.write(50);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
}
int lookLeft()
{
myservo.write(170);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
delay(100);
}
int readPing() {
delay(70);
pg. 106 Zeeshan Ansari (s09466807)
int cm = sonar.ping_cm();
if(cm==0)
{
cm = 250;
}
return cm;
}
void moveStop() {
motor1.run(RELEASE);
motor2.run(RELEASE);
}
void moveForward() {
if(!goesForward)
{
goesForward=true;
motor1.run(FORWARD);
motor2.run(FORWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring
the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet+MAX_SPEED_OFFSET);
delay(5);
}
}
}
void moveBackward() {
goesForward=false;
motor1.run(BACKWARD);
motor2.run(BACKWARD);
pg. 107 Zeeshan Ansari (s09466807)
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the
speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet+MAX_SPEED_OFFSET);
delay(5);
}
}
void turnRight() {
motor1.run(FORWARD);
motor2.run(BACKWARD);
delay(300);
motor1.run(FORWARD);
motor2.run(FORWARD);
}
void turnLeft() {
motor1.run(BACKWARD);
motor2.run(FORWARD);
delay(300);
motor1.run(FORWARD);
motor2.run(FORWARD);
}
20.2 Research for Further Useful Improvements
Use Opto-Isolators, Why?, Detail, Justification and Recommendations. URL: http://www.arxterra.com/opto-isolator/
Use Voltage Regulator, Why?, Detail, Justification and
Recommendations. URL: http://www.arxterra.com/voltage-regulator/ Arduino Robot Project: A DIY obstacle avoiding robot using an SG90
servo and Ultrasonic Sensor. URL: https://www.youtube.com/watch?v=6TB0F_7SZHg URL for Code: http://educ8s.tv/arduino-robot-easy-diy-project/
pg. 108 Zeeshan Ansari (s09466807)
Arduino: How To Build An Obstacle Avoiding Robot. URL:
https://www.youtube.com/watch?v=t3kXWSctj2Q How to connect a SRF05 to a SPIDER controller? URL:
http://www.robotshop.com/letsmakerobots/how-connect-a-srf05-a-spider-controller