Sie sind auf Seite 1von 23

PATHFOLLOWING ROBOTIC CAR

ABSTRACT

The graphical user interface of the MATLAB


provides a way for the user to input the path that he
wants the robotic car to follow. MATLAB processes the
path by using the program written on MATLAB and
produces four signals for left, right ,forward and for
stopping the car. This is communicated to the
microcontroller on the vehicle part by using a serial
communication port and the microcontroller generates
the signal to drive the stepper motors and the robotic car
runs in the path drawn.

College of Engineering, Trivandrum

PATHFOLLOWING ROBOTIC CAR


INTRODUCTION

In a world where everything robotic is trying to


become more human-like, there is a need for making a robotic car which
follows any path the user defines for it. It will be better to have the user
predefine the path instead of always having to monitor the path.
The RC car is designed to follow a path drawn by
the user. The Control signals are transmitted according to a user defined
path with the help of MATLAB and Microcontroller. The robotic car can be
controlled from the MATLAB environment. The MATLAB signals are
serially transmitted to the Microcontroller using a serial interfacing
wireless module. Control of the wheels is done by Microcontroller. Thus the
car follows the path drawn by the user.
MATLAB is a numerical computing environment and
programming language. Maintained by The Math Works, MATLAB allows
easy matrix manipulation, plotting of functions and data, implementation of
algorithms, creation of user interfaces, and interfacing with programs in
other languages.
The MATLAB sent the signals to the microcontroller and
proper controlling of the car was done so that it followed the path that was
drawn. . There are 2 control signals from the microcontroller was
transmitted to the receiver and then given to the motor driving circuit.The
Web Camera placed in front of the vehicle instantly catches all the images
in front of it .The final result acquired was an RC car that follows the user
defined path.

College of Engineering, Trivandrum


DESIGN APPROACH
The Project was executed in 4 stages:-

1) MATLAB: - The path drawn by the user is read using MATLAB and
programming is done to generate the signals accordingly. Path is drawn using a
drawing tool (GIMP, Paint) which is read by MATLAB using its inbuilt function
imread.

2) Serial Communication: - The signals generate by the MATLAB is serially


communicated to the Microcontroller using RS 232 cable. Output signals from
MATLAB is sent in 8 bit frame format and a baud rate of 9600 based on serial
communication protocol.

3) Microcontroller: - Microcontroller programming is done to generate the control


signals provided to the motor driving circuit. RS232 serial communication port
and Microcontroller 18F452 is interfaced using a MAX 232 for logic
conversion from CMOS to TTL.

4) Driving Circuit: - The stepper motor in the motor driving circuit picks up the
control signals and drives the wheels. Microcontroller output is three controlling
signals that are taken up by the interfacing module made up of TIP 122 and sent to the
motor driving circuit for driving the wheels.

PATHFOLLOWING ROBOTIC CAR


BLOCK DIAGRAM

TRANSMITTER PART

PC Communic-
Serial port ation
module

College of Engineering, Trivandrum

PATHFOLLOWING ROBOTIC CAR


MOBILE PART

College of Engineering, Trivandrum


PATHFOLLOWING ROBOTIC CAR

CIRCUIT DIAGRAM

2
Q 1
5 V 1 T I P 1 2 2
5 V

23
1
11 K

C
R Q 2
2 . 2 K 1 T I P 1 2 2
R 2
U 1 1 8 F 4 5 2

9
8
7
6
5
4
3
2
8 x 1 0 0 E M O T O R 1

23
1 4 0 R 3
2 M C L R / V P PR B 7 / 3P 9 G D R 4 Q 3 1 T P 1
3 R A 0 / A N 0 R B 6 / 3P 8 G C R 5 1 T I P 1 2 2
4 R A 1 / A N 1 R B 5 / 3P 7 G M R 6 1 T P 2
5 R A 2 / A N 2 / V R R E B F3 4 6 R 7
6 R A 3 / A N 3 /R V B R 3 E / CF3 5+C P 2 R 8 1 T P 3
7 R A 4 / T 0 C K R I B 2 / 3I N4 T 2 R 9
R A 5 / A N 4 R B 1 / 3I N3 T 1

3
5 V 8 R 1 0 1 T P 4
9 R E 0 / R D / A R N B 5 0 / 3I N2 T 0

2
1 0 R E 1 / W R / A N V 6 D 3D 1 5 V Q 4 1 T P 9
1 1 R E 2 / C S / A N V7 S 3S 0 5 V 1 T I P 1 2 2
1 2 V D D R D 7 / 2P 9 S P 7
V S S R D 6 / 2P 8 S P 6 D 1L 12 12
1 3
O S C 1 / C L RK ID 5 / 2P 7 S P 5
E D R 0 E
1 4
1 5 O S C 2 / C L RK OD / 4 R / 2P A 6 S 6 P 4
R C 0 / T 1 O RS OC 7 / R2 5 X / D T

3
1 6 T P 1 3
1 7 R C 1 / T 1 O RS I C / C 6 /C T2 PX4 /2 C K 1
Y 1 1 8 R C 2 / C C P R1 C 5 / 2 S 3 D O
R C 3 / S C RK /C S 4 C / S L 2D 2 I / S D A B +
1 9

2
R D 0 / P S P R0 D 3 / 2P 1 S P 3
2 0
R D 1 / P S P R1 D 2 / P S P 2
Q 5 6 V D C / 5 A
1 0 M H z 1 T I P 1 2 2
C 1 C 2 + C 9 M O T O R S U P P L Y
3 3 p F 3 3 p F 1 0 0 0 m F
R X
T P 1 4

3
5 V 1 B -
T X

2
U 3L M 7 8 0 5 Q 6
T P 1 1 1 T I P 1 2 2
1 1
I N O U
3
T
5 V 1 m fC 3
B + 1 T P 5
U 2
16

C 4 1 T P 6
GN D

3
+ C 5 + 1 m f 1
C +
9 V D C / 5 0 0 m1A0 0 0 m F C 6 3 2 1 T P 7
VCC

C 1 - V +
1 m fC 7
2
2

1 0 0 0 m F 4 6 Q 7 1 T P 8
C 2 + V -
T P 1 2 1 m f 5
C 2 -
1 T I P 1 2 2
B - 1 C 8 1 T P 1 0
1 1 1 4
5 V 1 0 T 1 I N T 1 O 7U T
P 1 T 2 I N T 2 O U T
M O T O R 2
3

1 1 2 1 3
6 9 R 1 O U T R 1 I8 N
GN D

R 2 O U T R 2 I N
T O 2
2

7 Q 8
B L U E T O O T 3H M A X 2 3 2 1 T I P 1 2 2
15

M O D U L E 8
4
9 T X
5
3

R X

College of Engineering, Trivandrum


PATHFOLLOWING ROBOTIC CAR

Figure shows the block diagram of the


transmitter unit and mobile unit. In the Transmitter
unit consist of Pc, serial port and communication
module. In the mobile unit consists of Receiver part
of the communication module, Microcontroller and the
Interface unit. The block diagram also consists of web
camera and usb port.

This GUI file with the program to be


executed is opened by calling Pc used in the Transmitter
unit used for the creation of GUI file.the MATLAB file
‘car.m’ at the command prompt. ‘Load ’ loads the image on
the GUI window. ‘Run’ command is used to execute the
program. The input at the GUI level is the filename The
graphical user interface of the MATLAB provides a way for
the user to input the path that he wants the robotic car to
follow of the path that the user has drawn. MATLAB
processes the path and produces four signals for left, right
,forward and for stopping the car. The serial port interface for
connecting two devices is specified by the TIA/EIA-232C
Software serial port monitor, Com Rs232 sniffer with
communication packet data analyzer. This monitoring utility
can spy, capture, view, analyze, test com ports activity
performing com port connection and traffic analysis with data
acquisition and control. We can use this system as device
interface testing tool, modem data transfer viewer and so on.
SerialTerm is a program designed for PC to serial device
interfacing and debugging. With SerialTerm we can perform
design time tests and troubleshooting of your 8051 based
projects and other serial devices.
SerialTerm application comes with eight pre-defined outputs
which let us to send data packets to connected serial port
with a single click. An especial Hex Text Processor lets
us to send any binary characters to serial port from the
standard input text boxes. SerialTerm is a helpful tool for
8051 assembly programmers, electronics professionals,
hardware engineers, or anyone who needs a handy tool to
develop, test and manage their serial devices In any
communication system, the receiver must know what kind of
data to expect and at what rate the data will arrive. In
both synchronous and asynchronous serial
communication, the receiver needs to know with which bit the
transmitter begins. In most systems the LSB is the first bit
transmitted.

For an asynchronous system, the number of bits


transmitted per second must be known by the receiver. Since
the clock signal is not transmitted, the receiver needs to know
what clock frequency the transmitter is using so that it can use
the same.

The receiver also needs to know how many bits per word
the transmitter is using (in most cases we deal with 8-bit
words, but we will see cases where nine bits are transmitted
per word). And the receiver needs to know where the data
begins and where the data stops. Bluetooth wireless
technology is a short-range communications technology
intended to replace the cable connecting portable and/or fixed
devices while maintaining high levels of security.

The mobile unit consists of Receiver part of the


communication module and the it is followed by
microcontroller part. The Microcontroller part will gives signals
to the motor driving circuit. And it is also followed by the web
camera and then the signals from the camera will transmit to the
Pc for showing the pathe that the robotic car gone.
Microcontroller programming is done to generate the control
signals provided to the motor driving circuit. RS232 serial
communication port and Microcontroller 18F452 is interfaced
using a MAX 232 for logic conversion from CMOS to TTL
The stepper motor in the motor driving circuit picks up the
control signals and drives the wheels. Microcontroller output is
three controlling signals that are taken up by the interfacing
module made up of TIP 122 and sent to the motor driving circuit for
driving the wheels. The Web camera placed infront of the
moving part takes up instantaneous images &the user can check
the images instantaneously. If any obstacle comes in the
designed path he can see the image and can redraw a new path
for the destination
The Circuit diagram of mobile part will be shown in
figure. It will consists of Voltage Regulated Ic LM7805 is used
for voltage for the power supply. 10MHz crystal oscillator will
be used for the frequency generation for the microcontroller Ic.
RS232 is used for transmission and reception of the signals.
The collector of TIP122 is connected to the coils of the motor
for giving signals to the transmitter.
College of engineering,Trivandrum
PATHFOLLOWING ROBOTIC CAR
PIC MICROCONTROLLERS

PIC is a family of Harvard architecture microcontrollers


made by Microchip Technology, derived from the PIC1640
originally developed by General Instrument’s
Microelectronics division. The name PIC initially referred to
“Programmable Interface Controller”, but shortly thereafter
was renamed “ Programmable Intelligent Computer”.

PICs are popular with developers and hobbyists alike due


to their low cost, wide availability, large user base, extensive
collection of application notes, availability of low cost or free
development tools, and serial programming (and re-
programming with flash memory) capability.

Core Architecture

The PIC architecture is distinctively minimalist. It is


characterized by the following features:

• Separate code and data spaces (Harvard architecture)


• A small number of fixed length instructions
• Most instructions are single cycle execution (4 clock cycles),
with single delay cycles upon branches and skips
• A single accumulator (w), the use of which (as source
operand) is implied (ie is not encoded in the opcode)
• All RAM locations function as registers as both source and/or
destination of math and other functions.
• A hardware stack for storing return addresses
• A fairly small amount of addressable data space (typically 256
bytes), extended through banking
• Data space mapped CPU, port, and peripheral registers
• The program counter is also mapped into the data space and
writable (this is used to implement indirect jumps)

Unlike most other CPUs, there is no distinction between


“memory” and “register” space because the RAM serves the
job of both memory and registers, and the RAM is usually just
referred to as the register file or simply as the registers.

Data Space (RAM)

PIC have a set of registers that function as general


purpose RAM. Special purpose control registers for on-chip
hardware resources are also mapped into the data space. The
addressability of memory varies depending on device series,
and all PIC devices have some banking mechanism to extend
the addressing to additional memory. Later series of devices
feature move instructions which can cover the whole
addressable space, independent of the selected bank. In earlier
devices (i.e., the baseline and mid-range cores), any register
move has to be achieved via the accumulator.

To implement indirect addressing, a “file select register” (FSR)


and “indirect register” (INDF) are used: A register number is
written to the FSR, after which reads from or writes to INDF will
actually be to or from the register pointed to by FSR. Later
devices extended this concept with post-and pre-
increment/decrement for greater efficiency in accessing
sequentially stored data. This also allows FSR to be treated
almost like a stack pointer.

External data memory is not directly addressable except in some


high pin count PIC18 devices.
Code Space

All PICs feature Hardvard architecture, so the code space and


the data space are separate. PIC code space is generally
implemented as EPROM,ROM, or flash ROM.

In general, external code memory is not directly addressable due


to the lack of an external memory interface. The exceptions are
PIC17 and select high pin count PIC18 devices.

Word Size

The Word size of PICs can be a source of confusion. All PICs


handle (and address) data in 8-bit chunks, so they should be
called 8-bit microcontrollers. However, the unit of addressability
of the code space is nit generally the same as the data space. For
example, PICs in the baseline and mid-range families have
program memory addressable in the same wordsize as the
instruction width, ie. 12 or 14 bits respectively. In contrast, in the
PIC18 series, the program memory is addressed in 8-bit
increments (bytes), which differs from the instruction width of 16
bits.

In order to be clear, the program memory capacity is usually


stated in number of (single word) instructions, rather than in
bytes.

Stacks

PICs have a hardware call stack, which is used to save return


addresses. The hardware stack is not software accessible on
earlier devices, but this cganged with the 18 series devices.

Hardware support for a general purpose parameter stack was


lacking in early series, but this greatly improved in the 18 series,
making the 18 series architecture more friendly to high level
language compilers.

Instruction Set

A PIC’s instructions vary in number from about 35 instructions


for the low-end PICs to over 80 instructions for the high-end
PICs. The instruction set includes instructions to perform a
variety of operations on registers directly, the accumulator and a
literal constant or the accumulator and a register, as well as for
conditional execution, and program branching.

Some operations, such as bit setting and testing, can be


performed on any numbered register, but bi-operand arithmetic
operations always involve W; writing the result back to either W
or the other operand register. To load a constant, it is necessary
to load it into W before it can be moved into another register. On
the older cores, all register moves needed to pass through W, but
this changed on the “high end” cores.
PIC cores have skip instructions which are used for conditional
execution and branching. The skip instructions are: ‘skip if bit
set’, and, ‘skip if bit not set’. Because cores before PIC18 had
only unconditional branch instructions, conditional jumps are
implemented by a conditional skip (with the opposite condition)
followed by an unconditional branch. Skips are also of utility for
conditional execution of any immediate single following
instruction.

The PIC architecture has no (or very meager) hardware support


for automatically saving processor state when servicing
interrupts. The 18 series improved this situation by
implementing shadow registers which save several important
registers during an interrupt.

In general, PIC instructions fall into 5 classes:

1. Operation on W with 8-bit immediate (“literal”) operand. E.g.


movlw (move literal to W), andlw (And literal with W). One
instruction peculiar to the PIC is retlw, load immediate into W and
return, which is used with computed branches to produce lookup
tables.
2. Operation with W and indexed register. The result can be
written to either the W register (e.g. addwf reg, w). or the selected
register (e.g.addwf reg,w).
3. Bit operations. These take a register number and a bit
number, and perform one of 4 actions: set or clear a bit, and
test and skip on set/clear. The latter are used to perform
conditional branches. The usual ALU status flags are
available in a numbered register so operation
3. Control transfers. Other than the skip instructions
previously mentioned, there are only two: goto and call.
4. A few miscellaneous zero-operand instructions, such as
return from subroutine, and sleep to enter low-power mode.

Limitations
The PIC architecture have several limitations:

•Only a single accumulator


•A small instruction set
•Operations and registers are not orthogonal; some instructions
can address RAM and / or immediate constants, while others
can only use the accumulator
•Memory must be directly referenced in arithmetic and logic
operations, although indirect addressing is available via 2
additional registers
•Register-bank switching is required to access the entire RAM
of many devices, making position-independent code complex
and inefficient
•Cnditional skip instructions are used of conditional branch
instructions used by most other architectures

The following limitations have been addressed in the PIC18,


but still apply to earlier cores:
• Indexed addressing mode is very rudimentary.
• Stack:

• The hardware call stack is so small that program structure


must often be flattened

• The hardware call stack is not addressable, so pre-emptive


task switching cannot be implemented

• Software-implemented stacks are not efficient, so it is


difficult to generate reentrant code and support local variables

• Program memory is not directly addressable, and thus space-


inefficient and / or time-consuming to access. (Thus is true of
most Harvard architecture microcontrollers.)

With paged program memory, there are two page sizes to


worry about: one for CALL and GOTO and another for
computed GOTO (typically used for table lookups). For
example, on PIC16, CALL and GOTO have 11 bits of
addressing, so the page size is 2KB. For computed GOTOs,
where you add to PCL, the page size is 256 bytes. In both
cases, the upper address bits are provided by the PCLATH
register. This register must be changed every time control
transfers between pages. PCLATH must also be preserved by
any interrupt handler.

PIC18 High End Core Devices

Microchip introduced the PIC18 architecture in 2002.


Unlike the 17 series, it has proven to be very popular, with a
large number of device variants presently in manufacture. In
contrast to earlier devices, which were more often than not
programmed in assembly, C has become the predominant
development language.

The 18 series inherits most of the features and


instructions of the 17 series, while adding a number of
important new features:

• Much deeper call stack (31 levels deep)


• The call stack may be read and written
• Conditional branch instructions
• Indexed addressing mode (PLUSW)
• Extending the FSR registers to 12 bits, allowing them to
linearly address the entire data address space
• The aqddition of another FSR register (bringing the number
up to 3)

The auto increment/decrement feature was improved by


removing the control bits and adding four new indirect
registers per FSR. Depending on which indirect file register
is being accessed it is possible to postdecrement,
postincrement, or preincrement FSR; or from the effective
address by adding W to FSR.

In more advanced PIC18 devices, an “extended mode”


is available which makes the addressing even more favorable
to compiled code:

• A new offset addressing mode; some addresses which were


relative to the access bank are now interpreted relative to the
FSR2 register
• The addition of several new instructions,notable for
manipulating the FSR registers.
These changes were primarily aimed at improving the
efficiency of a data stack implementation. If FSR2 is used
either as the stack popinter or frame pointer, stack items may
be easily indexed—allowing more efficient re-entrant code.
Microchip C18 chooses to use FSR2 as a frame pointer.

Device Variants and Hardware Features

PIC devices generally feature:


• Sleep mode (power saving).
• Watchdig timer.
• Various crystal or RC oscillator configurations, or an
external clock.

Variants

Within a series, there are still many device variants


depending on what hardware resources the chip features.

• General purpose I/O pins.


• Internal clock oscillators.
• 8/16 Bit Timers.
• Internal EEPROM Memory.
• Synchronous/Asynchronous Serial Interface USART.
• MSSP Peripheral for I2C and SPI Communications.
• Capture/compare and PWM modules.
• Analog-to-digital converters (up to 1.0 MHz).
• USB, Ethernet, CAN interfacing support.
• External memory interface.
• Integrated analog RF front ends (PIC16F639, and rfPIC).
• KEELOQ Rolling code encryption peripheral
(encode/decode)

Fig:D-subconnectors. Fig:Left: DE9M Right: DB25F

Das könnte Ihnen auch gefallen