You are on page 1of 83

ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

INDEX

CHAPTER 1
Department of EIE, VITS 1
ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

OVERVIEW OF THE PROJECT


1.1 INTRODUCTION

Since sometimes blind people collide against high and moving obstacles, we need obstacle-sensing
function in front of the blind people. This paper proposes a method of point-to-point distance
measurement using ultrasonic for cap in order to detect moving and high obstacles.

In this method, we apply ultrasonic wave technique to measure distance to obstacles, since it does
not disturb other people. By setting two ultrasonic sensors on the cap, one for transmission and the other
for reception, the moving and high obstacles are detected before colliding. Moreover, embedded systems
are employed in the system in order to reduce system size and cost, as well as saving energy.

In experiments (with wood, concrete, plastic, etc. as obstacles), the results reveal distance
measurement accuracy 95 % approximately. In this project we are using an IR transmitter and Receiver
circuit based path clearing assist stick. Path clearing assist stick is used to detect any obstacles. If any
obstacle is found, the IR light will be reflected back and sensed by IR receiver and sends a signal to the
buzzer driver circuit, which produces buzzer sound near hand.

The project works very well even in night and day timings, irrespective of the lighting intensity. The
project is reliable and effective. This project uses regulated 5V, 750mA power supply. Unregulated 12V
DC is used for relay. 7805 three terminal voltage regulator is used for voltage regulation. Bridge type
full wave rectifier is used to rectify the ac output of secondary of 230/12V step down transformer. This
project can be powered by a simple 9V battery also for portability.

1.2 OBJECTIVE

The objective of this project is to help Blind people in their daily commute. As Blind people are
given less importance in the society, we took the initiate to help them in their day to day life with this
project.

Department of EIE, VITS 2


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

1.3 TOOLS REQUIRED

1.3.1 HARDWARE REQUIREMENTS:


1. PIC Micro Controller
2. Power Supply
3. 16 X 2 LCD
4. Ultrasonic Sensor
5. APR33A3
6. Speaker

1.3.2 SOFTWARE REQUIREMENTS:

1. Programming in embedded C
2. Keil Micro vision
3. Flash Magic

1.4 THESIS ORGANIZATION


The rest of the thesis is organized as follows:

Chapter 2 Micro-Controller Introduction.

Chapter 3 Block diagram of the project is explained and mode of operation and also their function in
detail.

Chapter 4 Discuss about Circuit Diagram, Operation and also the code.

Chapter 5 Checking the Result and also analyzing it.

Chapter 6 Conclusion of the project and Future Scope.

CHAPTER 2
MICROCONTROLLER
2.1 INTRODUCTION

Department of EIE, VITS 3


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

An Embedded System is a combination of computer hardware and software, and perhaps


additional mechanical or other parts, designed to perform a specific function. A good example is the
microwave oven. Almost every household has one, and tens of millions of them are used every day, but
very few people realize that a processor and software are involved in the preparation of their lunch or
dinner.

This is in direct contrast to the personal computer in the family room. It too is comprised of
computer hardware and software and mechanical components (disk drives, for example). However, a
personal computer is not designed to perform a specific function rather; it is able to do many different
things. Many people use the term general-purpose computer to make this distinction clear. As shipped, a
general-purpose computer is a blank slate; the manufacturer does not know what the customer will do
wish it. One customer may use it for a network file server another may use it exclusively for playing
games, and a third may use it to write the next great American novel.

Frequently, an embedded system is a component within some larger system. For example,
modern cars and trucks contain many embedded systems. One embedded system controls the anti-lock
brakes, other monitors and controls the vehicle's emissions, and a third displays information on the
dashboard. In some cases, these embedded systems are connected by some sort of a communication
network, but that is certainly not a requirement.

At the possible risk of confusing you, it is important to point out that a general-purpose computer
is itself made up of numerous embedded systems. For example, my computer consists of a keyboard,
mouse, video card, modem, hard drive, floppy drive, and sound card-each of which is an embedded
system. Each of these devices contains a processor and software and is designed to perform a specific
function. For example, the modem is designed to send and receive digital data over analog telephone
line. That's it and all of the other devices can be summarized in a single sentence as well.

If an embedded system is designed well, the existence of the processor and software could be
completely unnoticed by the user of the device. Such is the case for a microwave oven, VCR, or alarm
clock. In some cases, it would even be possible to build an equivalent device that does not contain the
processor and software. This could be done by replacing the combination with a custom integrated
circuit that performs the same functions in hardware. However, a lot of flexibility is lost when a design

Department of EIE, VITS 4


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

is hard-cooled in this way. It is much easier, and cheaper, to change a few lines of software than to
redesign a piece of custom hardware.

2.2 Real Time Systems

One subclass of embedded is worthy of an introduction at this point. As commonly defined, a


real-time system is a computer system that has timing constraints. In other words, a real-time system is
partly specified in terms of its ability to make certain calculations or decisions in a timely manner. These
important calculations are said to have deadlines for completion. And, for all practical purposes, a
missed deadline is just as bad as a wrong answer.

The issue of what if a deadline is missed is a crucial one. For example, if the real-time system is
part of an airplane's flight control system, it is possible for the lives of the passengers and crew to be
endangered by a single missed deadline. However, if instead the system is involved in satellite
communication, the damage could be limited to a single corrupt data packet. The more severe the
consequences, the more likely it will be said that the deadline is "hard" and thus, the system is a hard
real-time system. Real-time systems at the other end of this discussion are said to have "soft" deadlines.

All of the topics and examples presented in this book are applicable to the designers of real-time
system who is more delight in his work. He must guarantee reliable operation of the software and
hardware under all the possible conditions and to the degree that human lives depend upon three
system's proper execution, engineering calculations and descriptive paperwork.

2.3 Application Areas

Nearly 99 per cent of the processors manufactured end up in embedded systems. The embedded
system market is one of the highest growth areas as these systems are used in very market segment-
consumer electronics, office automation, industrial automation, biomedical engineering, wireless
communication, data communication, telecommunications, transportation, military and so on.

2.3.1 Consumer Appliances

At home we use a number of embedded systems which include digital camera, digital diary,
DVD player, electronic toys, microwave oven, remote controls for TV and air-conditioner, VCO player,
video game consoles, video recorders etc. Today’s high-tech car has about 20 embedded systems for

Department of EIE, VITS 5


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

transmission control, engine spark control, air-conditioning, navigation etc. Even wristwatches are now
becoming embedded systems. The palmtops are powerful embedded systems using which we can carry
out many general-purpose tasks such as playing games and word processing.

2.3.2 Office Automation

The office automation products using embedded systems are copying machine, fax machine, key
telephone, modem, printer, scanner etc.

2.3.3 Industrial Automation

Today a lot of industries use embedded systems for process control. These include
pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity generation and transmission.
The embedded systems for industrial use are designed to carry out specific tasks such as monitoring the
temperature, pressure, humidity, voltage, current etc., and then take appropriate action based on the
monitored levels to control other devices or to send information to a centralized monitoring station. In
hazardous industrial environment, where human presence has to be avoided, robots are used, which are
programmed to do specific jobs. The robots are now becoming very powerful and carry out many
interesting and complicated tasks such as hardware assembly.

2.3.4 Medical Electronics

Almost every medical equipment in the hospital is an embedded system. These equipment’s
include diagnostic aids such as ECG, EEG, blood pressure measuring devices, X-ray scanners;
equipment used in blood analysis, radiation, colonoscopy, endoscopy etc. Developments in medical
electronics have paved way for more accurate diagnosis of diseases.

2.3.5 Computer Networking

Computer networking products such as bridges, routers, Integrated Services Digital Networks
(ISDN), Asynchronous Transfer Mode (ATM), X.25 and frame relay switches are embedded systems
which implement the necessary data communication protocols. For example, a router interconnects two
networks. The two networks may be running different protocol stacks. The router’s function is to obtain
the data packets from incoming pores, analyse the packets and send them towards the destination after

Department of EIE, VITS 6


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

doing necessary protocol conversion. Most networking equipment’s, other than the end systems (desktop
computers) we use to access the networks, are embedded systems

2.3.6 Tele-communications

In the field of telecommunications, the embedded systems can be categorized as subscriber


terminals and network equipment. The subscriber terminals such as key telephones, ISDN phones,
terminal adapters, web cameras are embedded systems. The network equipment includes multiplexers,
multiple access systems, Packet Assemblers Dissemblers (PADs), sate11ite modems etc. IP phone, IP
gateway, IP gatekeeper etc. are the latest embedded systems that provide very low-cost voice
communication over the Internet.

2.3.7 Wireless Technologies

Advances in mobile communications are paving way for many interesting applications using
embedded systems. The mobile phone is one of the marvels of the last decade of the 20’h century. It is a
very powerful embedded system that provides voice communication while we are on the move. The
Personal Digital Assistants and the palmtops can now be used to access multimedia services over the
Internet. Mobile communication infrastructure such as base station controllers, mobile switching centres
are also powerful embedded systems.

2.3.8 Security

Security of persons and information has always been a major issue. We need to protect our
homes and offices; and also the information we transmit and store. Developing embedded systems for
security applications is one of the most lucrative businesses nowadays. Security devices at homes,
offices, airports etc. for authentication and verification are embedded systems. Encryption devices are
nearly 99 per cent of the processors that are manufactured end up in~ embedded systems. Embedded
systems find applications in. every industrial segment- consumer electronics, transportation, avionics,
biomedical engineering, manufacturing, process control and industrial automation, data communication,
telecommunication, defence, security etc. Used to encrypt the data/voice being transmitted on
communication links such as telephone lines. Biometric systems using fingerprint and face recognition
are now being extensively used for user authentication in banking applications as well as for access
control in high security buildings.

Department of EIE, VITS 7


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

2.3.9 Finance

Financial dealing through cash and cheques are now slowly paving way for transactions using
smart cards and ATM (Automatic Teller Machine, also expanded as Any Time Money) machines. Smart
card, of the size of a credit card, has a small micro-controller and memory; and it interacts with the
smart card reader! ATM machine and acts as an electronic wallet. Smart card technology has the
capability of ushering in a cashless society. Well, the list goes on. It is no exaggeration to say that eyes
wherever you go, you can see, or at least feel, the work of an embedded system.

2.4 Microcontroller
2.4.1 Definition

Like all good things, this powerful component is basically very simple. It is made by mixing
tested and high- quality "ingredients" (components) as per following receipt:

1. The simplest computer processor is used as the "brain" of the future system.

2. Depending on the taste of the manufacturer, a bit of memory, a few A/D converters, timers,
input/output lines etc. are added

3. All that is placed in some of the standard packages.

4. A simple software able to control it all and which everyone can easily learn about has been
developed.

On the basis of these rules, numerous types of microcontrollers were designed and they quickly
became man's invisible companion. Their incredible simplicity and flexibility conquered us a long time
ago and if you try to invent something about them, you should know that you are probably late, someone
before you has either done it or at least has tried to do it.

The following things have had a crucial influence on development and success of the
microcontrollers:

1. Powerful and carefully chosen electronics embedded in the microcontrollers can independently
or via input/output devices (switches, push buttons, sensors, LCD displays, relays etc.), control

Department of EIE, VITS 8


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

various processes and devices such as industrial automation, electric current, temperature, engine
performance etc.
2. Very low prices enable them to be embedded in such devices in which, until recent time it was
not worthwhile to embed anything. Thanks to that, the world is overwhelmed today with cheap
automatic devices and various “smart” appliances.
3. Prior knowledge is hardly needed for programming. It is sufficient to have a PC (software in use
is not demanding at all and is easy to learn) and a simple device (called the programmer) used for
“loading” ready-to-use programs into the microcontroller.

So, if you are infected with a virus called electronics, there is nothing left for you to do but to learn how
to use and control its power.

2.4.2 Operation

Even though there is a large number of different types of microcontrollers and even more
programs created for their use only, all of them have many things in common. Thus, if you learn to
handle one of them you will be able to handle them all. A typical scenario on the basis of which it all
functions is as follows:

1. Power supply is turned off and everything is still…the program is loaded into the
microcontroller, nothing indicates what is about to come…

2. Power supply is turned on and everything starts to happen at high speed! The control logic unit
keeps everything under control. It disables all other circuits except quartz crystal to operate.
While the preparations are in progress, the first milliseconds go by.

3. Power supply voltage reaches its maximum and oscillator frequency becomes stable. SFRs are
being filled with bits reflecting the state of all circuits within the microcontroller. All pins are
configured as inputs. The overall electronics starts operation in rhythm with pulse sequence.
From now on the time is measured in micro and nanoseconds.

4. Program Counter is set to zero. Instruction from that address is sent to instruction decoder which
recognizes it, after which it is executed with immediate effect.

Department of EIE, VITS 9


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

5. The value of the Program Counter is incremented by 1 and the whole process is
repeated...several million times per second.

Fig 2.4.2.1: Microcontroller Architecture

2.5 Inside Microcontroller

As you can see, all the operations within the microcontroller are performed at high speed and
quite simply, but the microcontroller itself would not be so useful if there are not special circuits which
make it complete. In continuation, we are going to call your attention to them.

2.5.1 Read Only Memory (ROM)

Read Only Memory (ROM) is a type of memory used to permanently save the program being
executed. The size of the program that can be written depends on the size of this memory. ROM can be
built in the microcontroller or added as an external chip, which depends on the type of the

Department of EIE, VITS 10


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

microcontroller. Both options have some disadvantages. If ROM is added as an external chip, the
microcontroller is cheaper and the program can be considerably longer. At the same time, a number of
available pins is reduced as the microcontroller uses its own input/output ports for connection to the
chip. The internal ROM is usually smaller and more expensive, but leaves more pins available for
connecting to peripheral environment. The size of ROM ranges from 512B to 64KB.

2.5.2 Random Access Memory (RAM)

Random Access Memory (RAM) is a type of memory used for temporary storing data and
intermediate results created and used during the operation of the microcontrollers. The content of this
memory is cleared once the power supply is off. For example, if the program performs an addition, it is
necessary to have a register standing for what in everyday life is called the “sum”. For that purpose, one
of the registers in RAM is called the "sum" and used for storing results of addition. The size of RAM
goes up to a few KBs.

2.5.3 Electrically Erasable Programmable ROM (EEPROM)

The EEPROM is a special type of memory not contained in all microcontrollers. Its contents may
be changed during program execution (similar to RAM), but remains permanently saved even after the
loss of power (similar to ROM). It is often used to store values, created and used during operation (such
as calibration values, codes, values to count up to etc.), which must be saved after turning the power
supply off. A disadvantage of this memory is that the process of programming is relatively slow. It is
measured in milliseconds

2.5.4 Special Function Registers (SFR)

Special function registers are part of RAM memory. Their purpose is predefined by the
manufacturer and cannot be changed therefore. Since their bits are physically connected to particular
circuits within the microcontroller, such as A/D converter, serial communication module etc., any
change of their state directly affects the operation of the microcontroller or some of the circuits. For
example, writing zero or one to the SFR controlling an input/output port causes the appropriate port pin
to be configured as input or output. In other words, each bit of this register controls the function of one
single pin.

Department of EIE, VITS 11


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

2.5.5 Program Counter

Program Counter is an engine running the program and points to the memory address containing
the next instruction to execute. After each instruction execution, the value of the counter is incremented
by 1. For this reason, the program executes only one instruction at a time just as it is written. However…
the value of the program counter can be changed at any moment, which causes a “jump” to a new
memory location. This is how subroutines and branch instructions are executed. After jumping, the
counter resumes even and monotonous automatic counting +1, +1, +1…

2.6 Block Diagram of project

Block diagram consists of a micro-controller (PIC), Power Supply, LCD Display (16X2
Display), APR33A3 (Voice module), Ultrasonic Sensor, Speaker. The Block Diagram is shown below to
get a better understanding of the project

Department of EIE, VITS 12


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Fig 2.2: Block Diagram of Project

Department of EIE, VITS 13


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

CHAPTER 3
HARDWARE DESCRIPTION

3.1 Micro controller:

Fig: 3.1.1 Microcontrollers

3.1.2 Introduction to Microcontrollers:

Circumstances that we find ourselves in today in the field of microcontrollers had their
beginnings in the development of technology of integrated circuits. This development has made it
possible to store hundreds of thousands of transistors into one chip. That was a prerequisite for
production of microprocessors, and the first computers were made by adding external peripherals such
as memory, input-output lines, timers and other. Further increasing of the volume of the package resulted
in creation of integrated circuits. These integrated circuits contained both processor and peripherals.
That is how the first chip containing a microcomputer, or what would later be known as a
microcontroller came about.

Microprocessors and microcontrollers are widely used in embedded systems products.


Microcontroller is a programmable device. A microcontroller has a CPU in addition to a fixed amount of
RAM, ROM, I/O ports and a timer embedded all on a single chip. The fixed amount of on-chip ROM,
RAM and number of I/O ports in microcontrollers makes them ideal for many applications in which cost
and space are critical.

The microcontroller used in this project is PIC16F73. The PIC families of microcontrollers are
developed by Microchip Technology Inc. Currently they are some of the most popular microcontrollers,
selling over 120 million devices each year. There are basically four families of PIC microcontrollers:

Department of EIE, VITS 14


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

1. PIC12CXXX 12/14-bit program word

2. PIC 16C5X 12-bit program word

3. PIC16CXXX and PIC16FXXX 14-bit program word

4. PIC17CXXX and PIC18CXXX 16-bit program word

The features, pin description of the microcontroller used are discussed in the following sections.

3.2 MICROCONTROLLER

A Microcontroller is a programmable digital processor with necessary peripherals. Both


microcontrollers and microprocessors are complex sequential digital circuits meant to carry out job
according to the program / instructions. Sometimes analog input/output interface makes a part of
microcontroller circuit of mixed mode (both analog and digital nature).

1. A smaller computer

2. On-chip RAM, ROM, I/O ports...

Example: Motorola’s 6811, Intel’s 8051, Zilog’s Z8 and PIC 16X

3.2.1 General-purpose microprocessor

1. CPU for Computers

2. No RAM, ROM, I/O on CPU chip itself

3. Example: Intel’s x86, Motorola’s 680x0

3.3 Microprocessor vs. Microcontroller

3.3.1 Microprocessor

• CPU is stand-alone, RAM, ROM, I/O, timer are separate

• Designer can decide on the amount of ROM, RAM and I/O ports.

• expansive

• versatility

Department of EIE, VITS 15


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

• general-purpose

3.3.2 Microcontroller

• CPU, RAM, ROM, I/O and timer are all on a single chip

• fix amount of on-chip ROM, RAM, I/O ports

• for applications in which cost, power and space are critical

• single-purpose

3.3.3 Choosing a MC

• Speed

• Packaging(Ex. DIP,QFP Quad Flat Package)

• Power Consumption

• Amount of RAM,ROM

• I/O Pins

• Final Cost of The product

• How easy it is Upgraded

3.4 Memory types

In a microcontroller, two types of memory are found. They are, program memory and data memory
respectively. Program memory is also known as 'control store' and 'firm ware'. It is non-volatile i.e, the
memory content is not lost when the power goes off. Non-volatile memory is also called Read Only
Memory (ROM). There are various types of ROM.

3.4.1 Mask ROM: Some microcontrollers with ROM are programmed while they are still in
the factory. This ROM is called Mask ROM. Since the microcontrollers with Mask ROM
are used for specific application, there is no need to reprogram them. Some times, this
type of manufacturing reduces the cost for bulk production.

Department of EIE, VITS 16


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

3.4.2 Reprogrammable program memory (or) Erasable PROM (EPROM): Microcontrollers


with EPROM were introduced in late 1970's. These devices are electrically programmable but are
erased with UV radiation. The construction of a EPROM memory cell is somewhat like a MOSFET
but with a control and float semiconductor as shown in the figure.

In the un programmed state, the 'float' does not have any charge and the MOSFET is in the OFF
state. To program the cell, the 'control' above the 'float' is raised to a high enough potential such that
a charge leaks to the float through SiO 2 insulating layer. Hence a channel is formed between 'Source'
and 'Drain' in the silicon substrate and the MOSFET becomes 'ON'. The charge in the 'float' remains
for a long time (typically over 30 years). The charge can be removed by exposing the float to UV
radiation. For UV erasable version, the packaging is done in a ceramic enclosure with a glass
window.

3.4.3 OTP EPROM: One time programmable (OTP) EPROM based microcontrollers do not have
any glass window for UV erasing. These can be programmed only once. This type of packaging

Department of EIE, VITS 17


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

results in microcontroller that have the cost 10% of the microcontrollers with UV erase facility (i.e.,
1/10th cost).

3.4.4 EEPROM: (Electrically Erasable Programmable ROM): This is similar to EPROM but the
float charge can be removed electrically.

3.4.5 FLASH (EEPROM Memory): FLASH memory was introduced by INTEL in late 1980's.

This memory is similar to EEPROM but the cells in a FLASH memory are bussed so that they
can be erased in a few clock cycles. Hence the reprogramming is faster.

3.6 Different Data memory types:

1. Random access memory (RAM)

2. Read only memory (ROM)

3.6.1 Random access memory (RAM): data will disappear after power down.

– Static RAM (SRAM): each bit is a flip-flop, fast but expensive.

– Dynamic RAM (DRAM): each bit is a small capacitor, and is needed to be recharged
regularly, slower but cheap. To be used as primary memory in a computer.

Data memory can be classified into the following categories

 Bits

 Registers

 Variable RAM

 Program counter stack

Microcontroller can have ability to perform manipulation of individual bits in certain registers (bit
manipulation). This is a unique feature of a microcontroller, not available in a microprocessor.

Department of EIE, VITS 18


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Eight bits make a byte. Memory bytes are known as file registers.

Registers are some special RAM locations that can be accessed by the processor very easily.

3.6.2 Static RAM (SRAM) memory cell:

This consists of two CMOS inverters connected back to front, so as to form a latch. Processor stacks
store/save the data in a simple way during program execution. Processor stack is a part of RAM area
where the data is saved in a Last in First out (LIFO) fashion just like a stack of paper on a table. Data is
stored by executing a 'push' instruction and data is read out using a 'pop' instruction

SRAM memory cell equivalent

Internal Structure of a Microcontroller

Department of EIE, VITS 19


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

At times, a microcontroller can have external memory also (if there is no internal memory or extra
memory interface is required). Early microcontrollers were manufactured using bipolar or NMOS
technologies. Most modern microcontrollers are manufactured with CMOS technology, which leads
to reduction in size and power loss. Current drawn by the IC is also reduced considerably from
10mA to a few micro Amperes in sleep mode (for a microcontroller running typically at a clock
speed of 20MHz).

3.7 Harvard vs. Princeton Architecture

Many years ago, in the late 1940's, the US Government asked Harvard and Princeton universities
to come up with a computer architecture to be used in computing distances of Naval artillery shell
for defense applications. Princeton suggested computer architecture with a single memory interface.
It is also known as Von Neumann architecture after the name of the chief scientist of the project in
Princeton University John Von Neumann (1903 - 1957 Born in Budapest, Hungary).

Department of EIE, VITS 20


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Harvard suggested a computer with two different memory interfaces, one for the data / variables and
the other for program / instructions. Although Princeton architecture was accepted for simplicity and
ease of implementation, Harvard architecture became popular later, due to the parallelism of
instruction execution

3.7.1 Princeton Architecture (Single memory interface):

Program memory and data memory are interfaced to CPU through common buses

An instruction "Read a data byte from memory and store it in the accumulator" is executed as follows: -

Cycle 1 - Read Instruction

Cycle 2 - Read Data out of RAM and put into Accumulator

It will take more time to execute instructions

3.7.2 Harvard Architecture (Separate Program and Data Memory interfaces)

Department of EIE, VITS 21


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Hence each instruction is effectively executed in one instruction cycle, except for the ones that
modify the content of the program counter. For example, the "jump" (or call) instructions takes 2
cycles. Thus, due to parallelism, Harvard architecture executes more instructions in a given time
compared to Princeton Architecture

3.8 PIC Microcontrollers:

PIC stands for Peripheral Interface Controller given by Microchip Technology to identify its
single-chip microcontrollers. These devices have been very successful in 8-bit microcontrollers. The
main reason is that Microchip Technology has continuously upgraded the device architecture and
added needed peripherals to the microcontroller to suit customers' requirements. The development
tools such as assembler and simulator are freely available on the internet at www.microchip.com.

3.8.1 Low - end PIC Architectures:

Microchip PIC microcontrollers are available in various types. When PIC microcontroller MCU was
first available from General Instruments in early 1980's, the microcontroller consisted of a simple
processor executing 12-bit wide instructions with basic I/O functions. These devices are known as
low-end architectures. They have limited program memory and are meant for applications requiring
simple interface functions and small program & data memories. Some of the low-end device
numbers are

Department of EIE, VITS 22


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

12C5XX
16C5X
16C505

3.8.2 Mid range PIC Architectures

Mid range PIC architectures are built by upgrading low-end architectures with more number of
peripherals, more number of registers and more data/program memory. Some of the mid-range
devices are

16C6X
16C7X
16F87X

Program memory type is indicated by an alphabet.

C = EPROM
F = Flash
RC = Mask ROM
Popularity of the PIC microcontrollers is due to the following factors.

1. Speed: Harvard Architecture, RISC architecture, 1 instruction cycle = 4 clock cycles.

2. Instruction set simplicity: The instruction set consists of just 35 instructions (as opposed to 111
instructions for 8051).

3. Power-on-reset and brown-out reset. Brown-out-reset means when the power supply goes below
a specified voltage (say 4V), it causes PIC to reset; hence malfunction is avoided.

A watch dog timer (user programmable) resets the processor if the software/program ever
malfunctions and deviates from its normal operation.

4. PIC microcontroller has four optional clock sources.

 Low power crystal

 Mid range crystal

Department of EIE, VITS 23


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

 High range crystal

 RC oscillator (low cost).

5. Programmable timers and on-chip ADC.

6. Up to 12 independent interrupt sources.

7. Powerful output pin control (25 mA (max.) current sourcing capability per pin.)

8. EPROM/OTP/ROM/Flash memory option.

9. I/O port expansion capability.

Free assembler and simulator support from Microchip at www.microchip.com

3.9 CPU Architecture:

The CPU uses Harvard architecture with separate Program and Variable (data) memory interface.
This facilitates instruction fetch and the operation on data/accessing of variables simultaneously.

Architecture of PIC microcontroller

PIC Microcontroller Clock

Most of the PIC microcontrollers can operate up to 20MHz. One instructions cycle (machine cycle)
consists of four clock cycles

Relation between instruction cycles and clock cycles for PIC microcontrollers

Department of EIE, VITS 24


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Instructions that do not require modification of program counter content get executed in one
instruction cycle.

Microcontrollers versus Microprocessors

Microcontroller differs from a microprocessor in many ways. First and the most important is its
functionality. In order for a microprocessor to be used, other components such as memory, or
components for receiving and sending data must be added to it. In short that means that microprocessor
is the very heart of the computer. On the other hand, microcontroller is designed to be all of that in one.
No other external components are needed for its application because all necessary peripherals are
already built into it. Thus, we save the time and space needed to construct devices.

Memory unit

Memory is part of the microcontroller whose function is to store data.

The easiest way to explain it is to describe it as one big closet with lots of drawers. If we suppose that
we marked the drawers in such a way that they can not be confused, any of their contents will then be
easily accessible. It is enough to know the designation of the drawer and so its contents will be known.

Department of EIE, VITS 25


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Memory components are exactly like that. For a certain input we get the contents of a certain addressed
memory location and that's all. Two new concepts are brought to us: addressing and memory location.
Memory consists of all memory locations, and addressing is nothing but selecting one of them. This
means that we need to select the desired memory location on one hand, and on the other hand we need to
wait for the contents of that location. Besides reading from a memory location, memory must also
provide for writing onto it. This is done by supplying an additional line called control line. We will
designate this line as R/W (read/write). Control line is used in the following way: if r/w=1, reading is
done, and if opposite is true then writing is done on the memory location.

Memory is the first element, and we need a few operation of our microcontroller.

Central Processing Unit

Let add 3 more memory locations to a specific block that will have a built in capability to multiply,
divide, subtract, and move its contents from one memory location onto another. The part we just added
in is called "central processing unit" (CPU). Its memory locations are called registers.

Registers are therefore memory locations whose role is to help with performing various mathematical
operations or any other operations with data wherever data can be found. Look at the current situation.
We have two independent entities (memory and CPU) which are interconnected, and thus any exchange
of data is hindered, as well as its functionality. If, for example, we wish to add the contents of two
memory locations and return the result again back to memory, we would need a connection between
memory and CPU. Simply stated, we must have some "way" through data goes from one block to
another.

Department of EIE, VITS 26


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Bus

That "way" is called "bus". Physically, it represents a group of 8, 16, or more wires
there are two types of buses: address and data bus. The first one consists of as many lines as the amount
of memory we wish to address and the other one is as wide as data, in our case 8 bits or the connection
line. First one serves to transmit address from CPU memory, and the second to connect all blocks inside
the microcontroller.

As far as functionality, the situation has improved, but a new problem has also appeared: we have a unit
that's capable of working by itself, but which does not have any contact with the outside world, or with
us! In order to remove this deficiency, let's add a block which contains several memory locations whose
one end is connected to the data bus, and the other has connection with the output lines on the
microcontroller which can be seen as pins on the electronic component.

Input-output unit

Those locations we've just added are called "ports". There are several types of ports : input, output or
bidirectional ports. When working with ports, first of all it is necessary to choose which port we need to
work with, and then to send data to, or take it from the port.

Department of EIE, VITS 27


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

When working with it the port acts like a memory location. Something is simply being written into or
read from it, and it could be noticed on the pins of the microcontroller.

Serial communication

Beside stated above we've added to the already existing unit the possibility of communication with an
outside world. However, this way of communicating has its drawbacks. One of the basic drawbacks is
the number of lines which need to be used in order to transfer data. What if it is being transferred to a
distance of several kilometers? The number of lines times’ number of kilometers doesn't promise the
economy of the project. It leaves us having to reduce the number of lines in such a way that we don't
lessen its functionality. Suppose we are working with three lines only, and that one line is used for
sending data, other for receiving, and the third one is used as a reference line for both the input and the
output side. In order for this to work, we need to set the rules of exchange of data. These rules are called
protocol. Protocol is therefore defined in advance so there wouldn't be any misunderstanding between
the sides that are communicating with each other. For example, if one man is speaking in French, and
the other in English, it is highly unlikely that they will quickly and effectively understand each other.
Let's suppose we have the following protocol. The logical unit "1" is set up on the transmitting line until
transfer begins. Once the transfer starts, we lower the transmission line to logical "0" for a period of time
(which we will designate as T), so the receiving side will know that it is receiving data, and so it will
activate its mechanism for reception. Let's go back now to the transmission side and start putting logic
zeros and ones onto the transmitter line in the order from a bit of the lowest value to a bit of the highest
value. Let each bit stay on line for a time period which is equal to T, and in the end, or after the 8th bit,
let us bring the logical unit "1" back on the line which will mark the end of the transmission of one
data. The protocol we've just described is called in professional literature NRZ (Non-Return to Zero).

Department of EIE, VITS 28


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

As we have separate lines for receiving and sending, it is possible to receive and send data (info.) at the
same time. So called full-duplex mode block which enables this way of communication is called a serial
communication block. Unlike the parallel transmission, data moves here bit by bit, or in a series of bits
what defines the term serial communication comes from. After the reception of data we need to read it
from the receiving location and store it in memory as opposed to sending where the process is reversed.
Data goes from memory through the bus to the sending location, and then to the receiving unit
according to the protocol.

Timer unit

Since we have the serial communication explained, we can receive, send and process data.

However, in order to utilize it in industry we need a few additionally blocks. One of those is the timer
block which is significant to us because it can give us information about time, duration, protocol etc.
The basic unit of the timer is a free-run counter which is in fact a register whose numeric value
increments by one in even intervals, so that by taking its value during periods T1 and T2 and on the
basis of their difference we can determine how much time has elapsed. This is a very important part of
the microcontroller whose understanding requires most of our time

Watchdog

Department of EIE, VITS 29


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

One more thing is requiring our attention is a flawless functioning of the microcontroller
during its run-time. Suppose that as a result of some interference (which often does occur in industry)
our microcontroller stops executing the program, or worse, it starts working incorrectly.

Of course, when this happens with a computer, we simply reset it and it will keep working. However,
there is no reset button we can push on the microcontroller and thus solve our problem. To overcome
this obstacle, we need to introduce one more block called watchdog. This block is in fact another free-
run counter where our program needs to write a zero in every time it executes correctly.

In case that program gets "stuck", zero will not be written in, and counter alone will reset the
microcontroller upon achieving its maximum value this will result in executing the program again, and
correctly this time around. That is an important element of every program to be reliable without man's
supervision.

Analog to Digital Converter

As the peripheral signals usually are substantially different from the ones that microcontroller can
understand (zero and one), they have to be converted into a pattern which can be comprehended by a
microcontroller. This task is performed by a block for analog to digital conversion or by an ADC. This
block is responsible for converting an information about some analog value to a binary number and for
follow it through to a CPU block so that CPU block can further process it.

Finally, the microcontroller is now completed, and all we need to do now is to assemble it into an
electronic component where it will access inner blocks through the outside pins. The picture below
shows what a microcontroller looks like inside.

Department of EIE, VITS 30


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

3.9 Physical configuration of the interior of a microcontroller

Thin lines which lead from the center towards the sides of the microcontroller represent wires
connecting inner blocks with the pins on the housing of the microcontroller so called bonding lines.
Chart on the following page represents the center section of a microcontroller.

3.10 Microcontroller outline with its basic elements and internal connections

Department of EIE, VITS 31


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

For a real application, a microcontroller alone is not enough. Beside a microcontroller, we need a
program that would be executed, and a few more elements which make up a interface logic towards the
elements of regulation (which will be discussed in later chapters).

The program adds the contents of two memory locations, and views their sum on port A. The
first line of the program stands for moving the contents of memory location "A" into one of the registers
of central processing unit. As we need the other data as well, we will also move it into the other register
of the central processing unit. The next instruction instructs the central processing unit to add the
contents of those two registers and send a result to port A, so that sum of that addition would be visible
to the outside world. For a more complex problem, program that works on its solution will be bigger.

Programming can be done in several languages such as Assembler, C and Basic which are most
commonly used languages. Assembler belongs to lower level languages that are programmed slowly, but
take up the least amount of space in memory and gives the best results where the speed of program
execution is concerned. As it is the most commonly used language in programming microcontrollers it
will be discussed in a later chapter. Programs in C language are easier to be written, easier to be
understood, but are slower in executing from assembler programs. Basic is the easiest one to learn, and
its instructions are nearest a man's way of reasoning, but like C programming language it is also slower
than assembler. In any case, before you make up your mind about one of these languages you need to
consider carefully the demands for execution speed, for the size of memory and for the amount of time
available for its assembly.

After the program is written, we would install the microcontroller into a device and run it. In
order to do this we need to add a few more external components necessary for its work. First we must
give life to a microcontroller by connecting it to a power supply (power needed for operation of all
electronic instruments) and oscillator whose role is similar to the role that heart plays in a human body.
Based on its clocks microcontroller executes instructions of a program. As it receives supply
microcontroller will perform a small check up on itself, look up the beginning of the program and start
executing it. How the device will work depends on many parameters, the most important of which is the
skillfulness of the developer of hardware, and on programmer's expertise in getting the maximum out of
the device with his program.

3.11 Introduction

Department of EIE, VITS 32


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

PIC16F belongs to a class of 8-bit microcontrollers of RISC architecture.

Its general structure is shown on the following map representing basic blocks.
Program memory (FLASH)-

It is used for storing a written program. Since memory made in FLASH technology can be programmed
and cleared more than once, it makes this microcontroller suitable for device development.

3.11.1 EEPROM - data memory that needs to be saved when there is no supply.
It is usually used for storing important data that must not be lost if power supply suddenly stops. For
instance, one such data is an assigned temperature in temperature regulators. If during a loss of power
supply this data was lost, we would have to make the adjustment once again upon return of supply. Thus
our device looses on self-reliance

3.11.2 RAM- Data memory used by a program during its execution. In RAM are stored all inter-results
or temporary data during run-time.

PORTA and PORTB are physical connections between the microcontroller and the outside world.

Port A has five, and port B has eight pins.

3.11.3 FREE-RUN TIMER is an 8-bit register inside a microcontroller that works independently of the
program. On every fourth clock of the oscillator it increments its value until it reaches the maximum
(255), and then it starts counting over again from zero. As we know the exact timing between each two
increments of the timer contents, timer can be used for measuring time which is very useful with some
devices.

3.11.4 CENTRAL PROCESSING UNIT has a role of connective element between other blocks in the
microcontroller. It coordinates the work of other blocks and executes the user program.

Department of EIE, VITS 33


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

3.11.5 Applications

PIC16F perfectly fits many uses, from automotive industries and controlling home appliances to
industrial instruments, remote sensors, electrical door locks and safety devices. It is also ideal for smart
cards as well as for battery supplied devices because of its low consumption.

EEPROM memory makes it easier to apply microcontrollers to devices where permanent storage of
various parameters is needed (codes for transmitters, motor speed, receiver frequencies, etc.). Low cost,
low consumption, easy handling and flexibility make PIC16F applicable even in areas where
microcontrollers had not previously been considered (example: timer functions, interface replacement in
larger systems, coprocessor applications, etc.).

Department of EIE, VITS 34


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

In System Programmability of this chip (along with using only two pins in data transfer) makes possible
the flexibility of a product, after assembling and testing have been completed. This capability can be
used to create assembly-line production, to store calibration data available only after final testing, or it
can be used to improve programs on finished products.

3.11.6Clock / instruction cycle

Clock is microcontroller's main starter, and is obtained from an external component called an
"oscillator". If we want to compare a microcontroller with a time clock, our "clock" would then be a
ticking sound we hear from the time clock. In that case, oscillator could be compared to a spring that is
wound so time clock can run. Also, force used to wind the time clock can be compared to an electrical
supply.

Clock from the oscillator enters a microcontroller via OSC1 pin where internal circuit of a
microcontroller divides the clock into four even clocks Q1, Q2, Q3, and Q4 which do not overlap. These
four clocks make up one instruction cycle (also called machine cycle) during which one instruction is
executed.

Execution of instruction starts by calling an instruction that is next in string. Instruction is called from
program memory on every Q1 and is written in instruction register on Q4. Decoding and execution of
instruction are done between the next Q1 and Q4 cycles. On the following diagram we can see the
relationship between instruction cycle and clock of the oscillator (OSC1) as well as that of internal
clocks Q1-Q4. Program counter (PC) holds information about the address of the next instruction.

Department of EIE, VITS 35


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

3.11.7 Pipelining

Instruction cycle consists of cycles Q1, Q2, Q3 and Q4. Cycles of calling and executing instructions are
connected in such a way that in order to make a call, one instruction cycle is needed, and one more is
needed for decoding and execution. However, due to pipelining, each instruction is effectively executed
in one cycle. If instruction causes a change on program counter, and PC doesn't point to the following
but to some other address (which can be the case with jumps or with calling subprograms), two cycles
are needed for executing an instruction. This is so because instruction must be processed again, but this
time from the right address. Cycle of calling begins with Q1 clock, by writing into instruction register
(IR). Decoding and executing begins with Q2, Q3 and Q4 clocks.

TCY0 reads in instruction MOVLW 55h (it doesn't matter to us what instruction was executed, because
there is no rectangle pictured on the bottom).

TCY1 executes instruction MOVLW 55h and reads in MOVWF PORTB.

TCY2 executes MOVWF PORTB and reads in CALL SUB_1.

TCY3 executes a call of a subprogram CALL SUB_1, and reads in instruction BSF PORTA, BIT3. As
this instruction is not the one we need, or is not the first instruction of a subprogram SUB_1 whose
execution is next in order, instruction must be read in again. This is a good example of an instruction
needing more than one cycle.

TCY4 instruction cycle is totally used up for reading in the first instruction from a subprogram at
address SUB_1.

Department of EIE, VITS 36


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

TCY5 executes the first instruction from a subprogram SUB_1 and reads in the next one.

Pin description

3.12 Clock generator - oscillator

Oscillator circuit is used for providing a microcontroller with a clock. Clock is needed so that
microcontroller could execute a program or program instructions.

3.13 Types of oscillators

PIC16Fcan work with four different configurations of an oscillator

Since configurations with crystal oscillator and resistor-capacitor (RC) are the ones that are used most
frequently, these are the only ones we will mention here. Microcontroller type with a crystal oscillator
has in its designation XT, and a microcontroller with resistor-capacitor pair has a designation RC.

This is important because you need to mention the type of oscillator when buying a microcontroller.
XT Oscillator

Crystal oscillator is kept in metal housing


with two pins where you have written
down the frequency at which crystal
oscillates. One ceramic capacitor of 30pF
whose other end is connected to the
ground needs to be connected with each
pin.

Oscillator and capacitors can be packed in


joint case with three pins. Such element is
called ceramic resonator and is represented
in charts like the one below. Center pins of
the element is the ground, while end pins
are connected with OSC1 and OSC2 pins
on the microcontroller. When designing a
device, the rule is to place an oscillator

Department of EIE, VITS 37


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

nearer a microcontroller, so as to avoid any


interference on lines on which
3.12.1 RC Oscillator

In applications where great time precision is not necessary, RC oscillator offers additional
savings during purchase. Resonant frequency of RC oscillator depends on supply voltage rate, resistance
R, capacity C and working temperature. It should be mentioned here that resonant frequency is also
influenced by normal variations in process parameters, by tolerance of external R and C components,
etc.

Above diagram shows how RC oscillator is connected with PIC16F84. With value of resistor R being
below 2.2k, oscillator can become unstable, or it can even stop the oscillation. With very high value of R
(ex.1M) oscillator becomes very sensitive to noise and humidity. It is recommended that value of
resistor R should be between 3 and 100k. Even though oscillator will work without an external capacitor
(C=0pF), capacitor above 20pF should still be used for noise and stability. No matter which oscillator is
being used, in order to get a clock that microcontroller works upon, a clock of the oscillator must be
divided by 4. Oscillator clock divided by 4 can also be obtained on OSC2/CLKOUT pin, and can be
used for testing or synchronizing other logical circuits.

Department of EIE, VITS 38


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Following a supply, oscillator starts oscillating. Oscillation at first has an unstable period and amplitude,
but after some period of time it becomes stabilized.

To prevent such inaccurate clock from influencing microcontroller's performance, we need to keep the
microcontroller in reset state during stabilization of oscillator's clock. Diagram above shows a typical
shape of a signal which microcontroller gets from the quartz oscillator.

Reset

Reset is used for putting the microcontroller into a 'known' condition. That practically means that
microcontroller can behave rather inaccurately under certain undesirable conditions. In order to continue
its proper functioning it has to be reset, meaning all registers would be placed in a starting position.
Reset is not only used when microcontroller doesn't behave the way we want it to, but can also be used
when trying out a device as an interrupt in program execution, or to get a microcontroller ready when
loading a program.

Department of EIE, VITS 39


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

In order to prevent from bringing a logical zero to


MCLR pin accidentally (line above it means that reset
is activated by a logical zero), MCLR has to be
connected via resistor to the positive supply pole.
Resistor should be between 5 and 10K. This kind of
resistor whose function is to keep a certain line on a
logical one as a preventive, is called a pull up.

Microcontroller PIC16F84 knows several sources of resets:


a) Reset during power on, POR (Power-On Reset)
b) Reset during regular work by bringing logical zero to MCLR microcontroller's pin.
c) Reset during SLEEP regime
d) Reset at watchdog timer (WDT) overflow
e) Reset during at WDT overflow during SLEEP work regime.
The most important reset sources are a) and b). The first one occurs each time a power supply is brought
to the microcontroller and serves to bring all registers to a starting position initial state.

The second one is a product of purposeful bringing in of a logical zero to MCLR pin during normal
operation of the microcontroller. This second one is often used in program development.
During a reset, RAM memory locations are not being reset. They are unknown during a power up and
are not changed at any reset. Unlike these, SFR registers are reset to a starting position initial state.

One of the most important effects of a reset is setting a program counter (PC) to zero (0000h) , which
enables the program to start executing from the first written instruction.

Reset at supply voltage drop below the permissible (Brown-out Reset). Impulse for resetting during
voltage voltage-up is generated by microcontroller itself when it detects an increase in supply Vdd (in a
range from 1.2V to 1.8V). That impulse lasts 72ms which is enough time for an oscillator to get
stabilized. These 72ms are provided by an internal PWRT timer which has its own RC oscillator.
Microcontroller is in a reset mode as long as PWRT is active. However, as device is working, problem

Department of EIE, VITS 40


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

arises when supply doesn't drop to zero but falls below the limit that guarantees microcontroller's proper
functioning. This is a likely case in practice, especially in industrial environment where disturbances and
instability of supply are an everyday occurrence. To solve this problem we need to make sure that
microcontroller is in a reset state each time supply falls below the approved limit.

If, according to electrical specification, internal reset circuit of a microcontroller can not satisfy the
needs, special electronic components can be used which are capable of generating the desired reset
signal. Beside this function, they can also function in watching over supply voltage. If voltage drops
below specified level, a logical zero would appear on MCLR pin which holds the microcontroller in
reset state until voltage is not within limits that guarantee accurate performance.

Memory organization

PIC16F84 has two separate memory blocks, one for data and the other for program. EEPROM memory
with GPR and SFR registers in RAM memory make up the data block, while FLASH memory makes up
the program block.

SFR registers

Registers which take up first 12 locations in banks 0 and 1 are registers of specialized function assigned
with certain blocks of the microcontroller. These are called Special Function Registers.

3.13 Description:

Introduction to PIC Microcontrollers:

PIC stands for Peripheral Interface Controller given by Microchip Technology to identify its
single-chip microcontrollers. These devices have been very successful in 8-bit microcontrollers. The
main reason is that Microchip Technology has continuously upgraded the device architecture and added
needed peripherals to the microcontroller to suit customers' requirements. The development tools such as
assembler and simulator are freely available on the internet at www.microchip.com

Low - end PIC Architectures:

Microchip PIC microcontrollers are available in various types. When PIC microcontroller MCU was
first available from General Instruments in early 1980's, the microcontroller consisted of a simple

Department of EIE, VITS 41


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

processor executing 12-bit wide instructions with basic I/O functions. These devices are known as low-
end architectures. They have limited program memory and are meant for applications requiring simple
interface functions and small program & data memories. Some of the low-end device numbers are

12C5XX
16C5X
16C505

Mid range PIC Architectures:

Mid range PIC architectures are built by upgrading low-end architectures with more number of
peripherals, more number of registers and more data/program memory. Some of the mid-range
devices are

16C6X
16C7X
16F87X

Program memory type is indicated by an alphabet.

C = EPROM, F = Flash, RC = Mask ROM

Popularity of the PIC microcontrollers is due to the following factors.

1. Speed: Harvard Architecture, RISC architecture, 1 instruction cycle = 4 clock cycles.


2. Instruction set simplicity: The instruction set consists of just 35 instructions (as opposed to 111
instructions for 8051).

3. Power-on-reset and brown-out reset. Brown-out-reset means when the power supply goes below
a specified voltage (say 4V), it causes PIC to reset; hence malfunction is avoided. A watch dog
timer (user programmable) resets the processor if the software/program ever malfunctions and
deviates from its normal operation.

4. PIC microcontroller has four optional clock sources.

 Low power crystal

 Mid range crystal

Department of EIE, VITS 42


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

 High range crystal

 RC oscillator (low cost).

5. Programmable timers and on-chip ADC.

6. Up to 12 independent interrupt sources.

7. Powerful output pin control (25 mA (max.) current sourcing capability per pin.)

8. EPROM/OTP/ROM/Flash memory option.

9. I/O port expansion capability.

CPU Architecture:

The CPU uses Harvard architecture with separate Program and Variable (data) memory interface.
This facilitates instruction fetch and the operation on data/accessing of variables simultaneously.
Architecture of PIC microcontroller

Fig.3.2.3Architecture of PIC microcontroller

Basically, all PIC microcontrollers offer the following features:

 RISC instruction set with around 35 instructions _9 Digital I/O ports


 On-chip timer with 8-bit prescaler.
 Power-on reset
 Watchdog timer
 Power saving SLEEP mode
 Direct, indirect, and relative addressing modes
 External clock interface

Department of EIE, VITS 43


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

 RAM data memory


 EPROM (or OTP) program memory
Peripheral features:

 High sink/source current 25mA


 Timer0: 8-bit timer/counter with 8-bit prescaler can be incremented during sleep via external
crystal/clock
 Timer2:8-bit timer/counter with 8-bit period register prescaler and post scalar.
 Capture, Compare, PWM (CCP) module
 Capture is 16-bit, max resolution is 12.5ns

 Compare is 16-bit, max resolution is 200 ns

 PWM max, resolution is 10-bit

 8-bit 5 channel analog-to-digital converter


 Synchronous serial port (SSP) with SPI (Master/Slave) and (Slave)
Some devices offer the following additional features:

 Analogue input channels


 Analogue comparators
 Additional timer circuits
 EEPROM data memory
 Flash EEPROM program memory
 External and timer interrupts
 In-circuit programming
 Internal oscillator
 USART serial interface

3.3 POWER SUPPLY


All digital circuits require regulated power supply. In this article we are going to learn how to get
a regulated positive supply from the mains supply.

Department of EIE, VITS 44


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Fig 3.3.1: Power Supply Block Diagram

Figure 3.19 shows the basic block diagram of a fixed regulated power supply. Let us go through
each block.

Fig 3.3.2 Circuit Diagram of power supply

3.3.3 TRANSFORMER

Fig 3.20: Transformer Types


A transformer consists of two coils also called as “WINDINGS” namely PRIMARY &
SECONDARY.

They are linked together through inductively coupled electrical conductors also called as CORE.
A changing current in the primary causes a change in the Magnetic Field in the core & this in turn

Department of EIE, VITS 45


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

induces an alternating voltage in the secondary coil. If load is applied to the secondary then an
alternating current will flow through the load. If we consider an ideal condition then all the energy from
the primary circuit will be transferred to the secondary circuit through the magnetic field.

So

The secondary voltage of the transformer depends on the number of turns in the Primary as well
as in the secondary.

3.2.2 Rectifier

A rectifier is a device that converts an AC signal into DC signal. For rectification purpose we use
a diode, a diode is a device that allows current to pass only in one direction i.e. when the anode of the
diode is positive with respect to the cathode also called as forward biased condition & blocks current in
the reversed biased condition.

Bridge Rectifier

Department of EIE, VITS 46


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Fig 3.21: Bridge Rectifier

As the name suggests it converts the full wave i.e. both the positive & the negative half cycle
into DC thus it is much more efficient than Half Wave Rectifier & that too without using a center tapped
transformer thus much more cost effective than Full Wave Rectifier.

Full Bridge Wave Rectifier consists of four diodes namely D1, D2, D3 and D4. During the
positive half cycle diodes D1 & D4 conduct whereas in the negative half cycle diodes D2 & D3 conduct
thus the diodes keep switching the transformer connections so we get positive half cycles in the output.

3.2.3 FILTER CAPACITOR


Even though half wave & full wave rectifier give DC output, none of them provides a constant
output voltage. For this we require to smoothen the waveform received from the rectifier. This can be
done by using a capacitor at the output of the rectifier this capacitor is also called as “FILTER
CAPACITOR” or “SMOOTHING CAPACITOR” or “RESERVOIR CAPACITOR”. Even after using
this capacitor a small amount of ripple will remain.

We place the Filter Capacitor at the output of the rectifier the capacitor will charge to the peak
voltage during each half cycle then will discharge its stored energy slowly through the load while the
rectified voltage drops to zero, thus trying to keep the voltage as constant as possible.

Fig 3.22: Filter Capacitor Input/output


If we go on increasing the value of the filter capacitor then the Ripple will decrease. But then the
costing will increase. The value of the Filter capacitor depends on the current consumed by the circuit,
the frequency of the waveform & the accepted ripple.

Department of EIE, VITS 47


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Where,

Vr= accepted ripple voltage. (Should not be more than 10% of the voltage)

I= current consumed by the circuit in Amperes.

F= frequency of the waveform. A half wave rectifier has only one peak in one cycle so F=25Hz

3.2.4 VOLTAGE REGULATOR


A Voltage regulator is a device which converts varying input voltage into a constant regulated

output voltage. Voltage regulator can be of two types

3.2.4.1 Linear Voltage Regulator

Also called as Resistive Voltage regulator because they dissipate the excessive voltage resistively as
heat.

3.2.4.2 Switching Regulators

They regulate the output voltage by switching the Current ON/OFF very rapidly. Since their
output is either ON or OFF it dissipates very low power thus achieving higher efficiency as compared to
linear voltage regulators. But they are more complex & generate high noise due to their switching
action. For low level of output power switching regulators tend to be costly but for higher output
wattage they are much cheaper than linear regulators.

The most commonly available Linear Positive Voltage Regulators are the 78XX series where the
XX indicates the output voltage. And 79XX series is for Negative Voltage Regulators.

Department of EIE, VITS 48


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Fig 3.2.4.2: Switching Regulators

After filtering the rectifier output the signal is given to a voltage regulator. The maximum input
voltage that can be applied at the input is 35V.Normally there is a 2-3 Volts drop across the regulator so
the input voltage should be at least 2-3 Volts higher than the output voltage. If the input voltage gets
below the Vmin of the regulator due to the ripple voltage or due to any other reason the voltage regulator
will not be able to produce the correct regulated voltage.

3.2.5 IC 7805
7805 is an integrated three-terminal positive fixed linear voltage regulator. It supports an input
voltage of 10 volts to 35 volts and output voltage of 5 volts. It has a current rating of 1 amp although
lower current models are available. Its output voltage is fixed at 5.0V. The 7805 also has a built-in
current limiter as a safety feature. 7805 is manufactured by many companies, including National
Semiconductors and Fairchild Semiconductors.

The 7805 will automatically reduce output current if it gets too hot. The last two digits represent
the voltage; for instance, the 7812 is a 12-volt regulator. The 78xx series of regulators is designed to
work in complement with the 79xx series of negative voltage regulators in systems that provide both
positive and negative regulated voltages, since the 78xx series can't regulate negative voltages in such a
system.

The 7805 & 78 is one of the most common and well-known of the 78xx series regulators, as it's
small component count and medium-power regulated 5V make it useful for powering TTL devices.

Table 3.4: Specifications of IC7805

SPECIFICATIONS IC 7805

Vout 5V

Vein - Vout Difference 5V - 20V

Department of EIE, VITS Operation Ambient Temp 0 - 125°C 49

Output Imax 1A
ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

3.4 ULTRASONIC RANGE FINDER


3.4.1 DESCRIPTION

Fig 3.28: Ultrasonic Sensor


A guide to using the Arduino Ultrasonic Range Detection Sensor with Arduino in order to
calculate distances from objects. In this case I'm also altering the output of an LED with PWM
according to how close an object is to the sensor. So the nearer you are the brighter the LED. So if we
start with the Arduino Ultrasonic Range Detection Sensor, it's an IC that works by sending an ultrasound
pulse at around 40 KHz. It then waits and listens for the pulse to echo back, calculating the time taken in
microseconds (1 microsecond = 1.0 x 10-6 seconds). You can trigger a pulse as fast as 20 times a second
and it can determine objects up to 3 meters away and as near as 3cm. It needs a 5V power supply to run.
Adding the Arduino Ultrasonic Range Detection Sensor to the Arduino is very easy, only 4 pins
to worry about. Power, Ground, Trigger and Echo. Since it needs 5V and Arduino provides 5V I'm
obviously going to use this to power it. Below is a diagram of my Arduino Ultrasonic Range Detection

Department of EIE, VITS 50


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Sensor, showing the pins. There are 2 sets of 5 pins, 1 set you can use, the other is for programming the
PIC chip so don't touch them!

3.4.2 Specification:

1. Working Voltage : 5V(DC) Working


2. Current: max 15 ma
3. Working frequency : 40HZ
4. Output Signal: 0-5V (Output high when obstacle in range)
5. Sentry Angle : max 15 degree
6. Sentry Distance: 2cm - 500cm
7. High-accuracy: 0.3cm
8. Input trigger signal: l0us
9. TTL impulse Echo signal: output TTL PWL signal
10. Size: 45*20* 15mm

Fig 3.3: Trigger and Echo Radius

Department of EIE, VITS 51


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Note: This module is not suitable to connect with electric power, if you need to connect this module
with electronic power, then let the GND terminal of this module to be connected first, otherwise, it will
affect the normal work of the module

3.4.3 Interface:

1: VCC; 2: trig (T); 3: echo (R); 4: GND

Fig 3.30: Ultrasonic Sensor Pins

Department of EIE, VITS 52


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

3.4.4 Usage

Supply module with 5 V, the output will be 5 V while obstacle in range, or OV


if not. The out pin of this module is used as a switching output when anti-theft
module, and without the feet when ranging modules,

Note: the module should be inserted in the circuit before been power, which
avoid producing high level of miss operation; if not, then power again.

3.4.5 Module Working Principle

1. Adopt 10 trigger through supplying at least l0us sequence of high level signal,

2. The module automatically send eight 40khz square wave and automatically
detect whether receive the returning pulse signal,

3. If there is signals returning, through outputting high level

Test distance = (high level time * sound velocity (340M/S) / 2,

3.4.6 The circuit

Very, very simple circuit, I've used the breadboard to share the GND
connection and to add the LED which I could probably have done without the
breadboard. You'll see the most complex thing is the code later on.

3.5 Buzzer

Basically, the sound source of a piezoelectric sound component is a


piezoelectric diaphragm. A piezoelectric diaphragm consists of a piezoelectric ceramic
plate which has electrodes on both sides and a metal plate (brass or stainless steel,
etc.). A piezoelectric ceramic plate is attached to a metal plate with adhesives.
Applying D.C. voltage between electrodes of a piezoelectric diaphragm causes
mechanical distortion due to the piezoelectric effect. For a misshaped piezoelectric
element, the distortion of the piezoelectric element expands in a radial direction. And
the piezoelectric diaphragm bends toward the direction. The metal plate bonded to the
piezoelectric element does not expand. Conversely, when the piezoelectric element

Department of ECE, MRITS 53


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

shrinks, the piezoelectric diaphragm bends in the direction Thus, when AC voltage is
applied across electrodes, the bending is repeated, producing sound waves in the air.

To interface a buzzer the standard transistor interfacing circuit is used. Note


that if a different power supply is used for the buzzer, the 0V rails of each power
supply must be connected to provide a common reference.

If a battery is used as the power supply, it is worth remembering that piezo sounders
draw much less current than buzzers. Buzzers also just have one ‘tone’, whereas a
piezo sounder is able to create sounds of many different tones.

To switch on buzzer -high 1

To switch off buzzer -low 1

Notice (Handling) In Using Self Drive Method

1) When the piezoelectric buzzer is set to produce intermittent sounds, sound may be
heard continuously even when the self drive circuit is turned ON / OFF at the "X"
point shown in Fig. 9. This is because of the failure of turning off the feedback
voltage.

2) Build a circuit of the piezoelectric sounder exactly as per the recommended circuit
shown in the catalog of the transistor and circuit constants are designed to ensure
stable oscillation of the piezoelectric sounder.

3) Design switching which ensures direct power switching.

4) The self drive circuit is already contained in the piezoelectric buzzer. So there is no
need to prepare another circuit to drive the piezoelectric buzzer.

5) Rated voltage (3.0 to 20Vdc) must be maintained. Products which can operate with
voltage higher than 20Vdc are also available.

6) Do not place resistors in series with the power source, as this may cause abnormal
oscillation. If a resistor is essential to adjust sound pressure, place a capacitor (about
1μF) in parallel with the piezo buzzer.

7) Do not close the sound emitting hole on the front side of casing.

Department of ECE, MRITS 54


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

8) Carefully install the piezo buzzer so that no obstacle is placed within 15mm from
the sound release hole on the front side of the casing.

Department of ECE, MRITS 55


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

CHAPTER 4

CIRCUIT DIAGRAM AND OPERATION

4.1 OPERATION

The existing range finders measure the distance to the object using ultrasound
beam and represent it via variable tone sound signals.

This approach has limitations because the individual must remember the
lookup table between sound tone and the distance. In addition, these range finders are
incapable of detecting moving objects such as cars or people which reduce safety.
This contest entry describes the vision system which helps the blind orienting in the
surround space. As contrasted to existing systems, the proposed device combines the
usefulness, simplicity to use together with low cost. Device measures the distance to
the object and “visualizes” the measurement results as special slider position which
can be easily touched by blind people. Moreover, the device estimates the
neighboured objects speed using Doppler and generates the proportional to the objects
speed number of sound signals. As result, the blind individual with the proposed
system can travel efficiently and safely.

The system consist of the ultrasound transmitter TX and receiver RX, the
CPU-controlled carrier generator to form the ultrasound carrier signal, the transmitter
driver to amplify the carrier signal to the piezoelectric transmitter acceptable levels,
the signal mixer to select the Doppler frequency shift during speed measurements,
synchronous rectifier to rectify the incoming signal during distance measurements,
multiplexer, low-pass filter to suppress the high frequency mixer/rectifier products,
CPU for system control, an buzzer.

4.2 OBSTACLE DETECTION AND DISTANCE CALCULATION

4.2.1 Obstacle detection

Ultrasonic sensors are used for obstacle detection and calculation of its
adaptive distance from the visually impaired person. Ultrasonic sensors are used in
pair as transceivers. One device which emits sound waves is called as transmitter and
other who receives echo is known as receiver. These sensors work on a principle
Department of ECE, MRITS 56
ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

similar to radar or sonar which detects the object with the help of echoes from sound
waves. An algorithm is implemented in C-language on PIC microcontroller. The time
interval between sending the signal and receiving the echo is calculated to determine
the distance to an object. As these sensors use sound waves rather than light for object
detection, so can be comfortably used in ambient outdoor application. Five ultrasonic
sensor pairs are used in this system.

Input Requirement: A Working Voltage: 5V (DC) A Working Current:


15mA .A Input trigger signal: 10us impulse TTL

Output Signals: An Echo signal: PWM signal. Time required for sound signal
to travel twice between source and obstacle. A Range: 5 meters.

4.2.2 Distance calculation

For distance calculation following equation is used:

D= [(EPWHT) * (SV)/2] … (1)

Where,

D = Distance in cm

EPWHT = Echo pulse width high time

SV = Sound velocity in cm/s

Before concluding the obstacle distance from the subject, repeated information
sampling and averaging is performed. As ambient light conditions do not affect
ultrasonic sensors, object detection and distance calculation can be performed
accurately.

4.3 COMMUNICATION BETWEEN SYSTEM AND SUBJECT

This system can understand 500 meters distant object / obstacle in any
direction. This system announces calculated real time distance as it is in meters or
centimetres using speech messages. To make distance understanding more appealing
to the subject, speech messages can be stored in a universal language.

4.3.1 Speech warning messages for conveying detected conditions to subject

Department of ECE, MRITS 57


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Many researchers [10, 11, 12] used vibration array, buzzer based audio
frequency clips or text to speech conversion for announcing any detected condition to
the subject. This system uses pre-recorded speech messages for conveying any
detected condition to the subject. It uses APR33A3 audio recording and playback
flash memory. It can store variable duration speech messages up to 60 sec. duration.
Number of messages can be increased by reducing the duration of each message. PIC
microcontroller processes real-time data collected by ultrasonic sensor array and takes
the correct decision. Based on processed data, correct decision is taken and relevant
message is invoked from the flash memory and conveyed to the subject through
earphone. Sample speech messages stored in flash memory are shown in table 1.

Table 4.3.1: Sample obstacle distance speech messages

SR.NO D I S TA N C E AUDIO OUPUT


IN METERS
1 Less than 50cm Object is less than 50cm

2 50cm to 100cm Object is less than 100cm

3 100cm to 150cm Object is less than 150cm

4 150cm to 200cm Object is less than 200cm

5 200cm to 250cm Object is less than 250cm

6 250cm to 300m Object is less than 300cm

Formal distance scaling (with speech message) 1 Less than 70 cm Object is


very close 2 70 cm to 99 cm Object is at 1 meter distance 3 100 cm to 199 cm Object
is at 2 meter distance 4 200 cm to 299 cm Object is at 3 meter distance 5 300 cm to
399 cm Object is at 4 meter distance 6 400 cm to 499 cm Object is at 5 meter
distance.

4.3.2 Flexibility to use any language for speech warning messages

For speech assisted navigation, many researchers are using text to speech
conversion. In such cases researchers are converting text into English language only.
As this system uses APR33A3 flash memory to store the pre-recorded speech
messages, there is no barrier for usage of any language. Any appealing universal

Department of ECE, MRITS 58


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

language can be used for recording speech warning messages. This system offers a
simple mechanism for recording and storing such speech warning messages.

Department of ECE, MRITS 59


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

CHAPTER 5

RESULT AND ANALYSIS

5.1 Test Methodology

Ultrasonic sensors, PIC and APR9600 are tested individually as well as an


integrated system. As ultrasonic sensors work on principle of echo, study of its
reflection properties on different object surfaces is very important. Four such tests are
carried on concrete wall, static human body, wood and metal. Surface smoothness
plays key role in obstacle detection. Smooth surface object can be detected from
maximum detection range of ultrasonic sensors.

Metal surface gives highest reflections and then concrete wall, wood and
human body. These four surfaces are considered for testing as subject can come across
any of them during navigation. All these tests are carried out in laboratory
environment and their readings are recorded. Details of test carried and their distance
range outcomes are given in table 5.1.

Table 5.1: Response of ultrasonic sensor to different object surface

O B S TA C L E DETECTION RANGE IN CM
S U R FA C E
Test 1 Test 2 Test 3 Test 4

Metal 490 485 476 480

Concrete wall 412 446 437 450

Wood 400 402 412 406

Human Body 392 380 401 394

Figure 5.1 Final output snap shot

4.2 RESULT

A wearable system prototype is developed by integration five ultrasonic sensor


pairs on customized spectacles & waist belt, APR33A3 flash memory, earphone with
PIC microcontroller. After blindfolding the person, he was asked to walk through the
corridor where different type of obstacles has been placed within 10 meter range.

Department of ECE, MRITS 60


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

During the experiment, user’s walking motion is recorded. Time taken by the users
(trained and novice) for successfully walking through the obstacles is measured and
travel speed for each test has been calculated. It is that average speed of a trained and
novice users are 0.76 and 0.38 m/s respectively. In comparison with the traveling
speed of the sighted people (1.4 m/s), this result is acceptable. The accuracy of the
device in finding out obstacles is also very good. This result shows that training of the
user is one of the important factors for gaining high traveling speed and also to
increase the user confidence to choose obstacle free path.

Department of ECE, MRITS 61


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

CHAPTER 5

CONCLUSION AND FUTURE SCOPE

5.1 CONCLUSION

This wearable electronic navigation system is successfully tested on blind


folded subjects in indoor environment. Less training time is required to use this
system. With rigorous training, system can be used for outdoor navigation also.

Considering the expectations and requirements of the visually impaired and


blind people, this system offers a low cost, reliable, portable, low power and robust
solution for smooth navigation. Though the system is light weight, but hard wired
with sensors and other components. Further wearable aspect of this system can be
improved using wireless connectivity between the system components. This system is
developed considering visually impaired and blind people in developing countries.

5.2 FUTURE SCOPE

In future we would see more compact and more user friendly devices which
can be operated with ease and comfort. We are presently using this application in
various projects like Automated parking systems, Velocity meter, Automatic door
systems and other applications.

By adding more sensors and appropriate technology we can make it more


compatible and mobile. We would see the future tech more user friendly in terms of
size and material.

CHAPTER 6
Department of ECE, MRITS 62
ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

SOFTWARE DESCRIPTION
This project is implemented using following software’s:
 Express PCB – for designing circuit
 PIC C compiler - for compilation part
 PIC2kit dumper – for dump embedded code into microcontroller
 Proteus 7 (Embedded C) – for simulation part

6.1 Express PCB:

Breadboards are great for prototyping equipment as it allows great flexibility to


modify a design when needed; however the final product of a project, ideally should
have a neat PCB, few cables, and survive a shake test. Not only is a proper PCB
neater but it is also more durable as there are no cables which can yank loose.

Express PCB is a software tool to design PCBs specifically for manufacture by the
company Express PCB (no other PCB maker accepts Express PCB files). It is very
easy to use, but it does have several limitations.

It can be likened to more of a toy then a professional CAD program.

It has a poor part library (which we can work around)

It cannot import or export files in different formats

It cannot be used to make prepare boards for DIY production

Express PCB has been used to design many PCBs (some layered and with surface-
mount parts. Print out PCB patterns and use the toner transfer method with an Etch
Resistant Pen to make boards. However, Express PCB does not have a nice print
layout. Here is the procedure to design in Express PCB and clean up the patterns so
they print nicely.

6.1.1 Preparing Express PCB for First Use:

Express PCB comes with a less then exciting list of parts. So before any project is
started head over to Audio logic and grab the additional parts by morsel, ppl, and

Department of ECE, MRITS 63


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

tangent, and extract them into your Express PCB directory. At this point start the
program and get ready to setup the workspace to suit your style.

Click View -> Options. In this menu, setup the units for “mm” or “in” depending on
how you think, and click “see through the top copper layer” at the bottom. The
standard color scheme of red and green is generally used but it is not as pleasing as
red and blue.

6.1.2 The Interface:

When a project is first started you will be greeted with a yellow outline. This yellow
outline is the dimension of the PCB. Typically after positioning of parts and traces,
move them to their final position and then crop the PCB to the correct size. However,
in designing a board with a certain size constraint, crop the PCB to the correct size
before starting.

Fig: 4.1 show the toolbar in which the each button has the following functions:

Fig 4.1: Tool bar necessary for the interface

 The select tool: It is fairly obvious what this does. It allows you to move and
manipulate parts. When this tool is selected the top toolbar will show buttons
to move traces to the top / bottom copper layer, and rotate buttons.
 The zoom to selection tool: does just that.

 The place pad: button allows you to place small soldier pads which are useful
for board connections or if a part is not in the part library but the part
dimensions are available. When this tool is selected the top toolbar will give
you a large selection of round holes, square holes and surface mount pads.

 The place component: tool allows you to select a component from the top
toolbar and then by clicking in the workspace places that component in the
orientation chosen using the buttons next to the component list. The

Department of ECE, MRITS 64


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

components can always be rotated afterwards with the select tool if the
orientation is wrong.

 The place trace: tool allows you to place a solid trace on the board of varying
thicknesses. The top toolbar allows you to select the top or bottom layer to
place the trace on.

 The Insert Corner in trace: button does exactly what it says. When this tool is
selected, clicking on a trace will insert a corner which can be moved to route
around components and other traces.

 The remove a trace button is not very important since the delete key will
achieve the same result.

6.1.3 Design Considerations:

Before starting a project there are several ways to design a PCB and one must be
chosen to suit the project’s needs.

Single sided, or double sided?

When making a PCB you have the option of making a single sided board, or a
double sided board. Single sided boards are cheaper to produce and easier to etch,
but much harder to design for large projects. If a lot of parts are being used in a
small space it may be difficult to make a single sided board without jumper over
traces with a cable. While there’s technically nothing wrong with this, it should be
avoided if the signal travelling over the traces is sensitive (e.g. audio signals).

A double sided board is more expensive to produce professionally, more difficult to


etch on a DIY board, but makes the layout of components a lot smaller and easier. It
should be noted that if a trace is running on the top layer, check with the
components to make sure you can get to its pins with a soldering iron. Large
capacitors, relays, and similar parts which don’t have axial leads can NOT have
traces on top unless boards are plated professionally.

Department of ECE, MRITS 65


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

When using a double sided board you must consider which traces should be on what
side of the board. Generally, put power traces on the top of the board, jumping only
to the bottom if a part cannot be soldiered onto the top plane (like a relay), and vice-
versa.

Some projects like power supplies or amps can benefit from having a solid plane to
use for ground. In power supplies this can reduce noise, and in amps it minimizes
the distance between parts and their ground connections, and keeps the ground
signal as simple as possible. However, care must be taken with stubborn chips such
as the TPA6120 amplifier from TI. The TPA6120 datasheet specifies not to run a
ground plane under the pins or signal traces of this chip as the capacitance generated
could effect performance negatively.

6.2 PIC Compiler:


PIC compiler is software used where the machine language code is written and
compiled. After compilation, the machine source code is converted into hex code
which is to be dumped into the microcontroller for further processing. PIC compiler
also supports C language code.
It’s important that you know C language for microcontroller which is commonly
known as Embedded C. As we are going to use PIC Compiler, hence we also call it
PIC C. The PCB, PCM, and PCH are separate compilers. PCB is for 12-bit opcodes,
PCM is for 14-bitopcodes, and PCH is for 16-bit opcode PIC microcontrollers. Due to
many similarities, all three compilers are covered in this reference manual. Features
and limitations that apply to only specific microcontrollers are indicated within. These
compilers are specifically designed to meet the unique needs of the PIC
microcontroller. This allows developers to quickly design applications software in a
more readable, high-level language. When compared to a more traditional C compiler,
PCB, PCM, and PCH have some limitations. As an example of the limitations,
function recursion is not allowed.
This is due to the fact that the PIC has no stack to push variables onto, and also
because of the way the compilers optimize the code. The compilers can efficiently
implement normal C constructs, input/output operations, and bit twiddling operations.
All normal C data types are supported along with pointers to constant arrays, fixed
point decimal, and arrays of bits.
Department of ECE, MRITS 66
ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

PIC C is not much different from a normal C program. If you know assembly, writing
a C program is not a crisis. In PIC, we will have a main function, in which all your
application specific work will be defined. In case of embedded C, you do not have
any operating system running in there. So you have to make sure that your program or
main file should never exit. This can be done with the help of simple while (1) or for
(;;) loop as they are going to run infinitely.

We have to add header file for controller you are using, otherwise you will not be able
to access registers related to peripherals.

#include <16F72.h> // header file for PIC 16F72//

6.3 PICkit

PICkit is a family of programmers for PIC microcontrollers made by Microchip


Technology. They are used to program and debug microcontrollers, as well as
program EEPROM. Some models also feature logic analyzer and serial
communications (UART) tool.m The people who develop opensource software
for the PICkit use a mailing list for collaboration

Versions

PICkit 1

The PICkit 1 — introduced on March 31, 2003 for US$36— was a rudimentary
USB programmer for PIC microcontrollers, produced by Microchip
Technology, the manufacturers of the PIC series of microcontrollers. It was
integrated into a demonstrator board, featuring eight LEDs, a switch, and a

Department of ECE, MRITS 67


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

potentiometer. Its default program, explained in the documentation, rotates the


LEDs in series. The light display's direction and speed of rotation can be
changed with the button and potentiometer on the PICkit board.

PICkit 2

The PICkit 2 — introduced in May 2005 — replaced the PICkit 1. The most notable
difference between the two is that the PICkit 2 has a separate programmer/debugger
unit which plugs into the board the chip to be programmed, whereas the PICkit 1 was
a single unit. This makes it possible to use the programmer with a circuit board via an
In Circuit Serial Programming (ICSP) header. This feature is not intended for socalled
"production" programming, however. The PICkit 2 uses an internal PIC18F2550 with
FullSpeed USB. The latest PICkit 2 firmware allows the user to program and debug
most of the 8 and 16 bit PICmicro and dsPIC members of the Microchip product line.
The PICkit 2 is open to the public, including its hardware schematic, firmware source
code (in C language) and application programs (in C# language). End users and third
parties can easily modify both the hardware and software for enhanced features. e.g.
GNU/Linux version of PICkit 2 application software, DOS style CMD support, etc.
The PICkit 2 has a programmertogo (PTG) feature, which can download the hex file
and programming instructions into onboard memory (128 KB I²C EEPROM or 256
KB I2C EEPROM),

Department of ECE, MRITS 68


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

so that no PC is required at the end application. The Microchip version of PICkit 2


has a standard 128 KB memory. 256 KB memory can be achieved by modifying the
hardware or from third party. Additionally, a 500 kHz threechannel logic analyser and
a UART tool are built into the PICkit 2. These features are missing from the PICkit 3.
Since release of V2.61, PICkit 2 PC software now supports a maximum 4 megabytes
of memory for the programmertogo. This modification makes the PICkit 2 support
eight times as much memory as the PICkit 3.

This enhancement has been contributed by Au Group Electronics and the PICkit 2
firmware is also reported to be submitted to Microchip PICkit 2 team in the middle of
March 2009. This enhancement may be integrated into future firmware releases, too.

PICkit 3

Microchip has gone on to manufacture the PICkit 3, a variation of the PICkit 2 with
the same form factor and a new translucent case. It features a faster 16bit PIC24F
processor and a wider voltage regulation range. There are some complaints of it not
being as as the Pickit 2. Both PICkit 2 and PICkit 3 have internal, switchmode
Voltage.

Clones:

PICkit 2 has been an interesting PIC programmer from Microchip. It can program
most PICs and debug most of the PICs (as of May2009, only the PIC32 family is not
supported for MPLAB debugging). Ever since its first releases, all software source
code (firmware, PC application) and hardware schematics are open to the public. This
makes it relatively easy for an end user to modify the programmer for use with a
Department of ECE, MRITS 69
ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

nonWindows operating system such as Linux or Mac OS. In the meantime, it also
creates much DIY interest and clones.
This opensource structure brings many features to the PICkit 2 community, such as
ProgrammertoGo, the UART Tool and the Logic Tool, which have been contributed
by PICkit 2 users. Users have also added such features to the PICkit 2 as 4 MB
Programmertogo capability, USB buck/boost circuits, RJ12 type connectors, and
more. It even penetrated into the Atmel community as it is able to be configured into
an AVR ICSP tool.
There are many other USB PIC programmers other than the PICkit series. regulators.
This allows them, in the case of the PICkit 2, to generate voltages from 2.5 to 5 volts,
or in the case of the PICkit 3, 2.5 to 5.5 volts, from a 5 V USB supply, at around 100
mA. Both have options

6.4 Proteus:

Proteus is software which accepts only hex files. Once the machine code is converted
into hex code, that hex code has to be dumped into the microcontroller and this is
done by the Proteus. Proteus is a programmer which itself contains a microcontroller
in it other than the one which is to be programmed. This microcontroller has a
program in it written in such a way that it accepts the hex file from the pic compiler
and dumps this hex file into the microcontroller which is to be programmed. As the
Proteus programmer requires power supply to be operated, this power supply is given
from the power supply circuit designed and connected to the microcontroller in
proteus. The program which is to be dumped in to the microcontroller is edited in
proteus and is compiled and executed to check any errors and hence after the
successful compilation of the program the program is dumped in to the
microcontroller using a dumper.

6.5 Procedural steps for compilation, simulation and dumping:

6.5.1 Compilation and simulation steps:

For PIC microcontroller, PIC C compiler is used for compilation. The compilation
steps are as follows:

Department of ECE, MRITS 70


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

 Open PIC C compiler.


 You will be prompted to choose a name for the new project, so create a
separate folder where all the files of your project will be stored, choose a
name and click save.

Fig 6.5.1: Picture of opening a new file using PIC C compiler

 Click Project, New, and something the box named 'Text1' is where your code
should be written later.
 Now you have to click 'File, Save as' and choose a file name for your source
code ending with the letter '.c'. You can name as 'project.c' for example and
click save. Then you have to add this file to your project work.

Department of ECE, MRITS 71


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Fig 6.5.2: Picture of compiling a new file using PIC C compiler

Fig 6.5.3: Picture of compiling a project.c file using PIC C compiler


 You can then start to write the source code in the window titled 'project.c' then
before testing your source code; you have to compile your source code, and
correct eventual syntax errors.
Department of ECE, MRITS 72
ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Fig 6.5.4: Picture of checking errors and warnings using PIC C compiler

 By clicking on compile option .hex file is generated automatically.


 This is how we compile a program for checking errors and hence the
compiled program is saved in the file where we initiated the program.

Fig 6.5.5: Picture of .hex file existing using PIC C compiler


Department of ECE, MRITS 73
ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

After compilation, next step is simulation. Here first circuit is designed in Express
PCB using Proteus 7 software and then simulation takes place followed by dumping.
The simulation steps are as follows:
 Open Proteus 7 and click on IS1S6.
 Now it displays PCB where circuit is designed using microcontroller. To
design circuit components are required. So click on component option.
10. Now click on letter ’p’, then under that select PIC16F73 ,other components related
to the project and click OK. The PIC 16F73 will be called your “'Target device”,
which is the final destination of your source code.
6.6 Dumping steps:
The steps involved in dumping the program edited in proteus 7 to microcontroller are
shown below:
1. Initially before connecting the program dumper to the microcontroller kit the
window is appeared as shown below.

Department of ECE, MRITS 74


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Fig 4.6: Picture of program dumper window

2. Select Tools option and click on Check Communication for establishing a


connection as shown in below window

Department of ECE, MRITS 75


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Fig 4.7: Picture of checking communications before dumping program into


microcontroller

3. After connecting the dumper properly to the microcontroller kit the window is
appeared as shown below.

Department of ECE, MRITS 76


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Fig 4.8: Picture after connecting the dumper to microcontroller

4. Again by selecting the Tools option and clicking on Check Communication the
microcontroller gets recognized by the dumper and hence the window is as shown
below.

Department of ECE, MRITS 77


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Fig 4.9: Picture of dumper recognition to microcontroller

5. Import the program which is ‘.hex’ file from the saved location by selecting File
option and clicking on ‘Import Hex’ as shown in below window.

Department of ECE, MRITS 78


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Fig 4.10: Picture of program importing into the microcontroller

6. After clicking on ‘Import Hex’ option we need to browse the location of our
program and click the ‘prog.hex’ and click on ‘open’ for dumping the program into
the microcontroller.

Department of ECE, MRITS 79


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

Fig 4.11: Picture of program browsing which is to be dumped

Department of ECE, MRITS 80


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

7. After the successful dumping of program the window is as shown below.

Fig 4.12: Picture after program dumped into the microcontroller

Department of ECE, MRITS 81


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

REFFERENCES

[1] Margrain, TH. Helping blind and partially sighted people to read: the
effectiveness of low vision aids. British Journal of Ophthalmology. Pp.919-922,
2000.

[2] Blindness and Visual Impairment: Global Facts.http://www.vision202 -0.org. [3]


A. Dodds, D. Clark-Carter, and C. Howarth, “The sonic Pathfinder: an evaluation,”
Journal of Visual Impairment and Blindness, vol. 78, no. 5, pp. 206–207, 1984.

[4] A. Heyes, “A polaroid ultrasonic travel aid for the blind,” Journal of Visual
Impairment and Blindness, vol. 76, pp. 199– 201, 1982.

[5] I. Ulrich, and J. Borenstein, “The guide cane-Applying mobile robot


technologies to assist the visually impaired,” IEEE Transaction on Systems, Man, and
Cybernetics-Part A: Systems and Humans, vol. 31, no.2, pp. 131-136, 2001. [6] J.
Barth, and E. Foulhe, “Preview: A neglected variable in orientation and mobility,”
Journal of Visual Impairment and Blindness, vol. 73, no.2, pp. 41–48, 1979.

[7] S. Shoval, J. Borenstein, and Y. Koren, “The NavBelt- A computerized travel aid
for the blind based on mobile robotics technology,” IEEE Transactions on Biomedical
Engineering, vol. 45, no 11, pp. 1376-1386,1998.

[8] P. Meijer, “An Experimental System for Auditory Image Representations,” IEEE
Transactions on Biomedical Engineering, vol.39, no 2, pp. 112-121, Feb 1991.

Department of ECE, MRITS 82


ULTRASONIC NAVIGATION FOR BLIND WITH AUDIO INTERFACE

[9] G. Sainarayanan, “On Intelligent Image Processing Methodologies Applied to


Navigation Assistance for Visually Impaired”, Ph. D. Thesis,University Malaysia
Sabah, 2002.

[10] G. Balakrishnan, G. Sainarayanan, R. Nagarajan and S. Yaacob,“Wearable Real-


Time Stereo Vision for the Visually Impaired,” Engineering Letters, vol. 14, no. 2,
2007.

[11] G. P. Fajarnes, L. Dunai, V. S. Praderas and I. Dunai, “CASBLiP- a new


cognitive object detection and orientation system for impaired people,”
Proceedings of the 4th International Conference on Cognitive Systems,ETH Zurich,
Switzerland, 2010.

[12] Amit kumar, M. Manjunatha and J. Mukhopadhyay, “An Electronic Travel Aid
for Navigation of Visually Impaired Person,” Proceeding of the 3rd International
Conference on Communication Systems and Networks, pp.1-5, 2011.

Department of ECE, MRITS 83

You might also like