Post on 16-Nov-2014
CHAPTER 1
INTRODUCTION
1.1 Background Study
Unmanned Helicopter can be determined by the no onboard pilot and it’s
flown by autonomously based on pre-programmed flight plans. Nowadays,
unmanned helicopters are about to become easy to operate and affordable thanks to a
stabilization system developed at the entrepreneurial incubator program at the
Technion-Israel Institute of Technology in Haifa. In UAVs, not only is stability an
issue, but "all the controls are backwards," Kalisch explains. [1] "Right is left, left is
right. Backward is forward and vice versa". The system uses intelligent devices
which control the component such as standard accelerometers, gyroscopes to
maintain proper orientation, motor driver and so on.
Unmanned Helicopter is basically exist base from the conventional helicopter
where helicopter here it means an aircraft which is lifted and propelled by one or
more horizontal rotors each of two or more rotor blades. Helicopters are classified as
rotary-wing aircraft to distinguish them from fixed-wing aircraft. The word
'helicopter' derives from the Greek words helix (spiral) and pteron (wing). The
compensatory, aviational advantage is maneuverability where the helicopters can
hover, reverse, and take off and land vertically. [2] Flying subject only to availability
of re-fueling airport and load and altitude limitations and fly to anywhere and land
any place with enough landing space.
By referring to the previous helicopter usage, we can notice that it have
advantages and disadvantages in their many way. For an example in the military,
there are many type of helicopter is used in war such as attack helicopter, transport
helicopter, observation helicopter, utility helicopter and also maritime helicopter.
Each of helicopters has their own function in order to make sure that the actual
purpose is gained. But as it say before each of them have their own advantages and
disadvantages. There are a lot of people dies and injures at war.[1] So the unmanned
helicopter is design to overcome the problem in term of safety and avoid that
unwanted scenario from happen again and again. With adding some intelligence
technology in this product and it will become more efficient and safe to be used.
Other than that, there are several advantages where we can found in the
Unmanned Helicopter (UH) such as is that it flies by computer and the computer
reacts far faster than a human can. Piloted helicopters that exist today would have
difficulty in getting much above 12,500ft, less than half the height of Everest, and
conventional engine types would be struggling to fly and maintain power in the thin
air. There are many crashed helicopters in the Himalayas that attest to flight
difficulties using conventional rotorcraft. The helicopter’s sophisticated computers
react and fly the helicopter quicker than a pilot could react. [3]
1.2 Problem Statement
Base on the topic given, one of the very first problems helicopter designers
encountered when they tried to create a machine that could hover was the problem of
speed rotation motor. Newton's third law of motion requires that for every action
there is an equal and opposite action. A typical single main rotor helicopter has a
rotor system mounted on a rotor mast. But in this project, we will build the system
which has two different motor with different speed where it’s needed to be stabilize
at the different post of center-of-gravity (CG) according due to the center of
helicopter where so called tandem rotor where the arrangement as a tandem rotor is
mainly used with big helicopters. Because of the opposite rotation of the rotors, the
2
torque of each single rotor will be neutralized. The construction of the control system
is much more complicated, compared to a helicopter with a tail rotor.
The primary advantage of tandem rotor configuration is the ability to lift
heavy loads whose position relative to the helicopter's centre of gravity is less critical
than in the single rotor configuration. Because there is no anti-torque rotor, full
engine power can be applied to lifting the load. By combining the idea between the
Unmanned Helicopter (UH) with the tandem rotor configuration, we can barely have
a batter solution for the nowadays problem in terms to the safety, facilities and
overcome some previous invention yet still dealing with the interface intelligent
which is controlled the devise. [4]
Figure 1.1 Tandem Rotor Helicopter
By focusing on the counteracting rotor torque reaction, the main idea of a tail
rotor to counter torque reaction and provide directional control was not used on most
early designs. Most early machines were built with either coaxial or laterally side-by-
side rotor configurations. Yet, building and controlling two rotors was even more
difficult that for one rotor. Igor Sikorsky was the first to successfully use the tail
rotor in the single rotor helicopter configuration we know today.
So the major problem in this project is how we want to stabilize the speed
rotation of both motors so they can hover statically and after done some researches
and a discussion with the instructor we finally decide to use speed sensor together
3
with the PIC Microcontroller to stabilize the speed rotation of both motor. In
addition, we use height sensor to make sure the unmanned helicopter will hover at
the controlled height.
1.3 Objective
The objective of this project is to:
(i) Design and program an unmanned helicopter.
(ii) Use a microcontroller system by using PIC microcontroller in order to
stabilize the speed of both rotors.
1.4 Scope of Project
This project will design a hovering system for tandem rotor Unmanned
Helicopter (UH). In develop this project the scope to be considered are:
(i) Design and developed circuit for control of Unmanned Helicopter.
(ii) The hovering range of the Unmanned Helicopter is limited to 3 meter.
(iii) The UH will remain hovering for 10 seconds and then will go down to
the ground.
4
CHAPTER 2
LITERATURE REVIEW
2.1 An Overview
A hovering system is a design system that make thing fly at the space.
Devices that can hover in air or water are needed for many military and commercial
applications. Vertical axis propeller systems can normally provide the thrust required
supporting the weight of the device, but many previous designs have proved to be
naturally unstable, and have had to be stabilized by active stability systems. These
usually incorporate motion sensors, such as accelerometers, gyroscopic sensors,
complex electronic processing networks, and mechanical actuators to provide the
action to create the necessary stabilizing moments. [2]
A helicopter is an aircraft which is lifted and propelled by one or more
horizontal rotors each of two or more rotor blades. Helicopters are classified as
rotary-wing aircraft to distinguish them from fixed-wing aircraft. The word
'helicopter' derives from the Greek words helix (spiral) and pteron (wing). The
compensatory, aviational advantage is maneuverability where the helicopters can
hover, reverse, and take off and land vertically. Flying subject only to availability of
re-fueling airport and load and altitude limitations and fly to anywhere and land any
place with enough landing space. [5]
Unmanned Helicopter can be determined by an aircraft with no onboard pilot.
UAVs can be remote controlled aircraft (e.g. flown by a pilot at a ground control
station) or can fly autonomously based on pre-programmed flight plans or more
complex autonomous flight systems and nowadays, unmanned helicopters are about
5
to become easy to operate and affordable thanks to a stabilization system developed
at the entrepreneurial incubator program at the Technion-Israel Institute of
Technology in Haifa. In UAVs, not only is stability an issue, but "all the controls are
backwards," Kalisch explains. "Right is left, left is right. Backward is forward and
vice versa". The system uses intelligent devices which control the component such as
standard accelerometers, gyroscopes to maintain proper orientation, motor driver and
so on. [1]
2.2 Tandem Rotor Helicopters
Tandem rotor helicopters operate a little differently than do the single rotor
variety. In a tandem rotor helicopter, you have no tail rotor, so there is no translating
tendency to deal with, but you still have pedals for directional control at a hover.
Your cyclic control, which is used as it always has been in single rotor helicopters,
has not changed either. The only thing different in terminology for tandem rotor
aircraft is the term "Thrust control", which is used to describe the collective pitch
control lever. It is used in the same way as any other collective, but the tandem guys
use the term thrust control.
Figure 2.1 Tandem rotor helicopters
6
Tandem rotor helicopters operate in forward flight by using "Differential
Collective Pitch" or "DCP". DCP is basically just increasing more pitch in one rotor
system then the other to make the aircrafts attitude change. By increasing the pitch in
the aft system more than the forward system, the aircraft will tilt nose low, and
accelerate forward. To climb without changing airspeed, more pitch is placed in both
systems simultaneously. It is really a matter of aircraft attitude more than anything
else. If the aircraft is in a nose high attitude, it will climb and bleed off airspeed. If it
is too nose low, it will dive and increase airspeed. The amount of pitch put in each
rotor system will dictate airspeed and altitude. The pilot will fly the aircraft just like
any other, but the rotor systems will act in a way peculiar to tandem helicopter flight.
The picture here is of a tandem helicopter in level hovering flight. Notice both rotor
systems are depicted as level. The actual blades will "Cone" a bit. What this means is
they will bend upwards to the tip. The more the weight on the aircraft, the more the
blades will cone.
2.3 PIC Microcontroller Implementation
Regarding this project, several reviews were made. One of the researches
made is about the brain of the tandem rotor Unmanned Helicopter (UH) which is PIC
microcontroller. In 1989, Microchip Technology Corporation introduced an 8-bit
microcontroller called the PIC, which stands for Peripheral Interface Controller. This
microcontroller had small amounts of data RAM, a few hundred bytes of on-chip
ROM for the program, one timer, and a few pins for I/O ports, all on a single chip
with only 8 pins. [17] Microcontroller is general purpose microprocessor which has
additional parts that allow them to control external devices. Basically, a
microcontroller executes a user program which is loaded in its program memory. [6]
The reason for using microcontroller is general purpose microprocessor
which has additional parts that allow them to control external devices. Basically, a
microcontroller executes a user program which is loaded in its program memory.
7
Figure 2.2 PIC microcontrollers in DIP and QFN packages
Instead of using the microcontroller, PIC type of microcontroller architecture
is distinctively minimalist. PIC microcontroller is the name for the microchip
microcontroller (MCU) family, consisting of a microprocessor, I/O ports, timer (s)
and other internal, integrated hardware. [6] It is characterized by the following
features:
(i) Separate code and data spaces.
(ii) A small number of fixed length instructions.
(iii) Most instructions are single cycle execution (4 clock cycles), with
single delay cycles upon branches and skips.
(iv) A single accumulator (W), the use of which (as source operand) is
implied
(v) All RAM locations function as registers as both source and/or
destination of math and other functions.
(vi) A hardware stack for storing return addresses.
(vii) A fairly small amount of addressable data space (typically 256 bytes),
extended through banking.
(viii) Data space mapped CPU, port, and peripheral registers.
(ix) The program counter is also mapped into the data space and writable
(this is used to synthesize 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. PIC
microcontrollers have a very small set of instructions (only 35 instruction), leading
8
some to consider them as RISC devices, however many salient features of RISC
CPU's are not reflected in the PIC architecture. For examples:
(i) It does not have load-store architecture, as memory is directly
referenced in arithmetic and logic operations.
(ii) It has a singleton working register, whereas most modern
architectures have significantly more.
PICs have a set of register files 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 (ie. the
baseline and mid-range cores), any register move had to be through the accumulator.
[7]
All PICs feature Harvard 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. [7]
The word size of PICs can be a source of confusion. All PICs (except dsPICs
and PIC24s) 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 not
generally the same as the data space. For example, PICs in the baseline and mid-
range families have program memory addressable in the same word size as the
instruction width, example like 12 or 14 bits respectively. In contrast, in the PIC18
series, the program memory is addressed in 8-bit (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. [7]
9
The PICs architecture has no (or very meager) hardware support for saving
processor state when servicing interrupts. The 18 series improved this situation by
implementing shadow registers which save several important registers during an
interrupt. The PICs architecture may be criticized on a few important points:
(i) The few instructions, limited addressing modes, code obfuscations
due to the "skip" instruction and accumulator register passing makes it
difficult to program in assembly language, and resulting code difficult
to comprehend. This drawback has been alleviated by the increasing
availability of high level language compilers.
(ii) Data stored in program memory is space inefficient and/or time
consuming to access, as it is not directly addressable.
2.4 Feedback Control System
A basic closed-loop control system is shown in Figure 2.3. This figure can
describe a variety of control systems, including those driving elevators, thermostats,
and cruise control. Closed-loop control systems typically operate at a fixed
frequency. The frequency of changes to the drive signal is usually the same as the
sampling rate, and certainly not any faster. After reading each new sample from the
sensor, the software reacts to the plant's changed state by recalculating and adjusting
the drive signal. The plant responds to this change, another sample is taken, and the
cycle repeats. Eventually, the plant should reach the desired state and the software
will cease making changes. [8]
Figure 2.3 A closed-loop control system
10
A standard definition of a feedback control system is a control system which
tends to maintain a prescribed relationship of one system variable to another by
comparing functions of these variables and using the difference as a means of
control. A feedback control system often uses a function of a prescribed relationship
between the output and reference input to control the process. Often, the difference
between the output of the process under control and the reference input is amplified
and used to control the process so that the difference is continually reduced. The
feedback concept has been the foundation for control system analysis and design. [9]
Figure 2.4 Close loop (feedback) control block diagram
Feedback is information in a closed-loop control system about the
condition of a process variable. This variable is compared with a desired condition
to produce the proper control action on the process. Information is continually "fed
back" to the control circuit in response to control action. [10]
One of the most important characteristics of control systems is their transient
response, which often must be adjusted until it is satisfactory. If an open-loop control
system does not provide a satisfactory response, then the process must be replaced or
modified. By contrast, a closed-loop system can often be adjusted to yield the desired
response by adjusting the feedback loop parameters. A second important effect of
feedback in a control system is the control and partial elimination of the effect of
disturbance signals. Many control systems are subject to extraneous disturbance
signals which cause the system to provide an inaccurate output. Feedback systems
have the beneficial aspect that the effect of distortion, noise, and unwanted
disturbances can be effectively reduced.
11
The transient response of a feedback control system is of primary interest and
must be investigated. A very important characteristic of the transient performance of
a system is the stability of the system. A stable system is defined as a system with a
bounded system response. That is, if the system is subjected to a bounded input or
disturbance and the response is bounded in magnitude, the system is said to be stable.
[10]
The concept of stability can be illustrated by considering a right circular cone
placed on a plane horizontal surface. If the cone is resting on its base and is tipped
slightly, it returns to its original equilibrium position. This position and response is
said to be stable. If the cone rests on its side and is displaced slightly, it rolls with no
tendency to leave the position on its side. This position is designated as neutral
stability. On the other hand, if the cone is placed on its tip and released, it falls onto
its side. This position is said to be unstable.
In redesigning a control system in order to alter the system response, an
additional component or device is inserted within the structure of the feedback
system to equalize or compensate for the performance deficiency. The compensating
device may be an electric, mechanical, hydraulic, pneumatic, or other-type device or
network, and is often called a compensator.
2.5 Pulse Width Modulation (PWM)
Pulse-width modulation (PWM) is a device that may be used as an efficient
light dimmer or DC motor speed controller. Pulse-width modulation control works
by switching the power supplied to the motor on and off. The DC voltage is
converted to a square-wave signal, alternating between fully on and zero. If the
switching frequency is high enough, the motor run at the steady speed. [11] By
controlling analog circuits digitally, system costs and power consumption can be
drastically reduced. In nowadays implementation, many microcontrollers and DSPs
already include on-chip PWM controllers, making implementation easy. In a
nutshell, PWM is a way of digitally encoding analog signal levels.
12
Through the use of high-resolution counters, the duty cycle of a square wave
is modulated to encode a specific analog signal level. The PWM signal is still digital
because, at any given instant of time, the full DC supply is either fully on or fully off.
The voltage or current source is supplied to the analog load by means of a repeating
series of on and off pulses. The on-time is the time during which the DC supply is
applied to the load, and the off-time is the periods during which that supply is
switched off. Given a sufficient bandwidth, any analog value can be encoded with
PWM.
Pulse-width modulation uses a square wave whose duty cycle is modulated
resulting in the variation of the average value of the waveform. If we consider a
square waveform f (t) with a low value ymin, a high value ymax and a duty cycle D (see
Figure 2.5), the average value of the waveform is given by:
(2.1)
As f (t) is a square wave, its value is ymax for and ymin for
. The above expression then becomes:
(2.2)
This latter expression can be fairly simplified in many cases where ymin = 0 as
. From this, it is obvious that the average value of the signal ( ) is
directly dependent on the duty cycle D.
13
Figure 2.5 A square wave, showing the definitions of ymin, ymax and D
Figure 2.6 shows three different PWM signals. Figure 2.6 (a) shows a PWM
output at a 10% duty cycle. That is, the signal is on for 10% of the period and off the
other 90% while Figures 2.6 (b) and Figure 2.6 (c) show PWM outputs at 50% and
90% duty cycles, respectively. These three PWM outputs encode three different
analog signal values, at 10%, 50%, and 90% of the full strength. If, for example, the
supply is 9V and the duty cycle is 10%, a 0.9V analog signal results.
Figure 2.6 PWM signals of varying duty cycles
Figure 2.7 shows a simple circuit that could be driven using PWM. In that
figure, a 9 V battery powers an incandescent light bulb. If we closed the switch
connecting the battery and lamp for 50 ms, the bulb would receive 9 V during that
interval. If we then opened the switch for the next 50 ms, the bulb would receive 0 V.
If we repeat this cycle 10 times a second, the bulb will be lit as though it were
connected to a 4.5 V battery (50% of 9 V). We say that the duty cycle is 50% and the
modulating frequency is 10 Hz. [12]
14
Figure 2.7 A simple PWM circuit
Most loads, inductive and capacitative alike, require a much higher
modulating frequency than 10 Hz. Imagine that our lamp was switched on for five
seconds, then off for five seconds, then on again. The duty cycle would still be 50%,
but the bulb would appear brightly lit for the first five seconds and off for the next. In
order for the bulb to see a voltage of 4.5 volts, the cycle period must be short relative
to the load's response time to a change in the switch state. To achieve the desired
effect of a dimmer (but always lit) lamp, it is necessary to increase the modulating
frequency. The same is true in other applications of PWM. Common modulating
frequencies range from 1 kHz to 200 kHz. [12]
Many microcontrollers include on-chip PWM units. For example,
Microchip's PIC16C67 includes two, each of which has a selectable on-time and
period. The duty cycle is the ratio of the on-time to the period; the modulating
frequency is the inverse of the period. To start PWM operation, the data sheet
suggests the software should:
(i) Set the period in the on-chip timer/counter that provides the
modulating square wave.
(ii) Set the on-time in the PWM control register.
(iii) Set the direction of the PWM output, which is one of the general-
purpose I/O pins.
(iv) Start the timer.
(v) Enable the PWM controller.
Although specific PWM controllers do vary in their programmatic details, the
basic idea is generally the same. One of the advantages of PWM is that the signal
remains digital all the way from the processor to the controlled system; no digital-to-
analog conversion is necessary. By keeping the signal digital, noise effects are
15
minimized. Noise can only affect a digital signal if it is strong enough to change a
logic-1 to a logic-0, or vice versa. [11]
2.6 Dc Motor
At the most basic level, electric motors exist to convert electrical energy into
mechanical energy. This is done by way of two interacting magnetic fields - one
stationary, and another attached to a part that can move. A number of types of
electric motors exist, but most BEAM bots use DC motors in some form or another.
DC motors have the potential for very high torque capabilities (although this is
generally a function of the physical size of the motor), are easy to miniaturize, and
can be "throttled" via adjusting their supply voltage. DC motors are also not only the
simplest, but the oldest electric motors. [18]
Figure 2.8 The DC Motor
The basic principles of electromagnetic induction were discovered in the
early 1800's by Oersted, Gauss, and Faraday. By 1820, Hans Christian Oersted and
Andre Marie Ampere had discovered that an electric current produces a magnetic
field. The next 15 years saw a flurry of cross-Atlantic experimentation and
innovation, leading finally to a simple DC rotary motor. A number of men were
involved in the work, so proper credit for the first DC motor is really a function of
just how broadly you choose to define the word "motor".
16
In any electric motor, operation is based on simple electromagnetism. A
current-carrying conductor generates a magnetic field; when this is then placed in an
external magnetic field, it will experience a force proportional to the current in the
conductor, and to the strength of the external magnetic field. As you are well aware
of from playing with magnets as a kid, opposite (North and South) polarities attract,
while like polarities (North and North, South and South) repel. The internal
configuration of a DC motor is designed to harness the magnetic interaction between
a current-carrying conductor and an external magnetic field to generate rotational
motion. [18]
Figure 2.9 The sketch of DC Motor
A DC motor works by converting electric power into mechanical work. This
is accomplished by forcing current through a coil and producing a magnetic field that
spins the motor. The simplest DC motor is a single coil apparatus, used here to
discuss the DC motor theory. The process can be explained in further detail by
observing the diagram below.
The voltage source forces voltage through the coil via sliding contacts or
brushes that are connected to the DC source. These brushes are found on the end of
the coil wires and make a temporary electrical connection with the voltage source. In
this motor, the brushes will make a connection every 180 degrees and current will
then flow through the coil wires. At 0 degrees, the brushes are in contact with the
voltage source and current is flowing. The current that flows through wire segment
C-D interacts with the magnetic field that is present and the result is an upward force
on the segment. The current that flows through segment A-B has the same
17
interaction, but the force is in the downward direction. Both forces are of equal
magnitude, but in opposing directions since the direction of current flow in the
segments are reversed with respect to the magnetic field. At 180 degrees, the same
phenomenon occurs, but segment A-B is forced up and C-D is forced down. At 90
and 270-degrees, the brushes are not in contact with the voltage source and no force
is produced. In these two positions, the rotational kinetic energy of the motor keeps it
spinning until the brushes regain contact.
Figure 2.10 The parts of DC Motor
18
CHAPTER 3
METHODOLOGY
3.1 An Overview of Project Procedure
The methodology explains about the flowing chart in how to develop a
hovering system for a tandem rotor UH where the block diagram will show about the
controller operational of the hovering system.
Figure 3.1 Project procedure
19
Figure 3.1 shows the step of finishing this project. While doing the research
and literature review for this project, the important and relevant information can be
obtained by surfing internet, browsing books and also with the guidance from
supervisor in charge. Basically, the project will start with collecting the information
from internet or others references. With finding the literature review while gathering
more knowledge about the system is al about. Then do the designing circuit together
with the fabrication terms. After that, it goes on to testifying the project and if there
are no other problems occur we can proceed with the report writing.
Within this project, there are two important aspects to be implemented in
order to make sure this project success, theoretical aspect and practical aspect. The
theoretical part gives scientific knowledge as regards electronic-device model and
design-analysis technique. The practical part allows the student to gain more
understanding of the theoretical concept with develop a hardware.
Figure 3.2 Block diagram of Hovering System
In the block diagram in Figure 3.2, the flow of the operational operation for
hovering system will be determined. This system has been divided into three parts
which are input, output and the feedback part.
3.2 Working Environment
20
A hovering system for tandem rotor UH needs a minimum space of 1.5 meter
high and 1.5 meter wide and with no obstacles at the surrounding area. The most
important is the safe from the any electrical devices to prevent from the short circuit
from happen. Besides that, we use the room for the demo. Although there is no
worried about the weather condition unless we need to perform outside the room the
velocity of the wind must be considered because of that will effect the balanced of
the speed for the propeller of the tandem rotor UH.
3.3 Review of Previous Design
It is important to have a review on the past designs so that study can be done
on advantages and disadvantages of the designs and its shortcomings can be
improved. This will prevent the repetition of the same design process, and further
modifications can be made in order to make the new design become more effective
and interactive.
Table 3.1 Main Parts with the specification
Parts Specification
PIC Microcontroller PIC18F4550
Speed Sensor RE08A
DC Motor Driver Cytron MD30A
3.4 Design Characteristics
21
The design characteristic or features are based on rules and regulation that we
had been agreed before. Therefore, best design is necessary to optimize the system of
the hovering system for tandem rotor UH. Some of the designs criteria are show as
follow:
(i) PIC Microcontroller – PIC18F4550
In this system, PIC18F4550 type of microcontroller is use to control
the operation. The control circuit will determine the speed and the
direction of the motor. One of the received signals received from user
inputs will be a control reference. It will be fed into the PWM circuit
to generate an appropriate duty ratio. The control circuit also will
receive a direction/stop command from the user inputs. It will be fed
into the DC motor driver circuit in order to allow the motor to run or
stop.
(ii) 30A Motor Driver – Cytron MD30A
The 30A Motor Driver circuit will enable the motor to choose the
direction that it is supposing to be running and also to come to a
complete stop if that is what the user instructed. This circuit will
receive PWM signals as a input from the control circuit for the user
defined action. Cytron MD30A is designed to drive high current brush
motor or application. It is a full bridge motor driver intended for wide
range of robotics and automotive applications. The board incorporates
most of the components of the typical applications. With minimum
interface, the board is ready to be plugged and play. It even includes
two push buttons for fast test run. Simply add in power, this driver is
ready to drive high current motor.
22
(iii) DC Motor – 12V DC Motor
A 12V brushless dc motor had been used for this system. When the
coil is powered, a magnetic field is generated around the armature.
The left side of the armature is pushed away from the left magnet and
drawn toward the right, causing rotation. The armature continues to
rotate. When the armature becomes horizontally aligned, the
commutate reverses the direction of current through the coil, reversing
the magnetic field and the process then repeats.
(iv) Speed Sensor – RE08A
RE08A is a rotary encoder kit which comes with a slotted disc (8
slots) and a simple interface sensor board. This speed sensor is used to
measure the speed value of both motor and give the feedback to the
microcontroller in order to stabilize both speed values to the same
amount to get the stable hovering.
(v) Rechargeable Battery – LIP-11.1-2000
11.1 V LiPo Rechargeable Battery is a voltage supply to the whole
circuits. It’s provided the 2200mAh and it a high-polymer type of
battery and compare to others it’s come with the solid size and weight.
(vi) Voltage Regulator – L7805
This voltage regulator is regulated the voltage supply to the maximum
of output voltage 5.2V to provide to the sensitive integrate circuit
such as PIC18F4550 in order to make sure that devices is functioning.
23
3.5 Design System
In this design, two systems have been generated for future analysis where
there are programming system for PIC18F4550 Microcontroller and another one is
feedback or closed-loop system for the stabilizing both rotor for tandem rotor UH
where we use speed sensor as a feedback item. Both of the systems need to be
synchronized in order to make an effective hovering design.
3.5.1 PIC18F4550 Microcontroller Structure
To design a speed controller must be using a microcontroller as a brain to that
design. Microcontroller that we used is PIC18F4550. This type of devices offers the
advantages of all PIC18 microcontrollers where they are namely, high computational
performance at an economical price with the addition of high endurance, Enhanced
Flash program memory. In addition to this feature, the PIC18F4550 family
introduces design enhancements that make these microcontrollers a logical choice for
many high-performances, power sensitive applications.
Figure 3.3 Pin diagram of PIC18F4550
24
Other than that, PIC18F4550 have the other feature which a Phase Lock Loop
(PLL) frequency multiplier. It’s available to both the high-speed crystal and external
oscillator modes, which allows a wide range of clock speeds from 4 MHz to 48 MHz.
because of we need to make sure that the speed of rotor is high enough to flied the
UH so the very high frequency is needed for that.
Figure 3.4 Crystal or ceramic resonator operation (HT, HS or HSPLL
configuration)
By referring to Figure 3.4, in HS, HSPLL, XT and XTPLL Oscillator modes,
a crystal or ceramic resonator is connected to the OSC1 and OSC2 pins to establish
oscillation. It shows the pin connections. The oscillator design requires the use of a
parallel cut crystal.
Figure 3.5 PLL block diagram (HS mode)
25
In this project, crystal value of 8.0 MHz is used. Base to the table 2.2 at
Appendix A, it shows that the crystal frequency for 4 MHz, 8 MHz and 20 MHz are
on HS type. Figure 3.5 explain the internal circuit built in the PIC Microcontroller
about PLL for HS mode. The HSPLL, ECPLL and ECPIO modes make use of the
HS mode oscillator for frequencies up to 48 MHz. The prescaler divides the
oscillator input by up to 12 to produce the 4 MHz drive for the PLL. The XTPLL
mode can only use an input frequency if 4 MHz is used which is drives the PLL
directly.
1
PIC18 F4550
8 M H z
C R Y S TA L
14
3132
1211
5 VV C C
13
Figure 3.6 Basic schematic diagram for PIC18F4550
26
3.5.2 PIC18F4550 Microcontroller Programming
This program is used to generate the basic or the original frequency that
used for speed controller design, which also know as carrier frequency. In the other
hands, with this programming the feedback system of the tandem rotor UH is
functioning. The basic programming description for the PIC18F4550 Microcontroller
is used to control the speed rotation for the both rotor. So, if the speed sensors detect
the different value in both rotors then it will give feedback to the microcontroller to
make it stable again. In order to make the speed stable, the duty cycles in PWM is
used as a preference to adjust it.
Figure 3.7 Speed controller block diagram
The programming of the feedback system is referred to the speed
controller block diagram in Figure 3.7. When the speed sensor detect the different
value from both rotors it will give feedback to the microcontroller and the
microcontroller will analyzed the data and give the new output through CCP 1 and
CCP2 direct to the motor driver through to both DC motor.
27
Figure 3.8: Speed controller flow chart
Figure 3.8 Speed controller flow chart
To become more understand about the flow for PIC18F4550
programming, refer to the Figure 3.8. The first, the system will be set to the 65% of
duty cycles for both HPWM and process will continue by determining the speed for
speed at rotor 1 and speed at rotor 2 after that, the microcontroller will analyzed the
data weather speed at rotor 1 is equal with the speed at rotor 2 or not. If not, the
analyzed will continue in order to defined which one of the speed needed to be
increase or decrease by increasing or decreasing the duty cycle of the HPWM. The
full project programming can be seen in Appendix B.
28
3.5.3 Software Development
In order to interface the hardware with the electronic equipment, Melabs
EPICTM Programmer software is required. This programmer is a software program
that runs on a PC to develop applications for Microchip microcontrollers. Before
that we need to change the type of document by compiling it with the MicroCode
Studio. Below are the steps on how to develop the project using this software:
(i) Open the MicroCode Studio program
(ii) Compile the program
Figure 3.9 Programming of the system
Figure 3.9 shows the programming of the system after the
compilation is done. Before we do the compilation, we must save the
document and then we compile. The documentation type will change
to the .HEX after the compiling.
29
(iii) Open the Melabs EPICTM Programmer
Figure 3.10 Select for PIC18F4550
Open Melabs EPICTM Programmer then select for PIC18F4550
as shown as Figure 3.10. The melabs EPIC™ Programmer connects to
a PC compatible parallel printer port. The melabs Serial Programmer
connects to a PC compatible serial port. The melabs USB Programmer
and melabs U2 Programmer connect to a PC USB port or powered
USB hub. Each programmer may be controlled by the melabs
Programmer software.
(iv) Open melabs configuration
Figure 3.11 Setup for PLL
After the selection of the PIC type Figure 3.11 show the step
to setup the melabs configuration for PLL application. Seen the 8
MHz crystal is used and the HS mode oscillator for frequencies is up
to 48 MHz, the configuration must be fill correctly.
30
(v) Open the compile programming
Figure 3.12 Programming selected
Figure 3.12 show the step for selecting the programming that
had been saving in .HEX type documentation. This were done after
the deleting the entire previous program in the PIC.
(vi) Verify the Program
Figure 3.13 Verifying the program
Figure 3.13 shows the complete of verifying program and the
PIC18F4550 is ready to be used.
31
3.5.4 DC Motor Driver Structure
MD30A is designed to drive high current brush motor or application. It is a
full bridge motor driver intended for wide range of robotics and automotive
applications. The board incorporates most of the components of the typical
applications. With minimum interface, the board is ready to be plugged and play. It
even includes two push buttons for fast test run. Simply add in power, this driver is
ready to drive high current motor. It has been designed with capabilities and features
for:
(i) Support up to 30A maximum.
(ii) 5V logic level compatible inputs.
(iii) 5V to 12V compatible for Vcc.
(iv) PWM speed control up to 10 KHz.
(iv) Bi-directional control for 1 motor.
Figure 3.14 Connection to microcontroller and DC motor
The connection of the DC motor driver shows in Figure 3.14 above. For this
project, two DC motor drivers were use seen there are two rotors in this system that
need to be stabilized. It’s used to give the input to the motors. The output from this
DC motor driver is the pulse digital. So, it will act like switching in order to make the
rotor run discontinuously. Therefore, it can prevent the rotors running directly
because if that happen the load burden will increase and the rotors can get hot
speedily. See Appendix C for more information.
32
3.5.5 Speed Sensor Structure
RE08A is a rotary encoder kit which comes with a slotted disc (8 slots) and a
simple interface sensor board. Rotary encoder is a sensor or transducer used to
convert the data of rotary motion into a series of electrical pulses which is readable
by controller. The slotted disc has a 35mm outside diameter with 8 slots that provides
16 transitions. The optical sensor is used to sense the 16 transitions of the slotted
disc. With these transitions, controller is able to recognize the rotary angle of the
disc. With this concept, a rotary encoder can be employed in a DC motor shaft for
the controller to ‘know’ its current position.
Figure 3.15 Connection to microcontroller
By referring to the Figure 3.15 the circuit is simply connect such us the “+5”
and “Gnd” to 5V supply, further connect the “Sig” pin to microcontroller input pin.
Normally, the “Sig” will be connected to Counter/Clock/Encoder input for automatic
counting purpose. Output the speed sensor is in pulse form. For the slot disc
installation, in order to get the rotation output from rotating shaft, the slotted disc
must be placed within the space between optical sensors as shown in Figure 3.16
below.
33
Figure 3.16 Speed sensor and 8 slots disc installation
By follow the installation guide and configure microcontroller to count the
pulses generated when the shaft rotates. Please refer Appendix D for more
information.
3.5.6 Height Sensor Structure
The Honeywell HMC1051 family of magnetoresistive sensors is Wheatstone
bridge devices to measure magnetic fields. They are extremely sensitive, low field,
solid-state magnetic sensors designed to measure direction and magnitude of Earth’s
magnetic fields, from 120 micro-gauss to 6 gauss.
Figure 3.17 Height Sensor (HMC1051)
With power supply applied to a bridge, the sensor converts any incident
magnetic field in the sensitive direction to a differential voltage output. In addition to
34
the bridge circuit, the sensor has two on-chip magnetically coupled straps; the offset
strap and the set/reset strap. These straps are Honeywell patented features for
incident field adjustment and magnetic domain alignment; and eliminate the need for
external coils positioned around the sensors. Please refer Appendix E for more
information.
Figure 3.18 Pin Configuration of HMC1051
Honeywell HMC1051 has been designed with capabilities and features for:
(i) Miniature Surface-Mount Packages.
(ii) Low Voltage Operations (1.8V).
(iii) Low Cost.
(iv) 4-Element Wheatstone Bridge.
(v) Wide Magnetic Field Range (+/- 6 Oe).
35
Figure 3.19 Package Drawing of HMC1051
CHAPTER 4
RESULT AND DISCUSSIONS
36
4.1 PIC18F4550 Microcontroller Programming Analysis
For the PIC18F4550 programming, the PicBasic Pro Compiler (or PBP) it used. It
makes the programming even quicker and easier to program Microchip Technology’s
powerful PICmicro microcontrollers (MCUs). The English-like BASIC language is
much easier to read and write than the quirky Microchip assembly language. PBP has
over 80 commands. Some commands are similar to the PicBasic commands with
minor changes. Decisions were made that we hope improve the language overall.
4.1.1 PicBasic Pro Commands
COUNT command, “COUNT Pin, Period, Var”. This command is used to
count the number of pulses that occur on Pin during the Period and stores the result
in Var. Pin can take values 0 to 15 but the “Portname.number” format is
recommended (e.g. PORTB.0). The highest frequency that can be counted with
4MHz crystal clock is 25 kHz and 125 kHz when a 20 MHz clock is used.
HPWM command, “HPWM Channel, Dutycycle, Frequency”. Some PIC
microcontrollers have one or more built-in circuits to generate pulse width-
modulated square-wave signals (PWM). For example, PIC 16F877 has two PWM
Channels. Channel 1 is known as CCP1 (also PORTC.2) and Channel 2 is known as
CCP2 (also PORTC.1). Dutycycle can vary from 0 to 255 which corresponds to 0%
(low all the time) to 100% (high all the time), respectively. A value of 127 gives 50%
duty cycle. The highest Frequency is 32,767 Hz, and on microcontrollers with two
channels, the Frequency must be the same on both channels. The PWM signal output
from the specified pin continuously in the background while the program executes
other instructions.
IF..THEN..ELSE command, these commands are similar to the PicBasic IF..THEN
command but the PicBasic Pro language provides more flexibility when one or more
comparisons are made. These commands can be used in the following format:
Format 1:
37
IF Comparison [AND/OR Comparison…] THEN Label
Format 2:
IF Comparison [AND/OR Comparison…] THEN Statement….
Format 3:
IF Comparison [AND/OR Comparison…] THEN
Statement….
ELSE
Statement…
ENDIF
Figure 4.1 Output when duty cycle is 50% at CCP1 and CCP2
Figure 4.1 shows the output waveform at CCP1 and CCP2 in 50% of duty
cycles. Channel one is represent of CCP1 and Channel 2 is represent of CCP2.
4.1.2 Calculations
Using the results from the oscilloscope, the value of RPM can be calculated.
38
(4
.1)
(4.2)
From that calculation, the RPM value of 10% till 100% can be calculated and
had been list in the Table 4.1 and Table 4.2 below. When the speed sensor detect the
different value at the rotor, it will give feedback to the PIC18F4550 microcontroller
and the microcontroller will analyzed the data an make the duty cycle of both rotor
changes. This process continued until they get the same value of data. The process
can be fully understood by referring to the flow chart in Figure 3.8.
Table 4.1 RPM calculation value for speed at rotor 1
DUTY CYCLE PRM
0% 0
10% 741
20% 1482
30% 2223
40% 2964
50% 3705
60% 4446
70% 5187
39
80% 5928
90% 6669
100% 7411
Table 4.2 RPM calculation value for speed at rotor 2
DUTY CYCLE PRM
0% 0
10% 698
20% 1327
30% 2565
40% 3012
50% 3705
60% 4900
70% 5025
80% 6124
90% 6578
100% 7501
4.2 Circuitry Development Analysis
During the project, the most problematic part is when done the DC motor
driver circuit. It’s because of the heating problem that needs to be face. Before the
CYTRON MD30A is used there is other type of DC motor driver that already used.
40
Figure 4.2 Circuit of Hovering System for Tandem Rotor UH
4.2.1 DMOS Full Bridge Driver
While using the DMOS full bridge driver, both DC motors still can run but
it’s because without the load. The integrated circuit will get slowly hot and by adding
the propeller the integrated circuit become hot faster. Therefore this driver cannot
perform indepently. The device can be combined with a current regulator like the
L6506 to implement a transconductance amplifier for speed control .For more
information see Appendix E.
The I.C. is a full bridge driver for a motor control applications realized in
Multipower-BCD technology which combines isolated DMOS power transistors with
DMOS and Bipolar circuits on the same chip. Since the I.C. integrates full H-Bridge
in a single package it is ideally suited for DC motors.
41
Figure 4.3 Circuit of DMOS Full Bridge Driver
4.3 Final Result
The final result of this project is that the programming for the hovering
system for tandem rotor UH is functioning. It can be prove by the LED indicator in
the circuit. If the red LED is emitted then it shows that the speed at rotor 1 is higher
then the speed at rotor 2. When the yellow LED is emitted, its shows that the speed at
rotor 2 becomes much higher then speed at rotor 1. But when both rotors have a same
speed then the green LED will be emitting. However the unmanned helicopter still
cannot hover properly like the expected result before. Based on troubleshooting
process it found that there are few parts that make the hovering system for tandem
rotor UH hover stably is fail, there are:
(i) The type of DC motor driver.
Base on this part, the most chance that make the hovering
system fail is when the motor did not get the exact value of voltage
and current to run it. Other consideration is even the rotor cam still
run at no load there is no guarantee that they also can run with load.
By changing the push-pull four channel and MOSPEC TIP35 motor
driver this problem is successfully overcome.
42
(ii) Weight of the unmanned helicopter.
By looking at the model of unmanned helicopter itself, the
weight is also play the important rule. After finished the unmanned
helicopter prototype and done all the connection with the main circuit
nad motor, the overall weight is 830 gram. The component selecting
must be relevant to the system and they must have a light weight in
order to make the load of UH is reduces. Beside that, the usage of
tandem helicopter itself is very helpful in order to solve this problem.
Because one of the advantages of tandem rotor is they can stand more
weight then other type of rotor system.
(iii) Mechanical design.
The one part that cannot be recovered in this project is the
mechanical part of the prototype of UH. It must be considered about
the length, the size of component that has been used. After do the
troubleshooting the base where one side the rotor and the propeller
have been installed is not tough enough. That problem cause the
unmanned helicopter cannot lift properly and that part is also shaking
so the propeller condition is not in the stable and cannot hover.
Figure 4.4 Hovering System for tandem rotor UH
43
CHAPTER 5
CONCLUSION AND RECOMMENDATIONS
5.1 Conclusion
This project provides an automatic operation of stabilizing speed of two
rotors using the PIC18F4550 microcontroller program. In this project, there are two
important systems that must be developed. The first is the tandem rotor system where
the rotors must be rotate in the opposite direction in order to canceling each other
torque. So we must design the circuit that can make the rotors rotate oppositely. The
other system is the PIC18F4550 microcontroller system. The PIC need to be install
with the correct programming to make sure the system function exactly like we need.
The failure of the programming program will make the feedback system of tandem
rotor UH cannot be running. The usage of appropriate sensors is also important to
make sure the process runs smoothly. The more accurate the input signal goes into
the PIC microcontroller, the more efficient the operation will be. Wire tagging is also
important while doing this project. Each wire must be connected correctly since there
are a lot of wires used in this PIC18F4550 connection. The wires must be connected
with careful to prevent the risk of short circuit which can damage the electrical
component.
Finally, Hovering System for Tandem Rotor is not successfully done. All the
circuits, devices functions in a right manner. But, the result is just right side lift about
7 inches and the left side not lifts. So in the end, the unmanned helicopter cannot lift
properly because of the physical condition of the prototype needs to be improving in
the future in order to overcome the problems state before.
44
5.2 Future Recommendation
After we do the project troubleshooting, there are few recommendations that
have been introduced to make this more effective and interactive. In order to make
this system become efficient, height determination can be added on it. This devices
can track the exactly height that used need to hover this UH. This device will interact
with the feedback system in this project and the new PIC184550 programming will
be needed. Besides that, the mechanical part of the prototype of unmanned helicopter
must be change. From using board and polystyrene to plastic or Polyvinyl
chloride(PVC) that will reduce more weight on mechanical part of prototype of
unmanned helicopter.
By adding and manipulated unmanned helicopter, the application of the
tandem rotor also becoming more interesting such as a military survey mission with
addition camera on it or the UH can become a rescue helicopter at the very high
altitude. As the information, the human brain cannot functional at 100% at very high
altitude and high pressure. So the UH will become the effective solution to that
problem.
5.3 Costing and Commercialization
5.3.1 Costing
This part explains about the costing of this project. The total project cost for
all components is estimated to be RM 312.40. The highest cost is reflected in the
price of helicopter blade component and DC motor, this part actually cannot buy
separately because it’s come with a package. Even though the price of these
components is expensive, it is still a necessary item and the less expensive substitutes
are nonexistent. The component chosen based on the performance of the component,
45
means that the chosen component rating is above designed value. The table of
component cost is on Table 5.1.
Table 5.1: The cost of component
Device Manufacture Qty UnitUnit Cost(RM)
Extended Cost(RM)
Capacitor 50V 2 1uF 0.20 0.40Capacitor 50V 1 100uF 0.40 0.40Resistor 2 220Ω 0.20 0.40Resistor 2 4.7kΩ 0.30 0.60Led 1 0.50 0.50LM7805 Bay Linear 1 1.50 1.50Crystal 1 20MHz 5.00 5.00Toggle switch 1 1.50 1.50Strip board 2 2.00 4.00Heat sink (small) 1 1.50 1.50Connector 10 0.50 5.00jumper wire 2 1m 0.30 0.60PIC 18F4550 1 40.00 40.00DC motor (12V) 2
130.00 130.00Helicopter blade 2Driver motor (MD30A) 2 30.00 60.00Speed sensorLiPo battery 1 60.00 60.00IC Base 1 40 pin 1.00 1.00
TOTAL RM 312.40
5.3.1 Commercialization
The total project cost is RM 312.40. Even though the price is quite expensive
and it does not function very well, the price is still considered reasonable because of
we are using the dc motor 12V. Usually in the market, they are using dc motor up to
5V. Because of that the overall component need to change to the suitable component
in order to use dc motor 12V. The important components that need to change are
battery and driver motor.
46
So this project is not suitable to be commercialization, because of the price.
In order to reduce the price, we need to change the dc motor. After that we can use
the component in the market.
47
REFERENCE
[1] Article (26 July 2001) “Unmanned Helicopter Breakthrough”, Citing internet
sources URL http://www.scienceagogo.com/news/about.shtml
[2] Wikipedia “Unmanned Helicopter”,
http://www.answers.com/main/=unmanned+helicopter,
Accessed on 12th February 2008
[3] Helicopter Rescue. Citing internet source URL
http://www.gizmg.com/g/6793/
[4] Global security “Advanced Tandem Rotor Helicopter (ATRH)”, Citing
internet sources URL http://www.globalsecurity.org/military/
[5] Glen S. Bloom. The Helicopter Page. Citing internet sources URL
http://www.helicopterpage.com
[6] Dogan Ibrahim (2001). PIC Basic:Programming and Projects. Oxford, UK.
[7] Wikipedia “PIC Microcontroller”
http://en.wikipedia/wiki/PIC_Microcontroller,
Accessed on 25th March 2008
[8] Barr Michael “Closed-loop control Embedded system programming”, Citing
internet source URL http://netrino.com
48
[9] Mc Graw Hill Professional “Control System”,
http://www.answers.com/main/=control+system,
Accessed on 9th March 2008
[10] Pulse-width modulation (PWM). Citing internet source URL
http://www.tpub.com
[11] Pulse-width modulation (PWM) controller. Citing internet sources URL
http://www.cpemma.co.uk/pwm
[12] “Introduction to Pulse Width Modulation (PWM)”, Citing internet source
URL http://netrino.com
[13] Wikipedia “TandemRotor”,
http://www.answers.com/main/=tandem+rotor,
Accessed on 9th February 2008
[14] ELH Communications Ltd. (2004). Motor controlling. Citing internet sources
URL http://www.epanorama.net
[15] Wikipedia “DC Motor”, Citing internet sources URL
http://en.wikipedia.org/wiki/DC_motor
Accessed on 20th August 2008
[16] Theodore Wildi (sixth edition), Electrical Machines, Drives and Power
System, Pearson Prentice Hall.
[17] Tim Wilmshurst. “Designing Embedded Systems with PIC Microcontrollers
Principles and Applications” Newnes.
[18] DC motor. Citing internet sources URL
http://www.solarbotics.net/starting/200111_dcmotor/200111_dcmotor.html
Accessed on 20th August 2008
49
REFERENCE
[1] Article (26 July 2001) “Unmanned Helicopter Breakthrough”, Citing internet
sources URL http://www.scienceagogo.com/news/about.shtml
[2] Wikipedia “Unmanned Helicopter”,
http://www.answers.com/main/=unmanned+helicopter,
Accessed on 12th February 2008
[3] Helicopter Rescue. Citing internet source URL
http://www.gizmg.com/g/6793/
[4] Global security “Advanced Tandem Rotor Helicopter (ATRH)”, Citing
internet sources URL http://www.globalsecurity.org/military/
[5] Glen S. Bloom. The Helicopter Page. Citing internet sources URL
http://www.helicopterpage.com
[6] Dogan Ibrahim (2001). PIC Basic:Programming and Projects. Oxford, UK.
[7] Wikipedia “PIC Microcontroller”
http://en.wikipedia/wiki/PIC_Microcontroller,
Accessed on 25th March 2008
[8] Barr Michael “Closed-loop control Embedded system programming”, Citing
internet source URL http://netrino.com
50
[9] Mc Graw Hill Professional “Control System”,
http://www.answers.com/main/=control+system,
Accessed on 9th March 2008
[10] Pulse-width modulation (PWM). Citing internet source URL
http://www.tpub.com
[11] Pulse-width modulation (PWM) controller. Citing internet sources URL
http://www.cpemma.co.uk/pwm
[12] “Introduction to Pulse Width Modulation (PWM)”, Citing internet source
URL http://netrino.com
[13] Wikipedia “TandemRotor”,
http://www.answers.com/main/=tandem+rotor,
Accessed on 9th February 2008
[14] ELH Communications Ltd. (2004). Motor controlling. Citing internet sources
URL http://www.epanorama.net
[15] Wikipedia “DC Motor”, Citing internet sources URL
http://en.wikipedia.org/wiki/DC_motor
Accessed on 20th August 2008
[16] Theodore Wildi (sixth edition), Electrical Machines, Drives and Power
System, Pearson Prentice Hall.
[17] Tim Wilmshurst. “Designing Embedded Systems with PIC Microcontrollers
Principles and Applications” Newnes.
[18] DC motor. Citing internet sources URL
http://www.solarbotics.net/starting/200111_dcmotor/200111_dcmotor.html
Accessed on 20th August 2008
51
Appendix A
PIC18F4550 Datasheet
52
53
54
55
56
Appendix B
PIC18F4550 Project Programming
define osc 20 'Oscilator Speed in MHz
define ccp1_reg portc 'Motor HPWM Config
57
define ccp1_bit 2 'for right motordefine ccp2_reg portcdefine ccp2_bit 1 'for left motor
D1 var byteD2 var byteSPEED1 var byteSPEED2 var byteD1=166D2=166
HPWM 1, D1, 1000 '65% Duty CycleHPWM 2, D2, 1000 '65% Duty Cycle
trisb = %11111111
right_sensor var portb.0 'Speed Sensor Configleft_sensor var portb.1
MAIN:count portb.0,1000,SPEED1 'count Speed for Right Sensorcount portb.1,1000,SPEED2 'count Speed for Left Sensor
if SPEED1<SPEED2 thenD2=D2-1
ENDIF
IF SPEED1>SPEED2 thenD2=D2+1
endifgoto main
58
Appendix C
MD30A Motor Driver Datasheet
59
60
61
62
63
64
Appendix D
Speed Sensor Datasheet
65
66
67
68
Appendix E
Height Sensor Datasheet
69
70
71
72
73
Appendix F
DMOS Full Bridge Driver Datasheet
74
75
76
77
78