Вы находитесь на странице: 1из 45

Embedded Systems

A Training/project report submitted in partial fulfillment of the requirements for the award of the degree of

Bachelor of Technology

By

Kumar Satyam (11003378)

Lovely Professional University Jalandhar Delhi G. T Road (NH-1), Phagwara, Punjab, 144402, India
2013

DECLARATION
I hereby certify that the work, which is being presented in the Training/Project entitled Embedded Systems, in partial fulfilment of the requirement for the award of the Degree of Bachelor of Technology submitted to the institution is an authentic record of my own work carried out during the period 30 May 2013 to 10 July 2013 under the supervision of Mr. Chiranjit Kumar. I also cited the reference about the text(s)/figure(s)/table(s) from where they have been taken.

Date:

Signature

II OBJECTIVE OF TRAINING
A microcontroller can lift up many of our everyday life work, making work more facile and require of less human physical effort. So where the microcontroller is the brain of the machine we somehow need to control it. Would not it much more convenient if we were to sit comfortably in our chairs and let the press of a button do our job? Such a luxury is provided by the communication between the machine and our switch over the RF. In this project such a work is shown by controlling motors to run in a direction we want through wireless control and using 8051 microcontroller. So where, where the motors should run would be decided by us (whether left or right, forward or backward) the microcontroller would be the one to actually process our data and move the motors in that direction. RF module is used for the wireless communication here. Therefore with projects like such and with increasing its dimension we can achieve a lot more than just rolling motors.

III ACKNOWLEDGEMNET
First,I would like to express my best regards to our project guide Mr.Chirajeet kumar, whose valuable guidance, encouragement, and provision of necessary facilities made this work possible. Many thanks are owed to my group mates for their useful discussion and timely suggestions. Their technical support and encouragement helped me to finalize our project. Our special thanks to Mr. Abhishek who helped me a lot through the problems we came across. We would also like to express our gratitude towards the Cetpa Infotech Pvt. Ltd. for providing me with the best facilities and proper environment to work on my project. Finally I offer my great thanks and regards to my family for their support which helped us through the difficulty and hardships of life to earn this achievement.

IV TABLE OF CONTENTS
Title
DECLARATION.. OBJECTIVE. ACKNOWLEDGEMENT LIST OF TABLES LIST OF FIGURES.. CHAPTER 1 INTORDUCTION 1.1 Embedded Systems. 1.2 Microcontroller families CHAPTER 2 COMPANY PROFILE 2.1 Introduction CHAPTER 3 IDENTIFICATION OF TRAINING 3.1 work done in company. 3.2 Assembly Language and Instruction set of 8051 3.2.1 Introduction 3.2.2 Addressing Modes.. 3.2.3 Instruction types.

Pgae no

3.3 Interrupts. 3.4 Serial Communication. CHAPTER 4 IMPLEMENTATION DETAIL 4.1 LED Interfacing.. 4.2 7 SEGMENT Interfacing.. 4.3 LCD interfacing. 4.4 DC MOTOR Interfacing.. 4.5 Project(RF controlled robo car) V 4.5.1 Introduction. 4.5.2 Rf Module 4.5.3 HT12E. 4.5.4 HT12D. 4.5.5L293D 4.5.6 DC geared motor.. 4.5.7 Design Details.. 4.5.7.1 Receiver Design 4.5.7.2 Transmitter Design 4.5.7.3 Source code . CHAPTER 5 RESULT AND DISCUSSION 5.1 Introduction 5.2 Discussion... 5.2.1 Conclusion ... 5.2.2 Future Scope REFERENCES.

VI LIST OF TABLES

VII LIST OF FIGURES

VIII
CHAPTER 1 INTRODUCTION

1.1 EMBEDDED SYSTEMS An embedded system is a special-purpose system in which the computer is completely encapsulated by the device it controls. Unlike a general-purpose computer, such as a personal computer, an embedded system performs pre-defined tasks, usually with very specific requirements. Since the system is dedicated to a specific task, design engineers can optimize it, reducing the size and cost of the product. Embedded systems are often mass-produced, so the cost savings may be multiplied by millions of items.

Handheld computers or PDAs are generally considered embedded devices because of the nature of their hardware design, even though they are more expandable in software terms. This line of definition continues to blur as devices expand. Physically, embedded systems range from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers. Complexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a large chassis or enclosure. Embedded systems contain processing cores that are either microcontrollers or digital signal processors (DSP). The key characteristic, however, is being dedicated to handle a particular task. Since the embedded system is dedicated to specific tasks, design engineers can optimize it to reduce the size and cost of the product and increase the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale. Robotics and automation are a part of embedded systems itself. Robot development and automation needs study of embedded systems.

1 Examples of Embedded System are I. II. automatic teller machines (ATMs) avionics, such as inertial guidance systems, flight control hardware/software and other integrated systems in aircraft and missiles III. IV. V. cellular telephones and telephone switches computer equipment such as routers and printers engine controllers and antilock brake controllers for automobiles

Characteristics of Embedded Systems 1. Embedded systems are designed to do some specific task, rather than be a generalpurpose computer for multiple tasks. Some also have real-time performance constraints

that must be met, for reasons such as safety and usability; others may have low or no performance requirements, allowing the system hardware to be simplified to reduce costs. 2. The program instructions written for embedded systems are referred to as firmware, and are stored in read-only memory or Flash memory chips. They run with limited computer hardware resources: little memory, small or non-existent keyboard or screen. 3. Many embedded systems consist of small, computerized parts within a larger device that serves a more general purpose. For example- a line follower autonomous robot which follows a specific path and moves accordingly to the path. 4. The embedded systems are special purpose computer systems designed to perform only the specific purposes. For Example- a system designed to display numbers cannot be used to operate motors. Table 1.1: Microcontrollers v/s Microprocessors

Microcontrollers 1. A Microcontroller (sometimes abbreviated C, uC or MCU) is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. 2. Microcontrollers are designed to perform specific tasks. Specific means applications where the relationship of input and output is defined. Depending on the input, some processing needs to be done and output is delivered. For example, keyboards, mouse, washing machine, digicam, pen drive, remote, microwave, cars, bikes, telephone, mobiles, watches, etc.

Microprocessors 1. A Microprocessor is an IC which has only the CPU inside them i.e. only the processing powers such as Intels Pentium 1,2,3,4, core 2 duo, i3, i5 etc.

2. Microprocessor find applications where tasks are unspecific like developing software, games, websites, photo editing, creating documents etc.

3. Since the applications are very specific, they need small resources like RAM, ROM, I/O ports etc. and hence can be embedded on a single chip.

3. In such cases the relationship between input and output is not defined. They need high amount of resources like RAM, ROM, I/O ports etc. So needs external RAM, ROM and Memory.

4. The microcontrollers operate from a few MHz to 30 to 50 MHz 5.The microcontroller is designed for embedded applications. Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems.

4. The microprocessor operates above 1GHz as they perform complex tasks. 5.The microprocessors are used in personal computers or other general purpose applications such as for laptops and heavy applications where complexity is more and memory requirements are high.

1.2 MICROCONTROLLER FAMILIES 8051- These microcontrollers are old but still trendy and most of the companies fabricate these microcontrollers. The older types of 8051 have 12 clocks per instruction that make it sluggish whereas the recent 8051 have 6 clocks per instruction. The 8051 microcontroller does not have an in built memory bus and A/D converters. In 1980, Intel fabricated the single chip microcontroller 8051 with Harvard architecture.

PIC- Programmable Interface Controller is usually referred as PIC. They are slightly older than 8051 microcontrollers but excel cause of their small low pin count devices. They perform well

and are affordable. The Microchip technology fabricated the single chip microcontroller PIC with Harvard architecture. The programming part is very tedious and hence it is not recommended for beginners.

AVR(Advanced Version RISC) - In 1996, Atmel fabricated this single chip microcontroller with a modified Harvard Architecture. This chip is loaded with C- compiler, Free IDE and many more features. This microcontroller is a bit difficult for the starters to handle.

CHAPTER 2 COMPANY PROFILE

2.1 INTRODUCTION
CETPA InfoTech Pvt. Ltd. is an ISO 9001:2008 Certified Company deals in the field of Software Development, Embedded Products Development, Placement Consultancy and Engineers Training Programs. CETPA is the mission, which is working for the promotion of latest technologies in India and abroad. To achieve our goal, we have made collaboration with a

number of institutions and firms. CETPA deals in three different domains, first is education, second is development and third is consultancy.

CETPA Education: CETPA Education mainly deals in Engineers Training Programs in latest technologies for Engineering students, corporate and other professionals. Some of the technologies offered for training are .NET, VHDL, Embedded System, Advance Embedded System, CATIA, MATLAB, J2EE, Verilog HDL, Linux, AutoCAD, PCB & Circuit Designing, and Personality &

Entrepreneurship Development.

CETPA Consultancy: CETPA Consultancy helps to provide jobs for different field s students and professionals. CETPA consultancy was started to provide jobs to CETPA Certified students, who are made technologically strong by CETPA, are well placed by CETPA Consultancy. Hence the fresher trained by us are well absorbed in companies.

CETPA Development: CETPA development deals in software as well as embedded production development. In software domains, CETPA offers customized software products, web development, web

hosting, search engine optimization and other related products. In embedded domain, CETPA has developed a number of solutions like moving message displays, token display systems for private as well government organizations.

Table 2.1: CETPA Corporate Training Clients

CHAPTER 3 IDENTIFICATION OF TRAINING

3.1 WORK DONE IN COMPANY ARCHITECTURE OF 8051 The most commonly used microcontroller is 8051 families AT89C51 microcontroller which is produced by Atmel. It is widely used in most of the application for having an advantage of simple programming and low cost.
AT89C51

AT89C51 is an 8-bit, 40 pin microcontroller that belongs to Atmel's 8051 family. ATMEL 89C51 has 4KB of Flash programmable and erasable read only memory (PEROM) and 128 bytes of RAM. It can be erased and program to a maximum of 1000 times. In 40 pin AT89C51, there are four ports designated as P1, P2, P3 and P0. All these ports are 8-bit bi-directional ports, i.e., they can be used as both input and output ports. Except P0 which needs external pull-ups, rest of the ports have internal pull-ups. When 1s are written to these port pins, they are pulled high by the internal pull-ups and can be used as inputs. These ports are also bit addressable and so their bits can also be accessed individually.

FIG. 3.1: BLOCK DIAGRAM OF 8051

Address bus-For a device (memory or I/O) to be recognized by the CPU, it must beassigned an address. The address assigned to a given device must be unique. The CPU puts the address on the address bus, and the decoding circuitry finds the device. Data bus-The CPU either gets data from the deviceor sends data to it. Control bus-Provides read or write signals to the device to indicate if the CPU is asking for information or sending it information .

FIG.3.2: PIN DIAGRAM OF 89C51

Memory and Registers The 8051 microcontroller has a total of 256 bytes of RAM in which 128 is visible or user accessible and extra 128 is for special function registers. The user accessible RAM is used for temporary data storage. The user accessible RAM is from the address range 00 to 7Fh. From the user accessible RAM, 32 bytes of RAM is used for registers and rest for Stack operations. The 32 Bytes of RAM is divided into four register Banks i.e. Bank0, Bank 1, Bank 2, Bank3. Each of these banks have 8 Registers i.e. R0 to R7 each. RAM locations from 0 to 7 are set aside for bank 0 of R0 R7 where R0 is RAM location 0, Rl is RAM location 1, and R2 is location 2, and so on, until memory location 7, which belongs to

R7 of bank 0. The second bank of registers R0 R7 starts at RAM location 08 and goes to location 0FH. The third bank of R0 R7 starts at memory location 10H and goes to location 17H. Finally, RAM locations 18H to 1FH are set aside for the fourth bank of R0 R7.

FIG. 3.3: BANKS OF 89C51 Generally for normal operations, Register bank Bank0 is set by default. But we can switch to other banks by using PSW Commands.

FIG. 3.4: BANK ADDRESS OF 89C51 SFRs (Special Function Register) - These Registers are in extra 128 bytes of the memory. This part of memory is not user accessible and these registers are used for special purposes. These registers range from 80h to FFh. There are a total of only 21 SFRs in this range and all other addresses from 80h to FFh are invalid and there use can cause errors and not valuable results. Some of the SFRs are TCON, SBUF, ACC, B, SCON, TMOD SP, P0, PSW, TL0, and TL1. These all the registers have some specific function that has to be performed after they are programmed. (i) Byte Addressable SFR with byte address SP Stack printer 81H DPTR Data pointer 2 bytes DPL Low byte 82H DPH High byte 83H

TMOD Timer mode control 89H TH0 Timer 0 Higher order bytes 8CH TL0 Timer 0 Low order bytes 8AH TH1 Timer 1 High bytes = 80H TL1 Timer 1 Low order byte = 86H SBUF Serial data buffer = 99H PCON Power control 87H. DPTR - Data Pointer in 8051 16 bit register; it is divided into two parts DPH and DPL. DPH for Higher order 8 bits, DPL for lower order 8 bits. DPTR, DPH, DPL these all are SFRs in 8051.

3.2 ASSEMBLY LANGUAGE AND INSTRUCTION SET OF 8051


3.2.1 Introduction Assembly language is instructional language which contains instruction in the form of Mnemonics. How to Program an 8051 microcontroller [Label:] mnemonic [operands] [; comment] Mnemonics -Assembly level instructions are called mnemonic like MOV R5 Operands -On which the operation is performed.

Example: Loop: MOVR1, #25H; transfer 25H into R1

Label mnemonics operand comments

3.3.2 Addressing Modes


Table 3.2

Addressing modes Register Direct Indirect Immediate Relative Absolute Long Indexed

Instructions MOV A, B MOV 30H,A MOV A,@R0 MOV A,#80H SJMP +127/-128 of PC AJMP within 2K LJMP FAR MOVC A,@A+PC

Register Addressing Mode-The register addressing instruction involves information transfer between registers Example: MOV R0, A

Direct Addressing Mode- This mode allows you to specify the operand by giving its actual memory address (typically specified in hexadecimal format) or by giving its abbreviated name (e.g. P3).Used for SFR accesses Example: MOV A, P3; Transfer the contents of Port 3 to the accumulator

Indirect Addressing Mode-In the Indirect Addressing mode, a register is used to hold the effective address of the operand. This register, which holds the address, is called the pointer register and is said to point to the operand. Only registers R0, R1 and DPTR can be used as pointer registers. R0 and R1 registers can hold an 8-bit address whereas DPTR can hold a 16-bit address. DPTR is useful in accessing operands which are in the external memory. Examples: MOV @R0, A; Store the content of accumulator into the memory location pointed to by the contents of register R0. R0 could have an 8-bit address, such as 60H.

Immediate Addressing Mode-In the Immediate Constant Addressing mode, the source operand is an 8- or 16-bit constant value. This constant is specified in the instruction itself (rather than in

a register or a memory location). The destination register should hold the same data size which is specified by the source operand. Examples: ADD A, #030H; Add 8-bit value of 30H to the accumulator register (which is an 8-bit register).

TIMER_INIT: ORL TMOD, #01H;

TIMER_INIT subroutine

Indexed Addressing Mode-The Indexed addressing is useful when there is a need to retrieve data from a look-up table (LUT). A 16-bit register (data pointer) holds the base address and the accumulator holds an 8-bit displacement or index value. The sum of these two registers forms the effective address for a JMP or MOVC instruction. Example: MOV A, #08H; Offset from table start MOV DPTR, #01F00H; Table start address MOVC A, @A+DPTR; Gets target value from the table starts address + offset and puts it in A.

3.3.3 INSTRUCTION TYPES

The 8051 instructions are divided into five functionalgroups: Arithmetic operations Logical operations Data transfer operations Boolean variable operations Program branching operations

Arithmetic Instructions-This group of operators perform arithmetic operations. Arithmetic operations affect the flags, such as Carry Flag (CY), Overflow Flag (OV) etc., in the PSW register. The appropriate status bits in the PSW are set when specific conditions are met, which allows the user software to manage the different data formats (carry, overflow etc)

Arithmetic Instructions of 8051 are shown as follows [@ RI] implies contents of memory location pointed to by R0 or R1. Rn refers to registers R0-R7 of the currently selected register bank.

Table 3.3: Arithmetic Instruction set of 8051

Logical Instructions-Logical instructions perform standard Boolean operations such as AND, OR, XOR, NOT (compliment). Other logical operations are clear accumulator, rotate accumulator left and right, and swap nibbles in accumulator. Examples: ANL A, #02H; ORL TCON, A; Mask bit 1 TCON=TCON OR A

Table 3.4: logical Instruction set

Data Transfer Instructions- Data transfer instructions can be used to transfer data between an internal RAM location and an SFR location without going through the accumulator. It is also possible to transfer data between the internal and external RAM by using indirect addressing. The upper 128 bytes of data RAM are accessed only by indirect addressing and the SFRs are accessed only by direct addressing. Table 3.5: Instructions for Data Transfer-

Program Branching Instructions- Program branching instructions are used to control the flow of program execution. Some instructions provide decision making capabilities before

transferring control to other parts of the program e.g. conditional and unconditional branches. the following table contains all the branching instructions. Table 3.6: Branching Instruction

3.4 INTERUPTS An interrupt is an external or internal event that interrupts the microcontroller to inform it that a device needs its service. The advantage of interrupts is that the microcontroller can serve many devices. Each device can get the attention of the microcontroller based on the assigned priority. The microcontroller can also ignore (mask) a device request for service.

Hardware and Software interrupt The interrupts in a controller can be either hardware or software. If the interrupts are generated by the controllers inbuilt devices, like timer interrupts; or by the interfaced devices, they are called the hardware interrupts. If the interrupts are generated by a piece of code, they are termed as software interrupts.

The 8051 controller has six hardware interrupts of which five are available to the programmer.

1. RESET Interrupt - This is also known as Power on Reset (POR). When the RESET interrupt is received, the controller restarts executing code from 0000H location. This is an interrupt which is not available to or, better to say, need not be available to the programmer. 2. Timer interrupts - Each Timer is associated with a Timer interrupt. A timer interrupt notifies the microcontroller that the corresponding Timer has finished counting. Therefore these are two interrupts for the timers. 3. External interrupts - There are two external interrupts EX0 and EX1 to serve external devices. Both these interrupts are active low. In AT89C51, P3.2 (INT0) and P3.3 (INT1) pins are available for external interrupts 0 and 1 respectively. An external interrupt notifies the microcontroller that an external device needs its service. 4. Serial interrupt - This interrupt is used for serial communication. When enabled, it notifies the controller whether a byte has been received or transmitted.

Fig. 3.5: Interrupts of 8051

The interrupts must be enabled by software in order for the microcontroller to respond to them. Interrupt Enable Register- There is a register called IE (interrupt enable) that is responsible for enabling(unmasking) and disabling (masking) theinterrupts.

EA

--------

ET2

ES

ET1

EX1

ET0

EX0

Fig. 3.6: Interrupt enable register

To enable any of the interrupts, first the EA bit must be set to 1. After that the bits corresponding to the desired interrupts are enabled.

ET0, ET1 and ET2 bits are used to enable the Timer Interrupts 0, 1 and 2, respectively. In AT89C51, there are only two timers, so ET2 is not used. EX0 and EX1 are used to enable the external interrupts 0 and 1. ES is used for serial interrupt.

EA bit acts as a lock bit. If any of the interrupt bits are enabled but EA bit is not set, the interrupt will not function. By default all the interrupts are in disabled mode.

3.5 SERIAL PORT COMMUNICATION The 8051 microcontroller transmits data serially as well as parallel communication is also done. For serial communication, the microcontroller comes with serial communication pin TXD and RXD. Normally TXD is used for transmitting serial data which is in SBUF register, RXD is used for receiving the serial data. SCON register is used for controlling the operation. The two registers used for controlling the communication are SCON and SBUF.

Serial Communication

Parallel Communication

Fig. 3.7 : Serial Communication

Serial data communication uses two methods Synchronous method transfers a block of data at a time Asynchronous method transfers a single byte at a time

It is possible to write software to use either of these methods, but the programs can be tedious and long. There are special IC chips made by many manufacturers for serial communications UART (universal asynchronous Receiver transmitter) USART (universal synchronous-asynchronous Receiver-transmitter)

The rate of data transfer in serial data communication is stated in bps (bits per second). Another widely used terminology for bps is baud rate.

SCON

Fig. 3.8: scon register RI (Receive Interrupt Flag)-Set by hardware on receiving. Must be cleared by software TI (Transmit Interrupt Flag) -Set by hardware on transmitted, must clear by hardware

Operating modes Mode 0- 8-bit shift register, f/12 1Mbit with 12 MHz Oscillator Frequency Mode 1- 8-bit UART, variable baud rate Mode 2 -9-bit UART, f/64 or f/32 187.5K and 375K with 12MHz Oscillator Frequency Mode 3- 9-bit UART, variable baud rate.

SBUF These are two separate data buffers for transmit and receive. The register SBUF is used to hold both the transmitter and receiver serial port data. To transmit the data, load SBUF register with data. MOV SBUF, source When transmission is complete the TI bit will be set in the SCONregister.

When a data frame is received the RI bit in SCON is set high. The received data may then be loaded from SBUF MOV destination, SBUF Data reception is double buffered.

3.6 CERTIFICATE

CHAPTER 4 IMPLEMENTATION DETAIL

4.1 LED INTERFACING


Interfacing an LED with 8051 is easy. The I/O pins are used as output pins. When any of the bit is set to 1, the LED glows if LED n side is connected to ground and p side with bit. And if p side is connected to power and n side to bit, then on bit low, the LED glows.

CodeORG 0000h loop: CLR P2.0 CALL DELAY

SETB P2.0 CALL DELAY JMP loop delay: mov R7,#100 L1_delay: djnz r7, L1_delay Ret

Fig. 4.1: LED Interfacing

4.2 SEVEN SEGMENT INTERFACING


A seven segment consists of eight LEDs which are aligned in a manner so as to display digits from 0 to 9 when proper combination of LED is switched on. Seven segment uses seven LEDs to display digits from 0 to 9 and the eighth LED is used for the dot. A typical seven segment looks like as shown in the figure below.

Fig. 4.2: 7 SEGMENT CodeORG 000H START: MOV A, #00001001B MOV B, A MOV R0, #0AH LABEL: MOV A, B INC A MOV B,A MOVC A,@A+PC MOV P1, A ACALL DELAY DEC R0 MOV A, R0 JZ START SJMP LABEL DB 3FH DB 06H DB 5BH DB 4FH

DB 66H DB 6DH DB 7DH DB 07H DB 7FH DB 6FH DELAY: MOV R4,#05H WAIT1: MOV R3,#00H WAIT2: MOV R2,#00H WAIT3: DJNZ R2,WAIT3 DJNZ R3,WAIT2 DJNZ R4,WAIT1 RET END

Fig.4.3: 7-SEGMENT INTERFACING

4.3 LCD INTERFACING

A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers. 1. Command/Instruction Register - stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing, clearing the screen, setting the cursor position, controlling display etc. 2.Data Register - stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD. Code-

Fig.4.4: HEX CODE FOR LCD

Fig. 4.5: LCD INTERFACING

4.4 INTERFACING MOTOR WITH 8051

Interfacing DC motor to 8051 forms an essential part in designing embedded robotic projects. A well designed 8051-DC motor system has essentially two parts. Firstly an 8051 with the required software to control the motor and secondly a suitable driver circuit.

L293D-L293 is a dedicated quadruple half H bridge motor driver IC available in 16 pin package. The L293 is designed to provide bidirectional drive currents of up to 1 A at voltages from 4.5 V to 36 V.

Fig. 4.6: MOTOR INTERFACING CodeORG 00H // initial starting address MAIN: MOV P1,#00000001B // motor runs clockwise ACALL DELAY // calls the 1S DELAY MOV P1,#00000010B // motor runs anti clockwise ACALL DELAY // calls the 1S DELAY SJMP MAIN // jumps to label MAIN for repaeting the cycle DELAY: MOV R4,#0FH WAIT1: MOV R3,#00H WAIT2: MOV R2,#00H WAIT3: DJNZ R2,WAIT3 DJNZ R3,WAIT2 DJNZ R4,WAIT1 RET END

2.3 PROJECT (RF CONTROLLED ROBO CAR)

2.3.1 INTRODUCTION There are many ways to communicate data that is wireless or wired. Now we are going to transfer the data wireless using RF. And we are going to control the robot with this project. This project describes a design of effective data communication without wires and air as communication medium using RF. The source information is generated by a key pad and this will be sent to destination through RF communication. The receiving system will check the data and control the robot as per as our concern.

2.3.2 RF MODULE Radio Frequency (RF) communication has a ton of applications. It can be used in robots, home automation, special effects, or in any application that needs the wireless transfer of data. The data transfer speed varies based on the receiver and transmitter. In the real world, with all the electrical interference, we get around 240 bytes per second. However, since half of the 240 bytes per second is used for encoding, we really can only do 120 bytes of data a second. In reality the range is closer to 250 feet. 2.3.3 HT12E HT12E is a 212 series encoder IC (Integrated Circuit) for remote control applications. It is commonly used for radio frequency (RF) applications. By using the paired HT12E encoder and HT12D decoder we can easily transmit and receive 12 bits of parallel data serially. HT12E simply converts 12 bit parallel data in to serial output which can be transmitted through a RF transmitter. These 12 bit parallel data is divided in to 8 address bits and 4 data bits. By using these address pins we can provide 8 bit security code for data transmission and multiple receivers may be addressed using the same transmitter. 2.3.4 HT12D

This IC is paired with HT12E. For proper operation a pair of encoder/decoder with the same number of address and data format should be selected. The Decoder receive the serial address and data from its corresponding decoder, transmitted by a carrier using an RF transmission medium and gives output to the output pins after processing the data. 4.5.5 L293D 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. 4.5.6 DC Geared motor A geared DC Motor has a gear assembly attached to the motor. The speed of motor is counted in terms of rotations of the shaft per minute and is termed as RPM.

Fig 4.7. DC geared motor 4.5.7 DESIGN DETAIL The RF module, as the name suggests, operates at Radio Frequency. The corresponding frequency range varies between 30 kHz & 300 GHz. In this RF system, the digital data is represented as variations in the amplitude of carrier wave. This kind of modulation is known as Amplitude Shift Keying (ASK). Transmission through RF is better than IR (infrared) because of many reasons. Firstly, signals through RF can travel through larger distances making it suitable for long range applications. Also, while IR mostly operates in line-of-sight mode, RF signals can travel even when there is an obstruction between transmitter & receiver. Next, RF transmission is more strong and reliable than IR transmission. RF communication uses a specific frequency unlike IR signals which are affected by other IR emitting sources.

FIG.4.8: PIN DIAGRAM OF RF MODULE

4.5.7.1 Transmitter design

RF transmitters are an essential part of modern communications. Designed and assembled from core RF components, RF transmitters have many different forms and applications. We often think of RF transmitters in wireless communications. The system allows one way communication between two nodes, namely, transmission and reception. The RF module has been used in conjunction with a set of four channel encoder/decoder ICs. Here HT12E & HT12D have been used as encoder and decoder respectively. The encoder converts the parallel inputs (from the remote switches) into serial set of signals. These signals are serially transferred through RF to the reception point. The decoder is used after the RF receiver to decode the serial format and retrieve the original signals as outputs. Encoder IC (HT12E) receives parallel data in the form of address bits and control bits. The control signals from remote switches along with 8 address bits constitute a set of 12 parallel signals. The encoder HT12E encodes these parallel signals into serial bits. Transmission is enabled by providing ground to pin14 which is active low. The control signals are given at pins 10-13 of HT12E. The serial data is fed to the RF transmitter through pin17 of HT12E. Operating parameters, cost, and design considerations impact RF transmitter performance and, subsequently, the RF signal quality. Consequently, ensuring the RF transmitter meets specification is essential in quality RF communications. Across various implementations of RF transmitters there are standard tests that are essential to ensuring proper operation. RF power measurements take many forms, depending on the RF transmitter design and application. The RF output may be a simple continuous wave (CW) signal, a pulse, and an analog modulated signal. Among the types of RF power measurements, the steady state RF power of a CW tone is perhaps the simplest. Peak power, such as the overshoot of an RF pulse, is the maximum value over some period of time. The power measurement can be averaged across a time period, such as across a series of RF pulses, yielding the average power. Here, we have used four switches S1, S2, S3 and S4 to give 4-bit parallel data (D0-D3). Since the switches are in active low state (i.e. low signal is sent when the switch is pressed), we need to add external pull-up resistors as shown, so as to provide a high signal by default. A resistance as high as 1Mohm is required in between OSC1 and OSC2 pins. The Transmitter Enable (TE, pin

14) pin is an active low pin. Thus, it is permanently grounded, so as to enable the transistor always. The output serial data DOUT is fed to the RF Transmitter Module directly. The most important thing lies in the address pins (A0-A7, pin1-8). Suppose you have two wireless devices (A and B) in your house, both have different remote controls (AA and BB) and both implement the same type of RF module (say 433 MHz). AA is the remote control of A and BB is of B. Now, you obviously wouldnt want AA to control B (which is the most probable case since both the devices use same kind of RF module, having same frequency!). This is where address pins come into play. There are 8 address pins, thus giving you an opportunity to have 8! (8 factorial) different and independent ways to connect to a device, so that there is no interference. The address pins MUST have the same address in both transmitter and receiver, or else the data wont be transferred.

FIG.4.9: TRANSMITTER CIRCUIT

4.5.7.2 Receiver design When no signal is received at data pin of HT12D, it remains in standby mode and consumes very less current (less than 1A) for a voltage of 5V. When signal is received by receiver, it is given to DIN pin (pin14) of HT12D. On reception of signal, oscillator of HT12D gets activated. IC HT12D then decodes the serial data and checks the address bits three times. If these bits match with the local address pins (pins 1-8) of HT12D, then it puts the data bits on its data pins (pins 10-13) and makes the VT pin high. The corresponding output is thus generated at the data pins of decoder IC. A signal is sent by lowering any or all the pins 10-13 of HT12E and corresponding signal is received at receivers end (at HT12D). Address bits are configured by using the by using the first 8 pins of both encoder and decoder ICs. To send a particular signal, address bits must be same at encoder and decoder ICs. By configuring the address bits properly, a single RF transmitter can also be used to control different RF receivers of same frequency. So now that all the connections are made, I choose an antenna for signal transmission. Usually, a 20-30 cm wire serves best. It is sufficient to give a range of 80 meters in open region. To improve the efficiency, I use a coiled wire (take a wire and make it into a coil). It increases the signal strength.

FIG.4.10: RECEIVER CIRCUIT 4.5.7.3 SOURCE CODE #include<reg51.h> sbit a=P1^3; sbit b=P1^2; sbit c=P1^1; sbit d=P1^0; sbit w=P2^0; sbit x=P2^1;

sbit y=P2^2; sbit z=P2^3; void back(void); void left(void); void right(void); void fwd(void); void main(void) { P1=0xFF; P2=0x00; if(a==0&&b==1&&c==1&&d==1) {back();} else if(a==1&&b==0&&c==1&&d==1) {left();} else if(a==1&&b==1&&c==0&&d==1) {right();} else if(a==1&&b==1&&c==1&&d==0) {fwd();} else {w=0;x=0;y=0;z=0;} }

void back() {w=0;x=1;y=0;z=1;} void left() {w=1;x=0;y=1;z=0;} void right() {w=1;x=0;y=0;z=1;} void fwd() {w=0;x=1;y=1;z=0;}

FIG. 4.11: FINALE PROJECT

CHAPTER 5 RESULT AND DISCUSSION

5.1 RESULT

I got the training of embedded systems by CETPA infotech pvt. ltd. , which helped me to understand the embedded world and I enhanced my skills in this field. As I learned about 8051 family ICs so I am now able to understand the architecture, instruction set and other functionality of 89C51 ICs, which is common 8051 family IC. The classes on microcontroller 8051 was intended for practical knowledge of the subject rather than theoretical as it was told that there is a huge gap between theoretically knowing a subject and practically implementing it.

5.2 DISCUSSION

5.2.1

CONCLUSION

So by doing the training of embedded systems I made myself aware of importance of embedded system in our daily life. And, by doing project of Rf controlled robo car I made myself aware of working of Rf module and interface it with the 89c51 microcontroller.

5.2.2

FUTURE SCOPE

The future scope of this project can be replace the button remote with ACCELEROMETER which sends output by getting input by varying the position of that . so we dont need to press buttons to control the robo car, rather we only have to change the position of remote and the car will move accordingly.

The fm bug or spy cam can be fitted onto it so we can receive audio or video of other places by sending this robo with remote control.

REFRENCES

1. CETPA INFOTECH PVT. LTD. 2. ENGINEERSGARAGE.COM

3. WIKIPEDIA.ORG 4. ATMEL.COM 5. DATASHEETS.COM 6. CIRCUITSTODAY.COM 7. PDFs FROM VARIOUS SITES 8. GOOGLE.COM 9. The 8051 microcontroller and Embedded Systems by M.A.Mazid 10. www.8051projects.info

Вам также может понравиться