Date post: | 07-Jun-2015 |
Category: |
Documents |
Upload: | api-3836341 |
View: | 196 times |
Download: | 8 times |
ABSTRACT
The security system is one of the important parts of
the company, industry and other institution which is prone
to intruders. Inventing some of the hi-tech technology use
as a security device could lead us minimize the risk of
human security. This special project is another hi-tech
digital device which could be controlled in a wireless
system. It has a power to maneuver around within a power
range of 100ft distance and a frequency rated at 433MHz at
nominal range. This special project is controlled by Z80
encore microcontroller. The system of the project is
divided into to systems, the receiver system and
transmitter system. The receiver composes of the mobile
robot toy with a built-in wireless camera and the Z80F6401
microcontroller which is the brain of the robots. The
sender side is only the desktop computer and a wireless
transmitter module.
2
CHAPTER 1
INTRODUCTION
1.1 BACKGROUND OF THE STUDY
Almost 50 years ago where the digital evolution just
started, and it has started when the transistor was discover and
develop in the 1948, at Bell Telephone Laboratories by the
American Physicists, Walter Houser Brattain, John Bardeen, and
William Bradford Shockley. The transistor is rapidly developed
until the invention of microprocessor to the latest and yet still
evolved, a microcontroller which also known as a microcomputer.
Computerized world known in today’s era
The evolution of hi-tech technology could create tremendous
gadgets in today technology. The existing of microcontroller can
simplify the huge work. The continuous study of newest technology
could bring us better future to live in the sense of power
conservation and other way to live in simple and luxuries way.
The nano-technology is the latest technology invented in 21st
century, which still embedded with microcontroller. Observing the
world today, scientist focuses on the biomedical technology,
which could give us much greater help to improve our life style.
On the other hand, some focuses on the warfare technology, which
gives the arm forces much safer way to hunt. Some manufacturer
appreciated a lot the zilog product because it could implement in
a simple and or in a complicated way.
3
1.2 STATEMENT OF THE PROBLEM:
The researcher would want to answer the following question:
1. How to develop the security mobile robot?
2. How to make use of the EEPROM Z80 encore! microcontroller in
terms of developing an embedding program and application?
3. How to develop a C#.net program that access the serial
communication port RS232 that send data?
1.3 OBJECTIVES:
1.3.1 To develop a security mobile robot through wireless
communication.
1.3.2 To make use of the EEPROM Z80 encore! microcontroller
for their advance architecture and features of their uses.
1.3.3 To develop a program that is use to connect the RS232
communication serial port which use to send a data in transmitter
side
1.4 SIGNIFICANT OF THE STUDY:
The development of a new and hi-tech technology is just
only the beginning of a basic and a simple way of creating
something that is unusual which can give us more luxury and made
our work easy. Yet, it is look like an unnecessary thing but it
could bring to a newer evolution of modern days.
4
Microcontroller can be applied in a broader way, such as
factory, power plant, communication system, traffic lights,
conveyor, modern electronic gadgets, robotics and etch.
As this special project done, the security system can made
simpler less work and less cost of security budget. This is
helpful to the company need less human security.
To the security service, this could be very helpful for
them for minimizing the risk of works instead. It could possible
for them to capture the enemy easily or even it can take away for
them in a danger side.
To the developer, this project is just a simple way of
creating an electronic security device which applied by
microcontroller, and it could be improved ten times or more than
this stage.
To the researcher, you can learn C program in programming
microcontroller, and the C#.net language in sending a data.
1.5 SCOPE AND DELIMITAION:
This project proposal is intended only for a security
surveillance which is uses by simple mobile robots and controlled
by Z8F6401 Zilog microcontroller. In fact, this is a wireless
connection which controlled remotely by sending a data from a
desktop computer side to the mobile robot side.
This project uses the UC1817 RF Module for the transmitter
side through the power of 0dBm (1milliwatt) at the frequency of
5
(430-439), 433MGz for a nominal value, and thus, the design and
architectures of the transmitter and receiver module is beyond of
my project proposal. The RF module ranges about a distance not
more than 100ft but it can do more than 100ft distance for an
open space. It uses a wireless camera to make the mobile robot
freely move around.
The transmitter side controlled the robot through UC1817
transmitter module connected via RS232 communication serial port
in sending a data command. The data commands transmit to the
receiver side only if the RS232 serial port is decoded this done
through C#.net programming language.
The mobile robot is limited in any form of stairs; it can
only be worked in a plane area as long as it could reach the
range given by the transmitter module.
C#.net programming language is used to communicate the
RS232 serial port. C#.net is used because, it is an open source
programming language, and it can be downloaded anytime at
http://www.microsoft.com.
6
1.6 DEFFINATION OF TERMS:
Data-A collection of digital bits (binary digits) with
informational content such as a computer file, a digital
image, or a digital sound recording, wireless file
transfer. General expression for information, especially
in encoded or written form.
Frequency- frequency symbol, f. The rate at which a phenomenon
is repeated. The basic unit of frequency is the
Hertz (Hz), which represents one complete cycle per
second. Common units encountered in electronics are the
kilohertz (kHz), megahertz (MHz), and gigahertz
(GHz), where 1 kHz = 10 3 Hz, 1 MHz = 106 Hz, and 1 GHz
= 109 Hz. Occasionally, the terahertz (THz) is used; 1
THz = 1012 Hz.
Microcontroller-A computer contained within a single integrated
circuit (IC). The simplest such devices perform
elementary functions. More sophisticated devices control
radio receivers and transmitters, television sets,
automobiles, aircraft, and robots. The most advanced
devices can be programmed to provide electrical
impulses to control erratically functioning
body organs, move the muscles of paralyzed
persons, and transcribe speech to writing or vice versa.
It is also known as microcomputer.
Receiver- A device or system operated at the destination end of a
communication link; it accepts signal and processes or
7
converts it for local use Also see specific entries for
various types of receiver. 2. The earpiece of a telephone.
3. A radiobroadcast-band tuner integrated with a general
purpose preamplifier and power amplifier, an containing
standard jacks for input and output audio signals to and
from peripheral equipment.
RS232- (Recommended standard-232) is a standard interface
approved by the Electronic Industries Association (EIA)
for connecting serial devices. It describes the physical
interface and protocol for relatively low-speed serial
data communication between computers and related devices.
RS-232 is the interface that your computer uses to talk to
and exchange data with your modem and other serial
devices. The serial ports on most computers use a subset
of the RS-232C standard.
Transmitter-equipment for producing and sending signals or data.
One who originates signals or data.
Zilog- A brand of microcontroller.
Z8F6401- A product of Zilog microcontroller which contains 40
pins and a member of Z8 encore! microcontroller family.
8
CHAPTER II
REVIEW OF RELATED LITERATURE
2.1 What’s a Microcontroller?
A microcontroller is a computer-on-a-chip, or, if the
researcher prefer, a single-chip computer. Micro suggests that
the device is small, and controller tells you that the device
might be used to control objects, processes, or events. Another
term to describe a microcontroller is embedded controller,
because the microcontroller and its support circuits are often
built into, or embedded in, the devices they control. You can
find microcontrollers in all kinds of things these days. Any
device that measures, stores, controls, calculates, or displays
information is a candidate for putting a microcontroller inside.
In contrast, a microcontroller is a single-chip computer because
it contains memory and I/O interfaces in addition to the CPU.
Because the amount of memory and interfaces that can fit on a
single chip is limited, microcontrollers tend to be used in
smaller systems that require little more than the microcontroller
and a few support components.
A microcontroller is similar to the microprocessor inside a
personal computer. Examples of microprocessors include Intel’s
8086, Motorola’s 68000, and Zilog’s Z80. Both microprocessors and
microcontrollers contain a central processing unit, or CPU. The
CPU executes instructions that perform the basic logic, math, and
data-moving functions of a computer. To make a complete computer,
9
a microprocessor requires memory for storing data and programs,
and input/output (I/O) interfaces for connecting external devices
like keyboards and displays.
2.2 Brief history
2.2.1 The Intel 4004, the first (Nov 1971)
The first single chip CPU was the Intel 4004, a 4-bit
processor meant for a calculator. It processed data in 4 bits,
but its instructions were 8 bits long. Program and Data memory
were separate, 1K data memory and a 12-bit PC for 4K program
memory. There were also sixteen 4-bit (or eight 8-bit) general
purpose registers.
The 4004 had 46 instructions, using only 2,300 transistors
in a 16-pin DIP. It ran at a clock rate of 740 kHz (eight clock
cycles per CPU cycle of 10.8 microseconds) - the original goal
was 1MHz, to allow it to compute BCD arithmetic as fast (per
digit) as a 1960's era IBM 1620. The 4040 (1972) was an enhanced
version of the 4004, adding 14 instructions, larger (8 level)
stack, 8K program space, and interrupt abilities (including
shadows of the first 8 registers).
2.2.2 TMS 1000, First microcontroller (1972)
Texas Instruments followed the Intel 4004/4040 closely with
the 4-bit TMS 1000, which was the first microprocessor to include
enough RAM, and space for a program ROM, to allow it to operate
10
without multiple external support chips. It also featured an
innovative feature to add custom instructions to the CPU.
2.2.3 The Intel 8080 (April 1974)
The 8080 was the successor to the 8008 (April 1972,
intended as a terminal controller, and similar to the 4040).
While the 8008 had 14 bit PC and addressing, the 8080 had a 16
bit address bus and an 8 bit data bus. Internally it had seven 8
bit registers (A-E, H, L - pairs BC, DE and HL could be combined
as 16 bit registers), a 16 bit stack pointer to memory which
replaced the 8 level internal stacks of the 8008, and a 16 bit
program counter. It also had several I/O ports - 256 of them, so
I/O devices could be hooked up without taking away or interfering
with the addressing space, and a signal pin that allowed the
stack to occupy a separate bank of memory.
2.2.4 The 650x, Another Direction (1975)
Unlike the 8080 and its kind, the 6502 and 6800 had very
few registers. It was an 8 bit processor, with 16 bit address
bus. Inside was one 8 bit data register, two 8 bit index
registers, and an 8 bit stack pointer (stack was preset from
address 256 ($100 hex) to 511 ($1FF)). It used these index and
stack registers effectively, with more addressing modes,
including a fast zero-page mode that accessed memory addresses
from address 0 to 255 ($FF) with an 8-bit address that speeded
11
operations (it didn't have to fetch a second byte for the
address).
2.2.5 Microchip Technology PIC 16x/17x, call it RISC (1975)
The PIC 16x is an interesting look at an 8 bit design made
with slightly newer design techniques than other 8 bit CPUs in
this list - around 1978 by General Instruments (the 1650, a
successor to the more general 1600). It lost out to more popular
CPUs and was later sold to Microchip Technology, which still
sells it for small embedded applications. An example of this
microprocessor is a small PC board called the BASIC Stamp,
consisting of 2 ICs - an 18-pin PIC 16C56 CPU (with a BASIC
interpreter in 512 word ROM (yes, 512)) and 8-pin 256 byte serial
EEPROM (also made by Microchip) on an I/O port where user
programs (about 80 tokenized lines of BASIC) are stored.
2.2.6 The Zilog Z-80 - End of an 8-bit line (July 1976)
The Z-80 was intended to be an improved 8080 (designed by
ex-Intel engineers), and it was - vastly improved. It also used 8
bit data and 16 bit addressing, and could execute all of the 8080
(but not 8085) op codes, but included 80 more, instructions (1,
4, 8 and 16 bit operations and even block move and block I/O).
The register set was doubled, with two banks of data registers
(including A and F) that could be switched between. This allowed
fast operating system or interrupt context switches. The Z-80
also added two index registers (IX and IY) and 2 types of
12
relocatable vectored interrupts (direct or via the 8-bit I
register).
But the thing that really made the Z-80 popular in designs was
the memory interface - the CPU generated its own RAM refresh
signals, which meant easier design and lower system cost.
It has a unique architecture with three memory spaces:
program memory, data memory, and a CPU register file. On-chip
features include UART, timers, DMA, up to 40 I/O lines. Some
versions include a synchronous/asynchronous serial channel.
Features fast interrupt response with 37 interrupt sources. The
Z8671 has Tiny Basic in ROM. The Super-8 is just that, a super
version of the Z8 with more of everything.
2.2.7 Intel 8051, Descendant of the 8048.
While the 8048 used 1-byte instructions, the 8051 has a
more flexible 2-byte instruction set. It has eight 8-bit
registers, plus an accumulator A. Data space is 128 bytes
accessed directly or indirectly by a register, plus another 128
above that in the 8052 which can only be accessed indirectly
(usually for a stack). External memory occupies the same address
space, and can be accessed directly (in a 256 byte page via I/O
ports) or through the 16 bit DPTR address registers much like in
the RCA 1802. Direct data above location 32 is bit-addressable.
Although complicated, these memory models allow flexibility in
embedded designs, making the 8051 very popular (over 1 billion
sold since 1988).
13
2.3 THE ZILOG MICROCONTROLLER
For the Zilog microcontroller architecture:
FIG. A.1 THE GENENRAL BLOCK DIAGRAM OF eZ8 MICROCONTROLLER
FAMILY (Courtesy of Z8F640 data sheets)
CPU FEATURES:
The eZ8, ZiLOG’s latest 8-bit Central Processing Unit
(CPU), meets the continuing demand for faster and more code-
efficient microcontrollers. The eZ8 CPU executes a superset of
the original Z8 instruction set. The eZ8 CPU features include:
• Direct register-to-register architecture allows each register
to function as an
14
• Software stack allows much greater depth in subroutine calls
and interrupts than hardware stacks
• Compatible with existing Z8 code
• Expanded internal Register File allows access of up to 4KB
• New instructions improve execution efficiency for code
developed using higher-level programming languages, including C
• Pipelined instruction fetch and execution
• New instructions for improved performance including BIT, BSWAP,
BTJ, CPC, LDC, LDCI, LEA, MULT, and SRL
• New instructions support 12-bit linear addressing of the
Register File
• Up to 10 MIPS operation
• C-Compiler friendly
• 2-9 clock cycles per instruction
General Purpose I/O
The Z8 Encore! features seven 8-bit ports (Ports A-G) and
one 4-bit port (Port H) for general purpose I/O (GPIO). Each pin
is individually programmable.
Flash Controller
The Flash Controller programs and erases the Flash memory.
10-Bit Analog-to-Digital Converter
The Analog-to-Digital Converter (ADC) converts an analog
input signal to a 10-bit binary number. The ADC accepts inputs
from up to 12 different analog input sources.
15
UARTs
Each UART is full-duplex and capable of handling
asynchronous data transfers. The UARTs support 8- and 9-bit data
modes and selectable parity.
(I2C)
The inter-integrated circuit (I2C) controller makes the Z8
Encore! compatible with the (I2C) protocol. The (I2C) controller
consists of two bidirectional bus lines, a serial data (SDA) line
and a serial clock (SCL) line.
Serial Peripheral Interface
The serial peripheral interface (SPI) allows the Z8 Encore!
To exchange data between other peripheral devices such as
EEPROMs, A/D converters and ISDN devices. The SPI is a full-
duplex, synchronous, character-oriented channel that supports a
four-wire interface.
Timers
Up to four 16-bit reloadable timers can be used for
timing/counting events or for motor control operations. These
timers provide a 16-bit programmable reload counter and operate
in One-Shot, Continuous, Gated, Capture, Compare, Capture and
Compare, and PWM modes. Only 3 timers (Timers 0-2) are available
in the 40- and 44-pin packages.
Interrupt Controller
The Z8F640x family products support up to 24 interrupts.
These interrupts consist of 12 internal and 12 general-purpose
16
I/O pins. The interrupts have 3 levels of programmable interrupt
priority.
Reset Controller
The Z8F640x family can be reset using the RESET pin, power-
on reset, Watch-Dog Timer (WDT), Stop mode exit, or Voltage
Brown-Out (VBO) warning signal.
On-Chip Debugger
The Z8 Encore! features an integrated On-Chip Debugger
(OCD). The OCD provides a rich set of debugging capabilities,
such as reading and writing registers, programming the Flash,
setting breakpoints and executing code. A single-pin interface
provides communication to the OCD.
DMA Controller
The Z8F640x family features three channels of DMA. Two of
the channels are for register RAM to and from I/O operations. The
third channel automatically controls the transfer of data from
the ADC to the memory.
For more information regarding the eZ8 CPU, refer to the eZ8 CPU
User Manual available for download at http://www.zilog.com/
2.4 BRIEF HISTORY OF ROBOTS
The robot really became a popular concept during the late
1950's and early 1960's. With the automotive industry in full
expansion at that time, industrial robots were employed to help
factory operators. Industrial robots do not have the
imaginative, human-like appearance that we have been dreaming of
17
throughout the ages. They are computer-controlled manipulators,
like arms and hands, which can weld or spray paint cars as they
roll down an assembly line.
Robots were created to help humans, especially in high risk
or dangerous situations. A robot can deactivate a bomb, go to the
edges of an active volcano, transport dangerous materials,
explore the ocean floor and even perform tasks in the most
hostile environment known to man: space without the proper
protection, like a spacecraft or even the EVA suit used by space
walkers, survival in space is not possible. When repairs have to
be made outside a spacecraft, astronauts are sometimes required
to leave the space shuttle or the Space Station. These
extravehicular activities are very dangerous; so, robots are used
to carry out tasks in space in order to limit the number of risks
taken. As we have discovered, today's robots do not necessarily
resemble humans. A human is made up of a number of different
visible components, like a head where the brain sends messages
to the rest of the body; arms and hands to grasp and manoeuvre
objects; a torso to which all of the components are attached and
legs to move. Robots need all these different components to
operate. A number of robots make up the Mobile Servicing System.
The Mobile Servicing System is Canada's contribution to the
International Space Station. Canada created the Mobile Servicing
System to help in the construction of the Space Station; it will
first build the Space Station and then help maintain the Station
throughout its lifetime.
18
Just like humans have a brain that sends messages to the
rest of the body; there is a main computer that communicates with
the robotic system. The Space Station Remote Manipulator System
(SSRMS), Canada's new robotic arm, will be able to lift and move
objects the size and mass of the Space Shuttle. The crew of STS-
100 with Canadian Space Agency Astronaut Chris Hadfield will
deliver and install the new arm to the International Space
Station as it orbits high above the Earth. This second generation
Canadarm is Canada's primary contribution to the Station. The
Space Vision System (CSVS), another critical piece of Canadian
robotics innovation, is comprised of several cameras and targets.
These are located in key areas of the Space Station and on the
robotic arm; it will serve to pinpoint the exact movement and
location of components for the building and maintenance of the
Station. Therefore, astronauts from inside the Space Station are
able to operate the Mobile Servicing System by using this Space
Vision System.
19
2.5 THE RS232 DATA
TABLE 1. THE RS232 DATA
FIG A.2 RS232 ASSIGNING PIN
20
CHAPTER 3
METHODOLOGY
3.1 STUDY DESIGN
Upon constructing a robot is quietly difficult in terms of
mechanical and electrical parts of materials to be used.
In mechanical part the system, it must be workable to avoid
malfunctioning. It has to be built an appropriate combination of
materials in mechanical parts although it is not totally exact
but it will make workable. The mechanical parts are one of the
more difficult parts to be considered.
On the other hand, electrical part, this is quit more
complicated, because it deals with advance electronic mechanisms
such as designing a circuit in microcontroller, an H-bridge
circuit using L298 in controlling the motors, programming a Z8
encore! microcontroller, programming a data transmitter in
desktop computer using c#.net and decoding the RS232 serial port.
The harder part is to minimize the uncontrolled losses of data in
transmitter side.
21
3.2 THEORETICAL STRUCTURE
FIGURE A.3 THE SYSTEM CONFIGURATION FOR THE PROCESS OF DATA
3.3 RESEARCH PROCEDURE
Before constructing and starting to begin this project
proposal, we have to determine first the system of our works.
22
3.3.1 At the transmitter side:
The desktop computer is the part where the data will be
created and waiting for the command to transfer which was the
programmed used is in C#.net shown in appendix (A). After the
data was set and sent to RS232 serial communication port where
the UC1817 transmitter module attach, instantly UC1817
transmitter throw a binary data in analog form to the receiver
side of 433MHz at a power rating of 1milliwatt. The UC1817
transmitter uses 9pin ports RS232C serial communication. Among
the 9 pins only pin 3 transmitter pin, pin 4 the data terminal
ready, pin 5 the signal ground. The transmitter pin or pin 3 is
the only pin who transmit digital signal to UC1817 module
transmitter and pin 4 always at the high level and pin5 is a
ground signal.
3.3.2 At the receiver side:
The flow of the data in a wireless system side in this
special project is that; at the sender side the data transfer
first the header at a hexadecimal form of 0x54 or 0x55, then the
actual data which actually you want to transmit, then the
checksum. The checksum is the last data to transmit such as the
header + actual data and it’s automatically truncated to 8 bits.
The hexadecimal data 0x54 and 0x55 is the clock address data of
the Z86E02 to perform the output up to 216 bit or 2 byte of
23
combination data through using the 74LS374. Upon reception, the
receiver checks the integrity of the header and proceeds to
compute its own checksum and compares it with the received
checksum. If the checksum matches, a valid data reception is
assumed and the 8-bit data is outputted on the receiver output
port. Other-wise, if error is found in either header or checksum,
the receiver rejects the data set by ignoring it.
The data receive at a sensitivity of 8uV at 2.4 KHz 80
percent mod from the receiver amplify to its maximum rating. In
order to work the receiver module more efficient, avoid the robot
to go beyond the wall, because the RF can hardly penetrate the
thick wall.
The receiver side composes of, simple mobile robot toy, the
receiver module, data decoder which uses the Z8f6401
microcontroller, he H-bridge which controlling the wheel of the
motor, steeper and servo motor which both controls the wireless
camera and the camera.
24
CHAPTER 4
PRESENTATION AND IMPLEMENTATION OF DATA
The circuit figure A.4 is quit complicated design. It
contains the layout of the microcontroller, servo motor and the
transistorized circuits of stepper motor in, the researcher
should aware of the circuitry where the connection of the source
of the microcontroller should be separate source of the two
motors the stepper and the servo. Because the Z8F6401
microcontroller can power for only 3.3 volts in order to operate
the microcontroller. Unlike for the servo it reaches up to 5
volts to operate and 12 volts maximum for stepper motor.
The circuit of the stepper motor is design to overcome and
avoid the extra current spikes which can actually destroy the
inductor coil of the stepper motor. The microcontroller can drive
the stepper motor through transistorized design see fig. A.4.
The servo motor can be directly controlled by the
microcontroller. It will support the cmos output controlled. The
servo could be drive through the PWM signal or Pulse Width
Modulation. It turns only up to 180 degrees, and which can be
drive depend upon the percentage of modulation. It can be solve
in to this basic formula:
25
FIG. A.4 THE CIRCUIT DIAGRAM OF MICROCONTROLLER AND STEPPER
MOTOR.
26
FIG. A.5 3DIMENSIONAL VIEW OF MCU AND PCB LAYOUT
27
For H-bridge circuit of the motors. For this it uses L298 for the circuit.
FIG. A.6 3D VIEW OF H-BRIDGE TYPE
FIG. A.8 L298 PIN CONFIGURATION
FIG. A.9 L298 CIRCUIT LAYOUT
FIG. A.7 PCB OF H-BRIDGE LAYOUT
28
The h-bridge circuit layout of Fig.A.9 uses the L298 power
IC which could be controlled in digital signal. It power up to 50
volts maximum and can be controlled. The L298 is an integrated
monolithic circuit in a 15-lead Multi-watt and PowerSO20
packages. It is a high voltage, high current dual full-bridge
driver designed to accept standard TTL logic levels and drive
inductive loads such as relays, solenoids, DC and stepping
motors. Two enable inputs are provided to enable or disable the
device independently of the input signals. The emitters of the
lower transistors of each bridge are connected together and the
corresponding external terminal can be used for the connection of
an external sensing resistor. An additional supply input is
provided so that the logic works at a lower voltage.
Circuit data: Treat all Integrated Circuit (IC) as a prone of static force ITEMS DISCRIPTION Quantity *
price(Php) Z846401 40 pin Z8 encore!
Microcontroller (1)(1200.00)
UC1817/ 455 RF receiver
Wireless module (1)(900.00)
L298 Dual full bridges driver
(1)(250.00)
Servo motor ------------------- (1)(650.00) Stepper motor ------------------- (1)(300.00) 2N2222A NPN transistors (8)(8.00) LM317 Voltage regulator (1)(20.00) 7805 5 volts voltage
regulator (2)(18.00)
1N4001 Diode (16)(1.50) Resistors ------------------- (32)(.75) Capacitors
Polarize and Ceramic
(7)(8.00)
Screw terminal ------------------- (12)(13.50) SWG solid wires (4meters)(6.50)per
29
meter Mobile toy ------------------- (1)(350.00) C#.net (Csharp) Software Open source (free
to down load) Desktop Computer (1)()
PCB and other components
700.00
Total: 4,762.00 without computer
TABLE 2 LIST OF COMPONENTS
The complete source and code of the program of this robot
(see figure a.10) can be found in appendices A an B. for the
appendix A that is the C#.net code which control the transmitter
signal whereas the robot can be maneuvered for that program. Be
aware of editing the program if the researchers edit some of the
data code which uses to transmit data sometimes it will not fit
in to the receiver decoder. Thus the program of the appendices A
and B are co-related each other and for the program of appendix B
is for the microcontroller.
30
FIG. A.10 THE FINAL LOOK OF THE PROJECT
31
CHAPTER 5
RECOMMENDATION AND CONCLUSION
5.1 RECOMENDATION
Security services are widely needed for the protection of
any form of criminal moves. Using any gadgets such as
surveillance camera, intruders’ detectors, robots and many bother
can help a lot to prevent the risk of the human security
services. It is highly recommended for the gadget to have a high
quality of equipment for the hi-tech uses. Upon of this project
proposal it is more efficient to have an almost accurate of data
to receive and or preventing the losses of data in transmission.
It is recommended to have a two antenna both ends which assure to
have an efficient transmit of data. The power source is one of
the problems of any electronic gadgets. For recommendations of
this project it is much better to use a self charging battery to
minimize the weak of the battery.
Improving the data sender side and the wireless camera, it
is much better to have a two wireless camera and record it to the
desktop computer. For further improvement the researcher would
implement the data image processing and intruder alarm while
recording the video, this could help a lot to recognize instantly
the person weather it’s an intruders or not and it should be much
better to record the from time to time to ensure much better
security.
32
5.2 CONCLUSION In development of the security system is hardly to
implement in easier way, the life of the innocent people must be
put in the risk. The system of the project should be examined
twice before it implement. The development of this project is
much probably decreasing the risk of life in the human security
services. And it is much better security guard in overnight
unless the battery becomes weak.
To develop wireless technology could probably decrease the
elements of the row materials. Your application could be apply
without carrying a bundle of wire to generate your robots.
The evolution of hi-tech technology could create
tremendous gadgets in today technology. The existing of
microcontroller can simplify the huge work. The continuous study
of newest technology could bring us better future to live in the
sense of power conservation and other way to live in simple and
luxuries way. The nano-technology is the latest technology
invented in 21st century, which still embedded with
microcontroller. Observing the world today, scientist focuses on
the biomedical technology, which could give us much greater help
to improve our life style. On the other hand, some focuses on the
warfare technology, which gives the arm forces much safer way to
hunt their enemies.
The zilog microcontroller is can’t hard to implement if the
researcher has a back ground about C language programming. The
33
software used to transmit signal is the C#.net. This software can
be downloaded anytime at http://wwww.microsoft.com/ and which the
researcher found out that it is the heritage of from C to C++ and
to C#. If the researcher has a background either of these two
languages the C and C++ you can begin coding right away.
According to some author that C#.net is one of trend in
programming a networking and probably much better than Java
software because Java run 10 times slower than Microsoft base
like c#. Accessing the serial port can easily implement in c#
program.
34
BIBLIOGRAPHY
Axelson, Jan “The Microcontroller Idea Book” 2209 Winnebago St.
Madison, WI 53704, United States of America;
International Thomson Publishing (ITP).1997
Gaonkar, Ramesh S. “Microprocessor Architecture Programming and
Application with 8085” United States of America;
Macmillan Publishing Company.1989.
Chua, Henry (2005). “8/16-bit RF Wireless Remote Output”: e-Gizmo
Mechatronix Central, 16 pages in Datasheets.
Retrieved 2005, from http://www.e-gizmo.com
Gordon, Mc Comb (2001). “The Builder’s Robot Bonanza” United
States of America; McGraw-Hill. 2001.
Dr. Timothy S. Margush (2006).” USING AN 8-BIT RISC
MICROCONTROLLER IN AN ASSEMBLY LANGUAGE PROGRAMMING
COURSE” University of Akron.2006.
35
APPENDIX A
FIG. A.11 APPLET VIEWER FOR ROBOT CONTROL
This is a C#.net code. This is a designer form. namespace WindowsApplication1 { partial class Form1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify
36
/// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Windows.Forms.LinkLabel linkLabel1; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.checkBox1 = new System.Windows.Forms.CheckBox(); this.button7 = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.serialPort1 = new System.IO.Ports.SerialPort(this.components); this.serialPort2 = new System.IO.Ports.SerialPort(this.components); this.serialPort3 = new System.IO.Ports.SerialPort(this.components); this.serialPort4 = new System.IO.Ports.SerialPort(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer2 = new System.Windows.Forms.Timer(this.components); this.timer3 = new System.Windows.Forms.Timer(this.components); this.timer4 = new System.Windows.Forms.Timer(this.components); this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.timer5 = new System.Windows.Forms.Timer(this.components); this.button6 = new System.Windows.Forms.Button(); this.button8 = new System.Windows.Forms.Button(); this.button9 = new System.Windows.Forms.Button(); this.button10 = new System.Windows.Forms.Button(); this.textBox3 = new System.Windows.Forms.TextBox(); this.button5 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); linkLabel1 = new System.Windows.Forms.LinkLabel(); this.SuspendLayout(); // // linkLabel1 // resources.ApplyResources(linkLabel1, "linkLabel1"); linkLabel1.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; linkLabel1.LinkColor = System.Drawing.Color.Lime; linkLabel1.Name = "linkLabel1";
37
linkLabel1.TabStop = true; // // progressBar1 // this.progressBar1.AccessibleRole = System.Windows.Forms.AccessibleRole.None; this.progressBar1.BackColor = System.Drawing.Color.Aqua; this.progressBar1.ForeColor = System.Drawing.Color.Maroon; resources.ApplyResources(this.progressBar1, "progressBar1"); this.progressBar1.MarqueeAnimationSpeed = 5; this.progressBar1.Maximum = 0; this.progressBar1.Name = "progressBar1"; this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee; // // comboBox1 // resources.ApplyResources(this.comboBox1, "comboBox1"); this.comboBox1.ForeColor = System.Drawing.Color.Black; this.comboBox1.FormattingEnabled = true; this.comboBox1.Items.AddRange(new object[] { resources.GetString("comboBox1.Items"), resources.GetString("comboBox1.Items1"), resources.GetString("comboBox1.Items2"), resources.GetString("comboBox1.Items3")}); this.comboBox1.Name = "comboBox1"; this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); // // checkBox1 // resources.ApplyResources(this.checkBox1, "checkBox1"); this.checkBox1.Name = "checkBox1"; this.checkBox1.UseVisualStyleBackColor = true; this.checkBox1.CheckedChanged += new System.EventHandler(this.open_com_CheckedChanged); // // button7 // resources.ApplyResources(this.button7, "button7"); this.button7.ForeColor = System.Drawing.Color.Red; this.button7.Name = "button7"; this.button7.UseVisualStyleBackColor = true; this.button7.Click += new System.EventHandler(this.button7_Click); // // label1 // resources.ApplyResources(this.label1, "label1"); this.label1.Name = "label1"; // // serialPort1
38
// this.serialPort1.BaudRate = 2400; // // serialPort2 // this.serialPort2.BaudRate = 2400; this.serialPort2.PortName = "COM2"; // // serialPort3 // this.serialPort3.BaudRate = 2400; this.serialPort3.PortName = "COM3"; // // serialPort4 // this.serialPort4.BaudRate = 2400; this.serialPort4.PortName = "COM4"; // // timer1 // this.timer1.Interval = 250; this.timer1.Tag = ""; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // timer2 // this.timer2.Interval = 3; this.timer2.Tick += new System.EventHandler(this.timer2_Tick); // // timer3 // this.timer3.Interval = 3; this.timer3.Tick += new System.EventHandler(this.timer3_Tick); // // timer4 // this.timer4.Interval = 3; this.timer4.Tick += new System.EventHandler(this.timer4_Tick); // // textBox1 // this.textBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); resources.ApplyResources(this.textBox1, "textBox1"); this.textBox1.ForeColor = System.Drawing.Color.LimeGreen; this.textBox1.Name = "textBox1"; // // textBox2 // this.textBox2.BackColor = System.Drawing.Color.CornflowerBlue; resources.ApplyResources(this.textBox2, "textBox2");
39
this.textBox2.ForeColor = System.Drawing.Color.Yellow; this.textBox2.Name = "textBox2"; this.textBox2.ReadOnly = true; this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged); // // label3 // resources.ApplyResources(this.label3, "label3"); this.label3.Name = "label3"; // // label4 // resources.ApplyResources(this.label4, "label4"); this.label4.Name = "label4"; // // timer5 // this.timer5.Interval = 50; this.timer5.Tick += new System.EventHandler(this.timer5_Tick); // // button6 // this.button6.ForeColor = System.Drawing.Color.Purple; resources.ApplyResources(this.button6, "button6"); this.button6.Name = "button6"; this.button6.UseVisualStyleBackColor = true; this.button6.Click += new System.EventHandler(this.button6_Click_1); // // button8 // this.button8.ForeColor = System.Drawing.Color.Purple; resources.ApplyResources(this.button8, "button8"); this.button8.Name = "button8"; this.button8.UseVisualStyleBackColor = true; this.button8.Click += new System.EventHandler(this.button8_Click); // // button9 // resources.ApplyResources(this.button9, "button9"); this.button9.ForeColor = System.Drawing.Color.Purple; this.button9.Name = "button9"; this.button9.UseVisualStyleBackColor = true; this.button9.Click += new System.EventHandler(this.button9_Click); // // button10 // this.button10.ForeColor = System.Drawing.Color.Purple; resources.ApplyResources(this.button10, "button10");
40
this.button10.Name = "button10"; this.button10.UseVisualStyleBackColor = true; this.button10.Click += new System.EventHandler(this.button10_Click); // // textBox3 // this.textBox3.BackColor = System.Drawing.Color.CornflowerBlue; resources.ApplyResources(this.textBox3, "textBox3"); this.textBox3.ForeColor = System.Drawing.Color.Red; this.textBox3.Name = "textBox3"; this.textBox3.ReadOnly = true; // // button5 // resources.ApplyResources(this.button5, "button5"); this.button5.Name = "button5"; this.button5.UseVisualStyleBackColor = true; this.button5.Click += new System.EventHandler(this.button5_Click); // // button4 // resources.ApplyResources(this.button4, "button4"); this.button4.Name = "button4"; this.button4.UseVisualStyleBackColor = true; this.button4.Click += new System.EventHandler(this.button4_Click); // // button1 // resources.ApplyResources(this.button1, "button1"); this.button1.Name = "button1"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // resources.ApplyResources(this.button2, "button2"); this.button2.Name = "button2"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // // button3 // resources.ApplyResources(this.button3, "button3"); this.button3.Name = "button3"; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click);
41
// // imageList1 // this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Turquoise; this.imageList1.Images.SetKeyName(0, "logo2.png"); // // Form1 // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.Controls.Add(this.textBox3); this.Controls.Add(this.button10); this.Controls.Add(this.button9); this.Controls.Add(this.button8); this.Controls.Add(this.button6); this.Controls.Add(linkLabel1); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.textBox2); this.Controls.Add(this.textBox1); this.Controls.Add(this.label1); this.Controls.Add(this.button7); this.Controls.Add(this.checkBox1); this.Controls.Add(this.comboBox1); this.Controls.Add(this.progressBar1); this.Controls.Add(this.button5); this.Controls.Add(this.button4); this.Controls.Add(this.button3); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Cursor = System.Windows.Forms.Cursors.SizeAll; this.ForeColor = System.Drawing.Color.DarkBlue; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.Name = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button4;
42
private System.Windows.Forms.Button button5; private System.Windows.Forms.ProgressBar progressBar1; private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.CheckBox checkBox1; private System.Windows.Forms.Button button7; private System.Windows.Forms.Label label1; private System.IO.Ports.SerialPort serialPort1; private System.IO.Ports.SerialPort serialPort2; private System.IO.Ports.SerialPort serialPort3; private System.IO.Ports.SerialPort serialPort4; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Timer timer2; private System.Windows.Forms.Timer timer3; private System.Windows.Forms.Timer timer4; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Timer timer5; private System.Windows.Forms.Button button6; private System.Windows.Forms.Button button8; private System.Windows.Forms.Button button9; private System.Windows.Forms.Button button10; private System.Windows.Forms.TextBox textBox3; private System.Windows.Forms.ImageList imageList1; } } EXECUTION CODE: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.IO.Ports; using System.Timers; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button6_Click(object sender, EventArgs e) { new Form2().Show(); } private void open_com_CheckedChanged(object sender, EventArgs e) {
43
if (checkBox1.Checked == false) { textBox2.Text = null; textBox2.Text = ("stop/ready"); textBox1.Text = "\n" + " serial port closed..."; checkBox1.Enabled = false; button1.Enabled = false; button2.Enabled = false; button3.Enabled = false; button4.Enabled = false; button5.Enabled = false; button6.Enabled = false; button8.Enabled = false; button9.Enabled = false; button10.Enabled = false; progressBar1.Visible = false; comboBox1.Enabled = true; switch (comboBox1.Text) { case "COM1": { timer1.Stop(); serialPort1.Close(); comboBox1.Text = " "; break; } case "COM2": { timer2.Stop(); serialPort2.Close(); comboBox1.Text = " "; break; } case "COM3": { timer3.Stop(); serialPort3.Close(); comboBox1.Text = " "; break; } case "COM4": { textBox2.Text = ("stop/ready"); timer4.Stop(); serialPort4.Close(); comboBox1.Text = " "; break; } } } if (checkBox1.Checked == true) {
44
textBox1.Text = ("\n" + " serial port open ready to send data..."); button1.Enabled = true; button2.Enabled = true; button3.Enabled = true; button4.Enabled = true; button5.Enabled = true; checkBox1.Enabled = true; comboBox1.Enabled = false; button6.Enabled = true; button8.Enabled = true; button9.Enabled = true; button10.Enabled = true; progressBar1.Show(); textBox2.Text = null; textBox2.Text = ("stop/ready"); switch (comboBox1.Text) { case "COM1": { textBox2.Text = null; textBox2.Text = "stop/ready"; serialPort1.Open(); timer1.Start(); break; } case "COM2": { textBox2.Text = null; textBox2.Text = "stop/ready"; serialPort2.Open(); timer2.Start(); break; } case "COM3": { textBox2.Text = null; textBox2.Text = "stop/ready"; serialPort3.Open(); timer3.Start(); break; } case "COM4": { textBox2.Text = null; textBox2.Text = "stop/ready"; serialPort4.Open(); timer4.Start(); break; } } }
45
} private void timer1_Tick(object sender, EventArgs e) { //sending data at port1******************************************** textBox1.Text = ("\n" + "sending data in serial port1..."); if (textBox2.Text == "stop/ready") { button7.Enabled = true; } else { button7.Enabled = false; } if (textBox2.Text == "stop/ready") { //ready stop serialPort1.Write(new Byte[] { 0x54, 0xAA, (0x54 + 0xAA) & 0xFF }, 0, 3); } else if (textBox2.Text == "reverse") { //reverse serialPort1.Write(new Byte[] { 0x54, 0xA8, (0x54 + 0xA8) & 0xFF }, 0, 3); } else if (textBox2.Text == "go_left") { //GO_LEFT serialPort1.Write(new Byte[] { 0x54, 0xA6, (0x54 + 0xA6) & 0xFF }, 0, 3); } else if (textBox2.Text == "go_right") { //GO_RIGHT serialPort1.Write(new Byte[] { 0x54, 0xA4, (0x54 + 0xA4) & 0xFF }, 0, 3); } else if (textBox2.Text == "forward") { //forward serialPort1.Write(new Byte[] { 0x54, 0xAB, (0x54 + 0xAB) & 0xFF }, 0, 3); } } private void timer2_Tick(object sender, EventArgs e) { //sending data at port2******************************************** textBox1.Text = ("\n" + "sending data in serial port2..."); if (textBox2.Text == "stop/ready") {
46
button7.Enabled = true; } else { button7.Enabled = false; } if (textBox2.Text == "stop/ready") { //ready stop serialPort2.Write(new Byte[] { 0x54, 0xAA, (0x54 + 0xAA) & 0xFF }, 0, 3); } else if (textBox2.Text == "reverse") { //reverse serialPort2.Write(new Byte[] { 0x54, 0xA8, (0x54 + 0xA8) & 0xFF }, 0, 3); } else if (textBox2.Text == "go_left") { //GO_LEFT serialPort2.Write(new Byte[] { 0x54, 0xA6, (0x54 + 0xA6) & 0xFF }, 0, 3); } else if (textBox2.Text == "go_right") { //GO_RIGHT serialPort2.Write(new Byte[] { 0x54, 0xA4, (0x54 + 0xA4) & 0xFF }, 0, 3); } else if (textBox2.Text == "forward") { //forward serialPort2.Write(new Byte[] { 0x54, 0xAB, (0x54 + 0xAB) & 0xFF }, 0, 3); } } private void timer3_Tick(object sender, EventArgs e) { //sending data at port3********************************************* textBox1.Text = ("\n" + "sending data in serial port3..."); if (textBox2.Text == "stop/ready") { button7.Enabled = true; } else { button7.Enabled = false; } if (textBox2.Text == "stop/ready")
47
{ //ready stop serialPort3.Write(new Byte[] { 0x54, 0xAA, (0x54 + 0xAA) & 0xFF }, 0, 3); } else if (textBox2.Text == "reverse") { //reverse serialPort3.Write(new Byte[] { 0x54, 0xA8, (0x54 + 0xA8) & 0xFF }, 0, 3); } else if (textBox2.Text == "go_left") { //GO_LEFT serialPort3.Write(new Byte[] { 0x54, 0xA6, (0x54 + 0xA6) & 0xFF }, 0, 3); } else if (textBox2.Text == "go_right") { //GO_RIGHT serialPort3.Write(new Byte[] { 0x54, 0xA4, (0x54 + 0xA4) & 0xFF }, 0, 3); } else if (textBox2.Text == "forward") { //forward serialPort3.Write(new Byte[] { 0x54, 0xAB, (0x54 + 0xAB) & 0xFF }, 0, 3); } } private void timer4_Tick(object sender, EventArgs e) { //sending data at port4********************************************** if (textBox2.Text == "stop/ready") { button7.Enabled = true; } else { button7.Enabled = false; } textBox1.Text = ("\n" + "sending data in serial port4..."); switch (textBox2.Text) { case "stop/ready": { //ready stop serialPort4.Write(new Byte[] { 0x54, 0xAA, (0x54 + 0xAA) & 0xFF }, 0, 3); break; }
48
case "reverse": { //reverse serialPort4.Write(new Byte[] { 0x54, 0xA9, (0x54 + 0xA8) & 0xFF }, 0, 3); break; } case "go_left": { //GO_LEFT serialPort4.Write(new Byte[] { 0x54, 0xA7, (0x54 + 0xA6) & 0xFF }, 0, 3); break; } case "go_right": { //GO_RIGHT serialPort4.Write(new Byte[] { 0x54, 0xA8, (0x54 + 0xA4) & 0xFF }, 0, 3); break; } case "forward": { //forward serialPort4.Write(new Byte[] { 0x54, 0xAB, (0x54 + 0xAB) & 0xFF }, 0, 3); break; } } } private void Form1_Load(object sender, EventArgs e) { button1.Enabled = false; button2.Enabled = false; button3.Enabled = false; button4.Enabled = false; button5.Enabled = false; button6.Enabled = false; button8.Enabled = false; button9.Enabled = false; button10.Enabled = false; checkBox1.Enabled = false; } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.Text == ("COM1")) { textBox1.Text = ("\n" + "sending data in serial port4..."); checkBox1.Enabled = true; } else if (comboBox1.Text == ("COM2"))
49
{ textBox1.Text = ("\n" + "ready to open com2..."); checkBox1.Enabled = true; } else if (comboBox1.Text == ("COM3")) { textBox1.Text = ("\n" + "ready to open com3..."); checkBox1.Enabled = true; } else if (comboBox1.Text == ("COM4")) { textBox1.Text = ("\n" + "ready to open com4..."); checkBox1.Enabled = true; } } private void button1_Click(object sender, EventArgs e) { textBox2.Text = null; textBox2.Text = ("forward"); } private void button2_Click(object sender, EventArgs e) { textBox2.Text = null; textBox2.Text = ("go_right"); } private void button3_Click(object sender, EventArgs e) { textBox2.Text = null; textBox2.Text = ("go_left"); } private void button4_Click(object sender, EventArgs e) { textBox2.Text = null; textBox2.Text = ("reverse"); } private void button5_Click(object sender, EventArgs e) { textBox2.Text = null; textBox2.Text = ("stop/ready"); } private void button7_Click(object sender, EventArgs e) { switch (comboBox1.Text) { case "COM1": { serialPort1.Close(); timer1.Stop(); this.Dispose(true); break; } case "COM2":
50
{ serialPort2.Close(); timer2.Stop(); this.Dispose(true); break; } case "COM3": { serialPort3.Close(); timer3.Stop(); this.Dispose(true); break; } case "COM4": { timer4.Stop(); serialPort4.Close(); this.Dispose(true); break; } case "": { this.Dispose(true); break; } } Application.Exit(); } void check4() { switch (textBox3.Text) { case "up": { serialPort4.Write(new Byte[] { 0x54, 0xD8, (0x54 + 0xD8) & 0xFF }, 0, 3); textBox3.Text = "up"; break; } case "down": { serialPort4.Write(new Byte[] { 0x54, 0xD6, (0x54 + 0xD6) & 0xFF }, 0, 3); textBox3.Text = "down"; break; } case "left": { serialPort4.Write(new Byte[] { 0x54, 0xD2, (0x54 + 0xD2) & 0xFF }, 0, 3); textBox3.Text = "left"; break;
51
} case "right": { serialPort4.Write(new Byte[] { 0x54, 0xD4, (0x54 + 0xD4) & 0xFF }, 0, 3); textBox3.Text = "right"; break; } } } void check3() { switch (textBox3.Text) { case "up": { serialPort3.Write(new Byte[] { 0x54, 0xD8, (0x54 + 0xD8) & 0xFF }, 0, 3); textBox3.Text = "up"; break; } case "down": { serialPort3.Write(new Byte[] { 0x54, 0xD6, (0x54 + 0xD6) & 0xFF }, 0, 3); textBox3.Text = "down"; break; } case "left": { serialPort3.Write(new Byte[] { 0x54, 0xD2, (0x54 + 0xD2) & 0xFF }, 0, 3); textBox3.Text = "left"; break; } case "right": { serialPort3.Write(new Byte[] { 0x54, 0xD4, (0x54 + 0xD4) & 0xFF }, 0, 3); textBox3.Text = "right"; break; } } } void check2() { switch (textBox3.Text) { case "up": { serialPort2.Write(new Byte[] { 0x54, 0xD8, (0x54 + 0xD8) & 0xFF }, 0, 3);
52
textBox3.Text = "up"; break; } case "down": { serialPort2.Write(new Byte[] { 0x54, 0xD6, (0x54 + 0xD6) & 0xFF }, 0, 3); textBox3.Text = "down"; break; } case "left": { serialPort2.Write(new Byte[] { 0x54, 0xD2, (0x54 + 0xD2) & 0xFF }, 0, 3); textBox3.Text = "left"; break; } case "right": { serialPort2.Write(new Byte[] { 0x54, 0xD4, (0x54 + 0xD4) & 0xFF }, 0, 3); textBox3.Text = "right"; break; } } } void check1() { switch (textBox3.Text) { case "up": { serialPort1.Write(new Byte[] { 0x54, 0xD8, (0x54 + 0xD8) & 0xFF }, 0, 3); textBox3.Text = "up"; break; } case "down": { serialPort1.Write(new Byte[] { 0x54, 0xD6, (0x54 + 0xD6) & 0xFF }, 0, 3); textBox3.Text = "down"; break; } case "left": { serialPort1.Write(new Byte[] { 0x54, 0xD2, (0x54 + 0xD2) & 0xFF }, 0, 3); textBox3.Text = "left"; break; } case "right":
53
{ serialPort1.Write(new Byte[] { 0x54, 0xD4, (0x54 + 0xD4) & 0xFF }, 0, 3); textBox3.Text = "right"; break; } } } private void timer5_Tick(object sender, EventArgs e) { switch (comboBox1.Text) { case "COM1": { timer1.Stop(); for (int t = 0; t < 10; t++) { check1(); } textBox3.Text = null; timer5.Stop(); timer1.Start(); break; } case "COM2": { timer2.Stop(); for (int t = 0; t < 10; t++) { check2(); } textBox3.Text = null; timer5.Stop(); timer2.Start(); break; } case "COM3": { timer3.Stop(); for (int t = 0; t < 10; t++) { check3(); } textBox3.Text = null; timer5.Stop(); timer3.Start(); break; } case "COM4": { timer4.Stop(); for (int t = 0; t < 10; t++)
54
{ check4(); } timer5.Stop(); timer4.Start(); textBox3.Text = null; break; } } } private void textBox2_TextChanged(object sender, EventArgs e) { if (textBox2.Text == "stop/ready") { checkBox1.Enabled = true; } else { checkBox1.Enabled = false; } } private void button6_Click_1(object sender, EventArgs e) { //textBox3.Text = null; textBox3.Text = "up"; timer5.Start(); } private void button8_Click(object sender, EventArgs e) { //textBox3.Text = null; textBox3.Text = "left"; timer5.Start(); } private void button9_Click(object sender, EventArgs e) { //textBox3.Text = null; textBox3.Text = "down"; timer5.Start(); } private void button10_Click(object sender, EventArgs e) { //textBox3.Text = null; textBox3.Text = "right"; timer5.Start(); } } }
55
APPENDIX (B)
#include <ez8.h> #define reverse 0xA9 #define go_left 0xA7 #define go_right 0xA8 #define forward 0xAB #define stop_ready 0xAA #define camera_up 0xD8 #define camera_down 0xD6 #define camera_left 0xD2 #define camera_right 0xD4 int check_pin(void); int strd; void timer_01(int); void rev(void),stop(void), fwrd(void),left(void),right(void); void cam_up(void),cam_down(void), cam_left(void),cam_right(void); void delay(int high,int low)
{ T1CTL &= ~0x80; T1CTL = (0x07 << 3)|0x01; T1H = 0x00; T1L = 0x00; T1RH = high; T1RL = low; IRQ0ENH &= ~0x40; IRQ0ENL &= ~0x40; IRQ0 &= ~0x40; T1CTL |= 0x80;
} void wait(void) { while (!(IRQ0 & 0x40)); IRQ0 &= ~0x40; } void init_pin(void) {
PADD = 0x00; PAOC = 0x00; PAAF = 0x00 | 0x01;/*for timer0 */ PAHDE = 0x00; PBDD = 0xFF; PBOC = 0x00; PBHDE = 0xFF; PBAF = 0x00; PDDD = 0x00; PDOC = 0x00; PDAF = 0x00; PDHDE = 0xFF; PCDD = 0x00;
56
PCOC = 0x00; PCAF = 0x00 | 0x01; //for timer1 PCHDE = 0x00;
} ///////////////////////////////////////////////////////////// void main(void) {
int detect; strd=80; timer_01(80); init_pin(); delay (0x00,0x00); timer_01(0xA0); while(1) { detect = check_pin(); switch (detect) {
/////////////////////motor control/////////////////// case reverse: { rev(); break; } case stop_ready: { stop(); break; } case forward: { fwrd(); break; } case go_left: { left(); break; } case go_right: { right(); break; } ////////////////////end motor control/////////////////// ////////////////////camera control////////////////////// case camera_up: { cam_up(); break; }
57
case camera_down: { cam_down(); break; } case camera_left: { cam_left(); break; } case camera_right: { cam_right(); break; } ////////////////end camera control////////////////////////// } } } ///////////////////////////////////////////////////////////// int check_pin() { int value; switch (PBIN) { /////////////////////motor control//////////////////////// case 0xAB: value = 0xAB; break; case 0xA9: value = 0xA9; break; case 0xA7: value = 0xA7; break; case 0xA8: value = 0xA8; break; case 0xAA: value = 0xAA; break; ///////////////////////end motor control/////////////////// /*********************************************************/ //////////////////////camera control start//////////////// case 0xD2: value = 0xD2; break; case 0xD4: value = 0xD4; break; case 0xD6:
58
value = 0xD6; break; case 0xD8: value = 0xD8; break; /////////////////////end camera control//////////////////// } return value; } /**********************************************************/ //using the pin PORT D ******* D0, D1,--->RIGHT WHEEL CONTROL
// D4, D5,--->LEFT WHEEL CONTROL void rev(void) ///******PDOUT = 00010001 {
delay(0x07,0xA0);wait(); PDOUT = 0x11; delay(0x07,0xA0);wait(); PDOUT = 0x03;
} void stop(void)///******PDOUT = 00000000 { PDOUT = 0x00; } void fwrd(void)//******PDOUT = 00100010 { delay(0x07,0xD0);wait(); PDOUT = 0x22; delay(0x07,0xD0);wait(); PDOUT = 0x22; } void left(void)//********PDOUT = 00010010 {
stop(); PDOUT = 0x12; delay(0x07,0xA0);wait(); PDOUT = 0x12; stop();
} void right(void)//********PDOUT = 00100001 {
stop(); PDOUT = 0x21; delay(0x07,0xA0);wait(); PDOUT = 0x21; stop();
} /**********************************************************/
59
///////////camera control/////////////////////////// void cam_left(void) { delay(0x07,220); PAOUT=0x10; while (!(IRQ0 & 0x40)); IRQ0 &= ~0x40; PAOUT<<=1; while (!(IRQ0 & 0x40)); IRQ0 &= ~0x40; PAOUT<<=1; while (!(IRQ0 & 0x40)); IRQ0 &= ~0x40; PAOUT<<=1; while (!(IRQ0 & 0x40)); IRQ0 &= ~0x40; } void cam_right(void) { delay(0x07,220); PAOUT=0x80; while (!(IRQ0 & 0x40)); IRQ0 &= ~0x40; PAOUT>>=1; while (!(IRQ0 & 0x40)); IRQ0 &= ~0x40; PAOUT>>=1; while (!(IRQ0 & 0x40)); IRQ0 &= ~0x40; PAOUT>>=1; while (!(IRQ0 & 0x40)); IRQ0 &= ~0x40; } /////timer1///////////////////////////////////// ////2ms timer0****for servo motor//////////////// /////50% 0f PWM is ((0xA0)/2 or (160/2) base 10// //dont pass timer = 0 else it goes top by diffualt //<-------------------------------------------->// void timer_01(int strd) { PAAF = 0x02;
T0CTL &= ~0x80; T0CTL = (0x07 << 3) | 0x43; T0H = 0x00; T0L = 0x01; T0RH = 0x7F>>8; T0RL = 160&0xFF; T0PWMH = 0x7F>>8; T0PWML = strd&0xFF; IRQ0ENH &= ~0x20; IRQ0ENL &= ~0x20;
60
IRQ0 &= ~0x20; T0CTL |= 0x80;
} void cam_up(void) { if (strd<146) timer_01(strd = strd+2); else strd=144; while (!(IRQ0 & 0x20)); IRQ0 &= ~0x20; } void cam_down(void) { if (strd>20) timer_01(strd = strd-2); else strd=22; while (!(IRQ0 & 0x20)); IRQ0 &= ~0x20; } /***********************************************************/ //////////END OF THE PROGRAM/////////////////////////////////
61
APPENDIX D
Courtesy of e-gizmo Mechatronix central.
FIG A.12 TRANSMITTER AND RECEIVER MODULE
62
TABLE 3 LIST OF RECEIVER COMPONENTS
FIG.A.13 PCB LAYOUT FOR RECIEVER MODULE (Copper Bottom)
FIG.A.14 PCB LAYOUT FOR RECIEVER MODULE (Copper TOP)
63
TABLE 4 TRANSMITTER COMPONETS
FIG A.15 TRANSMITTER MODULE A transmitter and receiver circuit layout and diagram.