Sei sulla pagina 1di 83

1

CHAPTER I

INTRODUCTION

1.1

Introduction

The obstacles avoidance robot is widely use recently either as the favourite student
projects or as a robotic kits that can be bought for a reasonable price. It also made as
a toy for the children. The robot that based on the hardware and the software was a
simple constructed robot that able to attract people as it can avoid the obstacles in
front by using motion sensor as the input and the controller will control the motor to
move the robot so it can avoid the obstacles.
The concept of obstacles avoidance robot was so many that it can be applied
at any systems, applications, and also machines. In this project, the obstacles
avoidance robot concept will be used as a device for the baby walker application
with some modification so it can be implement on the baby walker.

1.2

Problem Statement

Dr. Joan Shook (1998), chief of the Emergency Medicine Service at Texas Children's
Hospital reported that nearly 20,000 children are treated in emergency rooms each
year for baby walker-related injuries. The devices, long considered an easy and
entertaining way to occupy a child's time and provide exercise, can gather speed
quickly moving as fast as four feet per second and put children at risk for falls and
give them access to other hazards.

The physicians group says children in baby walkers can roll down the stairs
and it may cause breaking bones or injuring their heads and also drown by falling
into a pool, bathtub, or toilet while in a walker. The majority of children with baby
walker-related injuries fall down stairs are 80 percent and many of them sustain
serious head injuries (Neil Villette, 2001). On April 7, 2004, Canada became the first
country ever to ban the sale, importation and advertisement of baby walkers.

1.3

Project Background

The main purpose of this project is to design a distance controller for the baby walker
to prevent children from serious injuries causing by fall down from stairways and
also other hazards. By using the basic concept of obstacles avoidance robot, this
device used ultrasonic sensor to detect far from the fixed distance for example the
stairs, and by using microcontroller, it will control the motor to stop the baby walker
from falling down from the stairs.

1.4

Objectives of The Project

The main objective of designing the baby walker distance controller is more
concentrate on the device itself and not the baby walker. There are some objectives
for this project:
i.

To use the ultrasonic sensor as the input and the motor as the output of
the controller.

ii.

To study and understand the application and program for PIC


microcontroller.

iii.

To design the distance controller circuit by using microcontroller in


the circuit.

iv.

1.5

To construct the distance controller and place it at the baby walker.

Scopes of The Project

The few topics defined in the scope of the project and there are:
i.

MPLAB IDE software was used to program the PIC microcontroller


from the assembly language.

ii.

Design a distance controller that can detect the stairs.

iii.

The motor controlled by PIC microcontroller and received the signal


from ultrasonic sensor.

1.6

Summary

In this chapter, the main problem is there are children treated in emergency rooms
each year for baby walker-related injuries that put children at risk for falls and gives
them access to other hazards. The main purpose of this project is to design a distance
controller for the baby walker to prevent children from serious injuries causing by
fall down from stairways. The project objectives and scopes was explained to
specified the components and softwares that been used during the project
construction.

CHAPTER II

LITERATURE REVIEW

2.1

Introduction

The details of the component and also device that will be use for this project is
explained in this chapter. The main objective is to understand each component and
also devices that will be use in this project. This is to ensure there will be fewer
problems when using this component and device during the project progress.

2.2

Previous Case Study

The background of this project was formed based on several topics. Some principles,
application and knowledge in this project obtained from these researches based on
journals, thesis and also technical papers. By following the previous literature case,
several information and data was collected and compared to specify the research and
also to prevent the problems in the previous research.
By studying the previous related project, the cost of project construction can
be reduced by determine and calculate the component that was used only for the
project.

2.2.1

Case Study 1

Project Report Title: Ultrasonic Obstacle Avoidance by Using PIC


Microcontroller
Author: Sivananthan A/L Subramaniam
Year: 2008
This project discuss on the design and construction of an obstacles avoidance mobile
robot. This robot moved on a flat surface using the wheels. The robot construction
consists of two major parts which are the project planning, hardware design
including chassis and circuit design, and the software development.
This robot moved using four wheels which two wheels located at the bottom
of the robot by using DC motor with gearbox assisted by the programmed instruction
from microcontroller. The other two wheels were installed at the front part of the
robot for stabilizing the body.
In order to properly avoid objects like human, the robot was designed with
sensors, and this sensor was mounted of the robot so that they could be rotated either
left or right. Sensing system of the robot consists of ultrasonic sensor (Sivananthan
A/L Subramaniam, 2008, page vi). The overall system of the obstacles avoidance
mobile robot controlled by PIC (Peripheral Integrated Controller) 16F84A
microcontroller from Microchip, while the programming was written in assembly
language using MPLAB IDE compiler.
By studied this case for this project, the construction of Ultrasonic Obstacle
Avoidance by Using PIC Microcontroller seems to be well with the ultrasonic
sensors as the input to the PIC16F84A microcontroller and control the DC motor to
avoid the obstacle.

2.2.2

Case Study 2

Project Report Title: Autonomous Mobile Robot


Author: Mohd Hafiz Bin Kosni
Year: 2003
This project discuss on the design and construction of an autonomous robot that
moved on a flat surface by the wheels. The design and construction for this robot
consist of two major parts which was the software development and the hardware
design including the chassis of the robot and the wheel, where all the circuit are
attach to it. This robot moved using four wheels which two wheels assembled at the
bottom of the robot by using DC motor with gearbox assisted by the programmed
instruction from microcontroller. The other two wheels were fixed at the front part
of the robot for stabilizing the body.
This robot had an arm and also a grabber at the end of arm to take the
detected object by the infrared sensor mounted at the front of the robot. The
autonomous robot moves by itself as it can avoid obstacle without any outside
assistance. This is because the robot has three ultrasonic sensors mounted at left,
right, and also at the middle of the front robot (Mohd Hafiz Bin Kosni, 2003, page
vi).
In this project report, the PIC16F84A microcontroller acts as a brain of the
robot control the robot movement including robot arm. The programming was
written in assembly language using Code Designer Lite software. However some
objective was not succeeding because of the problem with program instruction for
microcontroller. But the design of the robot including used an Ackermann steering
seems to be well. DC motor, stator motor and stepper motor was used in this project.

2.2.3

Case Study 3

Project Report Title: A Mobile Robot Using PIC16F84A Microcontroller


Author: Tan Yann-Yun
Year: 2002
This project discuss about the problem of avoid the obstacles for a two wheeled
mobile robot with a supporting rod at the front to stabilized the robot. The robot is
equipped with sensors to detect and avoid objects in its path. The construction of the
robot consist of chassis, sensors (infrared sensor), motor (DC motor with gearbox),
motor driver (L293B) and PIC16F84 microcontroller as a robot brain.
This robot moves with two wheels that were attached on two motors with a
supporting rod at the front to stabilize the robot. Two DC motors were used to propel
the robot. However, DC motor usually spins too fast and has too little torque to drive
the loads of the wheels. Gear reduction was required to slow down the rotation
speed and increase the torque of the motors. The robot senses the obstacles through
the infrared sensors installed at the front of the robot. A bump switch installed on the
robot acts as a backup for the infrared detection system.
The robot steers by individually changing the direction of its drive motor, so
the robot able to turns in the direction of the stopped or reversed wheel (Tan YannYun, 2002, page v). The result for this project is robot capable to sense the obstacles
through the sensors installed at the robot.
This project only used in an indoor application. The robot by itself to the
desired destination using ultrasonic sensor and avoid any obstacles. Two DC motors
were used in the robot. The program instruction for microcontroller is the key for
accomplish the objective for the project.

2.2.4

Case Study 4

Technical Paper Title: Design and Development PIC-Based Autonomous Robot


Author: Gow Moh Kee
Year: 2008
This technical paper is purpose to develop an autonomous robot that can move by
itself without continuous human guidance. This automation robot was overall in two
parts which were electronic parts and mechanical parts. Electronic parts were the
controller board, infrared sensors and ISD 2560 Chip Coder. The controller board
consist of microcontroller PIC16F877A, power supply unit and ST L293D motor
driver. The mechanical parts are the gearbox with DC motors and the case of the
robot.
When the robot is ON, it will sound Autonomous Robot On and move
forward. When it senses obstacle in front, it will sound Obstacle at Front,
Reversing and reverse the turn right before it continues to move forward. When it
senses obstacle at right, it will sound Obstacle at Right, Turning Left then turn left
and when it senses obstacle at left, it will sound Obstacle at Left, Turning Right
then turn right before it continues to move forward (Gow Moh Kee, 2008). As a
result, this robot is useful as a guide for blind people as it is also economic.
The project was used infrared sensor as the input of autonomous robot. The
ISD 2560 Chip Coder as the assembly language for microcontroller. These robots
have additional function that is it can talk if there is obstacle in front of the robot.
This robot was referred for the project even the microcontroller that was used is
PIC16F877A.

2.2.5

Case Study 5

Journal Title: Sensor and actuator modelling of a realistic wheeled mobile


robot simulator
Author: Jos Gonalves, Jos Lima, Hlder Oliveira and Paulo Costa
Year: 2008
The mobile robot simulator was developed in Object Pascal with its dynamics based
on the ODE (Open Dynamics Engine), allowing to develop robot software for a three
wheel omnidirectional robot equipped with infrared distance sensors and brushless
motors modelling of a realistic wheeled mobile robot simulator. The main
motivation to develop such software is to have the possibility of adding new features,
like sensors, actuators and omnidirectional wheels that were not included in the
available commercial softwares. The omnidirectional robot prototype uses brushless
motors for its locomotion because of its higher performance when compared with the
common DC motors, since DC motors dont have mechanical switching. The
purpose of such simulator was to allow the production of robot software that can be
migrated to real world systems with minimal overhead (Jos Gonalves, Jos Lima et
al., 2008). As future work, the robot simulation software developed to a real world
system.
This journal was more concentrated to the robot simulation and also Object
Pascal with its dynamics based on the ODE (Open Dynamics Engine) development
as the robot can avoid the obstacle by using infrared sensors as the input. The
brushless motor was used in the construction of the robot simulation. The
information and also the real construction of the robot were not clear, but there was a
lot of knowledge able to gain from it.

10

2.2.6

Case Study 6

Journal Title: A Novel Ultrasonic Sensing System for Autonomous Mobile


Systems.
Author: Dirk Bank
Year: 2002
This journal describes how wide angled ultrasonic transducers can be used to obtain
substantial information of the environment. The ultrasonic sensing system also
allows the detection of multiple echoes from different echo paths for each sensor. In
this way a significantly higher number of echoes can be obtained in comparison to
conventional ultrasonic sensing systems for mobile robots. In order to benefit from
the increased sensor information adequate data post processing is required.
Ultrasonic transducers were preferably used to obtain three dimensional
information of the environment. The most commonly used sonar device for mobile
robots is the well known Polaroid ultrasonic ranging system with a detection cone
30o. The ultrasonic sensors utilize the pulse echo principle.
The distance between the sensor and a reflecting object can be calculated by
multiplying the speed of sound in air by the measured "time of flight" of a short
ultrasonic pulse travelling to the object and its echo travelling back to the sensor
(Dirk Bank, 2002).
In this journal, the specific ultrasonic sensor was used to detect the distance
on real time as the knowledge of this journal shows much information of ultrasonic
sensors. The first step toward identifying the right proximity sensor for project
application is to understand the fundamental ultrasonic properties of the transmission
medium and the way they influence the measurement and system operation.

11

2.3

Ultrasonic Sensor

Ultrasonic sensor is the sensor that use the high frequency sound waves to measures
the time for the echo of targeted object by transmit the sound wave to the target and
the sound reflects back to the sensor. And the sensor computes the distance to the
target using the speed of sound in the medium. By knowing the speed of sound in
the medium, the sensor can determine the distance of the object from the transducer
element.
There are many applications for ultrasonic sensors, such as in intrusion alarm
systems, automatic door openers and backup sensors for automobiles. In this project,
the ultrasonic sensor was used for the baby walker distance controller as the input.
Figure 2.1 below shows the ultrasonic sensor.

Figure 2.1: Ultrasonic sensor (www.futurlec.com/sensors, 2006)

12

2.3.1

The Fundamental About Ultrasonic

Ultrasonic instruments are sensitive to sound frequencies above the range of human
hearing, usually over than 20 kHz (Sivananthan A/L Subramaniam, 2008, page 15).
The ultrasonic sensor transducers used as transmit the sound pulse and receive the
reflected echo, typically operating at frequencies between 40 kHz and 250 kHz.
Figure 2.2 below shows the ultrasonic emitting and detecting sound wave.

Figure 2.2: The ultrasonic emitting and detecting sound wave (Innovation One,
2005)
When voltage is applied to piezoelectric ceramics, mechanical
distortion is generated according to the voltage and frequency. On
the other hand, when vibration is applied to piezoelectric ceramics,
an electric charge is produced. By applying this principle, when an
electric signal is added to a vibrator, constructed of 2 sheets of
piezoelectric ceramics or a sheet of piezoelectric ceramics and a
metal sheet, an electric signal is radiated by flexure vibration. As a
reverse effect, when an ultrasonic vibration is added to the
vibrator, an electric signal is produced. Because of these effects,
piezoelectric ceramics are utilized as ultrasonic sensors. Figure 2.3
below shows the construction of ultrasonic sensor.

13

Figure 2.3: Construction of ultrasonic sensor (www.futurlec.com/sensors, 2006)

2.3.2

Advantages and Disadvantages of Ultrasonic Sensor

There are an advantages and disadvantages of ultrasonic sensor which were


considered as the main factor of the ultrasonic sensor.

2.3.2.1 Advantages of Ultrasonic Sensor


i.

Easy to calibrate.

ii.

Low maintenance.

iii.

Excellent linearity and lack of significant hysteresis.

iv.

Can withstand freezing temperature.

14

v.

Long-term reliability.

vi.

Not affected by high flow rates.

vii.

Not affected by fluctuating water temperature.

viii.

Non-contacting so its not affected by dirty water, floating debris, or


aquatic wildlife.

2.3.2.2 Disadvantages of Ultrasonic Sensor


i.

Affected by air temperature fluctuations.

ii.

May reflect off floating foam or debris.

iii.

Must be aligned precisely.

iv.

Maybe affected by turbulent water.

v.

If the echo lost, may displayed misleading reading.

vi.

Large beam angles cannot be used in constricted space.

vii.

Some sensors damaged by flooding (didnt waterproof).

viii.

Some delay between the time when power is first applied and the first
output.

15

2.4

Microcontroller

A Microcontroller is an electronic device which can operate on its own according to


the program which is stored in its memory and it is designed for very specific task
which is to control a particular system. It does not need to be controlled by other
interfaces once it is programmed (Sharina Binti Safiee, 2004, page 22). This
characteristic is an advantage for the microcontrollers and this is the reason why it is
being used widely in the electronics world. In this project, microcontroller was used
for the baby walker distance controller as the brain to control the motor output at
the baby walker. Figure 2.4 below shows a PIC Microcontroller.

Figure 2.4: PIC microcontroller (Microchip Technology Inc., 2001)


The reason why this project using microcontroller are because it is easy to use
and designed the program, can be interfaced with motors, read external sensors and
so on. It is also reduces the design cost. It is also able to perform math and logic
function as it can mimic sophisticated logic and electronic circuit. Other program
can make the microcontroller behave like a neural circuit or a fuzzy logic controller.
The output of the microcontroller can control direct current (DC) motor, servo motor
positioning, stepper motors and many more (Sharina Binti Safiee, 2004, page 22).

16

2.4.1

The Different Between Microcontroller and Microprocessor

Table 2.1: Microcontroller vs Microprocessor

Microcontroller
Incorporate program memory, RAM

Microprocessor
Require external components to

memory, and Input/Output resources

implement program memory, RAM

internal to the chip.

memory and Input/Output.


Need additional circuit to connect

Contains microprocessor

memory and interfacing chip through

Designed to perform a small set of

bus.
Designed to perform a wider set of

specific function.
CPU (Central Processing Unit) was

general purpose function.


CPU was designed at different part of

designed inside microcontroller.

microprocessor.
Need a big space because of purpose

Small size
Inexpensive

2.4.2

function.
Expensive

PIC16F84A Microcontroller

The PIC16F84A microcontroller is made by Microchip Technology, Inc of Chandler,


Arizona. The PIC stands for Programmable Interface Controller is the one of the
most popular microcontrollers in use today. The reason it is called a single chip
microcomputer is because an entire computer system lies within the confines of an
integrated circuit (IC) chip. Microcontrollers are embedded inside some other
device (often a consumer product) so that they can control the features or actions of
the product. Figure 2.5 below shows a PIC16F84A microcontroller.

17

Figure 2.5: PIC16F84A microcontroller (Microchip Technology Inc., 2001, page 1)


These are the details about PIC16F84A:
i. Only 35 single-word instructions to learn.
ii. The operating voltage is 2 to 6 volt.
iii. The Flash program memory contains 1K words, which translates to
1024 instructions, since each 14-bit program memory word is the
same width as each device instruction.
iv. The data memory (RAM) contains 68 byte.
v. The data memory (EEPROM) contains 64 byte.
vi. The temperature range between -40 to 85 degree celcius.
vii. There are 13 Input/Output pins that are user-configured on a pin-topin basis.
viii.Pinout compatible to 18 pin.
ix. There are two ports (PORT A and PORT B).
2.4.3

Ports

18

Ports are the group of pins on microcontroller that can access simultaneously / set
desired combination of zeros and ones. It is the physical register inside PIC
microcontroller which is connected by wires to pins. Ports also are physical
connection of CPU inside microcontroller & outside world. Ports used to
monitor/control other components or devices beside designated as input / output.
Ports are divided into two parts. First, PORT A and TRIS A. PORT A was a
5-bit wide and bi-directional port. Meanwhile TRIS A corresponding data direction
registers. When TRISA equals to 1, the corresponding PORTA pin was equals to
input (put corresponding output driver in a Hi-Impedance mode). And when TRISA
equals to 0, the corresponding PORTA pin equals to the output (put contents of
output latch on the selected pin). The second part is PORT B and TRIS B. PORT B
was an 8-bit wide and bi-directional port. Meanwhile TRIS B corresponding data
direction registers. When TRISA equals to 1, the corresponding PORTA pin was
equals to input (put corresponding output driver in a Hi-Impedance mode). And
when TRISA equals to 0, the corresponding PORTA pin equals to the output (put
contents of output latch on the selected pin) (Sharina Binti Safiee, 2004, page 30).

2.4.4

CPU (Central Processing Unit)

It is responsible for finding and fetching the right instruction to be executed. The
program instruction was fetch to decode (assembler) and it was executed into binary
form so the microcontroller understands the given instruction. Data bus & address
bus is used to connect CPU to all part of microcontroller. ALU (Arithmetic Logic
Unit) function is to add, subtract, move/shift (left & right) & logic (Sharina Binti
Safiee, 2004, page 30). The PIC16F84A contains an 8-bit arithmetic logic unit & 8bit work registers.

2.5

DC Motor

19

DC motor or direct current motor is the most common of all motors. A DC motor
works by converting electric power into mechanical work. DC motor is small,
cheap, reasonable efficient and easy to use. It works when electrical current through
loops of wires mounted on a rotating shaft. When current is flowing, loops of wire
generate a magnetic field, which reacts against the magnetic fields of permanent
magnets positioned around the wire loops. These magnetic fields push against one
another and the armature turns.
Many applications call for a high start-up torque. The DC motor has a high
torque versus falling speed characteristic and this enables it to deal with high starting
torques and to absorb sudden rises in load easily. The speed of the motor adjusts to
the load. Furthermore, the DC motor is an ideal way of achieving the miniaturisation
designers are constantly seeking because the efficiency it gives is high compared
with other designs. Figure 2.6 below shows a DC Motor.

Figure 2.6: DC Motor (www.cytron.com.my, 2010)

2.5.1

Basic Parts of DC Motor

20

The DC motor has two basic parts: the rotating part that is called the armature and
the stationary part that includes coils of wire called the field coils. The stationary
part is called the stator. The armature is made of coils of wire wrapped around the
core, and the core has an extended shaft that rotates on bearings. The ends of each
coil of wire on the armature are terminated at one end of the armature. The
termination points are called the commutator, and this is where the brushes make
electrical contact to bring electrical current from the stationary part to the rotating
part of the machine (www.sgmada.com, 2007). Figure 2.7 below shows basic parts
of DC motor.

Figure 2.7: Basic parts of DC Motor (www.sgmada.com, 2007)

2.5.2

DC Geared Motor

DC motors are constructed to operate continuously within a range of speeds near


their no-load speed. This range of speeds is generally too high for most applications.
In order to reduce this speed, a full range of geared motors is available, each with a
series of gear ratios to suit most speed requirements. The complete range is suitable
for a wide variety of applications (www.sgmada.com, 2007).
The gears have been designed for optimum performance and for maximum
life under normal operating conditions. Their main characteristic is the capacity to
withstand maximum design torque with continuous duty. Every DC geared motor

21

has a torque limit, which is the breaking torque. If this torque is applied to the
gearbox, it will cause severe damage. Figure 2.8 below shows DC geared motor.

Figure 2.8: DC Geared Motor (www.sgmada.com, 2007)

2.6

ULN 2003A High-Voltage High-Current Darlington Transistor Array

The ULN2003A is the high-voltage, high-current Darlington transistor arrays. Each


consists of seven NPN Darlington pairs that feature high-voltage outputs with
common-cathode clamp diodes for switching inductive loads. The collector-current
rating of a single Darlington pair is 500 mA. The Darlington pairs can be paralleled
for higher current capability. Applications include relay drivers, hammer drivers,
lamp drivers, display drivers (LED and gas discharge), line drivers, and logic buffers.
The ULN2003A have a 2.7-k series base resistor for each Darlington pair
for operation directly with TTL or 5-V CMOS devices. It also have 500-mA-rated
collector current for every single output. The high-voltage outputs is about 50 V
with output clamp diodes. The inputs for ULN 2003A compatible with various types
of logic (Texas Instruments, 2003, page 2). It is also used for relay-driver
applications especially for this project. Figure 2.9 below shows an ULN 2003A and
figure 2.10 below shows ULN 2003A logic diagram .

22

Figure 2.9: ULN 2003A (www.in-car-staff.com, 2001)

Figure 2.10: ULN 2003A Logic Diagram (Texas Instruments, 2003)

2.7

Summary

In this chapter, the fundamental knowledge for every each component was explained.
This is to ensure there will be fewer problems when using this component and device
during the project progress.

23

CHAPTER III

METHODOLOGY

3.1

Introduction

Methodology is a process flow from designing to development of the project. In this


chapter, the phase to construct the baby walker distance controller and also the
softwares that will be use along in this project will be describe in details. After
reviews the literature including studying the previous cases, there are three phases of
project development:
i.

The baby walker distance controller circuit design and construction.

ii.

Programming PIC16F84A.

iii.

Design the prototype of baby walker distance controller.

These selection phases involves choosing project title, the suitable circuit
with availability components, programming PIC microcontroller to meet projects
needs, the material that used to design the baby walker distance controller prototype
and project scheduling. Figure 3.1 below shows research methodology.

24

Figure 3.1: Research methodology


A research from thesis, website and others are needed to collect some
information about obstacle avoidance robot and DC motor controller using PIC
microcontroller. The information including the operation, background and literature
review. A discussion with supervisor, lecturers and friends also are helping the
research scope. Survey on parts and components electronic outlet and datasheet were
needed to build this project.
Each project encounters the problem in the process. The problem
determination was needed to identify the best solution and also the suitable
component especially ultrasonic sensors, motors and PIC microcontroller for the
application. This will lead to design the suitable circuit for this project.
The prototype for this project needs to be suitable for baby walker. It has to
be small, practical and safe. The electrical part such as infrared circuit,
microcontroller circuit and driver motor circuit were combined together in the
prototype. The whole system need to be analysed after complete the project. All the
problems need to solve until satisfied result obtain. Figure 3.2 shows the flowchart
for the project methodology.

25

Figure 3.2: The flowchart for the project methodology

26

3.2

First Stage: Circuit Design and Construction

The first stage of this project involves designing and constructing the sensor circuit
and motor control circuit. The most suitable circuit for infrared sensors and motor
has been determined. After that, numerous tests on the designed circuit were
simulated using Proteus software. Once it complete simulated, the designed circuit
were construct and performed on the prototyping board. Once it works efficiently, the
circuit design will transfer on the printed circuit board (PCB). The circuit once again
were been tested and troubleshoot, if necessary. Figure 3.3 below shows circuit
design and construction flowchart.

Figure 3.3: Circuit Design and Construction Flow Chart

27

3.3

Second Stage: Programming PIC16F84A

PIC16F84A microcontroller is the device selected for the project. Its wide operating
voltage range is about 2.0 to 5.5V. MPLAB was used to develop PIC program. It
provides a set of equivalent tools in one integrated package. Assembly code is used
because it is generally faster and requires less memory. Figure 3.4 shows PIC
program development flowchart.

Figure 3.4: PIC program development flowchart

28

3.4

Third Stage: The baby walker distance controller prototype design

To design the distance controller prototype, it must fulfil all these criteria:
i.

Small
The prototype needs to be small because it will be place below
the baby walker. The suitable motor is the main factor in designing
this project prototype. The motor needs to be in small size and have a
large torque.

ii.

Practical
The functions for this prototype need to be friendly use and it
can function as plug and play. It cannot be complicated so the
consumer doesnt have any problems on how to use it.

iii.

Safe
The important factor in designing the distance controller
prototype is it must be safe for the consumers especially for babies
who used the baby walker. The safety of the distance controller must
be for the baby and from the baby. It must safe for the baby because it
will stop the baby walker when detected stairs and it must be saved
from the baby to get hurt while using this device.

3.5

The Software Development

The most important thing in designing the baby walker distance controller is the
softwares. The softwares that being used in this project will make the project
construction became more fast, easy and efficient. Without these softwares the baby
walker distance controller maybe cannot completed on a schedule.

29

3.5.1

PROTEUS

The distance controller for the baby walker use ultrasonic sensor circuit and also
motor controller circuit as an input and output. All the circuit must be designed and
simulated to make the system works accordingly. When the simulated system circuit
works accordingly, then the circuit can be constructed on the printed circuit board
and finally the circuit can be test. The software that has been used to design and
simulate the distance controller circuit for the baby walker system is PROTEUS
software.
PROTEUS software is used to design and simulate the circuit before the
circuit is been construct. This is to make sure the circuit is functionally as desired.
This software also can analyse the simulated circuit by using the application in it.
The most interesting part in the PROTEUS software is it also able to simulate the
circuit that using the PIC microcontroller. This is can be done by inserting a certain
program file type from the MPLAB software into the PIC microcontroller. Figure
3.5 shows the Proteus Software from Labcenter Electronics.

Figure 3.5: Proteus software (www.labcenter.co.uk , 2007)

30

3.5.2

MPLAB IDE

The system works depends on the commands from the microcontroller. To program
a microcontroller, the assembly language, source code, algorithm and the
specification of the microcontroller need to be known. After the written program
successfully run without an error in the source code, the microcontroller can use the
program by compiled it with a compiler. A compiler act as a burner as it burns the
source code into the microcontroller. The program was written and assembled using
MPLAB IDE. Figure 3.6 below shows MPLAB Integrated Development
Environment (IDE).

Figure 3.6: MPLAB Integrated Development Environment (IDE)


(www.microchip.com, 2008)
MPLAB Integrated Development Environment (IDE) software is used to
program the PIC16F84A microcontroller. MPLAB IDE offers the user a complete
suite of tools that enable to write source code, compile, test and then finally program
the microcontroller. MPLAB IDE runs as 32-bit application on MS Windows, is
easy to use and includes a host of free software components for fast application
development and supercharged debugging. MPLAB IDE also serves as a single,
unified graphical user interface for additional Microchip and third party software and
hardware development tools.

31

3.6

Overall Project

The details for designing the baby walker distance controller form the system, block
diagram, flowchart, circuit diagram, programming code and also prototype design
has been explained. This is to make sure the project proceed accordingly and not
going out of track. The project scope is the important matter to make sure all the
progress is in under control.

3.6.1

Overall System Overview

The baby walker distance controller is in off condition when the baby walker moving
around as the sensor detects the fixed distance. When the sensor detects stairs (the
distance is over than the fixed distance) the controller will automatically turn on and
stop the baby walker from moving forward. The distance controller will hold the
baby walker by lift the baby walker a little bit as the wheels did not touch the ground.
The signal came from the infrared sensor and the motor is moving based the
programmed PIC16F84A microcontroller. Figure 3.7 shows a project system
overview.

Figure 3.7: Project system overview

32

3.6.2

The Project System Block Diagram

The electronic control system consists of electronic circuit, controller circuit using
PIC16F84A and motor driver. The power supply is a battery will supply the voltage
to the electronic control circuit. The DC motor will stop the baby walker if the
ultrasonic sensor detects stairs or further than fixed distance. Figure 3.8 shows the
project system block diagram.

Figure 3.8: The project system block diagram


Motor

33

3.6.3

The Project System Flow Chart

Figure 3.9 shows a structured algorithm flow chart for the project system. The
program has been written base on the flow chart given and then it was compiled to
the microcontroller. The flow chart construction usually is based on the circuit
design as it determines the input and output for the system.
This program is structured in a continuous loop. First of all, the related
register takes place, and then the program looks at the ultrasonic sensor. If the
ultrasonic sensor doesnt detect stairs (ON condition), the motor is in idle. But if the
ultrasonic sensor detect stairs (OFF condition), the program ran the next instruction
which was moving the motor to the left for about a second and it stopped
automatically after that.
The program was waited until the sensor is in ON condition again as it moved
the motor to the right for about a second and it stopped automatically after that. The
interesting part of the program is it will move the motor to the right or to the left
based on ultrasonic sensor condition.

34

Figure 3.9: The project system flow chart

35

3.6.4

The Schematic Circuit Design

In order for the baby walker distance controller to operate, it requires an electronic
circuit which is designed based on the function of the baby walker distance
controller. There are three circuits that have been used for this project which are the
voltage regulator circuit, ultrasonic sensor circuit and also motor controller circuit.
Each circuit required a voltage supply to make it function. Battery is the
most suitable to supply all these three circuits. So the schematic circuit design for
these three circuits need to be connected to the same battery as long as the loads from
the circuits are not higher than the supplied battery voltage.

3.6.4.1 Voltage Regulator Circuit


The voltage regulator circuit functions as the power supply for the motor controller
circuit. The construction of the voltage regulator circuit is consists of voltage
regulator LM 7805, and a capacitor. The power for the circuit is derived from a 12 V
DC battery and it was regulated down to 5 volt by the LM 7805 voltage regulator.
The capacitor eliminates any high frequency pulses that could otherwise interfere
with the operation of the regulator. It is also bypass the supply and helps the voltage
regulator to stabilize. Reverse polarity will destroys the regulator almost instantly.
Figure 3.10 below shows voltage regulator circuit.

Figure 3.10: Voltage Regulator Circuit

36

3.6.4.2 Ultrasonic Sensor Circuit


The ultrasonic sensor circuit was functioned as the input for the
baby walker distance controller. This ultrasonic sensor using 40
kHz frequency ultrasonic waves to detect the obstacles as it
changes its frequency slightly. Transmitter generates ultrasonic
sound and the receiver senses ultrasonic sound from the
transmitter and switches on a relay.
An ultrasonic transmitter transducer is used here to transmit
ultrasonic sound very effectively. The ultrasonic receiver circuit
used an ultrasonic receiver transducer to sense ultrasonic signals.
It also uses a two-stage amplifier, a rectifier stage, and an
operational amplifier in inverting mode. Output of op-amp is
connected to a relay through a complimentary relay driver stage.
When transmitter transmits the signal, it generates ultrasonic
sound. The sound is received by ultrasonic receiver. It converts it
to electrical variations of the same frequency. The calibration can
be made at receiver as it determines the desired range for the
ultrasonic sensor to detect the signal. These signals are amplified
by transistor and then rectified and filtered. And finally it actuates
the relay. The relay can be used to control any electrical or
electronic equipment. Figure 3.11 shows ultrasonic sensor circuit.

37

Figure 3.11: Ultrasonic sensor circuit

38

3.6.4.3 Motor Controller Circuit


The motor controller circuit is the main circuit for this project. It receives input from
ultrasonic sensor and the output was connected to the DC motor. This circuit is using
PIC16F84A microcontroller to control the motor.
The pin 17 and pin 18 of PIC16F84A microcontroller was configured as input
of the motor controller circuit are connected to the output relay of the ultrasonic
sensor circuit. Meanwhile, pin 6 and pin 7 are configured as outputs of the motor
controller circuit are connected to the pin 1 and 2 of ULN2003A Darlington
Transistor Array. The output of ULN2003A which are pin 16 and pin 15 are
connected to the relay as it supplied with 12 volt battery for the motor to run. The
motor will run depending on the output pin of the ULN2003A. The pin 9 is a
common pin that controls the supply voltage to the relay.
The 4MHz crystal oscillator was used in the motor controller circuit for the
PIC16F84A microcontroller to form its clock oscillator. The clock signal is divided
by four internally to derive the microcontroller instruction clock resulting in a 1 ns
execution time for each instruction.
Pin 14 of microcontroller is connected to the 5 volt source voltage while pin 5
is connected to the ground. For the ULN2003A, pin 8 is connected to the 5 volt
source voltage. Pin 4 of microcontroller is function as clear or reset to the
microcontroller. As the motor controller circuit for the baby walker distance
controller using a continuous program, so the pin 4 is connected to the 5 volt source
thru the 10k ohm resistor. Figure 3.12 below shows motor controller circuit.

39

Figure 3.12: Motor controller circuit

40

3.6.4.4 The Circuit Construction


After the schematic circuit for the baby walker distance controller is designed using
PROTEUS software and being successfully simulated, the next step is to construct
the circuit using breadboard to make sure the designed circuit function as desired.
The construction circuit on a breadboard also help to determine the error or to test the
circuit output especially for PIC16F84A microcontroller as it required to test either
the compiled program successfully function or not.
After the circuit function successfully, PROTEUS ARES software is used to create
the layout diagram of the circuit and print it on a Printed Circuit Board (PCB). This
software helps to design the circuit layout by placing the component at any position
and also able to decide either the circuit requires single layer layout, double layer
layout or a jumper. Figure 3.13 below shows the component position on the PCB
layout using PROTEUS ARES software for the circuit.

Figure 3.13: The component position on the PCB layout using PROTEUS ARES
software for the circuit

41

The PCB is chosen for a network connection to operate the circuit. After the
circuit has been designed by using PROTEUS ARES software, the circuit layout was
printed and finally etched on a PCB. Figure 3.14 shows the etched circuit board.

Figure 3.14: The etched circuit board

3.6.5

The PIC Programming

The project circuit will not function if there is no programme in the PIC
microcontroller. The programme is the set of instruction that was given to the PIC
microcontroller to control the output as desired. The programme that is used in this
project is assembly language programme. The reason for using this language is easy
to understand and have a small library of language. This project is not using so many
instructions so the programme writing will be not difficult and easy to understand.
MPLAB IDE software is used to write the programme. This software also
capable to compiled the programme into the PIC microcontroller. The programme
for this project was written based on the function of this project itself. The project is
about the control of the motor to stop the baby walker. So the programme basically
is to control how long the motor will turned on. Flowchart is the main key to write a
programme.

42

To start writing a programme, the PIC microcontroller types need to be set by


using Project Wizard. This is to make sure the MPLAB IDE recognize the memory
of the PIC microcontroller as there are so many of microcontroller. In this project
the PIC16F84A is used. Figure 3.15 below shows the project wizard.

Figure 3.15: Project Wizard


After that, the programme is written and by clicking at build all, the
programme writing was checked either right or wrong. Build Succeeded statement
was shown at the output if the programme writing was right. Figure 3.16 shows
statement Build Succeeded.

43

Figure 3.16: Statement Build Succeeded


After the build succeeded, the programme now can be compiled into the PIC
microcontroller by using the PIC burner.
3.6.6

The Project Design

The baby walker distance controller used two motor to stop the baby walker. The
prototype design for those two motor is the important part for this project. The
design need to be function as required which is to stop the baby walker from moving
when the ultrasonic sensor did not detect any obstacle. The design was focused to
the DC geared motor as the motor will stop the baby walker by the motor shaft is
turning clockwise or counter clockwise.
The prototype design used the screw movement concept because it is same to
the motor movement. The concept is simple, when the screw turning clockwise, it
will move the screw forward and when the screw turning anticlockwise, it will move
the screw backward. Figure 3.17 below shows the screw movement.

Figure 3.17: The screw movement


The design including the screw design, nut design, and also the casing design
for the motor. The casing for the motor is very important because it will determine

44

the range of the motor movement for the baby walker distance controller. The
prototype design specification was detailed so the construction of the prototype will
be much easier. Figure 3.18 shows the prototype design for the baby walker distance
controller.

Figure 3.18: The prototype design for the baby walker distance controller

3.6.6.1 The Project Construction


The material is the one of the most important factors in the project construction. The
criteria for the best materials that been used are it were able to carry the baby and the
baby walker weight. Normally the baby weight is about 5 to 7 kg mean while the
baby walker weight is about 2 to 3 kg. So, the total weight for the baby and the baby
walker are about 7 to 10 kg.
Steel is the material that has been chose for the baby walker distance
controller construction as it able to carry more than 10 kg of weight. This is the
reason that steel is suitable material for the project. Figure 3.19 shows the example
of steel screw that already constructed is attached with the motor.

45

Figure 3.19: The steel screw is attached with the motor

3.7

Summary

In this chapter, the methodology of the project including the research methodology,
circuit design and construction, programming PIC16F84A and also the baby walker
distance controller prototype design were explained. The softwares that were used
along in this project also were described in details.

46

CHAPTER IV

RESULT AND ANALYSIS

4.1

Introduction

From the circuits and the prototype of baby walker distance controller that is
produced, it is necessary to analyse several experiment on the product based on the
capability itself. There are four major analyses that being done for data collection
and also the capable to understand the function of the system for more further
research. The analysis for the baby walker distance controller is the motor analysis,
ultrasonic analysis, motor controller circuit analysis and also the baby walker
distance controller analysis.
Several techniques, calculations and some measurements are made for data
collection and result collection. Then the analysis from the result is being made to
get the information and also to be able to understand the function of the project that
being made.

4.2

Results

To ensure the baby walker distance controller is working properly, several of the
output can be analyse. The output of ultrasonic sensor will send a signal to the
programmed PIC microcontroller to control the motor movement. The result will
showed the written program for the PIC microcontroller and the distance controller
prototype design.

47

4.2.1 The Program For The Baby Walker Distance Controller


The program for this project was written based on the flowchart
from the figure 3.8 above. The flowchart makes the program
writing easier and formally. This is important to make sure the
program can be read and understand easily. Figure 4.1 below is the
program for the baby walker distance controller.

48

Figure 4.1: The program for the baby walker distance controller

Figure 4.1(continued): The program for the baby walker distance


controller

4.2.2 Distance Controller Prototype Design


When ultrasonic sensor detect obstacle (when there is no stairs)
the motor will rotate up and the baby walker can freely moving
around. But when ultrasonic sensor dont detect obstacle (when
there is a stair) the motor will rotate down and lift up the baby
walker so it cant move. Figure 4.2 shows the prototype design of
distance controller and figure 4.3 shows the baby walker distance

49

controller. Meanwhile figure 4.4 shows the distance controller


condition when ultrasonic sensor is ON and figure 4.5 shows the
distance controller condition when ultrasonic sensor is OFF.

Figure 4.2: Distance controller prototype design

50

Figure 4.3: The baby walker distance controller

Figure 4.4: The distance controller condition when ultrasonic sensor


is ON

Figure 4.5: The distance controller condition when ultrasonic sensor


is OFF

51

4.3

Analysis

From the circuits and the prototype of the baby walker distance
controller that is produced, it is necessary to analyse at the product
based on the capability itself. The analysis including the voltage
regulator circuit analysis, dc motor analysis, ultrasonic sensor
analysis, ultrasonic sensor analysis, and motor controller circuit
analysis.

4.3.1 Voltage Regulator Circuit Analysis


The function of voltage regulator is to decrease the high voltage
value to the desired voltage value. The desired voltage value is 5
volt. Table below shows several voltages value was tested to the
voltage regulator circuit.
Table 4.1 : The result of voltage regulator circuit output voltage

Input voltage
(volt)
Output voltage
(volt)

12

24

5.00401

5.00493

5.00863

Table 4.1 shows the result of voltage regulator circuit output


voltage. The output voltage shows that the same result even
different input voltage was tested to the regulator. This is shows
that the voltage regulator is function as desired.

52

4.3.2 DC Motor Analysis


The rpm value of DC motor was analysed to verify the speed of
motor rotation. Figure 4.6 shows tachometer that had been used to
verify the speed of motor rotation and figure 4.7 shows the motor
was tested using tachometer.

Figure 4.6: Tachometer

Figure 4.7: The motor was tested using tachometer

53

Table 4.2: The result of rpm for DC Geared Motor

Input Voltage value (Volt)

12

Motor speed r/ minute (rpm)

174.66

249.36

Table 4.2 shows the result of rpm for DC motor. The result
shows that the speed of DC motor is increased when the voltage
input is increased. This can be shown at the graph below. Figure
4.8 shows the graph of DC motor rpm proportional to voltage input.
The important of this graph is to calculate the approximate time
how long the motor will rotate. This is to ensure the motor will lift
the baby walker up to stop it.

Voltage
(V)

rpm

14
12
10
8
6
4
2
0

50

100

150

200

54

Figure 4.8: The graph of DC motor rpm proportional to voltage input

4.3.3 Ultrasonic Sensor Analysis


The analysis for the ultrasonic sensor is divided by two which are
when the sensor detect an obstacle and when the sensor not detect
an obstacle. The 40 kHz frequency is used in the ultrasonic sensor
circuit.
Figure 4.9 shows the waveform of transmitter without
obstacle. Figure 4.10 shows the waveform of receiver without
obstacle. The voltage value for transmitter is 6.88volt peak-peak
while the voltage value for receiver is 8.4mvolt peak-peak. The
result shows that when there are no obstacles, the ultrasonic
sensor waveform is stable.

Figure 4.9: The waveform of transmitter without obstacle

55

Figure 4.10: The waveform of receiver without obstacle


Figure 4.11 shows the waveform of transmitter with obstacle.
Meanwhile figure 4.12 shows the waveform of receiver with
obstacle. The voltage value for transmitter is 5.68volt peak-peak
while the voltage value for receiver is 166mvolt peak-peak. The
result shows that when there are any obstacles, the ultrasonic
sensor waveform is not stable and the voltage always changed.

Figure 4.11: The waveform of transmitter and receiver with obstacle

56

Figure 4.12: The waveform of transmitter and receiver with obstacle

4.3.4 Motor Controller Circuit Analysis


Figure 4.13 shows the input and output waveform of motor
controller circuit. When the pin RA0 of microcontroller is 1 (ON),
automatically pin RA1 is 0 (OFF), the output A is equal to -12 volt
meanwhile the output B is equal to 12 volt. This is shows that the
motor receive the voltage from output B to the output A and makes
the motor to rotate left for 1 second.

57

Figure 4.13: The input and output waveform of motor controller


circuit when RA0 = 1
Figure 4.14 shows the input and output waveform of motor
controller circuit. When the pin RA1 of microcontroller is 1 (ON),
automatically pin RA0 is 0 (OFF), the output A is equal to 12 volt
meanwhile the output B is equal to -12 volt. This is shows that the
motor receive the voltage from output A to the output B and makes
the motor to rotate right for 1 second.

58

Figure 4.14: The input and output waveform of motor controller


circuit when RA1 = 1

4.4

Summary

In this chapter, all the project constructions were finalized. The results were analysed
using several techniques to gain the information and also to be able to understand the
function of the project that being made.

59

CHAPTER V

CONCLUSION AND RECOMMENDATIONS

This project development contains three phases and which are the baby walker
distance controller circuit design and construction, the programming of PIC16F877A
and also to design the prototype of baby walker distance controller. The main
components that use in this project are ultrasonic sensors, PIC16F877A
microcontroller and servo motor. MPLAB Integrated Development Environment
(IDE) program is use to program the PIC16F877A microcontroller. From this project,
the baby walker distance controller was designed successfully. The circuit was
function as desired.

5.1

Conclusion

Designing the baby walker distance controller requires the idea of


how to stop the baby walker from falling down from the stairs. It is
very useful especially when the accident is not predictable and also
when the parents are not watching the baby. By using PIC16F84A
microcontroller chip, it is easier to control the motor rotating
movement. The motor movement is based on the input of
microcontroller which is ultrasonic sensor. The main objective of
this project which is designing the baby walker distance controller
was succeed with the distance controller stop the baby walker by

60

using the screw movement method move the motor down and lift
the baby walker up so the wheel doesnt touch the ground.
5.2

Recommendation

The baby walker distance controller development still has a plenty


of room to be improved. The design for this project is more of a
prototype than an actual design. Below are some recommendations
which would provide greater improvements in these aspects.
i.

The more interesting design of distance controller.

ii.

Using another PIC microcontroller with more application that


can be added.

iii.

Design the baby walker distance controller that able to


prevent the baby from getting closer to the table or other
hazards.

iv.

Using more suitable material to design the distance controller.

61

REFERENCES

Sivananthan A/L Subramaniam. (2008). Ultrasonic Obstacle Avoidance by Using


PIC Microcontroller. Project Report. Universiti Tun Hussien Onn Malaysia
(UTHM). Johor, Malaysia.
Mohd Hafiz Bin Kosni. (2003). Autonomous Mobile Robot. Project Report.
Universiti Tun Hussien Onn Malaysia (UTHM). Johor, Malaysia.
Tan Yann Yun. (2002). A Mobile Robot Using PIC16F84A Microcontroller. Project
Report. Universiti Tun Hussien Onn Malaysia (UTHM). Johor, Malaysia.
Gow Moh Kee. (2008). Design and Development PIC-Based Autonomous Robot.
Technical Paper. Universiti Pahang Malaysia (UPM). Pahang, Malaysia.
Jos Gonalves, Jos Lima, Hlder Oliveira and Paulo Costa. (2008). Sensor and
actuator modelling of a realistic wheeled mobile robot simulator. Faculdade
de Engenharia da Universidade do Porto, DEEC Porto, Portugal.
Dirk Bank. (2002). A Novel Ultrasonic Sensing System for Autonomous Mobile
Systems. Research Institute for Applied Knowledge Processing (FAW)
D89081Ulm, Germany.
Sharina Binti Safiee. (2004). Position Servo Motor Control Using Microcontroller.
Project Report. Universiti Tun Hussien Onn Malaysia (UTHM). Johor,
Malaysia.

62

Anca Discant, Alexandrina Rogozan, Corneliu Rusul and Abdelaziz Bensrhair.


(2007). Sensors for Obstacle Detection A Survey. Avenue de L'Universite,
76801 Saint Etienne du Rouvray Cedex, Rouen, France.
Ningbo Yinzhou Shengguang Motor Co., Ltd. (2007). DC Geared Motor.
http://www.sgmada.com/ technical.htm
Neil Villette. (2001). Baby Walker Danger, http://babywalker.com/ Baby_Walker_
Danger.htm
Childrens Safety Association of Canada. (2004). Baby Walkers - now ILLEGAL in
Canada!, http://www.safekid.org/walker.htm

63

APPENDICES

64

APPENDIX A

65

66

APPENDIX B

67

68

APPENDIX C

69

70

APPENDIX D

71

72

73

74

75

76

APPENDIX E

77

78

79

80

81

82

83

Potrebbero piacerti anche