* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Chapter 2 LITERATURE REVIEW 2. Chapter Overview This chapter
Electric motor wikipedia , lookup
Transmission line loudspeaker wikipedia , lookup
Resistive opto-isolator wikipedia , lookup
Buck converter wikipedia , lookup
Brushless DC electric motor wikipedia , lookup
Flip-flop (electronics) wikipedia , lookup
Power electronics wikipedia , lookup
Power dividers and directional couplers wikipedia , lookup
Control system wikipedia , lookup
Schmitt trigger wikipedia , lookup
Induction motor wikipedia , lookup
Regenerative circuit wikipedia , lookup
Brushed DC electric motor wikipedia , lookup
Switched-mode power supply wikipedia , lookup
Pulse-width modulation wikipedia , lookup
Stepper motor wikipedia , lookup
Two-port network wikipedia , lookup
Variable-frequency drive wikipedia , lookup
Chapter 2 LITERATURE REVIEW 2. Chapter Overview This chapter encompasses the related fields and knowledge pertaining that is used for archiving the objective of the project. First topic is discussing about an infrared sensor then move on to a motor selection topic and lastly the microcontroller unit. 6 2.1. INFRARED SENSOR 2.1.1. Infrared Radiation Infrared radiation exists in the electromagnetic spectrum at a wavelength that is longer than visible light. Infrared radiation cannot be seen but it can be detected. Objects that generate heat also generate infrared radiation and those objects include animals and the human body whose radiation is strongest at a wavelength of 9.4µm. 2.1.2. PIR325 Infrared Pyroelectric Sensors The pyroelectric sensor is made of a crystalline material that generates a surface electric charge when exposed to heat in the form of infrared radiation. When the amount of radiation striking the crystal changes, the amount of charge also changes and can then be measured with a sensitive FET device built into the sensor. The sensor elements are sensitive to radiation over a wide range so a filter window is added to the TO5 package to limit incoming radiation to the 8 to 14µm range which is most sensitive to human body radiation. Figure 1: Typical Configuration 7 Figure 1 shows how typically, the FET source terminal pin 2 connects through a pull-down resistor of about 100 K to ground and feeds into a two stage amplifier having signal conditioning circuits. Each of the two cascaded stages has a gain of 100 for a total gain of about 10,000. The amplifier is typically bandwidth limited to below 10Hz to reject high frequency noise and is followed by a window comparator that responds to both the positive and negative transitions of the sensor output signal. A well filtered power source of from 3 to 15 volts should be connected to the FET drain terminal pin 1. The PIR325 sensor has two sensing elements connected in a voltage bucking configuration. This arrangement cancels signals caused by vibration, temperature changes, and sunlight. A body passing in front of the sensor will activate first one and then the other element as shown in figure 2 whereas other sources will affect both elements simultaneously and be cancelled. The radiation source must pass across the sensor in a horizontal direction when sensor pins 1 and 2 are on a horizontal plane so that the elements are sequentially exposed to the IR source. Figure 3 shows the PIR325 electrical specifications and layout in its TO5 package. Please note that the distance from the front of the sensing elements to the front of the filter window is 0.045 inch (1.143mm). Figures 4 and 5 describe a Fresnel lens designed to be used with the PIR325 sensor. Figure 6 shows a typical application circuit that drives a relay. R10 and C6 adjust the amount of time that RY1 remains closed after motion is detected. When used with a PIR325 sensor and FL65 Fresnel lens, this circuit can detect motion at a distance of up to 90 feet. Figure 7 shows an application circuit that will indicate the direction that an infrared radiating source is moving. 8 Figure 2: Object Detection 9 Figure 3: Specification and Dimensions: 10 2.1.3. Fresnel Lens A Fresnel lens is a Plano Convex lens that has been collapsed on itself as in figure 4 to form a flat lens that retains its optical characteristics but is much smaller in thickness and therefore has less absorption losses. Figure 4: Fresnel lens Shape The FL65 Fresnel lens is made of an infrared transmitting material that has an IR transmission range of 8 to 14 µm that is most sensitive to human body radiation. It is designed to have its grooves facing the IR sensing element so that a smooth surface is presented to the subject side of the lens which is usually the outside of an enclosure that houses the sensor. The lens element is round with a diameter of 1 inch and has a flange that is 1.5 inches square. This flange is used for mounting the lens in a suitable frame or enclosure. Mounting can best and most easily be done with strips of Scotch tape. Silicone rubber adhesive can also be used to form a more waterproof seal. The FL65 has a focal length of 0.65 inches from the lens to the sensing element. It has been determined by experiment to have a field of view of approximately 10 degrees when used with a PIR325 Pyroelectric sensor. Figure 5 shows the lens dimensions. 11 Figure 5: Fresnel lens Dimension and Specification 12 2.1.4. General purpose motion detector This motion detector circuit uses a low cost LM324 quad operational amplifier as both a two stage amplifier and a window comparator. Amplifiers IC1A and IC1B have a gain of 100 each for a total of about 10,000. IC1C and IC1D form a window comparator that responds to signals about 200 millivolts above and 200 millivolts below Vcc/2. This window is set by the low current voltage drops across D1 and D2. Comparator outputs feed through D3 and D4 that pass only the positive transitions into CD4538 CMOS single shot IC2 which feeds into Q1 that drives relay RY1. The R10 and C6 time constant determine how long the relay remains energized after motion is detected. All components can operate on 5 to 12 volts. This type of circuit is often used to turn a light on outside of a house when motion is detected. Figure 6: Motion Detector 13 2.1.5. Direction sensing motion detector This motion detector circuit will both detect motion and indicate the direction that an infrared emitting body is moving. The amplifier and comparator circuits are similar to those in figure 6. Potentiometer R10 is a sensitivity adjustment to vary the detection range. IC2 is a CD4538 dual single shot. The first single shot to receive a trigger input from IC1C or IC1D will turn its output on to indicate the direction of detection and will also inhibit the other single shot so that it cannot be triggered while the first single shot is on. Potentiometer R15 adjusts the amount of time that an output remains on after motion is detected. This type of motion detector can be used to indicate people entering or leaving a building or in some robotic applications.[4] Figure 7: Direction Sensing 14 2.2. Motor Selections Generally, there is three types of motor that robot builder used in their project. These three types are servo motor, stepper motor and DC motor. All these types have their own advantages and weaknesses. The type of motor chosen based on their application in certain project. The cost and physical characteristic also be considered before make any decision on which motor will be used. 2.2.1. DC Motor Direct Current Motor or DC motor is the general motor that usually used in many applications. Supplied with direct current voltage, DC motor make ease on any application. There are many categories of DC motors, for example brushless motor, coreless motor, fix magnet motor, 5-pole motor and servomotor. DC motors generally have two wires, and can be powered directly from a battery or other DC power supply. DC motor can also be powered through driver circuits that can also regulate the speed and directions of the motor. The direction of the DC motors rotation can be set controlling the polarity of the voltage supplied to the DC motor. In robot application, usually supply voltage for DC motor is 6V and 12V. The current rating depends on the make of the robot but it is usually between 1A and 3A. Varying the voltage input into the motor will vary the speed of the motor accordingly. DC motors have the ability to turn at high revolution per minute but has low torque. The most significant limitation of DC motors is the low output torque. Although the output speed can be reduced and the torque increased by adding a gear train to the output shaft it is still not adequate to actuate a biped robot using DC motors. For the purpose of robot building, DC motor is the cheapest compare to stepper or servomotor. But it is hard to detect the rotation angle for this motor and some external electronic circuit is needed to detect the rotation angle. 15 2.2.2. Stepper Motor Stepper motor is not famous as other type of motor. Normally, all windings in the motor are part of the stator, and the rotor is either a permanent magnet or, in the case of variable reluctance motors, a toothed block of some magnetically soft material. All of the commutation must be handled externally by the motor controller, and typically, the controller is designed by the user so that the motor may be held in any fixed position as well as being rotated one way or the other. Most stepping motors can be stepped at audio frequencies, allowing them to spin quite quickly, and with an appropriate controller, they may be started and stopped "on a dime" at controlled orientations. Stepper motor usually has four control wires and two power supply wire. A sequence of signals is needed to feed into the motor via the four control wire in order to driven the motor to move a single step. It is advisable to use a motor driver to interface a stepper motor with the microcontroller as a motor driver makes controlling a stepper motor easier. For some applications, there is a choice between using servomotors and stepping motors. Both type of motors offer similar opportunities for precise positioning, but they differ in a number of ways. Servomotors require analogue feedback control systems of some type. Typically, this involves a potentiometer to provide feedback about the rotor position, and some mix of circuitry to drive a current through the motor inversely proportional to the difference between the desired position and the current position. In making a choice between stepping motors and servomotors, a number of issues must be considered; which of these will matter depends on the application. For example, the repeatability of positioning done with a stepping motor depends on the geometry of the motor rotor, while the repeatability of positioning done with a servomotor generally depends on the stability of the potentiometer and other analogue components in the feedback circuit. 16 Stepping motors can be used in simple open-loop control systems; these are generally adequate for systems that operate at low accelerations with static loads, but closed loop control may be essential for high accelerations, particularly if they involve variable loads. If a stepping motor in an open-loop control system is over torque, all knowledge of rotor position is lost and the system must be reinitialized. The weight of stepper motor is heavier than servo motor. The stepper motor also has lower torque compared to servo motor and is typically more expensive. 2.2.3. Servo Motor There are actually two types of servomotors available. The first type is for industrial use which is much heavier and powerful but expensive. This type of servo generally used in building bigger robot. The second type is called the pager type. This pager type named because it looks like a pager. Pager type servomotor, or simply called a servo motor are used widely in building small robots. Servo motor first developed for use in radio controlled car, aircraft and sailboat. Today, servo motors are adapted in building a small robot. We can find dozens of servo motor used in robots in building arms, legs, grippers and sensor platforms. Servo motor is used in almost anywhere that needs repeatable position control. Major servo manufacturers are Futaba, Hitec, Sanwa, JR, Airtronics and Hobicco. Servo motors generally have three wires, one for controlling the motor and the other two is the power supply. Servomotor can be powered directly from a battery or other DC supply. Servo motors receive an input signal in the form of a Pulse Width Modulation (PWM) signal, and then turn their output shaft to the position indicated by the signal. Usually, the maximum rotation angle for servo motor is 90 or 180 degrees depends on the motor's specifications and manufacturing. Servomotors typically weight more or less 50 gram, and there is servo motor weighted around 100 gram, depending on the servo's architecture. 17 A servomotor comes in a cartridge type casing usually with 20mm x 40mm x 35mm dimension. Inside this cartridge casing is a DC motor, a set of gears, potentiometer and a control circuit. The output shaft of the DC motor is attached to a set of gears and a potentiometer. The potentiometer is used to determine the exact position of the servo motor's output shaft. The control circuit used to control the output of the DC motor according to input signal from the potentiometer and from the control wire. The nature of the servo motor, wide selection of torque, low weight, cartridge type casing, precise positioning of the servo and robust, make it an obvious choice for the biped robot. The limitations of servomotors are its price which is a bit expensive and that most of the model can't be obtained in Malaysia. There is a new type of servomotor available at the market. It is the digital servomotor. Basically the physical characteristic of the digital servo is pretty much the same as conventional analogue servo. The difference is that the digital servo motor has faster response time and consumes more power. It is not practicable to use a digital servomotor in this project because of the fast response, high power needed and it is more expensive. 18 2.2.4. Servo Motor Control The servo motor has a control circuits and a potentiometer that is connected to the output shaft. This potentiometer allows the control circuitry to monitor the current rotation angle of the output shaft. If the shaft is at the correct angle, then the motor will be shuts off. If the circuit finds that the angle is not correct, it will turn the motor to the correct direction until the angle is correct. The output shaft of the servo is capable of travelling somewhere around 180 degrees. Usually, it’s somewhere in the 210 degree range, but it varies by manufacturer and model. A normal servo is used to control an angular motion of between 0 and 180 degrees. A normal servo is mechanically not capable of turning any farther due to a mechanical stop built on to the main output gear. The amount of power applied to the motor is proportional to the distance it needs to travel. So, if the shaft needs to turn a large distance, the motor will run at full speed. If it needs to turn only a small amount, the motor will run at a slower speed. This is called proportional control. The control wire is used to communicate the angle of turning of the servomotor. 19 Figure 8: A Pulse Width Modulation to control servo motor The angle is determined by the duration of a pulse that is applied to the control wire. This is called Pulse Width Modulation. The servo expects to see a pulse every 20 milliseconds. The length of the pulse will determine how far the motor turns. For example, 1.5 millisecond pulses will make the motor turn to the 90 degree position called the neutral position. If the pulse is shorter than 1.5 ms, then the motor will turn the shaft to closer to 0 degrees. If the pulse is longer than 1.5ms, the shaft turns closer to 180 degrees. The pulse width modulation used to control the servomotor varies between manufacturers. Nevertheless, the controlling method for all servomotors is the same; just the value of the pulse varies. 20 2.3. Microcontroller Figure 9: M68HC11 E-Series Block Diagram The microcontroller 68HC11 family from Motorola will be used in this project. This microcontroller has been used widely in many applications as a control unit system. The 68HC11 family is an advance 8 bit microcontroller with significant ability and internal peripheral. 2.3.1. Introduction 21 The microcontroller M68HC11 family from Motorola are its using M68HC11 CPU for data processing. Microcontroller from Motorola also have power saving criteria that are STOP and WAIT modes and a low-voltages devices also available from 3.0-5.5 Vdc and 2.7-5.5 Vdc. For the memory, they have Random Access Memory in 256, 512, or 768 Bytes of On-Chip RAM and the data detained during standby. Read Only Memory in 12, or 20 Kbytes of On-Chip ROM or EPROM and 512, or 2048 Bytes of On-Chip EEPROM with block protect for security and also 2048 bytes of EEPROM with selectable base address in MC68HC811E2. For the communication, there are asynchronous Non return to Zero (NRZ) Serial Communications Interface (SCI) and additional baud rates available on MC68HC (7)11E20 and also synchronous Serial Peripheral Interface (SPI). Other peripherals are 8-Channel 8-Bit Analogue-to-Digital (A/D) Converter, 16Bit Timer System, three Input Capture (IC) Channels, four Output Compare (OC) Channels and one additional channel, selectable as fourth Input Capture or fifth Output Compare , 8-Bit Pulse Accumulator, Real-Time Interrupt Circuit, Computer Operating Properly (COP) supporting a Watchdog System. In generally its have 38 General-Purpose Input/Output (I/O) Pins, 16 Bidirectional I/O Pins, 11 Input-Only Pins, 11 Output-Only Pins. There are also several packaging options that are 52-Pin Plastic Leaded Chip Carrier (PLCC), 52Pin Windowed Ceramic Leaded Chip Carrier (CLCC), 52-Pin Plastic Thin Quad Flat Pack, 10 mm X 10 mm (TQFP), 64-Pin Plastic Quad Flat Pack (QFP), 48-Pin Plastic Dual In-Line Package (DIP), 56-Pin Plastic Dual In-Line Package, .070" Lead Spacing (SDIP). The 68HC11 family had a lot of microcontroller type and for this project; the microcontroller 68HC11E1 with 48- pin DIP is selected. 22 Figure 10: Pin Assignments for 48-Pin DIP (MC68HC811E2 There are many advantages in using microcontroller for this project rather than using microprocessor. The microcontroller acts like microcomputer because all of basic component for microprocessor such as EEPROM, ROM, RAM, and analogue digital converter are already embedded in this system. 23 2.3.2. VDD and VSS Power is supplied to the microcontroller unit through pin VDD and VSS. VDD is the power supply, VSS is ground. The microcontroller unit operates from a single 5-volt (nominal) power supply. Low-voltage devices in the E series operate at either 3.0 – 5.5 volts or 2.7 – 5.5 volts. Very fast signal transitions occur on the microcontroller unit pins. The short rise and fall times place high, short duration current demands on the power supply. To prevent noise problems, provide good power supply bypassing at the microcontroller unit. Also, use bypass capacitors that have good high-frequency characteristics and situate them as close to the microcontroller unit as possible. Bypass requirements vary, depending on how heavily the microcontroller unit pins are loaded. 2.3.3. RESET A bidirectional control signal RESET acts as an input to initialize the microcontroller unit to a known start-up state. It also acts as an open-drain output to indicate that an internal failure has been detected in either the clock monitor or COP watchdog circuit. The CPU distinguishes between internal and external reset conditions by sensing whether the reset pin rises to a logic one in less than two Eclock cycles after a reset has occurred. Do not connect an external resistor capacitor (RC) power-up delay circuit to the reset pin of M68HC11 devices because the circuit charge time constant can cause the device to misinterpret the type of reset that occurred. 24 Figure 11: External Reset Circuit . 2.3.4. Crystal Driver and External Clock Input (XTAL and EXTAL) Crystal Driver and External Clock Input (XTAL, EXTAL) provide the interface for either a crystal or a CMOS compatible clock to control the internal clock generator circuitry. The frequency applied to these pins is four times higher than the desired E-clock rate. The XTAL pin is normally left unterminated when an external CMOS compatible clock input is connected to the EXTAL pin. However, a 10 kW to 100 kW load resistor connected from XTAL to ground can be used to reduce RFI noise emission. The XTAL output is normally intended to drive only a crystal. The XTAL output can be buffered with a high-impedance buffer, or it can be used to drive the EXTAL input of another M68HC11 microcontroller unit. 25 Figure 12: Common Crystal Connection Figure 13: External Oscillator Connections Figure 14: One Crystal Driving Two Microcontroller’s 26 2.3.5. E-Clock Output (E) E-Clock Output (E) is the output connection for the internally generated E clock. The signal from E is used as a timing reference. The frequency of the E-clock output is one fourth that of the input frequency at the XTAL and EXTAL pins. When Eclock output is low, an internal process is taking place. When it is high, data is being accessed. All clocks, including the E clock, are halted when the microcontroller unit is in STOP mode. To reduce RFI emissions, the E-clock output of most E-series devices can be disabled while operating in single-chip modes. The E clock signal is always enabled on the MC68HC811E2. 2.3.6. Interrupt Request (IRQ) Interrupt Request (IRQ) input provides a means of applying asynchronous interrupt requests to the microcontroller unit. Either negative edge-sensitive triggering or level-sensitive triggering is program selectable (OPTION register). IRQ is always configured to level-sensitive triggering at reset. When using IRQ in a levelsensitive wired-OR configuration, connect an external pull-up resistor, typically 4.7 kW, to VDD. 2.3.7. Non-Maskable Interrupt (XIRQ/VPPE) Non-Maskable Interrupt (XIRQ/VPPE) input provides a means of requesting a non-maskable interrupt after reset initialization. During reset, the X bit in the condition code register (CCR) is set and any interrupt is masked until microcontroller unit software enables it. Because the XIRQ input is level sensitive, it can be connected to a multiple-source wired-OR network with an external pull-up resistor to VDD. XIRQ is often used as power losses detect interrupt. Whenever XIRQ or IRQ are used with multiple interrupt sources (IRQ must be configured for level-sensitive operation if there is more than one source of IRQ interrupt), each source must drive the interrupt input with an open-drain type of driver to avoid contention between outputs. There should be a single pull-up resistor near the microcontroller unit interrupt input pin (typically 4.7 kW). There must also 27 be an interlock mechanism at each interrupt source so that the source holds the interrupt line low until the microcontroller unit recognizes and acknowledges the interrupt request. If one or more interrupt sources are still pending after the microcontroller unit services a request, the interrupt line will still be held low and the microcontroller unit will be interrupted again as soon as the interrupt mask bit in the microcontroller unit is cleared (normally upon return from an interrupt). VPPE is the input for the 12 volt nominal programming voltage required for EPROM/OTPROM programming. On devices without EPROM/OTPROM this pin is only XIRQ input. 2.3.8. MODA and MODB (MODA/LIR and MODB/VSTBY) During reset, MODA and MODB (MODA/LIR and MODB/VSTBY) select one of the four operating modes; ● Single-chip mode ● Expanded mode ● Test mode ● Bootstrap mo After the operating mode has been selected, the load instruction register (LIR) pin provides an open-drain output to indicate that execution of an instruction has begun. A series of E-clock cycles occurs during execution of each instruction. The LIR signal goes low during the first E-clock cycle of each instruction (Opcode fetch). This output is provided for assistance in program debugging. The VSTBY pin is used to input RAM standby power. When the voltage on this pin is more than one MOS threshold (about 0.7 volts) above the VDD voltage, the internal RAM and part of the reset logic are powered from this signal rather than the VDD input. This allows RAM contents to be retained without VDD power applied to the microcontroller unit. Reset must be driven low before VDD is removed and must remain low until VDD has been restored to a valid level. 28 2.3.9. VRL and VRH VRL and VRH inputs provide the reference voltages for the analog-to-digital converter circuitry. VRL is the low reference, typically 0 Vdc. VRH is the high reference. For proper A/D converter operation, VRH should be at least 3 Vdc greater than VRL, and both VRL and VRH should be between VSS and VDD. 2.3.10. STRA/AS STRA/AS pin performs either of two separate functions, depending on the operating mode. In single-chip mode, STRA performs an input handshake (strobe input) function. In the expanded multiplexed mode, AS provides an address strobe function and can be used to demultiplex the address and data signals at port C. 2.3.11. STRB/R/W The strobe B (STRB) and read/write (R/W) pin acts as either an output strobe, or as a data bus direction indicator, depending on the operating mode. In single-chip operating mode, STRB acts as a programmable strobe for handshake with other parallel devices. In expanded multiplexed operating mode, R/W is used to indicate the direction of transfers on the external data bus. A low on the R/W pin indicates data is being written to the external data bus. A high on this pin indicates that a read cycle is in progress. R/W stays low during consecutive data bus write cycles, such as a doublebyte store. It is possible for data to be driven out port C, if internal read visibility is enabled and an internal address is read, even though R/W is in a high-impedance state 29 Table 1: Port Signal Functions 30 2.3.12. Port Signals Port pins have different functions in different operating modes. Pin functions for port A, port D, and port E are independent of operating modes. Port B and port C, however, are affected by operating mode. Port B provides eight general-purpose output signals in single-chip operating modes. When the microcontroller is in expanded multiplexed operating mode, port B pins are the eight high-order address lines. Port C provides eight general-purpose input/output signals when the microcontroller unit is in the single-chip operating mode. When the microcontroller is in the expanded multiplexed operating mode, port C pins are a multiplexed address/data bus. 2.3.12.1. Port A In all operating modes, port A can be configured for three timer input capture (IC) functions and four timer output compare (OC) functions. An additional pin can be configured as either the fourth IC or the fifth OC. Any port A pin that is not currently being used for a timer function can be used as either a general-purpose input or output line. Only port A pins PA7 and PA3 have an associated data direction control bit that allows the pin to be selectively configured as input or output. Bits DDRA7 and DDRA3 located in PACTL register control data direction for PA7 and PA3, respectively. All other port A pins are fixed as either input or output. PA7 can function as general-purpose I/O or as timer output compare for OC1. PA7 is also the input to the pulse accumulator, even while functioning as a general-purpose I/O or an OC1 output. PA6–PA4 serves as either general-purpose output, timer input captures, or timer output compare 2–4. In addition, PA6–PA4 can be controlled by OC1. PA3 can be a general-purpose I/O pin or a timer IC/OC pin. Timer functions associated with this pin include OC1 and IC4/OC5. IC4/OC5 is software selectable as either a fourth 31 input capture or a fifth output compare. PA3 can also be configured to allow OC1 edges to trigger IC4 captures. PA2–PA0 serves as general-purpose inputs or as IC1–IC3. PORTA can be read at any time. Reads of pins configured as inputs return the logic level present on the pin. Pins configured as outputs return the logic level present at the pin driver input. If written, PORTA stores the data in an internal latch, bits 7 and 3. It drives the pins only if they are configured as outputs. Writes to PORTA do not change the pin state when pins are configured for timer input captures or output compares. 2.3.12.2. Port B During single-chip operating modes, all port B pins are general-purpose output pins. During microcontroller unit reads of this port, the level sensed at the input side of the port B output drivers is read. Port B can also be used in simple strobe output mode. In this mode, an output pulse appears at the STRB signal each time data is written to port B. In expanded multiplexed operating modes, the entire port B pins act as high order addresses output signals. During each microcontroller unit cycle, bits 15–8 of the address bus are output on the PB7–PB0 pins. The PORTB register is treated as an external address in expanded modes. 2.3.12.3. Port C While in single-chip operating modes, all port C pins are general-purpose I/O pins. Port C inputs can be latched into an alternate PORTCL register by providing an input transition to the STRA signal. Port C can also be used in full handshake modes of parallel I/O where the STRA input and STRB output act as handshake control lines. When in expanded multiplexed modes, all port C pins are configured as multiplexed address/data signals. During the address portion of each microcontroller unit cycle, bits 7–0 of the address are output on the PC7–PC0 pins. During the data portion of each microcontroller unit cycle (E high), PC7–PC0 are bidirectional data signals, DATA7–DATA0. The direction of data at the port C pins is indicated by the R/W signal. The CWOM control bit in the PIOC register disables the port C P-channel output driver. CWOM simultaneously affects all eight bits of port C. Because the N- 32 channel driver is not affected by CWOM, setting CWOM causes port C to become an open-drain type output port suitable for wired-OR operation. In wired-OR mode; when a port C bit is at logic level 0, it is driven low by the Nchannel driver. When a port C bit is at logic level 1, the associated pin has highimpedance, as neither the N-channel nor the P-channel devices are active. It is customary to have an external pull-up resistor on lines that are driven by opendrain devices. Port C can only be configured for wired-OR operation when the microcontroller unit is in single-chip mode. 2.3.12.4. Port D Pins PD5–PD0 can be used for general-purpose I/O signals. These pins alternately serve as the serial communication interface (SCI) and serial peripheral interface (SPI) signals when those subsystems are enabled. ● PD0 is the receive data input (RxD) signal for the SCI. ● PD1 is the transmit data output (TxD) signal for the SCI. ● PD5–PD2 are dedicated to the SPI: ● PD2 is the master in/slave out (MISO) signal. ● PD3 is the master out/slave in (MOSI) signal. ● PD4 is the serial clock (SCK) signal. ● PD5 is the slave select (SS) input. 33 2.3.12.5. Port E Use port E for general-purpose or analog-to-digital (A/D) inputs.Port E is used as an input port. The sensors can be connected to this port as input for feedback controls. [1] Chapter 3 Theory and background 3. Chapter Overview This chapter include comprehensively some idea that is collected from references. The discussion will goes more details for some related topic in the chapter two which is corresponds as theory and background for this project. 35 3.1. Pulse Width Modulation (PWM) Pulse-width modulation uses square waves generated by microcontrollers to control voltage across a circuit. Square waves alternate between a high-logic (binary 1) level and a low logic (binary 0) level, where high logic has a positive voltage and low logic has zero voltage. Figure 9 is an example. Notice that, here the square wave alternates between 5V and 0V. Also notice that the square waves spend a value of time Δt on both high and low logic, this time is called a delay. In order to change the delay time, a certain number are input into a microprocessor program that will force the wave to remain at the high or low logic level until it switches to the opposite level. However, changing this delay time does not achieve what we want to achieve; essentially, the point of pulse width modulation is to achieve a different average voltage for the signal. That is to say, changing the delay time maintains the high-logic voltage while keeping factors associated with lower voltages, such as lower torque, lower angular velocity, constant. Instead of varying the time between high-logic peaks, pulse-width modulation varies the ratio between high- and low-logic times per cycle. This cycle is called duty cycle. For the square wave, in Figure 9 the ratio of high- and low- logic is one. However, the ratio may change when the high or low logic changes. 36 Figure 15: The Typical Square Wave What happens if we change this ratio? If we keep the duty cycle constant, but cut down the high logic to half ( also can be called half period), then the ratio of high to low logic is one-to-two. If the output voltage is a function of the averaging of high and low logic, it can be seen that the low-logic voltage has more influence on the output voltage. This is how pulse-width modulation works. PWM uses a variable, the high-to-logic logic delay ratio to control the voltage in a circuit. Half Period = 1 2 xfrequency From this theory, the PWM signal is generated using programmable timer function that had been offered in M68HC11E family microcontroller unit. Then the controlled outputs are put through output compare pins into servo motor.[2] 37 3.2. Stand & Mechanical Structure Structure for holding the video camera and selecting their material is very importing because this component will used to place all the servo motors that driven all joint for the movement system. The controlling circuit are placed on the stand. The mechanical design for the Video camera frame will determine the stability and centre of focusing in static position or when in the movement process. There are many type of material that can be use. Table below show some of material that can easily found and each type of these materials has their own advantages and disadvantages. For this project, aluminium bar are selected as the frame material for video camera. This type of material gives a lot of advantages, light in weight, strong architecture and heat and impact resistant. There is also disadvantage in using this material, not flexible for model building. This because it needs a certain kind of tool to cut, bending and combine it. All circuit involved this project are placed around the stand, so it is more appropriate to use a flexible item such as plastic. For stand design it will be wider for lower gravity point to support mechanical movement speed with the weight of video camera and servo motor. 38 Balsa Wood Plastic Ion Bar Aluminium Bar Lightest Light Heavy Light Strong Strong Not too strong Stronger than Balsa Wood Sensitive to heat Sensitive to heat Heat resistant Heat resistant Sensitive to impact Sensitive to impact Impact resistant Impact resistant Flexible for model Flexible for model Not building building flexible model building for Not flexible model building Table 2: Comparison of the quality and characteristic of different for Chapter 4 Methodology 4. Chapter Overview This chapter encompasses all related plan, design, and procedure that used for completing this project. Early in this chapter will discuss about project development, process model, requirement and design involve from beginning until end of the project. Result of the project will discuss in the next chapter. 40 4.1. Project Development A simple project can be done without engineering but not a complex project that is needs for details notation and a long period of time. Engineering is to work systematically. This project is developing with all of engineering knowledge learned in University of Technology Malaysia. The project planning is the first step taken in this project early in the first phase of this project (PSM1). In the earliest of the project development, first thing to do is to meet with supervisor and discussing on what are this project all about, how should it’s carry on and what kind of project related and appropriate to be develop. Then the project should be decided by considering a project that had never been developed and reviewed problem statements from a brain storming technique used. Then a proposal given to supervisor base on problem statements detailed with objectives, scope to be cover and final result expectation. This project is controlled by supervisor, so supervisor approval is needed to continue project development. If the project does not get approved then the expectation from supervisor shall be review from the last discussion. Then another proposal proposes until meet the supervisor expectation. Next is to research on project related topic, the fastest method is by using an internet. All literature study and references is searched base on the scopes of the project. Then project planning made base on time given for completing this project. It including literature study, purchasing mechanical and electronic components, study and construct the mechanical and the electronic part, test, analyze and troubleshoot the overall modules. At the end of phase one of the project, demo a given in front of panels that is faculties lecturer. If the project meets panels’ expectation then move on the next step of the project development and without panels’ approval the project development must go back into the earliest of project development that is discussing with supervisor then make a new proposal. 41 After demoed, the next step is design phase. First design is about electronic circuit for microcontroller unit. Basic circuit designs for microcontroller can be easily gets from any references related. The next design is about sensor circuit that had been referred to the manual of the component part. The designs then discussed with supervisor assistant. For the mechanical design, it’s has been referred to some of robotic over an internet and the idea came up. A full report on the first phase of this project submitted to supervisor detailed in objectives, scopes, problem statement, planning, and project acquisition. In the second phase of the project development, the mechanical parts constructed and electronic circuit fabricated. The functional test made after the hardware part finished. Then a program created in a lot of tries and errors process in a assembly language for Motorola microcontrollers. Then develop to hardware and program finalization where tests and troubleshoots are been done numerous of times. Then a final demo in front of the faculties panels and if ever a problem occurs a re-demo may be required depends on panel’s decision. Then a final report submitted to supervisor then follow up to this thesis report. 42 Start Meeting with supervisor Searching for topic Proposal Not Accepted Literature study and research on topic Demo 1 Not Accepted Circuit Design Mechanical design PSM 1 report Hardware Construction Assembly Programming Hardware and Programming Finalization Demo 2 Not Accepted PSM 2 report End Figure 16: The Flow Chart for Project 43 4.2. Process Model Here is the procedure used for design and fabricate the output of this project. The easiest way to resemble the project scheme is by using the waterfall model which is often used in software engineering method. The process is simple top-down solution. ● Design electronic circuit for microcontroller M68HC11E1 (power supply, clock, reset). ● Design Serial Communication circuit for M68HC11E1. ● Design electronic circuit for sensors. ● Get components part for all, assemble, and fabricate all the electronic circuit. ● Test all electronic circuit and update the changes. ● Design and construct mechanical part ● Combine all electronic circuit with mechanical part. ● Install and program the microcontroller. ● Test and troubleshoot the overall system. ● Combine both systems, test and troubleshoot overall system. Vertical Stepper Motors Vertical IR µC M68HC11 Horizontal Stepper Motors Horizontal IR Infrared Sensors (IR) MAX232 (For Serial Communication Interface) Figure 17: Project Block Diagram 44 4.3. Project Requirements Software Requirement ● THRSim11 4.00 ● HCLOAD 6.0 Hardware’s and Tools requirement ● Solder set ● Multimeter ● Wire Cutter ● ‘Adapter’ with decription of 3.5mm DC Jack Plug (‘male’ ) or Bateri 9V ● Computer ● Video Camera/ Video Cam Component Requirement ● Refer to appendix 45 4.4. Project Design Project design is about three main component designs of this project that is microcontroller unit, sensor and the mechanical part. The design phase begin after completed the literature study. 4.4.1. Microcontroller Circuit Design The design for microcontroller is very easy because the basis it is already covered in study syllabus and there are a lot of references. There are three importance circuit needed to use microcontroller. Here will be discussed the basis design and complete the microcontroller design. All kind of electric or electronic product definitely would not work without power. So this is the most important circuit. Power supply circuit design is very simple by using an adapter with 9-18 voltage and 1.0 ampere of current and connected with a jack plug. 1.0 ampere is quite big but it is needed to power up all circuit involves and 2 servo motors. From the female jack plug power is put through IC LM7805 to stabilize output voltage at 5 volt then it will be connected to all circuit and servos. The power supply circuit is shown in figure XXXXX. LM7805 1 Input DC 9v~18v 100µf 3 2 Output DC 5v 10µf Figure 18: Power Supply Schematic design 46 Second design is clock circuit that absolutely necessary for all kind of microcontroller to work properly. Fundamentally, the program for microcontroller run and generated signal synchronize with the clock. The process speed in a microcontroller also depend on how fast the clock itself. Synchronizing program and clock shall ease programmer to control the behavioural of program and also the behavioural of hardware. The external clock is generated with 8 MHz crystal. The schematic design is shown in figure XX. 1 MO 8 Mhz 27pf 27pf Figure 19: Schematic Design for Clock circuit. 47 Third design is reset circuit that is also essential for microcontroller. This circuit will support the reset function of microcontroller and make sure there is no feedback or any distortion when reset button pushed. The reset can simply implement with pull-up resistor and a tack switch. In order to make sure it is really stable an IC specializes for resetting need. In this project, IC MC364064 is used for reset circuit. Figure XXX show the schematic design for reset circuit. Vcc 4.7kO 3 Reset 1 MC34064 Tact Switch 2 Figure 20: Reset Schematic Design Last design associated with microcontroller is serial communication interface (SCI) circuit. The design is build base on microcontroller course taken in faculty of electric however the schematic design shown in figure 21 the overall of microcontroller unit schematic design that has been modified from www.myrosyl.com .[3] Figure 21: Microcontroller Unit Schematic design 48 49 4.4.2. Pyroelectric Sensor Circuit design The pyroelectric sensor circuit are built on reference from the literature review and originally from infrared part manual. The original circuit are analyzed and tested for many time and failed. The pyroelectric sensor circuit then has been rebuilt, redesign, analyzed and tested for another three time, however it still not very stable but able to work properly and right in the scope of the project and in overall it meet the need to accomplish the objective of this project. In the preliminary result of this project, the first pyroelectric sensor circuit built are unstable and the outputs are not as expected. It could be hardware errors, however it still using unnecessary component. Some component such as IC CD4538 dual single shot and others minor component supporter like NMOS transistors and diodes can be remove. The second pyroelectric sensor circuit is a modified circuit from the original by removing IC CD4538 dual single shot and another supporter component. The output for this pyroelectric sensor circuit is implemented with pull-up resistor to make an active low input for the microcontroller. An active low circuit is more stable to implement in hardware. Outputs from second pyroelectric sensor circuit then connected with microcontroller, servo motor and oscilloscope for analyzing and testing. The waveform readings at the oscilloscope from both outputs pin of pyroelectric sensor circuit show some unwanted signal that can be the source of instability for this sensor. However the pyroelectric sensor still can control the servo motor when testing with hand movement in front of the sensors for a few minutes. Figure 22: Sensor Schematic Design 50 Figure 23: Second Pyroelectric Sensor Schematic Design 51 52 The third pyroelectric sensor circuit is an alternative circuit. This circuit originally from the internet and the author claimed it is work perfectly. His circuit design is used in hope it could help improve my circuit design. After finish building the circuit, it is tested and analyzed. The outputs are decided not suitable for direction sensing motion detector of this project. The reason is it hard to understand the circuit behavioural and it output does not match the needs of this project and more suitable for movement motion detection. The last circuit design is a combination of two second pyroelectric sensor circuit. One of the pyroelectric sensor circuits is used to sense horizontal motion movement and another is for sensing vertical motion movement. So the last circuit design will cover all kind of object position and make both servo motors movement maximize. This will help the project camera stand move very flexible. 53 Figure 24: Finalize Pyroelectric Sensor Schematic Design 54 4.4.3. Mechanical Design Mechanical design is consist of positioning servo motor and joint forming a strong and simple stand for video camera. This design will make the stand move the mounted video camera in horizontal movement and vertical movement. Both movement in horizontal and vertical when combined shall make the mounted video camera on the stand act like a human eye because it will cover all view in front of it and however it would not be as flexible as human neck. Why the design is said simple? Maybe it would be very simple instead of simple because it only needs two U shapes and one base. The two U shapes are consist of a small U shape size of aluminium and a medium U shape size of aluminium that wide enough to support a video camera. It is strong enough because they are made of aluminium. Video Camera Sensors Servo Motors Main Circuit Boards Stand Figure 25: Hardware Design 55 The base is made of plastic that strong enough to support the weight of medium size of video camera and the mechanical parts. Plastic materials are chosen instead of stronger materials to ease testing and analyzing process. The plastic base is not only for supporting video camera and the mechanical parts but also all electronic circuit involve in this project. The base has a cap that can be easily remove and install to reach an electronic circuit that required a special setting like pyroelectric sensor circuit. Chapter 5 RESULTS 5. Chapter Overview This chapter is about the final results for this project. The actual results cannot be shown here in this chapter since it’s’ was a hardware mechanical movement. However this chapter will views thoroughly results of this project and the project details have been discussed in the previous chapter. 57 5.1. Hardware Part The hardware part is consisting of electronic circuits, and stand and mechanical structure for this project. Results are shown in figures. 5.1.1. Electronic Circuits There are only two main electronic circuits in that is microcontroller circuit and electronic circuit is sensor circuit. 5.1.1.1. Microcontroller Circuit Servo Motor Pins Serial Communication Interface Microcontroller unit Reset Voltage Regulator Tack Switches Clock Figure 26: Microcontroller Circuit Figure 26 show microcontroller consist of reset circuit, clock circuit, SCI circuit also added some tack switches for testing procedure. 58 5.1.1.2. Sensor circuit Horizontal Signal Voltage Regulator Vertical Signal Wires connected to sensors Quad-amplifier Figure 27: Sensor Circuit Figure 28: Sensors Figure 27 show sensor circuit while figure 28 show sensors. Sensors are split from the sensor circuit to ease mounting on mechanical structure. 59 5.1.2. Stand and Mechanical Structure U shape aluminium Servo motor Base stand Figure 29: Mechanical Structure Stand and the mechanical structure are made simple and tough enough to support sensors and CCTV video camera. 60 5.1.3. Overall Hardware Part CCTV video camera Horizontal sensor Vertical sensor Figure 30: Embedded Video Camera Movement Controller System Figure 29 show a complete hardware part. As seeing in the figure, sensors are mounting directly so range for motion direction movement is about three feet. It is limited, but enough to functional. 61 5.2. Program Part The hardware part works correctly as expected when programmed. The program source code can be view in the appendix A. the program is quite simple consist of initializing value, simple control method, subroutine, and timer operation using output compare and setting output compare interrupt. Chapter 6 Discussion, Suggestion, and Conclusion 6. Chapter Overview This chapter content of discussion, suggestion, and conclusion of the project. The discussion is discussing about results and a related topic in achieving the objective of the project. Suggestion is about a new implementation or idea that can be done to improve project quality. The conclusion will summarize overall of thesis content. 63 6.1. Discussion This project has three major components that are briefly discuss in the scope of the project in the chapter one. The project blocks diagram also shown these components in figure 17 in the chapter 4. These three main components are controller part, mechanical part, sensor part. Last component is the controller part which is using M68HC11E1 the Motorola microcontroller. This microcontroller has been used widely in many applications as a control unit system .This microcontroller unit is selected by considering basis knowledge that already learned. The M68HC11 is an advance 8 bit microcontroller with significant ability and internal peripheral. There are many advantages in using microcontroller for this project rather than using microprocessor. The microcontroller acts like microcomputer because all of basic component for microprocessor such as EEPROM, ROM, RAM, and analogue digital converter are already embedded in this system. There are five ports in the microcontroller namely Port A, Port B, Port C, Port D and Port E. Normally, not all ports are used to a certain project. Each port has different function. Port B is used as an output port, for example, to send pulse width modulation signal to the servomotors. Port E is used as an input port. The sensors can be connected to this port as input for feedback controls. Port C and Port D are different with previous ports. Both ports can be set as an input or output. This microcontroller also has Serial Communication Interface (SCI), Serial Peripheral Interface (SPI) and also has 8 channel 8-bit analogue digital converters. Moreover, output capture and input capture system also included. For controlling aspect, the value controlled is PWM signals base on sensors signals. Inputs for microcontroller unit are put through Port E that is a one directional type data 64 for inputs only. Port E for M68HC11E1 only has 4 pins and all connected to 4 signal output from sensor circuit. PE0 is connected to LEFT signal, PE1 is connected to RIGHT signal, PE2 is connected to DOWN signal, and PE3 is connected to UP signal. While the outputs are using Port A and connected to Output Compare pins which is OC4 connected to servo motor for vertical movement and OC5 connected to servo motor for horizontal movement. The control processes are when object detected in the range then the object position is decided by which direction it is moving. There are 8 set of position that has been program to the microcontroller unit. The position is DOWN-LEFT, DOWN-RIGHT, UPLEFT, UP-RIGHT, DOWN, UP, LEFT, RIGHT. See table 3. Position Input Signal (PE3, PE2, PE1, PE0) LEFT(L) (0,0,0,1) RIGHT(R) (0,0,1,0) DOWN(D) (0,1,0,0) UP(P) (1,0,0,0) DOWN-LEFT(DL) (0,1,0,1) DOWN-RIGHT(DR) (0,1,1,0) UP-LEFT(UL) (1,0,0,1) UP-RIGHT(UR) (1,0,1,0) Table 3: Positioning Signal The microcontroller unit will generate two PWM signal base on the inputs signal as there are two output signals for controlling vertical and horizontal movement. The control flow is shown in the in figure 30. The program coding can be view in appendix A. 65 Initialize Start H_Signal=Position V_Signal=Position Y UL Move to position UL N Y UR Move to position UR N Y DL Move to position DL N Y DR Move to position DL N Y D Move to position D N Y U Move to position U N Y L Move to position L N Y R Move to position R N Figure 31: Control Program Flow Chart 66 The hardware shown in figure 29 is working correctly ass expected. There are two tests that have been conducted and captured in video and it is included in CD with this thesis. In this Chapter also illustrates the test visual. First test is with my own self as an object. The project hardware is place in a table and object sits on a chair next to the table. See figure 32.Sequent 1 show object move to the left and stop. Sequent 2 show project hardware starts to keep focus on object and lock video camera focus on object. Sequent 3 show object move again, object move to the right. Sequent 4 shows then again project hardware keeps the video camera lock focus on object by moving also to the right. Sequent 1 Sequent 2 Sequent 3 Sequent 4 Figure 32: CCTV View 67 Sequent 1 Sequent 2 Sequent 3 Sequent 4 Figure 33: Overall View See figure 33.Sequent 1 show object move forward and stop. Sequent 2 show project hardware starts to keep focus on object and lock video camera focus on object. Sequent 3 show object move again, object move backward. Sequent 4 shows then again project hardware keeps the video camera lock focus on object by moving also to the right. Note that the action for figure 31 and figure 33 taken are the same but it is captured separately. One of the characteristic of project output is the video camera will lock focus on one life form. However if there are more than one life form on the surveillance area, there is no expectant behaviour of the system. This is a hardware project and the stability depends on test & troubleshoots phase. Nevertheless it is a costly project. 68 6.2. Suggestion From results and discussion there are still many more features can be added and the performance can be increase the project hardware stability. Here are some suggestions that can be done for improvement. The sensors performance can be improve extremely if the mounting process has been research properly. Since there a lot of stability problem, so there is not enough time for the research. Research can be conduct by internet, hardware testing to understand how the Fresnel lens can be mounting effectively. Currently in sensor performance of distance attribute there is about 0.03% of the maximum performance. Note that without a fresnel lens, sensor ranges is about 3 feet and with lens it’s about 90 feet. The process control also can be upgrade. Currently process control is quite simple that is just a direct control method. The project hardware currently also not moving smoothly and cannot follow a high speed movement. The look-up table cannot be implementing concurrently because the degree of movement cannot be determine by project hardware by any mean since it’s not equipped with measurement sensor. However with PWM signal mapping method the degree movement can be determine after project hardware finished her move. Suggestion for improving process control can be done if the hardware project support with an intelligent element such as fuzzy logic. The object movement can be determining by inference engine from set of knowledge base. With this upgrade there possibility project hardware can follow a higher speed than currently performance. In the implementing process it has already test with fuzzy logic control method, however it’s failed to archive the project objective because there are limited memory of M68HC11E1 microcontroller unit in a single mode. It’s is suggested to use and external memory since the microcontroller unit do support the fuzzy logic with a specific tools from Motorola itself. 69 6.3. Conclusion The Embedded Video Camera Movement Controller System project has been successfully archiving the objectives of project set up in the beginning of the project. This project result operates base on focussing a life form within range of sensor and it is a embedded system that control Video camera stand movement. The project will be the 1st controlled system base on pyroelectric sensors in faculty of electrical engineering, Universiti Teknologi Malaysia for as long as I know and expected to be capable to lock on a life form that emits heat similar to human in it surveillance area. Overall progress for the project is good. 70 References [1]: Motorola, “M68HC11E Family Technical Data”, Motorola Inc [2]: Peter Spasov (2004).”Microcontroller Technology” (international edition), Prentice Hall [3]:http://www.microsyl.com [4]: Glolab “Infrared Parts Manual”, Glolab Corporation. 71 Appendix A Program Coding REGBAS PORTE EQU EQU $1000 $0A OC1M OC1D TCNT EQU EQU EQU $0C $0D $0E TOC4 TOC5 TCTL1 TCTL2 TMSK1 TFLG1 TMSK2 TFLG2 PACTL EQU EQU EQU EQU EQU EQU EQU EQU EQU $1C $1E $20 $21 $22 $23 $24 $25 $26 OC4HI OC4LO OC5HI OC5LO EQU EQU EQU EQU $48 $4A $4C $4E SENSOR MEMV MEMH EQU EQU EQU $50 $52 $54 ORG $B600 ;--------------------------; INITIALIZE ;--------------------------LDS #$01FF LDX #REGBAS ;--------------------------;INITIALIZE OUTPUT CAPTURE VECTORS ;--------------------------- LDAA STAA LDY STY #$7E $D6 #SOC4I $D7 ;SET VECTOR SOC4I LDAA STAA LDY STY #$7E $D3 #SOC5I $D4 ;SET VECTOR SOC5I ;---------------------------;INITIALIZE SERVO POSITION ;---------------------------LDD #2800 STD MEMH LDD #2750 STD MEMV ; ; ; ; JSR LDD STD LDD STD SERVO4 #2800 OC4HI #37200 OC4LO ;SERVO OC4 (UpDown) 72 ; ; ; ; JSR LDD STD LDD STD SERVO5 #2700 OC5HI #37300 OC5LO ;SERVO OC5 (LeftRight) JSR INITOC CLI ;ENABLE INTERRUPT ********************************************************************************************* LOOP LDAA PORTE,X ;load sensor signal JSR LENGAH STAA SENSOR BRCLR SENSOR #%00001001 SERVOUL ;position sensing BRCLR SENSOR #%00001010 SERVOUR BRCLR SENSOR #%00000101 SERVODL BRCLR SENSOR #%00000110 SERVODR BRCLR SENSOR #%00000100 SERVOD BRCLR SENSOR #%00001000 SERVOU BRCLR SENSOR #%00000001 SERVOLtemp BRCLR SENSOR #%00000010 SERVORtemp BRA LOOP SERVORtemp SERVOLtemp JMP JMP SERVOR SERVOL SERVOU JSR LDD ADDD STD JSR BRA LENGAH MEMV #100 MEMV SERVO4 LOOP LDD ADDD STD BSR LDD SUBD STD BSR BRA JSR LENGAH MEMV #100 MEMV SERVO4 MEMH #100 MEMH SERVO5 LOOP LDD ADDD STD BSR LDD ADDD STD BSR BRA JSR LENGAH MEMV #100 MEMV SERVO4 MEMH #100 MEMH SERVO5 LOOP BSR LDD SUBD STD BSR BRA LENGAH MEMV #100 MEMV SERVO4 LOOP LDD SUBD STD BSR LDD BSR LENGAH MEMV #100 MEMV SERVO4 MEMH SERVOUL SERVOUR SERVOD SERVODL ;OVER OFSET VALUE 73 SUBD STD BSR JMP #100 MEMH SERVO5 LOOP LDD SUBD STD BSR LDD ADDD STD BSR JMP BSR LENGAH MEMV #100 MEMV SERVO4 MEMH #100 MEMH SERVO5 LOOP SERVOL BSR LDD SUBD STD BSR JMP LENGAH MEMH #100 MEMH SERVO5 LOOP SERVOR BSR LDD ADDD STD BSR JMP LENGAH MEMH #100 MEMH SERVO5 LOOP SERVODR ********************************************************************************************* SERVO4 LDD STD LDD SUBD STD RTS MEMV OC4HI #40000 OC4HI OC4LO LDD STD LDD SUBD STD RTS MEMH OC5HI #40000 OC5HI OC5LO SERVO5 ;-----------------;SPECIAL SUBRUTIN ;-----------------LENGAH ULANG LDY DEY BNE RTS #21429 ;WAIT 75ms ULANG ;--------------------------------;INITIALIZE OUTPUT COMPARE CAPTURE REGISTER ;--------------------------------INITOC LDX PSHA PSHB #REGBAS LDD TCNT,X ;PRESERVE REGISTER 74 STD STD TOC4,X TOC5,X LDAA STAA #$0F TCTL1,X ;OM4;5:OL4;5=1:1 TO SET ;OC4 TO OC5 HIGH FIRST TIME LDAA STAA STAA #$18 TFLG1,X TMSK1,X ;CLEAR OC4F TO OC5F PULB PULA RTS ;SET OC4I TO OC5I ENABLE INTERRUPT ;RETURN ;---------------------------------------------;INTERRUPT OUTPUT CAPTURE4 ;---------------------------------------------SOC4I LDX #REGBAS BRCLR LDD BRA TCTL1,X,$04,SETLO4 OC4HI NEWTOC4 LDD OC4LO ADDD STD TOC4,X TOC4,X LDAA EORA STAA BCLR TCTL1,X #%00000100 TCTL1,X TFLG1,X,$EF SETLO4 NEWTOC4 ;INVERT OL4 TO TOGGLE RTI ;---------------------------------------------;INTERRUPT OUTPUT CAPTURE5 ;---------------------------------------------SOC5I LDX #REGBAS BRCLR LDD BRA TCTL1,X,$01,SETLO5 OC5HI NEWTOC5 LDD OC5LO ADDD STD TOC5,X TOC5,X LDAA EORA STAA BCLR TCTL1,X #%00000001 TCTL1,X TFLG1,X,$F7 SETLO5 NEWTOC5 ;INVERT OL5 TO TOGGLE RTI ************************************************************************************************** 75 Appendix B Component List NAMA *STAF / PELAJAR : MOHD FADZLI BIN SULAIMAN NAMA *KETUA MAKMAL/ PENYELIA PROJEK TAJUK *UJIKAJI / PROJEK BIL. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 : EN. ZURAIMI YAHYA NO. * PEKERJA / MATRIK *JABATAN / KURSUS : AE000474 : 5 SEC : SISTEM KAWALAN GERAKAN KAMERA TERBENAM DENGAN SISTEM BANTUAN KOMPUTER. BAHAN/KOMPONEN KETERANGAN (UNIT/NOMBOR/SPEK) KUANTITI CLOCK 8 MHz CRYSTAL 27pF CAPASITOR 10MΩ RESISTOR 2 6 4 RESET MC34064P TACT SUIS 4.7KΩ RESISTOR 3 3 3 LM7805 +5 VOLTAGE REGILATOR 4 POWER SUPPLY 100µF 16V ELECTROLYTIC CAPASITOR 4 10µF 25V ELECTROLYTIC CAPASITOR 4 DC CONECTOR-3.5mm DC JACK PLUG (FEMALE) 4 SCI MAX232 10µF ELECTROLYTIC CAPASITOR Serial Connector 9 pin D_SUB (female) 1 6 1 Catatan *Ketua Makmal / Penyelia projek: ________________________________________________________________ Tandatangan *Ketua Makmal / Penyelia ………………………………. Tarikh: ……………………. Tandatangan Juruteknik Stor & Woksyop …..….……………………… Tarikh: …………………… 76 Lampiran 1 BIL. BAHAN/KOMPONEN Motor SENSORS KETERANGAN (UNIT/NOMBOR/SPEK) KUANTITI Servo Motor LED 2 10 TACT SUIS 100KΩ 1/8 watt 5% carbon film 10KΩ 1/8 watt 5% carbon film 1 MΩ 1/8 watt 5% carbon film 2 MΩ 1/8 watt 5% carbon film 300KΩ 1/8 watt 5% carbon film 1 MΩ potentiometer (EVM-L4GA00B16) 1N914 diode 100 pF 50 volt ceramic disc (50S5-101J) 10 µF 16 volt electrolytic (MLRL16V10) 1 µF 50 volt metalized film (ECQ-V1H104JL) 2N7000 Field Effect Transistor LP324N or equivalent micropower quad operational amplifier CD4538 CMOS dual single shot (CD4538BCN) PIR325 pyroelectric infrared sensor O RING – spacer (BUNA-N size 009) IC socket - 14 pin (390261-3) IC socket - 16 pin (390261-5) 6 10 10 3 6 6 6 8 3 12 8 6 10 MISCELLANEOUS PCB Board Itching Powder (PCB Sticker) Microcontroller MC68HC11E1 48-Pin Dip 48 Pin Dip IC Socket Double Wire (Multi-Core) Triple Wire (Multi-Core) Jumper Wire Pin Header female 35 pin Pin Header male 35 pin Infrared Fresnel lens (focal length of 0.65 inch) 2 2 2 10 2 3 1 packet 2 set 2 2 * * * 4 4 2