Upload
aditya
View
216
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Embeded System
Citation preview
A
PROJECT REPORT
ON
AM RECEIVER
Guru Gobind Singh Indraprastha University, USICT
Submitted By:
BIVEK KUMAR GUPTA
11516412812
ECE 3 yr
1
ACKNOWLEDGMENT
The completion of this project gives me immense pleasure. I use this opportunity to express my greatest gratitude to everyone who supported me throughout the course of this project.
I would like to show my deepest and heartiest gratitude to my teachers and the universityfor giving me a good guideline for the assignment throughout numerous consultations through their passion for the “underlying structures”, which had lasting effects. Many people, especially my partner in the project and my classmates &friends, themselves have made valuable comment suggestions regarding the work, which inspired me to improve the assignment.
I thank all the people for their help they had extended, directly and indirectly in completing the project through their aspiring guidance, invaluably constructive criticism and friendly advice and am sincerely grateful to them for sharing their truthful and illuminating views on a number of issues related to the project. Secondly I would also like to thank my parents and family who helped me a lot in finalizing this project within the limited time frame.
INDEX
2
1. Introduction1.1 What is modulation 1.2 What is amplitude modulation and de modulation1.3 Techniques for AM receiver
2. Super heterodyne receiver2.1 Circuit for super heterodyne receiver2.2 Local oscillator Stage2.3 Mixer Stage2.4 Coupling Capacitor2.5 Intermediate Frequency Transformer/Filter(IFT)2.6 Detector Stage2.7 Audio Amplifier Stage
3. Implementation3.1 Design Description
4. Matlab Coding4.1 Coding4.2 Output
5. Conclusion6. References
INTRODUCTION TO EMBEDDED SYSTEM
3
An embedded system is a computer system with a dedicated function within a larger
mechanical or electrical system, often with real-time computing constraints. It is embedded as
part of a complete device often including hardware and mechanical parts. By contrast, a
general-purpose computer, such as a personal computer (PC), is designed to be flexible and to
meet a wide range of end-user needs. Embedded systems control many devices in common
use today.
Modern embedded systems are often based on microcontrollers (i.e. CPUs with integrated
memory and/or peripheral interfaces) but ordinary microprocessors (using external chips for
memory and peripheral interface circuits) are also still common, especially in more complex
systems. In either case, the processor(s) used may be types ranging from rather general purpose
to very specialised in certain class of computations, or even custom designed for the application
at hand. A common standard class of dedicated processors is the digital signal processor (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.
Physically, embedded systems range from portable devices such as digital watches and MP3
players, to large stationary installations like traffic lights, factory controllers, and largely
complex systems like hybrid vehicles, MRI, and avionics. 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.
OBJECTIVE
4
The aim of our project is to make a Bluetooth controlled robotic car based on Embedded system.
Fig. 1 : Bluetooth controlled robotic car
BLOCK DIAGRAM
5
Fig. 2 : Block Diagram of android controlled robot car using Bluetooth Module
THEORY
6
HARDWARE :
Microcontroller :
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. Program memory in the form of NOR flash or OTP ROM is also often included on
chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded
applications, in contrast to themicroprocessors used in personal computers or other general
purpose applications.
Microcontrollers are used in automatically controlled products and devices, such as
automobile engine control systems, implantable medical devices, remote controls, office
machines, appliances, power tools, toys and other embedded systems. By reducing the size
and cost compared to a design that uses a separate microprocessor, memory, and input/output
devices, microcontrollers make it economical to digitally control even more devices and
processes. Mixed signal microcontrollers are common, integrating analog components needed
to control non-digital electronic systems.
7
Fig. 3 : Layout of general purpose microprocessor system and microcontroller
A micro-controller is a single integrated circuit, commonly with the following
features:
central processing unit - ranging from small and simple 4-bit processors to complex
32- or 64-bit processors
volatile memory (RAM) for data storage
ROM, EPROM, EEPROM or Flash memory for program and operating parameter
storage
discrete input and output bits, allowing control or detection of the logic state of an
individual package pin
serial input/output such as serial ports (UARTs)
other serial communications interfaces like I²C, Serial Peripheral
Interface and Controller Area Network for system interconnect
peripherals such as timers, event counters, PWM generators, and watchdog
clock generator - often an oscillator for a quartz timing crystal, resonator or RC circuit
8
many include analog-to-digital converters, some include digital-to-analog converters
in-circuit programming and debugging support
Fig. 4 : Types and family of Microcontrollers
9
Different Types of Microcontrollers :
After 8051 designed by Intel, there were many semiconductor companies designed a great range of microcontrollers. 8051 was 8 bit microcontroller. After that, various microcontrollers came in market with 16 bit, 32 bit and 64 bit. 8051 Microcontroller is mostly used in education domain. AVR Microcontroller is mostly used in Education, Industrial and Small Applications. PIC Microcontroller is mostly used in Industrial Applications.
ARM Microcontroller is mostly used in Automobiles, Biomedical, and Avionics.
AVR :The AVR is a modified Harvard architecture 8bit RISC single chip microcontroller which was developed by Atmel in 1996. The AVR was one of the first microcontroller families to use on-chip flash memory for program storage, as opposed to one-time programmable ROM,EPROMor EEPROM used by other microcontrollers at the time.
Fig. 5 : USART Block Diagram
AVR was developed in the year 1996 by Atmel Corporation. The architecture of AVR was developed by Alf-Egil Bogen and Vegard Wollan. AVR derives its name from its developers and stands for Alf-Egil Bogen Vegard Wollan RISCmicrocontroller, also known as Advanced Virtual RISC. The AT90S8515 was the first microcontroller which was based on AVR architecture however the first microcontroller to hit the commercial market was AT90S1200 in the year 1997.
An important point about the architecture is R for RISC. Actually AVR is not completely RISC type. It has all the features of RISC as well as some important features of CISC as well.
The AVR is a modified Harvard architecturemachine where program and data are stored in separate physical memory systems that appear in different address spaces, but having the ability to read data items from program memory using special instructions.
10
Basic families :
AVRs are generally classified into following:
tinyAVR — the ATtiny series 0.5–16 kB program memory 6–32-pin package Limited peripheral set
megaAVR — the ATmega series 4–512 kB program memory 28–100-pin package Extended instruction set (multiply instructions and instructions for handling larger
program memories) Extensive peripheral set
XMEGA — the ATxmega series 16–384 kB program memory 44–64–100-pin package (A4, A3, A1) Extended performance features, such as DMA, "Event System", and cryptography
support. Extensive peripheral set with ADCs
Application-specific AVR megaAVRs with special features not found on the other members of the AVR family,
such as LCD controller, USB controller, advanced PWM, CAN, etc.
FPSLIC (AVR with FPGA) FPGA 5K to 40K gates SRAM for the AVR program code, unlike all other AVRs AVR core can run at up to 50 MHz
32-bit AVRs
Device architecture
AVR has a long family with different series as discussed in the last section. Each series has its own features. Now, if we take a microcontroller of mega series,then
the nomenclature given by the company for this is ATmega, that means AT is from ATMEL and mega is the name of series. So we call it as ATmega.
Now, if we say ATmega 16, that means it is a microcontroller by ATMEL, of mega series which has 16 Kb of Flash Memory.
11
ATmega series has different microcontrollers like ATmega 8, ATmega16, ATmega 32, ATmega 64, ATmega 128, etc.
Here we will study the architecture of ATmega 16 because we have used it in the project . It is quite obvious that ATmega 16 has 16 Kb of flash memory.
Fig. 6 : Architecture of AVR
12
Fig. 7 : Different ATMEL microcontrollers
13
ATmega16 :
The ATmega16 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISCarchitecture. By executing powerful instructions in a single clock cycle, the ATmega16 achievesthroughputs approaching 1 MIPS per MHz allowing the system designed to optimize power consumption versus processing speed.
PIN DIAGRAM :
Fig. 8 : PIN Diagram of ATmega16
14
Fig. 9 : ATmega16 microcontroller
Pin Descriptions :
VCCDigital supply voltage.
GNDGround.
Port A (PA7..PA0)Port A serves as the analog inputs to the A/D Converter.Port A also serves as an 8-bit bi-directional I/O port, if the A/D Converter is not used. Port pins can provide internal pull-up resistors (selected for each bit). The Port A output buffers have symmetrical drive characteristics with both high sink and source capability. When pins PA0 to PA7 are used as inputs and are externally pulled low, they will source current if the internal pull-up resistors are activated. The Port A pins are tri-stated when a reset condition becomes active, even if the clock is not running.
Port B (PB7..PB0)Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running.
Port C (PC7..PC0)Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port C output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The
15
Port C pins are tri-stated when a reset condition becomes active, even if the clock is not running. If the JTAG interface is enabled, the pull-up resistors on pins PC5(TDI), PC3(TMS) and PC2(TCK) will be activated even if a reset occurs.
Port D (PD7..PD0)Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running.
RESETReset Input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running. Shorter pulses are not guaranteed to generate a reset.
XTAL1Input to the inverting Oscillator amplifier and input to the internal clock operating circuit.
XTAL2Output from the inverting Oscillator amplifier.
AVCC AVCC is the supply voltage pin for Port A and the A/D Converter. It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter.
AREFAREF is the analog reference pin for the A/D Converter.
16
USBASP Programmer :
The USBasp is a cheap and simple USB programmer for Atmel AVR's. It basically consists of an ATMega88 or ATMega8, a handful of passive components and as such easily etched and assembled. These AVR programmers are based on USBasp design and connect to your computer's USB port. Not only are they quite compact (70x20mm), but the design is really elegant. The USB interface is achieved by using an atmega8 processor and the rest is done in firmware.
Fig. 10 : USBASP Programmer
FEATURES :
Works under multiple platforms. Linux, Mac OS X and Windows are tested. No special controllers or smd components are needed. Programming speed is up to 5kBytes/sec. SCK option to support targets with low clock speed (< 1,5MHz). Planned: serial interface to target (e.g. for debugging).
BLUETOOTH MODULE :
17
HC-05 is a class-2 bluetooth module with Serial Port Profile , which can configure as either Master or slave. a Drop-in replacement for wired serial connections, transparent usage. You can use it simply for a serial port replacement to establish connection between MCU, PC to your embedded project and etc.
Fig. 11 : HC-05 Bluetooth Module
HC-05 Specification:
Bluetooth protocol: Bluetooth Specification v2.0+EDR Frequency: 2.4GHz ISM band Modulation: GFSK(Gaussian Frequency Shift Keying) Emission power: ≤4dBm, Class 2 Sensitivity: ≤-84dBm at 0.1% BER Speed: Asynchronous: 2.1Mbps(Max) / 160 kbps, Synchronous: 1Mbps/1Mbps Security: Authentication and encryption Profiles: Bluetooth serial port Power supply: +3.3VDC 50mA Working temperature: -20 ~ +75Centigrade Dimension: 26.9mm x 13mm x 2.2 mm
18
MOTORS :
Introduction of DC MotorA direct current or DC motor is a mechanically commutated electric motor powered from direct current (DC). It converts electrical energy intomechanical energy. It is one of two basic types of motors: the other type is thealternating current or AC motor. Among DC motors, there are shunt-wound,series-wound, compound-wound and permanent magnet motors.
Fig. 12 : Circuit Diagram of DC Motor
How DC Motor works?Let’s start with how actually DC motor runs. Direction control of a DC motor is very simple; just reverse the polarity, means every DC motor has two terminals out. When we apply DC voltage with proper current to a motor, it rotates in a particular direction but when we reverse the connection of voltage between two terminals, motor rotates in another direction.Controlling using Micro Controllers!!!Now let us consider how to control motor using Microcontroller provided:
Microcontroller provides us only digital logic (1 or a 0). We can’t provide polarity from microcontroller. We can’t connect motors to Controller as mostly motors runs on voltage higher that
+5V, and motors demands high current (depends). Now the solution to above limitations is use of an “H Bridge”.
It is a circuit which allows motor rotation in both directions. From four terminals of H Bridge you can control a DC motor.Using L293d Dual Half H Bridge …We can make our own H Bridge using transistors but it will be better if we use a readymade IC named as L293d, it’s a dual Half H Bridge IC.We can drive a maximum of two DC motor and one stepper motor using one L293d.
19
Programming of DC Motor
SERIAL COMMUNICATION IN AVR
USART
Communication between two entities is important for the information flow to take place. In general the information transport system can be parallel in which the complete byte of data is sent at a time, with each bit having a separate line or it can be serial where only one communication line is available which is shared by all the bits sequentially. The pros and cons of these two systems are equivalent and selection between the two depends on the application. Data can be exchanged using parallel or serial techniques. Setup for parallel data transfer is not cost effective but is a very fast method of communication. Serial communication is cost effective because it requires only a single line of connection but on the other hand is a slow process in comparison to parallel communication. This article explains serial communication of AVR microcontroller (ATmega16) with PC. The data is transmitted from the controller using RS232 standard and displayed on the PC using Hyper Terminal.
There are three ways in which serial communication can be done
i. Simplex: Transmission is done in one direction.
20
ii. Half duplex: Transmission can be done in both the direction but one side at a time.
iii. Full duplex:Transmission can be done in both the direction simultaneously.
Atmega16 is equipped with three different kinds of serial communication peripheral systems:
a. Serial USARTb. SPI (Serial Peripheral Interface)c. TWI (Two wire Interface)
SERIAL USART (universal synchronous asynchronous receiver and transmission/ transmitter):
Serial USART provides full-duplex communication between the transmitter and receiver. Atmega16 is equipped with independent hardware for serial USART communication. Pin-14 (RXD) and Pin-15 (TXD) provide receive and transmit interface to the microcontroller.
Fig. 13 : USART pins in ATmega16
21
Atmega16 USART provides asynchronous mode of communication and do not have a dedicated clock line between the transmitting and receiving end. The synchronization is achieved by properly setting the baud rate, start and stop bits in a transmission sequence.Start bit and stop bit: These bits are use to synchronize the data frame. Start bit is one single low bit and is always given at the starting of the frame, indicating the next bits are data bits. Stop bit can be one or two high bits at the end of frame, indicating the completion of frame.
Baud Rate: In simple words baud rate is the rate at which serial data is being transferred.
Atmega16 USART has following features: Different Baud Rates. Variable data size with options ranging from 5bits to 9bits. One or two stop bits. Hardware generated parity check. USART can be configured to operate in synchronous mode. Three separate interrupts for RX Complete, TX complete and TX data register
empty. USART Registers : To use the USART of Atmega16, certain registers need to be configured.
UCSR: USART control and status register. It’s is basically divided into three parts UCSRA, UCSRB and UCSRC. These registers are basically used to configure the USART.
UBRR: USART Baud Rate Registers. Basically use to set the baud rate of USART.
UDR: USART data register
1) UCSRA: (USART Control and Status Register A)
RXC (USART Receive Complete): RXC flag is set to 1 if unread data exists in receive
buffer, and set to 0 if receive buffer is empty. TXC (USART Transmit complete): TXC flag is set to 1 when data is completely
transmitted to Transmit shift register and no data is present in the buffer register UDR.
UDRE (USART Data Register Empty): This flag is set to logic 1 when the transmit buffer is empty, indicating it is ready to receive new data. UDRE bit is cleared by writing to the UDR register.
22
2) UCSRB: (USART Control and Status Register B)
RXCIE: RX Complete Interrupt Enable,
When 1 -> RX complete interrupt is enabled.When 0 -> RX complete interrupt is disabled.
TXCIE: TX Complete Interrupt Enable, When 1 -> TX complete interrupt is enabledWhen 0-> TX complete interrupt is disabled
UDRIE: USART Data Register Empty Interrupt Enable, When 1 -> UDRE flag interrupt is enabled.When 0 -> UDRE flag interrupt is disabled.
RXEN: Receiver Enabled,When 1 -> USART Receiver is enabled.When 0 -> USART Receiver is disabled.
TXEN: Transmitter Enabled,When 1 -> USART Transmitter is enabled.When 0 -> USART Transmitter is disabled.
3) UCSRC: (USART Control and Status Register C)The transmitter and receiver are configured with the same data features as configured in this register for proper data transmission.
23
URSEL: USART Register select. This bit must be set due to sharing of I/O location by UBRRH and UCSRC
UMSEL: USART Mode Select,When 1 -> Synchronous OperationWhen 0 -> Asynchronous Operation
UPM[0:1]: USART Parity Mode, Parity mode selection bits.
USBS: USART Stop Select Bit,When 0-> 1 Stop BitWhen 1 -> 2 Stop Bits
UCSZ[0:1]: The UCSZ[1:0] bits combined with the UCSZ2 bit in UCSRB sets size of data frame i.e., the number of data bits. The table shows the bit combinations with respective character size.
UCSZ2 UCSZ1 UCSZ0 Character Size0 0 0 5-bit0 0 1 6-bit0 1 0 7-bit0 1 1 8-bit1 0 0 Reserved1 0 1 Reserved1 1 0 Reserved1 1 1 9-bit
4) UDR: (USART Data Register)
The USART Data receive and data transmit buffer registers share the same address referred as USART UDR register, when data is written to the register it is written in transmit data buffer register (TXB). Received data is read from the Receive data buffer register (RXB).
5) UBRRH & UBRRL (USART Baud Rate Registers)
24
The UBRRH register shares the same I/O address with the UCSRC register, The differentiation is done on the basis of value of URSEL bit.When URSEL=0; write operation is done on UBRRH register.When URSEL=1; write operation is done on UCSRC register.
The UBRRH and UBRRL register together stores the 12-bit value of baud rate, UBRRH contains the 4 most significant bits and UBRRL contains the other 8 least significant bits. Baud rates of the transmitting and receiving bodies must match for successful communication to take place.
UBRR register value is calculated by the following formula:
The Connection of MAX232 and ATmega16 is shown in the circuit diagram. The MAX232 is used for level conversion. The reader can refer the component section for further details on MAX 232.The T1IN (pin11) of Max232 is connected to Tx (pin15) of AVR and R1IN(pin12) is connected to Rx(pin14) of AVR. The HyperTerminal software is used to send data to microcontroller via COM port.
25
SOFTWARE :
WINAVR :
WinAVR (pronounced "whenever") is a suite of executable, open source software development tools for the Atmel AVR series of RISC microprocessors hosted on the Windows platform. It includes the GNU GCC compiler for C and C .
WinAVR contains all the tools for developing on the AVR. This includes avr-gcc (compiler), avrdude (programmer), avr-gdb (debugger), and more! WinAVR is used all over the world from hobbyists sitting in their damp basements, to schools, to commercial projects.
Fig. 14 : WINAVR Program on PC desktop
Distribution also includes the standard operating system for UNIX tools such as Find , make , grep , awk , sed , etc., and based on the Scintilla editor for programming . Part of the package AVR-GCC cross-compiler supports not only the input languages C and C + +, but Objective-C , and provides a complete development environment for AVR32. WinAVR has no master source code AVR equipment settings and interface with different devices, but the code generated by the compiler master CVAVR , it is possible to compile in WinAVR.
26
EMBEDDED C : Looking around, we find ourselves to be surrounded by various types of embedded systems. Be it a digital camera or a mobile phone or a washing machine, all of them has some kind of processor functioning inside it. Associated with each processor is the embedded software. If hardware forms the body of an embedded system, embedded processor acts as the brain, and embedded software forms its soul. It is the embedded software which primarily governs the functioning of embedded systems.
Embedded systems are programmed using different type of languages:
Machine Code
Low level language, i.e., assembly
High level language like C, C++, Java, Ada, etc.
Application level language like Visual Basic, scripts, Access, etc.
Use of C in embedded systems is driven by following advantages :
It is small and reasonably simpler to learn, understand, program and debug.
C Compilers are available for almost all embedded devices in use today, and there is a
large pool of experienced C programmers.
Unlike assembly, C has advantage of processor-independence and is not specific to any
particular microprocessor/ microcontroller or any system. This makes it convenient for a
user to develop programs that can run on most of the systems.
As C combines functionality of assembly language and features of high level languages,
C is treated as a ‘middle-level computer language’ or ‘high level assembly language’
It is fairly efficient
It supports access to I/O and provides ease of management of large embedded projects.
ADVANTAGES:
Many of these advantages are offered by other languages also, but what sets C apart from
others like Pascal, FORTRAN, etc. is the fact that it is a middle level language; it provides
direct hardware control without sacrificing benefits of high level languages.
Compared to other high level languages, C offers more flexibility because C is relatively
small, structured language; it supports low-level bit-wise data manipulation.
27
Compared to assembly language, C Code written is more reliable and scalable, more portable
between different platforms (with some changes). Moreover, programs developed in C are
much easier to understand, maintain and debug. Also, as they can be developed more quickly,
codes written in C offers better productivity.
DIFFERENCE BETWEEN C AND EMBEDDED C :
The difference lies in their applications.
C is used for desktop computers, while embedded C is for microcontroller based
applications. Accordingly, C has the luxury to use resources of a desktop PC like memory,
OS, etc. While programming on desktop systems, we need not bother about memory.
However, embedded C has to use with the limited resources (RAM, ROM, I/Os) on an
embedded processor. Thus, program code must fit into the available program memory. If code
exceeds the limit, the system is likely to crash.
Compilers for C (ANSI C) typically generate OS dependant executables. Embedded
C requires compilers to create files to be downloaded to the microcontrollers/microprocessors
where it needs to run. Embedded compilers give access to all resources which is not provided
in compilers for desktop computer applications.
Embedded systems often have the real-time constraints, which is usually not there with
desktop computer applications.
Embedded systems often do not have a console, which is available in case of desktop
applications.
BLUETOOTH :
Bluetooth is a wireless technology standard for exchanging data over short distances (using
short-wavelength UHF radio waves in the ISM band from 2.4 to 2.485 GHz[2]) from fixed
and mobile devices, and building personal area networks (PANs). Invented by telecom
vendor Ericsson in 1994,[3] it was originally conceived as a wireless alternative to RS-
232 data cables. It can connect several devices, overcoming problems of synchronization.
28
Bluetooth is managed by the Bluetooth Special Interest Group (SIG), which has more than
20,000 member companies in the areas of telecommunication, computing, networking, and
consumer electronics. Bluetooth was standardized as IEEE 802.15.1, but the standard is no
longer maintained. The SIG oversees the development of the specification, manages the
qualification program, and protects the trademarks.To be marketed as a Bluetooth device, it
must be qualified to standards defined by the SIG. A network ofpatents is required to
implement the technology, which is licensed only for that qualifying device.
Fig. 15 : Bluetooth logo
Bluetooth operates in the range of 2400–2483.5 MHz (including guard bands). This is in the
globally unlicensed (but not unregulated) Industrial, Scientific and Medical (ISM) 2.4 GHz
short-range radio frequency band. Bluetooth uses a radio technology called frequency-hopping
spread spectrum. The transmitted data are divided into packets and each packet is transmitted on
one of the 79 designated Bluetooth channels. Each channel has a bandwidth of 1 MHz.
Bluetooth 4.0 uses 2 MHz spacing which allows for 40 channels. The first channel starts at
2402 MHz and continues up to 2480 MHz in 1 MHz steps. It usually performs 1600 hops per
second, with Adaptive Frequency-Hopping (AFH) enabled.
The Android platform includes support for the Bluetooth network stack, which allows a device to wirelessly exchange data with other Bluetooth devices. The application framework
29
provides access to the Bluetooth functionality through the Android Bluetooth APIs. These APIs let applications wirelessly connect to other Bluetooth devices, enabling point-to-point and multipoint wireless features.
Using the Bluetooth APIs, an Android application can perform the following:
Scan for other Bluetooth devices
Query the local Bluetooth adapter for paired Bluetooth devices
Establish RFCOMM channels
Connect to other devices through service discovery
Transfer data to and from other devices
Manage multiple connections
BLUETERM :
Blueterm is a VT-100 terminal emulator for communicating with any serial device using a bluetooth serial adapter. The RFCOMM/SPP protocol emulates serial communications over bluetooth.
30
Blueterm is basically a terminal emulator program that communicates over Bluetooth. It consists of several activities with Blueterm being the most important. It discovers, pairs, and connects with a remote Bluetooth device that supports SPP/RfComm.
It helps to control a robotic car with mobile. As we type a character on Blueterm the car responds according to the function set to the character.
Fig. 16 : Blueterm app on android phone
CODING :
The programming is done in winavr programmer's notepad.
#include<avr/io.h>
31
#include<util/delay.h>
char receive_char();
int main()
{
DDRA = 0XFF;
UBRRH=0;
UBRRL=47;
UCSRC= 0b10000110;
UCSRB= 0b00011000;
UCSRA= 0b00000000;
char ch;
while(1)
{
ch=receive_char();
if(ch=='a')
PORTA = 0b00001010;
else if(ch=='b')
PORTA = 0b00000101;
else if(ch=='c')
PORTA = 0b00000010;
else if(ch=='d')
PORTA = 0b00001000;
else if(ch=='e')
PORTA = 0b00000110;
else if(ch=='f')
PORTA = 0b00001001;
else if(ch=='g')
PORTA = 0X00;
32
}
}
char receive_char()
{
while(!(UCSRA & (1<<RXC)));
return UDR;
}
CONCLUSION :
We have made a Bluetooth controlled robotic car.The robotic car can have seven functions according to the instruction (character) given to it by the user through the Blueterm.
33
It has seven movements :
Forward
Reverse
Left axial turning
Right axial turning
Left differential turning
Right differential turning
Images of the robotic car :
34
Fig. 17 : Bluetooth controlled robotic car
This is a video of the robotic car :
REFERENCES
35
1) http://en.wikipedia.org/wiki/Atmel_AVR2) http://en.wikipedia.org/wiki/Microcontroller3) http://www.atmel.in/Images/2466S.pdf4) http://www.rajguruelectronics.com/bluetooth-module.html5) http://blueterm.soft112.com/6) http://www.engineersgarage.com/tutorials/emebedded-c-language 7) http://winavr.software.informer.com/
36