RF CONTROLLED VEHICLE ROBOT WITH METAL DETECTOR PAGE NO. 1. ABSTRACT 10 2. INTRODUCTION TO EMBEDDED SYSTEMS 13 3. BLOCK DIAGRAM OF PROJECT 4. HARDWARE REQUIREMENTS 4.1 VOLTAGE REGULATOR 4.2 MICROCONTROLLER (AT89S52/C51) 4.3 PUSH BUTTONS 4.4 MOTOR DRIVER L293D 4.5 DC MOTOR 4.6 ENCODER AND DECODER (HT12E, HT12D) 4.7 MICRO CONTROLLER AT89C2051 4.8 BATTERY 4.9 RF MODULE 4.10 BC547 4.11 1N4007 4.12 RESISTOR 4.13 CAPACITOR 4.14 METAL DETECTOR 5. SOFTWARE REQUIREMENTS 56 5.1 IDE 57 5.2 CONCEPT OF COMPILER 57 5.3 CONCEPT OF CROSS COMPILER 58 5.4 KEIL C CROSS COMPILER 59 5.5 BUILDING AN APPLICATION IN UVISION2
5.6 CREATING YOUR OWN APPLICATION IN UVISION2 59 5.7 DEBUGGING AN APPLICATION IN UVISION2 60 5.8 STARTING UVISION2 & CREATING A PROJECT 61 5.9 WINDOWS_ FILES 61 5.10 BUILDING PROJECTS & CREATING HEX FILES 61 5.11 CPU SIMULATION 62 5.12 DATABASE SELECTION 62 5.13 START DEBUGGING 63 5.14 DISASSEMBLY WINDOW 63 5.15 EMBEDDED C 64 6. SCHEMATIC DIAGRAM 66 6.1 DESCRIPTION 67 7. LAYOUT DIAGRAM 71 8. BILL OF MATERIALS 72 9. CODING 75 9.1 COMPILER 76 9.2 SOURCE CODE 84 10. HARDWARE TESTING 88 10.1 CONTINUITY TEST 88 10.2 POWER ON TEST 89 11. RESULTS 69 12. CONCLUSION 93 13. BIBLIOGRAPHY 94
4. HARDWARE REQUIREMENTS HARDWARE COMPONENTS: 1. BATTERY 2. VOLTAGE REGULATOR 3. MICRO CONTROLLER AT89C2051 4. MICRO CONTROLLER AT89S8052 5. PUSH BUTTONS 6. L293D 7. DC MOTOR 8. RF MODULE 9. BC547 10. 1N4007 11. RESISTOR 12. CAPACITOR 13. METAL DETECTOR 14. 4.2VOLTAGE REGULATOR 7805 15. Features 16. Output Current up to 1A 17. Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V 18. Thermal Overload Protection 19. Short Circuit Protection 20. Output Transistor Safe Operating Area Protection 21. 22. Description 23. The LM78XX/LM78XXA series of three-terminal positive regulators are available in the TO-220/D-PAK package and with several fixed output voltages, making them useful in a Wide range of applications. Each type employs internal current limiting, thermal shutdown and safe operating area protection, making it essentially indestructible. If adequate heat sinking is provided, they can deliver over 1A output Current. Although designed primarily as fixed voltage regulators, these devices can be used with external components to obtain adjustable voltages and currents. Internal Block Diagram
Absolute Maximum Ratings FIG 4.2(a): BLOCK DIAGRAM OF VOLTAGE REGULATOR TABLE 4.2(b): RATINGS OF THE VOLTAGE REGULATOR Typical Performance Characteristics What is the 2051 microcontroller? 4.3 MICROCONTROLLER AT89C2051 The 2051 is a 20 pin version of the 8051. It is a low-voltage, high-performance CMOS 8-bit microcomputer with 2K bytes of Flash programmable and erasable read only memory. Atmel manufactures the chip using high-density nonvolatile memory technology. The 2051 and is compatible with the industry-standard MCS-51 instruction set. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel 2051 is a powerful microcontroller. It provides a very flexible, cost-effective solution to many embedded control applications Operational features of the 2051 2051 Pin-out and Description Pin Description VCC: Supplies voltage and power. GND Ground. Port 1
Port 1 is an 8-bit bi-directional I/O port. Port pins P1.2 to P1.7 provide internal pull- ups. P1.0 and P1.1 require external pull-ups. P1.0 and P1.1 also serve as the positive input (AIN0) and the negative input (AIN1), respectively, of the on-chip precision analog comparator. The Port 1 output buffers can sink 20mA and can drive LED displays directly. When 1s are written to Port 1 pins, they can be used as inputs. When pins P1.2 to P1.7 are used as inputs and are externally pulled low, they will source current (IIL) because of the internal pull-ups. Port 1 also receives code data during Flash programming and verification. Port 3 Port 3 pins P3.0 to P3.5, P3.7 are seven bi-directional I/O pins with internal pull-ups. P3.6 is hard-wired as an input to the output of the on-chip comparator and is not accessible as a general purpose I/O pin. The Port 3 output buffers can sink 20mA. When 1s are written to Port 3 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 also serves the functions of various special features of the AT89C2051 as listed below: Port 3 also receives some control signals for Flash programming and verification. RST Reset input. All I/O pins are reset to 1s as soon as RST goes high. Holding the RST pin high for two machine cycles while the oscillator is running resets the device. Restrictions on Instructions The AT89C2051 and is the economical and cost-effective member of Atmel s family of microcontrollers. Therefore, it contains only 2K bytes of flash program memory. It is fully compatible with the MCS-51 architecture, and can be programmed using the MCS-51 instruction set. However, there are a few considerations one must keep in mind when utilizing certain instructions to program this device. All the instructions related to jumping or branching should be restricted such that the destination address falls within the physical program memory space of the device, which is 2K for the AT89C2051. This should be the responsibility of the software programmer. For example, LJMP 7E0H would be a valid instruction for the AT89C2051 (with 2K of memory), whereas LJMP 900H would not. Power-down Mode In the power down mode the oscillator is stopped, and the instruction that invokes power down is the last instruction executed. The onchip RAM and Special Function Registers retain their values until the power down model is terminated. The only exit from power down is a hardware reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be activated before VCC is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize. P1.0 and P1.1 should be set to 0 if no external pull-ups are used, or set to 1 if external pull-ups are used. The 2051 is a low voltage (2.7V - 6V), high performance CMOS 8-bit microcontroller with 2 Kbytes of Flash programmable and erasable read only memory (PEROM). This device is compatible with the industry standard 8051 instruction set and pin-out. The 2051 is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications. In addition, the 2051 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The Power Down Mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset. Idle Mode In idle mode, the CPU puts itself to sleep while all the on-chip peripherals remain active. The mode is invoked by software. The content of the on-chip RAM and all the special functions registers remain unchanged during this mode.
The idle mode can be terminated by any enabled interrupt or by a hardware reset. P1.0 and P1.1 should be set to '0' if no external pull ups are used, or set to '1' if external pull ups are used. It should be noted that when idle is terminated by a hardware reset, the device normally resumes program execution, from where it left off, up to two machine cycles before the internal reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this event, but access to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin when Idle is terminated by reset, the instruction following the one that invokes Idle should not be one that writes to a port pin or to external memory. 4.4 MICROCONTROLLER AT89S52 The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmel s high-density non volatile memory technology and is compatible with the industry standard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non volatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset. Features: Compatible with MCS -51 Products 8K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 10,000 Write/Erase Cycles 4.0V to 5.5V Operating Range Fully Static Operation: 0 Hz to 33 MHz Three-level Program Memory Lock 256 x 8-bit Internal RAM 32 Programmable I/O Lines Three 16-bit Timer/Counters Eight Interrupt Sources Full Duplex UART Serial Channel Low-power Idle and Power-down Modes Interrupt Recovery from Power-down Mode Watchdog Timer Dual Data Pointer Power-off Flag Fast Programming Time Flexible ISP Programming (Byte and Page Mode) Green (Pb/Halide-free) Packaging Option. Block Diagram of AT89S52:
4.5 PUSH BUTTONS A push-button (also spelled pushbutton) or simply button is a simple switch mechanism for controlling some aspect of a machine or a process. Buttons are typically made out of hard material, usually plastic or metal. The surface is usually flat or shaped to accommodate the human finger or hand, so as to be easily depressed or pushed. Buttons are most often biased switches, though even many un-biased buttons (due to their physical nature) require a spring to return to their un-pushed state. Different people use different terms for the "pushing" of the button, such as press, depress, mash, and punch. Uses: In industrial and commercial applications push buttons can be linked together by a mechanical linkage so that the act of pushing one button causes the other button to be released. In this way, a stop button can "force" a start button to be released. This method of linkage is used in simple manual operations in which the machine or process have no electrical circuits for control. Pushbuttons are often color-coded to associate them with their function so that the operator will not push the wrong button in error. Commonly used colors are red for stopping the machine or process and green for starting the machine or process. Red pushbuttons can also have large heads (mushroom shaped) for easy operation and to facilitate the stopping of a machine. These pushbuttons are called emergency stop buttons and are mandated by the electrical code in many jurisdictions for increased safety. This large mushroom shape can also be found in buttons for use with operators who need to wear gloves for their work and could not actuate a regular flush-mounted push button. As an aid for operators and users in industrial or commercial applications, a pilot light is commonly added to draw the attention of the user and to provide feedback if the button is pushed. Typically this light is included into the center of the pushbutton and a lens replaces the pushbutton hard center disk. The source of the energy to illuminate the light is not directly tied to the contacts on the back of the pushbutton but to the action the pushbutton controls. In this way a start button when pushed will cause the process or machine operation to be started and a secondary contact designed into the operation or process will close to turn on the pilot light and signify the action of pushing the button caused the resultant process or action to start. In popular culture, the phrase "the button" refers to a (usually fictional) button that a military or government leader could press to launch nuclear weapons. Push to ON button: Fig 4.7(a): push on button Initially the two contacts of the button are open. When the button is pressed they become connected. This makes the switching operation using the push button. 4.6 MOTOR DRIVER (L293D) Features: Wide supply-voltage range: 4.5V to 36V Separate input- logic supply Internal ESD protection Thermal shutdown High-Noise-Immunity input Functional Replacements for SGS L293 and SGS L293D Output current 1A per channel (600 ma for L293D) Peak output current 2 A per channel (1.2 A for L293D) Output clamp diodes for Inductive Transient Suppression(L293D
DESCRIPTION: L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as current amplifiers since they take a low-current control signal and provide a higher-current signal. This higher current signal is used to drive the motors. L293D contains two inbuilt H-bridge driver circuits. In its common mode of operation, two DC motors can be driven simultaneously, both in forward and reverse direction. The motor operations of two motors can be controlled by input logic at pins 2 & 7 and 10 & 15. Input logic 00 or 11 will stop the corresponding motor. Logic 01 and 10 will rotate it in clockwise and anticlockwise directions, respectively. Enable pins 1 and 9 (corresponding to the two motors) must be high for motors to start operating. When an enable input is high, the associated driver gets enabled. As a result, the outputs become active and work in phase with their inputs. Similarly, when the enable input is low, that driver is disabled, and their outputs are off and in the high-impedance state. Block diagram:
Pin description: 4.7 DC MOTOR What is DC Motor? A DC motor is an electric motor that runs on direct current (DC) electricity. 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. Let's start by looking at a simple 2-pole DC electric motor (here red represents a magnet or winding with a "North" polarization, while green represents a magnet or winding with a "South" polarization). Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator, commutator, field magnet(s), and brushes. In most common DC motors, the external magnetic field is produced by high-strength permanent magnets 1. The stator is the stationary part of the motor -- this includes the motor casing, as well as two or more permanent magnet pole pieces. The rotor rotates with respect to the stator. The rotor consists of windings (generally on a core), the windings being electrically connected to the commutator. The above diagram shows a common motor layout -- with the rotor inside the stator (field) magnets. RF MODULES What is RF? RF itself has become synonymous with wireless and high-frequency signals, describing anything from AM radio between 535 khz and 1605 khz to computer local area networks (LANs) at 2.4 GHz. However, RF has traditionally defined frequencies from a few khz to roughly 1 GHz. If one considers microwave frequencies as RF, this range extends to 300 GHz. The following two tables outline the various nomenclatures for the frequency bands. The third table outlines some of the applications at each of the various frequency bands.
Features Range in open space(standard Conditions) : 100 Meters RX Receiver Frequency : 433 MHz RX Typical Sensitivity : 105 Dbm RX Supply Current : 3.5 ma RX IF Frequency : 1MHz Low Power Consumption Easy For Application RX Operating Voltage : 5V TX Frequency Range : 433.92 MHz RF TRANSMITTER: Fig 4.9(a): 315/433 MHz TRANSMITTER General Description: The ST-TX01-ASK is an ASK Hybrid transmitter module. ST-TX01-ASK is designed by the Saw Resonator, with an effective low cost, small size, and simple-to-use for designing. Frequency Range: 315 / 433.92 MHZ. Supply Voltage: 3~12V. Output Power: 4~16dBm Circuit Shape: Saw RF RECEIVER: Fig.4.9(b):315/434 MHz ASK RECEIVER General Description: The ST-RX02-ASK is an ASK Hybrid receiver module. A effective low cost solution for using at 315/433.92 MHZ. The circuit shape of ST-RX02-ASK is L/C. Receiver Frequency: 315 / 433.92 MHZ Typical sensitivity: -105dBm Supply Current: 3.5mA IF Frequency: 1MHz