0% found this document useful (0 votes)
203 views

Device Control Through Bluetooth PDF

This document summarizes a project that aims to control devices through Bluetooth connectivity from a mobile phone. It introduces the project, outlines its objectives to develop skills while providing convenient home appliance control. Key features are noted like low cost, ease of use, efficiency and security. An overview of the software and hardware used is provided, including the microcontroller, Bluetooth module, mobile app, IDEs and simulation software. Literature on the microcontroller and Bluetooth module is also reviewed, covering programming, communication protocols and module specifications.

Uploaded by

Samit Tandukar
Copyright
© Attribution Non-Commercial No-Derivs (BY-NC-ND)
0% found this document useful (0 votes)
203 views

Device Control Through Bluetooth PDF

This document summarizes a project that aims to control devices through Bluetooth connectivity from a mobile phone. It introduces the project, outlines its objectives to develop skills while providing convenient home appliance control. Key features are noted like low cost, ease of use, efficiency and security. An overview of the software and hardware used is provided, including the microcontroller, Bluetooth module, mobile app, IDEs and simulation software. Literature on the microcontroller and Bluetooth module is also reviewed, covering programming, communication protocols and module specifications.

Uploaded by

Samit Tandukar
Copyright
© Attribution Non-Commercial No-Derivs (BY-NC-ND)
You are on page 1/ 23

CHAPTER 1: PROJECT INTRODUCTION

1.1 PROJECT INTRODUCTION


The project titled Device Control through Bluetooth is the device intended to provide control to the various devices connected to the microcontroller through Bluetooth of mobile phones. Automation has always been an immense and indispensable issue in todays fast paced life. There is always a need to have a feedback system that could aid to perform the task effectively and efficiently. At the present scenario, there hasnt been any such works that could contribute in controlling devices automatically. So, if the devices can be controlled wirelessly just from few clicks through the mobile phones then it significantly reduces unnecessary requirement of manual work which ultimately saves the time and effort. With the implementation of Bluetooth technology in this project, devices can be controlled wirelessly through Bluetooth enabled mobile phones from any corner of the room without being need to be in line of sight. 1.1.1 Bluetooth A wireless alternative to RS232 data cables, Bluetooth, was invented by Ericsson in 1994. Bluetooth has been invented in early 90s of 20 th century but it has been rapidly developed since then. Bluetooth has been evolved initially from the joint venture of 5 companies namely NOKIA, ERICSSON, IBM, INTEL and TOSHIBA but it was followed but numbers of organization later on forming Bluetooth SIG (Bluetooth Special Interest Group). Now the BSIG group has 130 member organizations. It can connect several devices overcoming the problem of synchronization. Bluetooth is a proprietary open wireless technology standard for exchanging datas over short distance from fixed and mobile devices with the high level security. It provides an adhoc approach for enabling various devices to communicate with one another within a nominal range of 10 meter. Bluetooth is packet based protocol with a master and slave structure thus enabling data transfer between the devices at any moment from master to the slave. To add another merit to itself the master and slave structure within the paired devices are swappable so any device may be master at one moment and slave at other instance.
1

Bluetooth has replaced the standard serial ports in case of computing. Nowadays wireless mouse, keyboard and printers are found all aided with Bluetooth. The range of the Bluetooth device may depends upon the lower transceiver chip embedded within the device which may range from a meter to hundreds of meter. As radio signal are used, no distinct line of sight can be traced.

1.2 OBJECTIVES
The main objective behind our project: To develop professionalism, teamwork, management and organizational skills. To provide easy access to various home appliances through Bluetooth device. Increase the comfortably in ones life. To promote technology for general public use in an economical way.

1.3 PROJECT FEATURES


The main features of our project are It is very cost effective and time efficient. It is easy to construct and install. It consumes less energy and more efficient. It provides better security. It works at higher speed. It has wide range of applications.

Low power consumption is especially important in this project because the software system requires the Bluetooth on the mobile phones to be turned on all the time. This helps to prolong battery life which is scarce in mobile phones. The inherent security features and medium range of Bluetooth makes Bluetooth relatively secure as compared to other wireless radios such as wireless LAN. The security features makes it hard to listen to the data transmissions. The medium range means that hackers would have to be within close physical range to the Bluetooth radio in order to listen to its traffic. All these features are important because this project deals with access control of various appliances in which security plays a very important role.

1.4 FEASIBILITY STUDY


1.4.1 Operational Feasibility The project consists of both programs and hardware such as microcontroller, Bluetooth module, mobile software, etc. Hardware used in this project is simple to setup and use and it does not require any skilled manpower. Mobile program used in this project has user friendly and better interface and is very simple to use and understand. Even a man with little knowledge of common mobile application can easily operate it. 1.4.2 Technical Feasibility Since, the project requires sending data from mobile to Bluetooth module connected to the microcontroller. One should have the mobile device with Connected Limited Device Configuration (CLDC 1.0) and Mobile Information Device Profile (MIDP 2.0). The mobile device operating system should have Bluetooth Personal Area Network Connection. Since the objective of the project is to control the device within the room so for greater accuracy of Bluetooth connection, one should be within the range of Bluetooth which is approximately 10 meters. 1.4.3 Economic Feasibility The mobile application to be used on this project is free of cost. The mobile application is based on Android operating system and the mobile operating on this platform cost less in the market. Bluetooth module is used for communication between mobile and hardware parts like resistors, capacitors, microcontroller, etc. So the overall cost of the project is expected to be approximately Rs.10,000.

1.5 SOFTWARE USED


The project require following applications: Proteus 7 professional Proteus 7 provides simulation of microcontroller embedded system. All the hardware are being tested and simulated with this software. This software allows loading hex files into embedded design and testing for flaws or bugs. SDCC SDCC is Free Open Source Software, distributed under GNU General Public License (GPL). SDCC is a re targetable, optimizing ANSI - C compiler that targets the Intel 8051, Maxim 80DS390, Zilog Z80, Z180, Rabbit 2000 and the Motorola 68HC08 based MCUs. Eclipse IDE with android emulator Eclipse is a multi-language software development environment comprising an integrated development environment (IDE) and an extensible plug-in system. It is written mostly in Java and can be used to develop applications in Java. Eclipse is used to program application for android with inclusion of android emulator in it. Hyper Terminal Hyper Terminal is as software to view serial data received by computer. The main purpose of hyper terminal is to view and debug the data obtained from the hardware. Eagle EAGLE (Easily Applicable Graphical Layout Editor) is a flexible and expandable EDA schematic capture, PCB layout, auto router and CAM program. EAGLE contains a schematic editor, for designing circuit diagrams.

CHAPTER 2: LITERATURE REVIEW


2.1 Microcontroller
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 Atmels 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: 8Kbytes 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. 2.1.1 Serial Port Programming One of the 8051s many powerful features is its integrated UART, otherwise known as a serial port. The fact that the 8051 has an integrated serial port means that values may be very easily read and written to the serial port. If it were not for the integrated serial port, writing a byte to a serial line would be a rather tedious process requiring turning on and off one of the I/O lines in rapid succession to properly clock out each individual bit, including start bits, stop bits and parity bits. 8051 serial communication requires setting of baud rate. Once configured, Serial Buffer is written with a value to the serial port for transmission and for receiving 8051 asserts successful sending of a byte through Transmit Interrupt Flag of Serial Control
7

Register. When a byte of data is available on Serial Buffer, Receive Interrupt flag is raised indicating data must be picked up now or it will be lost.
Before the serial port can be used it is necessary to set various registers: SCON: This is the serial port control register. It should be set to hexadecimal 0x50 for 8-bit data mode. TMOD: This register controls the timers for baud rate generation and it should be set to hexadecimal 0x20 to enable timer 1 to operate in 8-bit auto reload mode. TH1: This register should be loaded with a constant so that the required baud rate can be generated. TR1: This register starts/stops the timer and it should be set to 1 to start timer 1. TI: This register should be set to 1 to indicate ready to transmit.

2.2 AUBTUM-22 Bluetooth Module


AUBTUM-22 is Bluetooth Core V2.0 compliant module with SPP. The module is designed to be embedded in a host system which requires cable replacement function. Typically the module could interface with a host through the UART port. This module could both act as a SPP master and a SPP slave. When in master mode, the module could search for all the working slave devices around and the host could select which to connect. When it is in slave mode, it will listen for connection request from another SPP master device.

2.3 Analog to Digital Converter


Analog to digital converters find huge application as an intermediate device to convert the signals from analog to digital form. These digital signals are used for further processing by the digital processors. Various sensors like temperature, pressure, force, etc. convert the physical characteristics into electrical signals that are analog in nature. ADC0804 is a very commonly used 8-bit analog to digital converter. It is a single channel IC, i.e., it can take only one analog signal as input. The digital outputs vary from 0 to a maximum of 255. The step size can be adjusted by setting the reference voltage at pin9. When this pin is not connected, the default reference voltage is operating voltage i.e. Vcc. The step size at 5V is 19.53 mV (5V/255), i.e. for every
8

19.53 mV rise in the analog input; the output varies by 1 unit. To set a particular voltage level as the reference value, this pin is connected to half the voltage. For example, to set a reference of 4V (Vref), pin9 is connected to 2V (Vref/2), thereby reducing the step size to 15.62 mV (4V/255). ADC0804 needs a clock to operate. The time taken to convert the analog value to digital value is dependent on this clock source. An external clock can be given at the Clock IN pin. ADC0804 also has an inbuilt clock which can be used in absence of external clock. A suitable RC circuit is connected between the Clock IN and Clock R pins to use the internal clock.

2.4 IC 7805
7805 is a voltage regulator integrated circuit. It is a member of 78xx series of fixed linear voltage regulator ICs. The voltage source in a circuit may have fluctuations and would not give the fixed voltage output. The voltage regulator IC maintains the output voltage at a constant value. The xx in 78xx indicates the fixed output voltage it is designed to provide. 7805 provides +5V regulated power supply. Capacitors of suitable values can be connected at input and output pins depending upon the respective voltage levels.

2.5 Liquid Crystal Display


LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segments and other multi segment LEDs. The reasons being: LCDs are economical; easily programmable; have no limitation of displaying special & even custom characters (unlike in seven segments), animations and so on. 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, namely, Command and Data. The command register stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the cursor position, controlling display etc. The data
9

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.

10

CHAPTER 3: PROJECT IMPLEMENTATION


3.1 Project Implementation
The project has been carried out in two branches: Hardware Section Software Section 3.1.1 Hardware The project consists of a Bluetooth module for communication purposes. The circuit design is given below:

Figure 3.1: Device Control through Bluetooth

11

The circuit consists of the following components: Bluetooth Module Microcontroller Analog to Digital Converter Temperature Sensor LCD Display Relays

AUBTM-22 is Bluetooth Core V2.0 compliant module with serial port interface. The module is designed to be embedded in a host system which requires cable replacement function. Typically the module could interface with a host through the UART port. This module is used to establish connection between mobile device and micro controller. It acts as a SPP (Serial Port Profile) slave when it receives commands from mobile phones and it acts as a SPP master when it sends message from microcontroller to mobile phones. AT89S52 microcontroller from Atmel is used in the circuit. The main function of microcontroller is to send command to control the device as per command send from mobile phone and receive status of devices and send the information to mobile phone. Temperature Sensor LM35 is used to obtain the current room temperature and Analog to Digital Converter ADC0804 converts the analog data obtained from temperature sensor into digital data before sending the data to microcontroller. Relay is an electromagnetic device used to switch ON or OFF devices connected to it. 16*2 LCD Display is used to show the status of the device whether it is ON or OFF.

12

3.1.2 Software The commands to switch on/off devices is send from mobile phones to the microcontroller through Bluetooth module and similarly the information regarding the status of the device is send from the microcontroller to the mobile phones through Bluetooth module. So, the software was created to send and receive information between mobile phones and microcontroller.
Start

Initiate Relays

Initiate Analog to Digital Converter

Initiate LCD display

Initiate Bluetooth Module

Input String L1, L2, L3 and L4 into LCD Display

Update Device Status

A 13

False 1 True

False Is Device Flag not equal to y

True

Evaluate Device Flag

Yes Device Flag==1 sta_1=1

No Yes Device Flag==2 No Yes Device Flag==3 No C D 14 E sta_2=1 sta_1=0

Yes Device Flag==4 sta_2=0

No Yes Device Flag==5

sta_3=1

No Yes Device Flag==6 sta_3=0

No Yes Device Flag==7 sta_4=1

No Yes Device Flag==8 sta_4=0

C F

15

F B C

Device flag==y

Update Device Status

Send Temperature Data

Stop

Figure 3.2: Flowchart of Circuit Operation Above flowchart shows the how the commands are executed and the programs are running in the microcontroller.

16

MASTER
Inquiry

SLAVE
Inquiry Scan

Page

Inquiry Response

Page Scan

Master Response

Slave Response

Connection

Connection

Figure 3.3: Bluetooth Connection Procedure The inquiry procedure is an important part of Bluetooth. It is a process where one Bluetooth device tries to find all neighboring Bluetooth devices. A device that is trying to scan for other devices is said to be in inquiry mode. The device that listens for an inquiry request is in inquiry scan mode. This inquiry scan mode is usually set in a Bluetooth device by setting it to be discoverable. When inquiry is initiated, the device goes into inquiry mode and accelerates its hopping frequency. On the other hand, the device in the inquiry scan mode reduces its hopping frequency. This algorithm will allow the inquirer to catch up with the transmit frequency of devices that is in inquiry scan mode. This is important because of the frequency hopping algorithm employed in Bluetooth. When the frequencies coincide, the scanned device will act as slave and send its address and clock information to the master.

17

After inquiry, the inquirer will be able to initiate connection to the inquired device. Since the connection is initiated by the inquirer, it will act as the master. This initial connection is called paging. Paging is done by the master by sending paging requests to possible slave frequency slots. This frequency slots are calculated from the Bluetooth address and the clock information received during inquiry. At the time of connection establishment, the slave will synchronize its timing to that of the masters. Throughout the connection, the master never changes its hopping sequence or phase (current hop slot, determined by the masters clock). In contrast, the slave will have to synchronize with the masters clock all the time.

18

Some of the screenshots of the mobile application used in this project can be seen below:

Figure 3.4: Screenshots of Mobile Application From left in the above screenshot, it is the view of the application when it is initialized. Next image shows the view of the mobile application when we go to the settings of the mobile application. And final image shows the list of devices to be switch ON/OFF in the mobile application.

19

CHAPTER 4: EPILOGUE
4.1 Problems Faced
Several problems have been encountered during this project: No Bluetooth module for simulation purpose in software like Proteus Lack of prior knowledge of creating software in mobile operating system Lack of timely availability of hardware components Since our project is mainly based on Symbian OS but recently after takeover of Microsoft on Nokia, Nokia removed all the Symbian related SDKs so it took us long time to find an alternative Components used in this project are delicate so it took us long time to study about it so that no components gets damaged while making hardware

20

4.2 Conclusion
Device Control through Bluetooth is a good example and a practical application of microcontroller and Bluetooth based device control. It uses Bluetooth module which are now available in small dimension and low price. Bluetooth module receives the data from mobile phones and directs it to serial port and is read by the microcontroller. Microcontroller then sends commands to switch to the relays to turn on/off the devices and sends data regarding the status of the device through the Bluetooth module to the mobile phones. This project has proved to be very informative and practical. It has wide range of practical application at an unimaginably cheaper cost. Since, Bluetooth connectivity doesnt require line of sight, the devices can be control from any corner within the range of Bluetooth module. This kind of the system can be used in various sectors such as controlling the home appliances, in the shopping malls and many more.

21

4.3 References
Books Paul Barry, 2010, Head First Python, First Edition, OREILLY, Tokyo, ISBN: 978-1-449-38267-4 Jurgen Scheible, Ville Tuulos, 2008, Mobile Python, Second Edition, Wiley, New Delhi Dogan Ibrahim, 2000, Microcontroller Projects in C for the 8051, Newnes, Jordan Hill, Oxford Wei-Meng Lee, 2011, Beginning Android Application Development, Wiley, Indianapolis Internet http://en.wikipedia.org http://www.bluetooth.org

22

CHAPTER 5 APPENDIX

23

You might also like