Documente Academic
Documente Profesional
Documente Cultură
INTRODUCTION
1.1 Motivation
Assistive Technology (AT) that refers to hardware and software solutions for persons with
physical, cognitive or sensory disabilities can help people to have more productive and
pleasant lives. Several physical disabilities/conditions require the use of wheelchair including
brain injury, stroke, fractures, amputation, pulmonary disease, neurological disorders,
musculoskeletal diseases/injuries and spinal cord injuries. In such cases the use of a
wheelchair can bring an enhanced independence that will increase the user’s quality of life.
However some of the impairments cause severe difficulties on the use of wheelchair manual
or electronic.
This study concluded that 9 to 10 % of patients who use power chairs and who
received appropriate training “find it extremely difficult or impossible to use the wheelchair
for activities of daily living”. Some of the pointed reasons are difficult on controlling the
wheelchair with a joystick, uncomfortable and inappropriate interface for the disability
(because users with severe motor impairments are unable to operate the joystick smoothly).
For elderly patients arthritis is one of the major reasons for wheelchair use. The
repeated usage of joysticks and continuous wrist movements can be very painful for an
arthritic patient, and may result in reinforced difficulties. For the referred groups of users a
voice based interface is highly encouraging because it represents a natural and simple way of
controlling the device. For other types of disabilities different types of interfacing devices can
be used.
To achieve this, a wheelchair-based assistive device is developed, allowing the user to
select arbitrary local destinations through a voice recognition module and a mems module.
1
Since we use a voice recognition chip, it recognizes only user’s voice, additional noise
causes disturbances in input signal.
While using voice recognition module the sensitivity of MEMS causes overwriting of
voice input signal.
1.2.2 Contribution
High torque motors are used whenever high loads are given as input. In order to avoid
the clumsiness that occurs while recognition of several voices, a single user voice can
be used to give instructions.
MEMS module can be fixed rigidly such that, while operating with voice module, the
high sensitivity nature of MEMS shows no effect on the movement of wheel chair.
Chapter 1 Deals with the introduction of the project which includes motivation,
challenges and contributions, brief description of embedded system
organization of thesis and conclusion.
Chapter 2 Deals with the relevant work study on the wheel chair theoretical overview
and conclusion.
Chapter 3 Deals with hardware description of the project i.e schematic diagram and its
description.
Chapter 4 Deals with the software used to implement the project that is keil software,
Embedded C programming for communication of the data and ISIS
Professional Proteus 8.1
1.4 Conclusion
2
This chapter discussed the motivation of the project, challenges that are faced while doing
project and its contribution. Also discussed organization of thesis; given a brief description
about chapters. The next chapter will discuss the relevant work study.
3
Chapter 2
2.1. Introduction
This project mainly consists of micro controller LPC2103, MEMS, Voice recognition module
V2 and for the function of all the components power supply is needed. The power supply
module converts 230V A.C into 5V D.C supply, for this we preferred the book "Electronic
devices and circuits" by "Srinivasan" and "Shalivahana". For sensors we preferred the book
"Hand book of Modern Sensors" by "Jacob Fraden". For keil software, sensors and its
specifications we preferred the website www.google.com.
To work out this project we had studied different real time and working models of
automatic wheel chair as follows
A smart wheelchair equipped with sensors and driven by Head movement control that allows
the rider to interact with and command the system at various levels of abstraction as in [1]. A
novel hands-free control system for Intelligent Wheelchairs is proposed in [2]. A robust Hand
Gesture Interface is designed for vision based head gesture recognition of the Robot Chair
user. The recognized gestures are used to generate motion control commands so that the
Robot Chair can be controlled according to the user’s intention. An integrated approach to
real time detection, tracking and direction recognition of hands, which is intended to be used
as a human-robot interaction interface for the intelligent wheel chair is presented in [3]. The
author here demonstrates that accelerometers can be used to effectively translate finger and
hand gestures into computer interpreted signals. A different gesture recognition methods that
are employed in wheelchair used for navigation and that is affordable by the people in
developing nations is given in [4]. In this technique a GCUI (Gesture Controlled User
Interface) prototype application, called Open Gesture, to help users carry out everyday
activities such as making phone calls, controlling their television and performing
mathematical calculations is proposed as in [5]. Open Gesture uses simple hand gestures to
perform a diverse range of tasks via a television interface. This technique proposes a reactive
navigation algorithm that guarantees the safety of automated intelligent wheelchairs for
people with mobility impairments in dynamic uncertain environments as in [6]. The proposed
4
navigation algorithm restricts neither the natures nor the motions of the obstacles; the shapes
of the obstacles can be time-varying (deforming obstacles) and does not require prior
information about the positions and velocities of the obstacles to accomplish obstacle
avoidance.
The NavChair shares vehicle control decisions with the wheelchair operator regarding
obstacle avoidance, safe object approach, maintenance of a straight path, and other
navigational issues, to reduce the motor and cognitive requirements for operating a power
wheelchair[10].
[11]Touch Screen Based Direction and Speed Control of Wheel Chair for Physically
Challenged, This paper describes an intelligent motorized wheel chair for handicapped person
using touch screen technology. It enables a disabled person to move around independently
using a touch screen application which is interfaced with motors through micro-controller.
When we want to change the direction, the touch screen sensor is modelled to direct the user
to required destination using direction keys on the screen and that values are given to micro-
controller. Depending on the direction selected on the touch screen, micro-controller controls
the wheel chair directions. The speed controller works by varying the average voltage sent to
5
the motor. This is done by switching the motors supply on and off very quickly using PWM
technique.
[12]In this project the author has worked on the automatic wheelchair which is
controlled by both voice and MEMS sensor. This differs our project by usage of voice
module HM2007 instead of voice module v2.
[13] In the paper along with working on automatic wheelchair movement the authors
have also implemented home automation system using zigbee module and emergency call
system using GSM modules.
2.3 Conclusion
In this chapter we had discussed about the relevant work study done by us to refer projects
that relates to automatic movement of wheel chair using different technologies.
6
Chapter 3
Hardware Description
Considering the intensity levels of the technology support to the physically challenged
personalities the developed working model is tested with voice and MEMS based
accelerometer sensor
Display
MEMS MOTOR
SENSOR Assembly
All the digital circuits require regulated power supply. The power supply is designed to
convert high voltage AC mains electricity to a suitable low voltage supply for electronic
circuits and other devices. A power supply can be broken down into a series of blocks, each
of which performs a particular function. A DC power supply which maintains the output
voltage constant irrespective of AC mains fluctuations or load variations is known as
Regulated D.C Power Supply. But here voltage rectification is enough for the application.
7
Figure 3.2: Block Diagram of Power Supply
8
The lead-acid storage battery may be used. This battery is rechargeable; it consists of
lead and lead/dioxide electrodes which are immersed in sulfuric acid. When fully charged,
this type of battery has a 2.06-2.14 V potential (A 12 volt car battery uses 6 cells in series).
During discharge, the lead is converted to lead sulfate and the sulfuric acid is converted to
water. When the battery is charging, the lead sulfate is converted back to lead and lead
dioxide A nickel-cadmium battery has become more popular in recent years.
This battery cell is completely sealed and rechargeable. The electrolyte is not involved
in the electrode reaction, making the voltage constant over the span of the batteries long
service life. During the charging process, nickel oxide is oxidized to its higher oxidation state
and cadmium oxide is reduced. The nickel-cadmium batteries have many benefits.
Transformer
A transformer is a device which transforms high voltage AC into low voltage AC or vice
versa. Our goal is to convert high voltage AC into low voltage DC. So there is absolutely no
reason to use step-up transformer. The transformer that is used in power supply is step-down
transformer, which steps down the input AC voltage. The magnitude by which transformer
steps down the voltage depends on the turns ratio of primary and secondary winding. Observe
the magnitude of sinusoidal signal before the transformer block. Its magnitude is quite high
as compared to that of the signal after the transformer block diagram. This indicates that that
the signal was stepped down by the transformer. There arises an obvious question as to why
transformer is used in this system. The main reason why we use transformer in the system are
as follows.
9
1. We want to reduce the voltage level which we get from the AC mains. Transformer
can do the job of reducing the voltage level in a simple and efficient manner.
2. The diodes used in the rectifier block cannot handle such a high level of voltage from
the AC mains. So the voltage is first stepped down by the transformer and the reduced
voltage is applied to the rectifier section.
Rectifier
Rectifier is an electronic circuit consisting of diodes which carries out the rectification
process. Rectification is the process of converting an alternating voltage or current into
corresponding direct (dc) quantity. The input to a rectifier is ac whereas its output is
unidirectional pulsating dc. Usually a full wave rectifier or a bridge rectifier is used to rectify
both the half cycles of the ac supply (full wave rectification).
Filter capacitor
10
(input of the regulator in this case). Hence, an almost constant dc value having very less
ripple content is obtained.
Voltage Regulator
Input
GND
Output
3.3MEMS Accelerometer
3.3.1Principles of Operation
11
Most accelerometers are Micro-Electro-Mechanical Sensors (MEMS). The basic principle of
operation behind the MEMS accelerometer is the displacement of a small proof mass etched
into the silicon surface of the integrated circuit and suspended by small beams. Consistent
with Newton's second law of motion (F = ma), as an acceleration is applied to the device, a
force develops which displaces the mass. The support beams act as a spring, and the fluid
(usually air) trapped inside the IC acts as a damper, resulting in a second order lumped
physical system. This is the source of the limited operational bandwidth and non-uniform
frequency response of accelerometers.
MEMS-based accelerometers are available with different technologies. The most common are
based on capacitors and gas chambers.
3.3.2.1 Capacitor
MEMS-based accelerometer with capacitors is typically a structure that uses two capacitors
formed by a moveable plate held between two fixed plates. Under zero net force the two
capacitors are equal but a change in force will cause the moveable plate to shift closer to one
of the fixed plates, increasing the capacitance, and further away from the other fixed reducing
that capacitance. This difference in capacitance is detected and amplified to produce a voltage
proportional to the acceleration. The dimensions of the structure are of the order of microns.
12
Another design is based on the distribution of hot gas in a chamber and is typically used to
measure static tilt. The accelerometer has a chamber of gas with a heating element in the
center and four temperature sensors around its edge. Just as hot air rises and cooler air sinks,
the same applies to hot and cool gasses. The figure below on the left illustrates the situation
when the accelerometer is held level. The hot gas rises to the top-center of the accelerometer's
chamber, and all four temperature sensors measure the same temperature. The hot gas rises to
the top-center of the accelerometer’s chamber, and all four temperature sensors measure the
same temperature. When tilted, as is shown in the figure below on the right, the hot gas will
now collect closer to one, or possibly two, of the temperature sensors and the difference in
the four temperatures being measured will give a measure of the tilt.
Figure 3.8:
Gas
chamber
MEMS
3.3.2.3
Inputs,
outputs and performance characteristics
The main component of MEMS accelerometers with a capacitor is a cantilever beam with a
proof mass (also known as seismic mass). Damping results from the residual gas sealed in the
device. As long as the Q-factor is not too low, damping does not reduce sensitivity. External
accelerations make the proof mass deflect from its neutral position. This deflection is
measured in an analogue or digital manner. Most commonly, the capacitance between a set of
fixed beams and a set of beams attached to the proof mass is measured. This method is
simple, reliable, and inexpensive
3.4 ADXL335
The ADXL335 is a small, thin, low power, complete 3-axis accelerometer with signal
conditioned voltage outputs. The product measures acceleration with a minimum full-scale
13
range of ±3 g. It can measure the static acceleration of gravity in tilt-sensing applications, as
well as dynamic acceleration resulting from motion, shock, or vibration. The user selects the
bandwidth of the accelerometer using the Cx ,Cy, and Cz capacitors at the Xout , Yout and Zout pins.
Bandwidths can be selected to suit the application, with a range of 0.5 Hz to 1600 Hz for the X
and Y axes, and a range of 0.5 Hz to 550 Hz for the Z axis.
Features
1.3-axis sensing
3. Breakout module
9. High sensitive
3.4.1 Applications
14
1. Cost sensitive, low power, motion- and tilt-sensing applications
2. Mobile devices
3. Gaming systems
5. Image stabilization
15
Table 3.1: Orientation of axis
The ADXL335 is a complete 3-axis acceleration measurement system. The ADXL335 has a
measurement range of ±3 g mini-mum. It contains a poly silicon surface-micro machined
sensor and signal conditioning circuitry to implement open-loop acceleration measurement
architecture. The output signals are analog voltages that are proportional to acceleration. The
accelerometer can measure the static acceleration of gravity in tilt-sensing applications as
well as dynamic acceleration resulting from motion, shock, or vibration.
The basic block diagram of ADXL335 as mentioned in the data sheet. The chip has
in-built coupling capacitor between supply voltage and ground; thus reducing the noise at the
power supply line. It contains micro machined three axis sensor along with signal
conditioning circuitry. The output shows ratio metric characteristics thus, output voltage
changes depending on the change in supply voltage. Nominally, at zero g, output voltage is
half of the supply voltage. Each axis has a separate bandwidth adjustments. The capacitor in
series with output decides the bandwidth of each axis. Bandwidth range of 200 Hz to 1 KHz
is used.
16
Figure 3.12: ADXL Internal Structure
The accelerometer sensor used here is a poly silicon surface-micro machined structure
built on top of a silicon wafer. Deflection of the structure is measured using a differential
capacitor. The differential capacitor involves the inter digitations of moving fingers attached
to the proof mass with fixed fingers attached to the frame. The differential capacitance is
proportional to the overlapping area and the distance between the moving and fixed fingers.
Acceleration deflects the moving mass and unbalances the differential capacitor resulting in a
sensor output whose amplitude is proportional to acceleration. Acceleration deflects the
moving mass and unbalances the differential capacitor resulting in a sensor output whose
amplitude is proportional to acceleration. Phase sensitive demodulation techniques are then
used to determine the magnitude and direction of the acceleration.
17
3.5 Voice Recognition Module V2
The module could recognize your voice. It receives configuration commands or responds
through serial port interface. With this module, we can control the car or other electrical
devices by voice.
This module can store up to 15 pieces of voice instruction. Those 15 pieces are
divided into 3 groups, with 5 in each group. First we should train the module with voice
instructions group by group. After that, we should import one group before it could recognize
the 5 voice instructions within that group. If we need to implement instructions in other
groups, we should import the group first. This module is speaker dependent. If you trained
the module, your friend might not be able to make it work.
3.5.1 Parameters
1. Voltage: 4.5-5.5V
2. Current: <40mA
3. Digital Interface: 5V TTL level UART interface and GPIO
4. Analog Interface: 3.5mm mono-channel microphone connector + microphone pin
interface
5. Size: 30mm x 47.5mm
6. Recognition accuracy: 99% (under ideal environment)
This module can be configured by sending commands via serial port. Configuration
will be not erased after powered off.
Its interface is 5V TTL. The serial data format: 8 data bits, no parity, 1 stop bit. The
default baud rate is 9600 and baud rate can be changed.
18
Command format is "Head + Key". "Head" is a 0xaa, and "Key" is as follows:
Begin to "START \ n" : Ready for recording, you 0x41 : no voice detected
record can speak 0x42 : Speak the voice
group 1 "No voice \ n" : no voice detected speak until getting the START
"Again \ n" : Speak the voice message
instruction again. Do not speak until 0x43 : Too loud to record
getting the START message 0x44 : voice instruction
"Too loud \ n" : Too loud to record confirming failed. Voice for
"Different \ n" : voice instruction the second chance is different
confirming failed. Voice for the second with the first one.
19
chance is different with the first one. 0x45 : recording one voice
"Finish one \ n" : recording one voice instruction successfully
instruction successfully 0x46 : finish recording group
"Group1 finished! \ n" : finish 1
recording group 1
0x12 Begin to "ERROR! \ n" : Instruction error 0xe0 : Instruction error 0x40 :
record "START \ n" : Ready for recording, you Ready for recording, you can
instructions of can speak now "No voice \ n" : no speak now 0x41 : no voice
group 2 voice detected "Again \ n" : Speak the detected 0x42 : Speak the
voice instruction again. Do not speak voice instruction again. Do not
until getting the START message "Too speak until getting the START
loud \ n" : Too loud to record "Different message 0x43 : Too loud to
\ n" : voice instruction confirming record 0x44 : voice instruction
failed. Voice for the second chance is confirming failed. Voice for
different with the first one. "Finish the second chance is different
one \ n" : recording one voice with the first one. 0x45 :
instruction successfully "Group2 recording one voice
finished! \ n" : finish recording group 2 instruction successfully 0x47 :
finish recording group 2
0x13 Begin to "ERROR! \ n" : Instruction error 0xe0 : Instruction error
record "START \ n" : Ready for recording, you 0x40 : Ready for recording,
instructions of can speak now you can speak now
group 3 "No voice \ n" : no voice detected 0x41 : no voice detected
"Again \ n" : Speak the voice 0x42 : Speak the voice
instruction again. Do not speak until instruction again. Do not
getting the START message speak until getting the START
"Too loud \ n" : Too loud to record message
"Different \ n" : voice instruction 0x43 : Too loud to record
confirming failed. Voice for the second 0x44 : voice instruction
chance is different with the first one. confirming failed. Voice for
"Finish one \ n" : recording one voice the second chance is different
instruction successfully with the first one.
"Group3 finished! \ n" : finish 0x45 : recording one voice
recording group 3 instruction successfully
20
0x48 : finish recording group3
0x21 Import group 1 "Group1 Imported !\n" : Successful 0xcc : Successful 0xe0 :
and be ready "ERROR! \ n" : Instruction error Instruction error 0xe1 :
for voice "Import failed !\n" : Importing voice Importing voice group failed
instruction group failed
0x22 Import group 2 "Group2 Imported !\n" : Successful 0xcc : Successful
and be ready "ERROR! \ n" : Instruction error 0xe0 : Instruction error
for voice "Import failed !\n" : Importing voice 0xe1 : Importing voice group
instruction group failed failed
0x23 Import group 3 "Group3 Imported !\n" : Successful 0xcc : Successful 0xe0 :
and be ready "ERROR! \ n" : Instruction error Instruction error 0xe1 :
for voice "Import failed !\n" : Importing voice Importing voice group failed
instruction group failed
0x24 Query the "Used group:0\n" : No group is 0x00 : No group is recorded
recorded group recorded 0x01 : Group 1 is recorded
"Used group:1\n" : Group 1 is recorded 0x02 : Group 2 is recorded
"Used group:2\n" : Group 2 is recorded 0x04 : Group 3 is recorded
"Used group:3\n" : Group 3 is recorded 0x03 : Group 1 and Group 2
"Used group:12\n" : Group 1 and are recorded
Group 2 are recorded 0x05 : Group 1 and Group 3
"Used group:13\n" : Group 1 and are recorded
Group 3 are recorded 0x06 : Group 2 and Group 3
"Used group:23\n" : Group 2 and are recorded
Group 3 are recorded 0x07 : All the 3 groups are
"Used group:123\n" : All the 3 groups recorded
are recorded 0xe0 : Instruction error
"ERROR! \ n" : Instruction error
0x31 Change the "Baud: 2400\n" : Successful
baud rate to "ERROR! \ n" : Instruction error
2400bps
0x32 Change the "Baud: 4800\n" : Successful
baud rate to "ERROR! \ n" : Instruction error
4800bps
0x33 Change the "Baud: 9600\n" : Successful
baud rate to "ERROR! \ n" : Instruction error
9600bps
21
0x34 Change the "Baud: 19200\n" : Successful
baud rate to "ERROR! \ n" : Instruction error 0xcc : successful 0xe0 :
19200bps Instruction error
0x35 Change the "Baud: 38400\n" : Successful
baud rate to "ERROR! \ n" : Instruction error
38400bps
0x36 Switch to "Common Mode\n" : Successful
Common "ERROR! \ n" : Instruction error
Mode
22
0x63 in Pulse Mode
0x64 0x60 -- 10ms
0x65
0x61 -- 15ms
0x66
0x62 -- 20ms
0x67
0x68 0x63 -- 25ms
0x69 0x64 -- 30ms
0x6 0x65 -- 50ms "Ok\n" : Successful 0xcc : successful
A 0x66 -- 60ms "ERROR! \ n" : Instruction error 0xe0 : Instruction error
0x6B
0x67 -- 70ms
0x6C
0x68 -- 80ms
0x6
0x69 -- 90ms
D
0x6E 0x6A -- 100ms
0x6F 0x6B -- 200ms
0x6C -- 300ms
0x6D -- 400ms
0x6E -- 500ms
0x6F -- 1s
0x70 Reset Serial
Port to:
9600 baud "Ok\n" : Successful 0xcc : successful
rate, 8 data "ERROR! \ n" : Instruction error 0xe0 : Instruction error
bits, no parity,
1 stop bit
0xbb Query version Version information No respond
information
Table3.2: Commands of voice module V2
The main difference between Compact Mode and Common Mode is the returning
message. Common Mode response is long string but Compact Mode response is a byte. For
example, after sending 0xaa04 to delete all the contents of the 3 groups, in Common Mode it
will return "All Groups Deleted! \ n", but in Compact Mode it will return a concise bytes such
as 0xcc which means a successful operation.
Pulse Mode: Output is negative pulse. The pulse duration time (pulse duty) could be set by
command 0x60 ~ 0x6F
23
Flip Mode: each time while the module recognizes voice command, it will change the state
of the output pin.
Down Mode: The output will become LOW from HIGH once it detects voice command. It
will never come back to HIGH again until the module receives output reset command 0x41 ~
0x46
Up Mode: The output will become HIGH from LOW once it detects voice command. It
will never come back to LOW again until the module receives output reset command 0x41 ~
0x46
4. Import the group you need to use (only recognize 5 instructions within one group at the
same time)
After all the setting above, you can speak or send voice instruction to it. If identified
successfully, result will be returned via serial port in the format: group number + command
number. For example, return Result: 11 (Compact mode returns 0x11) means identified the
first command of group 1.
If voice instruction is recorded, each time after you power it on, you need to import
the group before letting it identify voice instructions
3.5.3 LED
1. Record indication: D1 (RED) flashes 3 times within the 600ms, then off for400ms,
and then flashes quickly for 4 times within 600ms. Now the recording indication is
over.
24
2. Begin to speak: D1 (RED) is off for 400ms, and then is on. Voice during the time
while D1 (RED) is on will be recorded by this module.
3. Recording a voice instruction successfully for the first time: D1 (RED) off, D2
(ORANGE) on for 300ms.
4. Recording a voice instruction successfully for the first time: D1 (RED) off, D2
(ORANGE) on for 700ms.
5. Recording failure: D2 (ORANGE) flashes 4 times within the 600ms. In cases that
voice instructions detected twice don’t match, or the sound is too large, or there is no
sound, recording will fail. You need to start over the recording process for that
instruction.
In waiting mode, D2 (ORANGE) is off, and D1 (RED) is on for 80ms every other 200ms,
fast flashing. In this mode, it doesn’t recognize voice command, only waiting for serial
commands.
In identification stage, D2 (ORANGE) is off, and D1 (RED) is on for 100ms every other
1500ms, slow flashing. In this stage, this module is processing received voice signal, and if
matching, it will send the result immediately via serial port.
3.5.3.4 Recording
Before using it, we have train it by recording voice instructions. Each voice instruction has
the maximum length of 1300ms, which ensures that most words can be recorded. Once you
start recording, you can’t stop the recording process until you finish all the 5 voice
instructions recording of one group. Also, once you start recording, the previous voice
instructions in that group will be erased. In training state, this module doesn’t reply to any
other serial commands.
LED will flash to indicate state. First, you need a serial tool. Here we use AccessPort
25
1. Serial port setting:
2. Send commands
Send: 0xaa11
Receive (in Common Mode):
START
No voice // I did not make any sound. So it replied such message
START
Speak now
Again
START
Speak again now
Different // I spoke another words for the second time. So it replied such message
START
Speak now
Again
START
Speak again now
Finish one // recording one instruction successfully
START
Again
START
Finish one
START
Again
START
26
Finish one
START
Again
START
Finish one
START
Again
START
Finish one
3.5.3.5 Recognition
We added another way to import the voice instruction group on V2. For V1, the only way is to
send command to it through serial port, for example:
27
exit the recognition stage until you send 0xAA00, or delete that group, or begin recording
instructions.
3.6.1 Introduction:
The ARM was originally developed at Acorn Computers Limited of Cambridge, England,
between 1983 and 1985. It was the first RISC microprocessor developed for commercial use
and has some significant differences from subsequent RISC architectures. In 1990 ARM
Limited was established as a separate company specifically to widen the exploitation of ARM
technology and it is established as a market-leader for low-power and cost-sensitive
embedded applications. The 16-bit CISC microprocessors that were available in 1983 were
slower than standard memory parts. They also had instructions that took many clock cycles to
complete (in some cases, many hundreds of clock cycles), giving them very long interrupt
latencies. As a result of these frustrations with the commercial microprocessor offerings, the
design of a proprietary microprocessor was considered and ARM chip was designed.
28
The three stage pipelined architecture of the ARM7 processor is shown in the above figure.
The key idea behind THUMB is that of a super-reduced instruction set. Essentially, the
The THUMB set’s 16-bit instruction length allows it to approach twice the density of
standard ARM code while retaining most of the ARM’s performance advantage over a
traditional 16-bit processor using 16-bit registers. This is possible because THUMB code
operates on the same 32-bit register set as ARM code.
29
Figure3.15: ARM7 identification
The ARM processors are based on RISC architectures and this architecture has provided
small implementations, and very low power consumption. Implementation size, performance,
and very low power consumption remain the key features in the development of the ARM
devices.
30
A large uniform register file
A load/store architecture, where data-processing operations only operate on register
contents, not directly on memory contents
Simple addressing modes, with all load/store addresses being determined from
register contents and instruction fields only uniform and fixed-length instruction
fields, to simplify instruction decode.
Control over both the Arithmetic Logic Unit (ALU) and shifter in most data-
processing instructions to maximize the use of an ALU and a shifter
Auto-increment and auto-decrement addressing modes to optimize program loops
Load and Store Multiple instructions to maximize data throughput
Conditional execution of almost all instructions to maximize execution throughput.
31
3.7.1 Block Diagram
32
3.7.2 Pin Diagram
ARM has a total of 37 registers .In which - 31 are general-purpose registers of 32-bits, and
six status registers .But all these registers are not seen at once. The processor state and
operating mode decide which registers are available to the programmer. At any time, among
the 31 general purpose registers only 16 registers are available to the user. The remaining 15
registers are used to speed up exception processing. There are two program status registers:
CPSR and SPSR (the current and saved program status registers, respectively). In ARM state
the registers r0 to r13 are orthogonal—any instruction that you can apply to r0 you can
equally well apply to any of the other registers.
33
The main bank of 16 registers is used by all unprivileged code. These are the User
mode registers. User mode is different from all other modes as it is unprivileged. In addition
to this register bank, there is also one 32-bit Current Program status Register (CPSR)
In the 15 registers, the r13 acts as a stack pointer register and r14 acts as a link
register and r15 acts as a program counter register.
Register r13 is the sp register, and it is used to store the address of the stack top. R13
is used by the PUSH and POP instructions in T variants, and by the SRS and RFE
instructions from ARMv6.
Register 14 is the Link Register (LR). This register holds the address of the next
instruction after a Branch and Link (BL or BLX) instruction, which is the instruction used to
make a subroutine call. It is also used for return address information on entry to exception
modes. At all other times, R14 can be used as a general-purpose register.
CPSR:
The ARM core uses the CPSR register to monitor and control internal operations. The CPSR
is a dedicated 32-bit register and resides in the register file. The CPSR is divided into four
fields, each of 8 bits wide: flags, status, extension, and control. The extension and status
fields are reserved for future use. The control field contains the processor mode, state, and
interrupts mask bits. The flags field contains the condition flags. The 32-bit CPSR register is
shown below.
34
Figure3.19: Current Program Status Register
There are seven processor modes. Six privileged modes abort, fast interrupt request, interrupt
request, supervisor, system, and undefined and one non-privileged mode called user mode.
The processor enters abort mode when there is a failed attempt to access memory.
Fast interrupt request and interrupt request modes correspond to the two interrupt levels
available on the ARM processor. Supervisor mode is the mode that the processor is in after
reset and is generally the mode that an operating system kernel operates in. System mode is a
special version of user mode that allows full read-write access to the CPSR. Undefined mode
is used when the processor encounters an instruction that is undefined or not supported by the
implementation. User mode is used for programs and applications.
3.7.5 PIPELINE:
Pipeline is the mechanism used by the RISC processor to execute instructions at an increased
speed. This pipeline speeds up execution by fetching the next instruction while other
instructions are being decoded and executed.The ARM7 processor has a three stage
pipelining architecture namely Fetch, Decode and Execute. The three stage pipelining is
explained as below.
35
Figure3.20 Pipe line in ARM7
As the pipeline length increases, the amount of work done at each stage is reduced,
which allows the processor to attain a higher operating frequency. This in turn increases the
performance.
Generally, even the simplest robot requires a motor to rotate a wheel or performs particular
action. Since motors require more current then the microcontroller pin can typically generate,
you need some type of a switch which can accept a small current, amplify it and generate a
larger current, which further drives a motor. This entire process is done by what is known as a
motor driver.
Turning a motor ON and OFF requires only one switch to control a single motor in a
single direction. What if we want to reverse its direction is to reverse its polarity. This can be
achieved by using four switches that are arranged in an intelligent manner such that the
circuit not only drives the motor, but also controls its direction. Out of many, one of the most
common and clever design is a H-bridge circuit where transistors are arranged in a shape that
resembles the English alphabet "H"
As you can see in the image, the circuit has four switches A, B, C and D. Turning
these switches ON and OFF can drive a motor in different ways.
36
Figure3.21 H Bridge of l293d
3.8.2 Features
37
Output current capability is limited to 600mA per channel with peak output current
limited to 1.2A
There are 4 input pins for l293d, pin 2,7 on the left and pin 15 ,10 on the right as shown on
the pin diagram. Left input pins will regulate the rotation of motor connected across left side
and right input for motor on the right hand side. The motors are rotated on the basis of the
inputs provided across the input pins as LOGIC 0 or LOGIC 1.
3.9Relays
Relays are electromechanical switches, used to control the several circuits by using low-
power signal or one signal. These are found in all sorts of devices. Relays allow one circuit to
switch a second circuit which can be completely separate from the first. There is no electrical
connection inside the relay between the two circuits; the link is magnetic and mechanical
only.
38
Figure3.24: Pin Diagram of Relay
The relay driver can drive up to 7 relays with each relay connected to each of the 7 outputs.
The input pins of the relay are connected to the I/O pins of the Microcontroller. Here only one
relay is shown for demonstration purpose. The relay as well as the relay driver requires a
power supply of 12 V at pin 9. The operation is similar to an inverter where a logic low input
results in a logic high output. The load is connected to the normally open contact. When a
logic zero is applied to one of the input pin of the relay driver, a logic high output is
developed across the corresponding output pin. Since the relay is connected to almost same
voltage at both of the end points, no current flows and the relay is not energized. Incase of a
high logic at the input pin, the output pin
39
Figure3.25: Working Diagram of relay
gets a low logic signal and due to a potential difference, a current flows and the relay coil gets
energized such that it causes the armature to move from the normally closed position to the
normally open position , thus completing the circuit and causing the lamp to glow.
3.10 Motors
Gear motors are complete motive force systems consisting of an electric motor and a
reduction gear train integrated into one easy-to-mount and -configure package. This greatly
reduces the complexity and cost of designing and constructing power tools, machines and
appliances calling for high torque at relatively low shaft speed or RPM. Gear motors allow
the use of economical low-horsepower motors to provide great motive force at low speed
such as in lifts, winches, medical tables, jacks and robotics. They can be large enough to lift a
building or small enough to drive a tiny clock
40
increasing the torque. The increase in torque is inversely proportional to the reduction in
speed. Reduction gearing allows small electric motors to move large driven loads, although
more slowly than larger electric motors. Reduction gears consist of a small gear driving a
larger gear. There may be several sets of these reduction gear sets in a reduction gear box.
41
The toothed and interlocking wheels which make up a typical gear movement. Gear
ratio is calculated by dividing the number of teeth on the driver gear by the number of teeth
on the driven gear (gear ratio = driver/driven); the idler gears are ignored. Idler gears change
the direction of rotation but do not affect speed. A high driven to driver ratio (middle) is a
speed-reducing ratio.Different gears are used to perform different engineering functions
depending on the change in direction of motion that is needed. Rack and pinion gears are the
commonest gears and are used in car steering mechanics.
Speed Reduction
Sometimes the goal of using a gear motor is to reduce the rotating shaft speed of a motor in
the device being driven, such as in a small electric clock where the tiny synchronous motor
may be spinning at 1,200 rpm but is reduced to one rpm to drive the second hand, and further
reduced in the clock mechanism to drive the minute and hours hand. Here the amount of
driving force is irrelevant as long as it is sufficient to overcome the frictional effects of the
clock mechanism.
Torque Multiplication
Another goal achievable with a gear motor is to use a small motor to generate a very large
force albeit at a low speed. These applications include the lifting mechanisms on hospital
beds, power recliners, and heavy machine lifts where the great force at low speed is the goal.
3.11 Wheelchair
Wheelchair used in this project is galvanized steel chair. It consists of two major wheels
made-up of with steel and two supporting wheels made up of with hard plastic. In this set up
the two major wheels support the motion of chair and bear the weight of the person who is
using it. The two plastic wheels are for direction changing purpose.
42
In this wheel chair setup gear motors are connected to wheels through gears. These gears are
made with iron and differ in diameter. Larger gear consists of 86 teeth and smaller one
consists of 8 teeth.
The schematic diagram for the MEMS and voice controlled wheel chair is as follows
43
3.13 Conclusion
In this chapter we had discussed the hardware components and interconnection of all the
components present in circuitry
44
Chapter 4
Code Implementation
4.1 Introduction
The software used to implement this project is KEIL SOFTWARE. Keil Software provides us
with software development tools for PIC16F877A based microcontrollers. With the Keil
tools, we can generate embedded applications for virtually every PIC16F877A derivative.
The software used to implement this project is KEIL SOFTWARE. Keil Software provides us
with software development tools for PIC16F877A based microcontrollers. With the Keil
tools, we can generate embedded applications for virtually every PIC16F877A derivative.
It is possible to create the source files in a text editor such as Notepad, run the Compiler on
each C source file, specifying a list of controls, run the Assembler on each Assembler source
file, specifying another list of controls, run either the Library Manager or Linker (again
specifying a list of controls) and finally running the Object-HEX Converter to convert the
Linker output file to an Intel Hex File. Once that has been completed the Hex File can be
downloaded to the target hardware and debugged. Alternatively KEIL can be used to create
source files; automatically compile, link and covert using options set with an easy to use user
interface and finally simulate or perform debugging on the hardware with access to C
variables and memory. Unless you have to use the tolls on the command line, the choice is
clear. KEIL Greatly simplifies the process of creating and testing an embedded application.
The user of KEIL centers on projects. A project is a list of all the source files required to build
a single application, all the tool options which specify exactly how to build the application,
and – if required – how the application should be simulated. A project contains enough
information to take a set of source files and generate exactly the binary code required for the
application. Because of the high degree of flexibility required from the tools, there are many
options that can be set to conFigure the tools to operate in a specific manner. It would be
tedious to have to set these options up every time the application is being built; therefore they
are stored in a project file. Loading the project file into KEIL informs KEIL which source
45
files are required, where they are, and how to conFigure the tools in the correct way. KEIL
can then execute each tool with the correct options. It is also possible to create new projects
in KEIL. Source files are added to the project and the tool options are set as required. The
project can then be saved to preserve the settings. The project is reloaded and the simulator or
debugger started, all the desired windows are opened. KEIL project files have the extension.
4.4 Simulation
The simulator/ debugger in KEIL can perform a very detailed simulation of a processor along
with external signals. It is possible to view the precise execution time of a single assembly
instruction, or a single line of C code, all the way up to the entire application, simply by
entering the crystal frequency. A window can be opened for each peripheral on the device,
showing the state of the peripheral. This enables quick trouble shooting of mis-conFigured
peripherals. Breakpoints may be set on either assembly instructions or lines of C code, and
execution may be stepped through one instruction or C line at a time. The contents of all the
memory areas may be viewed along with ability to find specific variables. In addition the
registers may be viewed allowing a detailed view of what the microcontroller is doing at any
point in time.
46
Figure 4.1: Selection of new project
4. Save the Project by typing suitable project name with no extension in your own folder sited
in either C:\ or D:\
47
Figure 4.2: Selection of Vendor of controller
9. Select LM2310
12. Now double click on the Target1, you would get another option Source group 1
13. Click on the file option from menu bar and select new
14. The next screen will be as shown in next page, and just maximize it by double clicking on
its blue boarder.
48
15.Now start writing program in either in C or ASM
14. For a program written in Assembly, then save it with extension (. Asm) and for C based program
15. Now right click on Source group 1 and click on “Add files to Group Source”
49
Figure 4.6: Adding files to target
16. Now you will get another window, on which by default C files will appear
17. Now select as per your file extension given while saving the file
19. Now Press function key F7 to compile. Any error will appear if so happen.
50
Figure 4.8: Compilation
51
23. Now click on the Peripherals from menu bar, and check your required port as shown in
fig below
24. Drag the port a side and click in the program file.
25. Now keep Pressing function key F11 slowly and observe.
52
26. You are running your program successfully.
4.6 Proteus
ISIS provides the development environment for PROTEUS VSM, our revolutionary
interactive system level simulator. This software combines mixed mode circuit simulation,
micro-processor models and interactive component models to allow the simulation of
complete micro-controller based designs. ISIS provides the means to enter the design in the
first place, the architecture for real time interactive simulation and a system for managing the
source and object code associated with each project. In addition, a number of graph objects
can be placed on the schematic to enable conventional time, frequency and swept variable
simulation to be performed.
2. Interactive peripheral models include LED and LCD displays, a universal matrix keypad,
an RS232 terminal and a whole library of switches, pots, lamps, LEDs etc.
4.5.1 Procedure
Creating the circuit diagram using Proteus.
Start > All Program > Proteus 8Professional > ISIS 8 Professional.
2. Proteus work area will appear and Select button “P”as shown below
53
Figure 4.13: Component Selection
4. Type the component name at keyword list box. Click OK button at the bottom right.
Repeat this step to select the components needed.
1. LM2310
54
2. RES (R1=330Ω, R2=4.7k Ω and R3=4.7k)
3. LED-RED
4. BUTTON (SW1, SW RESET)
5. CRYSTAL (X1=20MHz)
6. CAP (C1= 22pF, C2= 22pF)
5. Select instruction bellows and double click your left mouse to input components inside
category window
8. Right click mouse and select properties for rotate the components to your suitable positions
10. Click “Terminals Mode” button to input ‘POWER’ and ‘GROUND’ to your working space
11. Arrange your components to suitable position and completed your work with the correct
connections
12. Save your project in your own folder by select FILE>SAVE DESIGN AS
55
Figure 4.16: Loading HEX file
4.7 Algorithm
Else
Go to Step 4
then Go to Step 5
56
Step 5: compare the threshold value of the audio input
If
Then
Enable the L293d driver to move the wheel chair until further command is received .
then Go to Step5
then go to step5
Step 8: Go to Step 3
If
Then enable the motor drivers to move until further commands received.
else
Go to next Step.
If
Then enable the motor drivers to move until further commands received.
else
Go to next Step.
57
If
Then enable the motor drivers to move until further commands received.
else
Go to next Step.
If
Then enable the motor drivers to move until further commands received.
else
Go to next Step.
If
Then enable the motor drivers to move until further commands received.
else
Go to step3.
4.8. Conclusion.
In this chapter we are discussing about the software used to implement the project that is keil
Software, Embedded C programming for communication of the data, Proteus 8.1 features and
Algorithm of the report.
58
Chapter 5
The working model is developed for physically challenged personalities. The experiments
were conducted with MEMS accelerometer sensor to drive the wheel chair in all directions.
In order to move the wheel chair, MEMS module and Voice recognition module must be
initiated first. Fig 5.1 and Fig 5.2 represents the initialization of the MEMS and VOICE
modules. The wheel chair is able to drive forward, backward, right and left directions by
tilting the axis of the MEMS sensor. While driving the wheel chair with MEMS the voice
module is to be kept in standby mode even though it is enabled. Fig 5.3 and Fig 5.4
represents the forward and backward direction movements of the wheel chair. Fig 5.5 and
Fig 5.6 represents the left and right directions of the wheel chair movements. By keeping the
voice module in standby mode the wheel chair motion control is tested with varying load
conditions. With no load the acceleration and response of the device is significantly good.
100 rpm D.C motors are used to drive the wheel chair. With increasing the load the motion of
the wheel chair is significantly reduced. By considering the geared motor with high torque,
the proto type model wheelchair can be implemented for real time applications.
The Voice operated wheel chair is tested by keeping the MEMS Sensor position
Constant. Any tilt in the MEMS accelerometer sensor cause to enable the wheel chair
movements. Since the device is powered with both MEMS and Voice based devices the
MEMS Sensor should be positioned in a fixed surface with Zero Tilt angle. Then based on
the voice commands the developed wheel chair will respond to move in respective positions.
Fig 5.7, Fig.5.8, Fig 5.9, fig 5.10 represents the received command status of the wheel chair
for forward, backward, Left and right direction movements of the wheel Chair. The
command 1 is equated for forward direction. Command 2 is equated for back ward direction,
Command 3 is equated for left direction and command ‘4’ is equated for right direction.
Command ‘5’ is used for Stop the wheel chair motion.
The experiments were conducted repeatedly to meet the challenges and desired
positional directions. It has been observed that the proposed model response is favorably
59
good with both MEMS and Voice devices. The Base of the Voice input signal is
comparatively synchronized with the pre loaded voice base. It has been observed that Voice
Module ‘V2 ‘ is an optimum choice for voice operated Wheel chair for Physically challenged
Personalities. The Directional Control logic levels applied for the wheel chair with four D.C
motors represented in table 5.1.
The proposed wheel chair moves in the respective direction based upon the direction of tilting
the MEMS sensor.
FIGURE 5.3 MEMS tilted forward FIGURE 5.4 MEMS tilted backward
60
FIGURE 5.5: MEMS tilted left FIGURE 5.6: MEMS tilted right
While moving the wheel chair with voice recognition module, it moves in the direction
respective to the voice commands.
61
Figure 5.9 Voice command for LEFT
Figure 5.10 Voice command for RIGHT
The movement of the hand is sensed by the MEMS sensor and the corresponding
signal based on the angle of elevation is sent to the micro controller. The signal is
processed in the micro controller and corresponding directions are given to the motors.
Common 1(IN-1)
Left motor +Ve(Blue 1 0 1 0
Wire) –Yellow LED (High) (Low) (High) (Low)
Common 2(IN-2)
Left motor -Ve(Violet 0 1 0 1
Wire) –Green LED (Low) (High) (Low) (High)
Common 3(IN-3)
Right motor +Ve(Blue 1 0 0 1
Wire) –Yellow LED (High) (Low) (Low) (High)
Common 4(IN-4)
Right motor -Ve(Violet 0 1 1 0
Wire) –Yellow LED (Low) (High) (High) (Low)
62
If the angle of elevation is towards forward direction then the wheel chair moves in
forward direction. Similarly if the angle of elevation is towards left, right then the wheel chair
moves in the left, right directions respectively. The movement of wheelchair wheels, are as
follows
5.2 Conclusion
In this chapter we had discuss the result and the directional outcome of the automatic wheel
chair. This study also analyzed how the wheel chair moves in the respective positions based
on the sensed outputs of MEMS Accelerometer sensor and Voce recognition module. The
next chapter will discuss the conclusions of the thesis report.
Chapter 6
Conclusion
Considering the intensity levels of the technology support to the physically challenged
personalities the developed working model is tested with voice and MEMS based
63
accelerometer sensor. This study is focused to develop a user friendly device for both visually
imperative and physically dumb persons. The results harvested with the proposed model are
favorably impressive to meet the challenges identified in the chapter 1. The loading capacity
of the 100 rpm D.C motors is not supportive drive the heavy load torques.
This project is a user friendly device which is also a powerful tool to the physically
challenged people. It enables to carry out their own actions by themselves. This model the
replaced the human assistance accordingly. The result harvested clearly exhibits that the
proposed system is easy to operate by the patients. This chair can move forward, backward,
right and left directions by tilting the angle of the MEMS sensor which is attached to the hand
or head and mostly with voice recognition module.
In future the developed model is implemented for real time applications by selecting
the high torque geared motors to reach the demands of the society. The position and the state
wheel chair is to be monitored by imparting the internet of things. And also this model can be
further enhanced with Global system for Mobile Communication (GSM) module, housed
with the wheel chair for transmitting the state to the supervising locations.
64
References
References
[1] Rakhi A. Kalantri., D.K. Chitre., “ Automatic Wheelchair using Gesture Recognition”,
International Journal of Engineering and Innovative Technology (IJEIT), Vol 2,No.
9,pp.216218, March 2013.
[2] Pei Jia., Huosheng H. Hu., Tao Lu., Kui Yuan., “ Head gesture recognition for hands-free
control of an intelligent wheelchair” , An International Journal on Industrial Robot, Vol 34,
No.1, pp.60-68, 2007 .
[3] Javajji Veeraiah., P.V.N Aravind Syam,. N. Naga Durga., K. Ravi Kanth., G. Vasudha,
“Accelerometer Based Gesture Recognisation for Wheel Chair Direction Control Using
ZIGBEE Protocol”, International Journal of Technological Exploration and Learning (IJTEL),
Vol. 2, No. 2,pp.104-108, April 2013.
[4] Rajesh Kannan Megalingam., Athul Asokan Thulasi., Rithun Raj Krishna., “Methods of
Wheelchair Navigation: Novel Gesture Recognition Method”, International Journal of Applied
Engineering Research, Vol.7 No.11,pp.1-5, 2012.
[5] Moniruzzaman Bhuiyan., Rich Picking., “A Gesture Controlled User Interface For Inclusive
Design And Evaluation Study Of Its Usability”, Journal Of Software Engineering And
Applications,Vol.4,No.9,pp.513-521,September 2011.
[6] Chao Wang., Alexey S., Matveev., Andrey V. Savkin., Tuan Nghia Nguyen., Hung T.
Nguyen., “A Collision Avoidance Strategy for Safe Autonomous Navigation of an Intelligent
ElectricPowered Wheelchair in Dynamic Uncertain Environments with Moving Obstacles” ,
2013 European Control Conference (ECC) , Zürich, Switzerland,pp.4382-4387,17-19 July
2013.
[8] K. Sudheer., T.V. Janardhan Rao., CH. Srivedi., M.S. Madhan Mohan., “ Voice and
Gesture Based Electric-Powered Wheelchair Using ARM”, International Journal of Research
65
in Computer and Communication technology, IJRCCT, Vol 1, No. 6,pp.278-283, November
2012.
[10] Lincoln A. Jaros Richard C. Simpson Yoram Koren Senior Member IEEE Simon P. Levine,
David A. Bell and IEEEi Johann Borenstein, Member, “The navchair assistive wheelchair
navigation system,” IEEE TRANSACTIONS ON REHABILITATION ENGINEERING, 1999.
[11] Mahaboob Ali Shaik M.Prathyusha, K. S. Roy, “Voice and touch screen based direction
and speed control of wheel chair for physically challenged using arduino,”.
[12] K. Sudheer ,et al, International Journal of Research in Computer and Communication
technology, IJRCCT, ISSN 2278-5841, Vol 1, Issue 6, November 2012 , “Voice and Gesture
Based Electric-Powered Wheelchair Using ARM”.
[13] Automatic Wheelchair using Gesture Recognition Along with Room Automation
66
Appendix
The program code which is dumped in the microcontroller of our project is shown below.
SOURCE CODE:
#include<LPC2103.H>
#include<string.h>
#define Restg 0
#define Restd 1
67
#define Robot_Motors (BMotor_left_frwd|BMotor_left_bkwd |BMotor_right_frwd|
BMotor_right_bkwd)
/**************************************************/
68
/* Mode Pin- P0.15 Int 0*/
#include "external_int.c"
#include "I2C.c"
#include "robo.c"
//#include "rtc.c"
void Robo_Movements(void);
void LCD_Lable_display(void);
void Motor_Init(void);
unsigned char x;
69
main()
GPIO_Port0s_IODIR =(RF_Data|Mode_Leds|Robot_Motors);
Set_Port0s=M1_Led;
Set_Port0s=M2_Led;
Set_Port0s=M3_Led;
Motor_Init();
//ADC0_Init();
//Init_ExInt2_Interrupt_P0_15();
I2C_Init();
MEMS_Init();
while(1)
//if(Mode_select==1)
70
//{
Wheel_Chair_M1();
//}
/*
if(Mode_select==2)
{ */
//RF_Device_M2();
/*
if(Mode_select==3)
Voice_M3();
*/
71
PinStatus_Port(unsigned char port,unsigned int pin)
if(port==0)
x=(Port0_Set& (1<<pin))?1:0;
return x;
void RF_Device_M2(void);
void Voice_M3(void);
void Wheel_Chair_M1(void);
void Robot_Values(void);
void Mems_X_Y_Getdata(void);
float ADC_VALUE;
void Motor_Init(void)
72
Set_Port0s=BMotor_left_frwd;
Clear_Port0s=BMotor_left_bkwd;
Set_Port0s=BMotor_right_frwd;
Clear_Port0s=BMotor_right_bkwd;
Delay(400);
Clear_Port0s=BMotor_left_frwd;
Clear_Port0s=BMotor_left_bkwd;
Clear_Port0s=BMotor_right_frwd;
Clear_Port0s=BMotor_right_bkwd;
void Wheel_Chair_M1(void)
Reading_X_Y_Z_MEMS();
73
//"ROBO Moving Forward \r\n");
// //x y
//{
if((x>15&&x<25))
Set_Port0s=BMotor_left_frwd;
Clear_Port0s=BMotor_left_bkwd;
Set_Port0s=BMotor_right_frwd;
Clear_Port0s=BMotor_right_bkwd;
Delay(200);
Clear_Port0s=BMotor_left_frwd;
Clear_Port0s=BMotor_left_bkwd;
Clear_Port0s=BMotor_right_frwd;
Clear_Port0s=BMotor_right_bkwd;
74
//Set_Port0s=RF_bit1;
//Clear_Port0s=RF_bit2;
//Clear_Port0s=RF_bit4;
//Clear_Port0s=RF_bit8;
//Delay(100);
//Clear_Port0s=RF_bit1;
//Clear_Port0s=RF_bit2;
//Clear_Port0s=RF_bit4;
//Clear_Port0s=RF_bit8;
if(x<55&&x>45)
//Set_Port0s=RF_bit1;
//Clear_Port0s=RF_bit2;
//Clear_Port0s=RF_bit4;
//Clear_Port0s=RF_bit8;
//Delay(100);
//Clear_Port0s=RF_bit1;
//Clear_Port0s=RF_bit2;
//Clear_Port0s=RF_bit4;
75
//Clear_Port0s=RF_bit8;
Clear_Port0s=BMotor_left_frwd;
Set_Port0s=BMotor_left_bkwd;
//BACKWARD
Clear_Port0s=BMotor_right_frwd;
Set_Port0s=BMotor_right_bkwd;
Delay(200);
Clear_Port0s=BMotor_left_frwd;
Clear_Port0s=BMotor_left_bkwd;
Clear_Port0s=BMotor_right_frwd;
Clear_Port0s=BMotor_right_bkwd;
if(y>15&&y<25)
//Set_Port0s=RF_bit1;
//Clear_Port0s=RF_bit2;
76
//Clear_Port0s=RF_bit4;
//Clear_Port0s=RF_bit8;
//Delay(100);
//Clear_Port0s=RF_bit1;
//Clear_Port0s=RF_bit2;
//Clear_Port0s=RF_bit4;
//Clear_Port0s=RF_bit8;
Clear_Port0s=BMotor_left_frwd;
Set_Port0s=BMotor_left_bkwd;
Set_Port0s=BMotor_right_frwd;
Clear_Port0s=BMotor_right_bkwd;
Delay(200);
Clear_Port0s=BMotor_left_frwd;
Clear_Port0s=BMotor_left_bkwd;
Clear_Port0s=BMotor_right_frwd;
Clear_Port0s=BMotor_right_bkwd; //LEFT
77
}
if(y<55&&y>45)
Set_Port0s=BMotor_left_frwd;
Clear_Port0s=BMotor_left_bkwd;
Clear_Port0s=BMotor_right_frwd;
Set_Port0s=BMotor_right_bkwd;
Delay(200);
Clear_Port0s=BMotor_left_frwd;
Clear_Port0s=BMotor_left_bkwd;
Clear_Port0s=BMotor_right_frwd;
Clear_Port0s=BMotor_right_bkwd;
//Set_Port0s=RF_bit1;
//Clear_Port0s=RF_bit2;
//Clear_Port0s=RF_bit4;
//Clear_Port0s=RF_bit8;
//Delay(100);
//Clear_Port0s=RF_bit1;
78
//Clear_Port0s=RF_bit2;
//Clear_Port0s=RF_bit4;
//Clear_Port0s=RF_bit8;
void RF_Device_M2(void)
Reading_X_Y_Z_MEMS();
//
if((x>15&&x<25))
Set_Port0s=RF_bit1;
Clear_Port0s=RF_bit2;
79
Clear_Port0s=RF_bit4;
Clear_Port0s=RF_bit8;
Delay(100);
Clear_Port0s=RF_bit1;
Clear_Port0s=RF_bit2;
Clear_Port0s=RF_bit4;
Clear_Port0s=RF_bit8;
if(x<55&&x>45)
Clear_Port0s=RF_bit1;
Set_Port0s=RF_bit2;
Clear_Port0s=RF_bit4;
Clear_Port0s=RF_bit8;
Delay(100);
Clear_Port0s=RF_bit1;
Clear_Port0s=RF_bit2;
Clear_Port0s=RF_bit4;
Clear_Port0s=RF_bit8;
80
}
if(y>15&&y<25)
Set_Port0s=RF_bit1;
Set_Port0s=RF_bit2;
Clear_Port0s=RF_bit4;
Clear_Port0s=RF_bit8;
Delay(100);
Clear_Port0s=RF_bit1;
Clear_Port0s=RF_bit2;
Clear_Port0s=RF_bit4;
Clear_Port0s=RF_bit8; //LEFT
if(y<55&&y>45)
Clear_Port0s=RF_bit1;
Clear_Port0s=RF_bit2;
81
Set_Port0s=RF_bit4;
Clear_Port0s=RF_bit8;
Delay(100);
Clear_Port0s=RF_bit1;
Clear_Port0s=RF_bit2;
Clear_Port0s=RF_bit4;
Clear_Port0s=RF_bit8;
void Voice_M3(void)
Reading_X_Y_Z_MEMS();
//
if((x>15&&x<25))
Set_Port0s=RF_bit1;
82
Clear_Port0s=RF_bit2;
Set_Port0s=RF_bit4;
Clear_Port0s=RF_bit8;
Delay(100);
Clear_Port0s=RF_bit1;
Clear_Port0s=RF_bit2;
Clear_Port0s=RF_bit4;
Clear_Port0s=RF_bit8;
if(x<55&&x>45)
Clear_Port0s=RF_bit1;
Set_Port0s=RF_bit2;
Set_Port0s=RF_bit4;
Clear_Port0s=RF_bit8;
Delay(100);
Clear_Port0s=RF_bit1;
Clear_Port0s=RF_bit2;
Clear_Port0s=RF_bit4;
Clear_Port0s=RF_bit8;
83
if(y>15&&y<25)
Set_Port0s=RF_bit1;
Set_Port0s=RF_bit2;
Set_Port0s=RF_bit4;
Clear_Port0s=RF_bit8;
Delay(100);
Clear_Port0s=RF_bit1;
Clear_Port0s=RF_bit2;
Clear_Port0s=RF_bit4;
Clear_Port0s=RF_bit8; //LEFT
84
#define MODE 0x07
#define SR 0x08
#define PD 0x0A
#define ENB_I2C 6
#define Start_I2C 5
#define Stop_I2C 4
#define INTR_I2C 3
#define ACK 2
85
void I2C_Init(void);
void I2C_Read(void);
void MEMS_Init(void);
char RdData_MEMS(void);
void Reading_X_Y_Z_MEMS(void);
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
/******************************************************/
86
void I2C_Init(void)
PINSEL0 = 0x00000050;
I2C0SCLH=62;
I2C0SCLL=62;
I2C0CONCLR=All_Flags_Clr;
void Start(void)
I2C0CONCLR=All_Flags_Clr;
I2C0CONSET=(1<<ENB_I2C);
I2C0CONSET=(1<<Start_I2C);
void Stop(void)
I2C0CONCLR=(1<<INTR_I2C);
I2C0CONSET=(1<<Stop_I2C);
void MEMS_Init(void)
87
//Lcd_Data_Str(1,1,"Mem initing ");
Clear_Port0s=M1_Led;
Clear_Port0s=M2_Led;
Clear_Port0s=M3_Led;
WrByte_MEMS(MODE,0x00);
WrByte_MEMS(SPCNT,0x00);
//Lcd_Data_Str(1,12,".");
WrByte_MEMS(INTSU,0x03);
WrByte_MEMS(PDET,0x00);
//Lcd_Data_Str(1,13,".");
WrByte_MEMS(SR,0x00);
//Lcd_Data_Str(1,14,".");
WrByte_MEMS(PD,0x00);
//Lcd_Data_Str(1,15,".");
WrByte_MEMS(MODE,0x41);
//Lcd_Data_Str(1,16,".");
Delay(150);
Set_Port0s=M1_Led;
Set_Port0s=M2_Led;
Set_Port0s=M3_Led;
88
//Lcd_Data_Str(1,1," Mems Inited ");
Delay(250);
Start();
while(I2C0STAT!=0X08);
I2C0CONCLR=(1<<Start_I2C);
I2C0CONCLR=(1<<INTR_I2C);
I2C0ADR=SlaAdd_WR ;
I2C0DAT=SlaAdd_WR ;
I2C0CONCLR=(1<<INTR_I2C);
while(I2C0STAT!=0X18);
I2C0CONCLR=(1<<INTR_I2C);
WrData_MEMS(wr_ptr);
89
while(I2C0STAT!=0X28);
I2C0CONCLR=(1<<INTR_I2C);
WrData_MEMS(wr_value);
while(I2C0STAT!=0X28);
Stop();
Delay(100);
I2C0DAT=value;
/*******************Start Condition****************/
90
Start();
while(I2C0STAT!=0X08);
I2C0CONCLR=(1<<Start_I2C);
I2C0CONCLR=(1<<INTR_I2C);
I2C0ADR=SlaAdd_WR ;
I2C0DAT=SlaAdd_WR ;
I2C0CONCLR=(1<<INTR_I2C);
while(I2C0STAT!=0X18);
WrData_MEMS(rd_add);
I2C0CONCLR=(1<<INTR_I2C);
while(I2C0STAT!=0X28);
/*********************Sending Start****************/
I2C0CONSET=(1<<Start_I2C)|(1<<ACK);
I2C0CONCLR=(1<<INTR_I2C);
while(I2C0STAT!=0X10);
/****************Sending SlaveAdd+RD*************/
I2C0ADR=SlaAdd_RD ;
I2C0DAT=SlaAdd_RD ;
I2C0CONCLR=(1<<Start_I2C);
I2C0CONCLR=(1<<INTR_I2C);
91
while(I2C0STAT!=0X40);
I2C0CONCLR=(1<<INTR_I2C);
while(I2C0STAT!=0X50);
Data=I2C0DAT;
I2C0CONCLR=(1<<INTR_I2C);
I2C0CONCLR=(1<<ACK);
Delay(25);
Stop();
I2C0DAT=0x00;
return(Data);
void Reading_X_Y_Z_MEMS(void)
x=RrByte_MEMS(0x00);
//Delay(5);
//Lcd_Data_Chr(1,2,2,((x/10)+48));
//Delay(25);
//Lcd_Data_Chr(1,2,3,((x%10)+48));
92
Delay(25);
y=RrByte_MEMS(0x01);
/*
Delay(5);
Lcd_Data_Chr(1,2,8,((y/10)+48));
Delay(25);
Lcd_Data_Chr(1,2,9,((y%10)+48));
*/
//Delay(25);
if((f_b>15&&f_b<25))
Set_Port0s=BMotor_left_frwd;
Clear_Port0s=BMotor_left_bkwd;
Set_Port0s=BMotor_right_frwd;
Clear_Port0s=BMotor_right_bkwd;
Delay(700);
93
Clear_Port0s=BMotor_left_frwd;
Clear_Port0s=BMotor_left_bkwd;
Clear_Port0s=BMotor_right_frwd;
Clear_Port0s=BMotor_right_bkwd;
if(f_b<55&&f_b>45)
Clear_Port0s=BMotor_left_frwd;
Set_Port0s=BMotor_left_bkwd;
//BACKWARD
Clear_Port0s=BMotor_right_frwd;
Set_Port0s=BMotor_right_bkwd;
Delay(700);
Clear_Port0s=BMotor_left_frwd;
Clear_Port0s=BMotor_left_bkwd;
Clear_Port0s=BMotor_right_frwd;
Clear_Port0s=BMotor_right_bkwd;
94
}
if(l_r>15&&l_r<25)
Clear_Port0s=BMotor_left_frwd;
Set_Port0s=BMotor_left_bkwd;
Set_Port0s=BMotor_right_frwd;
Clear_Port0s=BMotor_right_bkwd;
Delay(700);
Clear_Port0s=BMotor_left_frwd;
Clear_Port0s=BMotor_left_bkwd;
Clear_Port0s=BMotor_right_frwd;
Clear_Port0s=BMotor_right_bkwd; //LEFT
if(l_r<55&&l_r>45)
95
Set_Port0s=BMotor_left_frwd;
Clear_Port0s=BMotor_left_bkwd;
Clear_Port0s=BMotor_right_frwd;
Set_Port0s=BMotor_right_bkwd;
Delay(700);
Clear_Port0s=BMotor_left_frwd;
Clear_Port0s=BMotor_left_bkwd;
ear_Port0s=BMotor_right_frwd;
Clear_Port0s=BMotor_right_bkwd;
*/
96