RUDRA_PROJECT.docx

40
1 REMOTE DC MOTOR DRIVING & POWER/CURRENT CONTROL (USING BLUETOOTH SYSTEM)  A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF Bachelor of Technology In Electrical Engineering National Institute of Techno logy Rou rkela, Orissa-769008 PROJECT GUIDE: PROF. S DAS UNDERTAKEN BY: NIKHIL T MESHRAM RUDRA NARAYAN PANIGRAHI 10502052 10502059

Transcript of RUDRA_PROJECT.docx

Page 1: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 1/40

1

REMOTE DC MOTOR DRIVING & POWER/CURRENTCONTROL (USING BLUETOOTH SYSTEM)

 A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE

REQUIREMENTS FOR THE DEGREE OF

Bachelor of Technology

In

Electrical Engineering

National Inst i tute of Techno logy

Rou rkela, Oriss a-769008

PROJECT GUIDE: PROF. S DASUNDERTAKEN BY:

NIKHIL T MESHRAM RUDRA NARAYAN PANIGRAHI10502052 10502059

Page 2: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 2/40

2

ACKNOWLEDGEMENT

 No thesis is created entirely by an individual, many people have helped to create

this thesis and each of their contribution has been valuable. My deepest

gratitude goes to my thesis supervisor, Dr. S Das Professor, Department of

Electrical Engineering, for her guidance, support, motivation and

encouragement throughout the period this work was carried out. Her readiness

for consultation at all times, her educative comments, her concern and

assistance even with practical things have been invaluable. I would also like to

thank all professors and lecturers, and members of the department of Electrical

Engineering for their generous help in various ways for the completion of this

thesis. A vote of thanks to my fellow students for their friendly co-operation.

DATE: Rudra Narayan Panigrahi

 Nikhil T Meshram

Page 3: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 3/40

3

Electrical Engineering Department

National Institute Of Technology -Rourkela

CERTIFICATE

This is to certify that the Thesis Report entitled REMOTE CONTROL OF

POWER/CURRENT BY USING BT-3000 MODEL submitted by RUDRA NARAYAN

PANIGRAHI (10502059) and NIKHIL MESHRAM(10502052) in partial fulfilment of the

requirements for the award of Bachelor of Technology degree in Electrical Engineering 

during session 2008-2009 at National Institute Of Technology, Rourkela (Deemed

University) and is an authentic work by them under my supervision and guidance.

Date: Prof. S Das

Dept. Of Electrical Engineering

 National Institute of Technology

Rourkela, 769008

Page 4: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 4/40

4

CONTENTS

 Abstract  

1. Introduction.....................................................................................

1.1 System introduction..............................................................

2. Equipments and Materials.............................................................

3. Module description.........................................................................

3.1 DC motor module.................................................................

4. DC motor control practice module.................................................

4.1 Source code.........................................................................

5. Power control mode......................................................................

5.1 Power control practice module............................................

5.2 Power control source code..................................................

6. Current control mode....................................................................

6.1 Current control practice module..........................................

6.2 Current control source code................................................

7. Conclusion...................................................................................

References..................................................................................

Page 5: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 5/40

5

ABSTRACT

Based on the Bluetooth technology, this project aims to achieve wireless control for certain

applications between a server and a slave. We used the BT 3000 system and established ACL

connection between slave and server via a desktop computer (compiler) for two modules-DC

motor/step motor driving and power/current control. BT-3000 system uses PIC16F877

microcontroller as processor while conventional computer is used for loading and compiling

 programs. Server program checks and monitors the entire situation on the slave. Server

 program is not coded by us, they are provided with the module. We coded programs for

motor control, power/current control and Bluetooth applications for communication with the

server.

Currently, instrument field technology is improving every day and most of wire controlled

 parts are replaced with wireless parts. Wireless instrument field seems complicated due to

many different technologies, in fact it is not so if the system is properly divided and studied.

This area needs to be studied and applied to telemetric and home automation so that perfect

ubiquitous system can be designed.

Page 6: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 6/40

6

CHAPTER-1 

Page 7: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 7/40

7

Why Bluetooth?

System introduction

Equipments and materials

Page 8: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 8/40

8

WHY BLUETOOTH?

Bluetooth is an open standard specification for a radio frequency (RF)-based, short-range

connectivity technology that promises to change the face of computing and wireless

communication. It is designed to be an inexpensive, wireless networking system for all

classes of portable devices, such as laptops, PDAs (personal digital assistants), and mobile

 phones. It also will enable wireless connections for desktop computers, making connections

 between monitors, printers, keyboards, and the CPU cable-free.

The idea of a cable-free, or wireless, technology was initially conceived by Ericsson in 1994,

when the company began a study to investigate the feasibility of a low-power, low-cost radio

interface between mobile phones and their accessories. The company’s goal was to eliminatethe need for cables.

The Bluetooth technology eliminates the need for numerous and inconvenient cable

attachments for connecting computers, mobile phones, mobile computers, and handheld

devices. The idea is to create a single digital wireless protocol to address end-user problems

arising from proliferation of various mobile devices.

In short, it is a wireless replacement for many of the cables we currently use to transmit voice

and data signals.

According to Bluetooth SIG, it is the fastest growing industry standard ever as more than

1,300 manufacturers have joined the Bluetooth family. Bluetooth wireless technology is a

short-range communications technology intended to replace the cables connecting portable

and/or fixed devices while maintaining high levels of security. The key features of Bluetooth

technology are robustness, low power, and low cost. The Bluetooth specification defines a

uniform structure for a wide range of devices to connect and communicate with each other.

Bluetooth technology has achieved global acceptance such that any Bluetooth enabled device,

almost everywhere in the world, can connect to other Bluetooth enabled devices in

 proximity. Bluetooth enabled electronic devices connect and communicate wirelessly through

short-range, ad hoc networks known as piconets. Each device can simultaneously

communicate with up to seven other devices within a single piconet. Each device can also

 belong to several piconets simultaneously. Piconets are established dynamically and

automatically as Bluetooth enabled devices enter and leave radio proximity.

Page 9: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 9/40

9

A fundamental Bluetooth wireless technology strength is the ability to simultaneously handle

 both data and voice transmissions. This enables users to enjoy variety of innovative solutions

such as a hands-free headset for voice calls, printing and fax capabilities, and synchronizing

PDA, laptop, and mobile phone applications to name a few.

Specification make-up:

Unlike many other wireless standards, the Bluetooth wireless specification gives product

developers both link layer and application layer definitions, which supports data and voice

applications.

Spectrum: 

Bluetooth technology operates in the unlicensed industrial, scientific and medical (ISM) band

at 2.4 to 2.485 GHz, using a spread spectrum, frequency hopping, full-duplex signal at a

nominal rate of 1600 hops/sec. The 2.4 GHz ISM band is available and unlicensed in most

countries.

Interference: 

Bluetooth technology’s adaptive frequency hopping (AFH) capability was designed to reduce

interference between wireless technologies sharing the 2.4 GHz spectrum. AFH works within

the spectrum to take advantage of the available frequency. This is done by detecting otherdevices in the spectrum and avoiding the frequencies they are using. This adaptive hopping

allows for more efficient transmission within the spectrum, providing users with greater

 performance even if using other technologies along with Bluetooth technology. The signal

hops among 79 frequencies at 1 MHz intervals to give a high degree of interference

immunity.

Range:

The operating range depends on the device class:

  Class 3 radios –  have a range of up to 1 meter or 3 feet

  Class 2 radios –  most commonly found in mobile devices –  have a range of 10 meters or

33 feet

  Class 1 radios  –  used primarily in industrial use cases  –  have a range of 100 meters or

300 feet

Page 10: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 10/40

10

Power :

The most commonly used radio is Class 2 and uses 2.5 mW of power. Bluetooth technology

is designed to have very low power consumption. This is reinforced in the specification by

allowing radios to be powered down when inactive. The Generic Alternate MAC/PHY in

Version 3.0 + HS enables the discovery of remote AMPs for high speed devices and turns on

the radio only when needed for data transfer giving a power optimization benefit as well as

aiding in the security of the radios.

Data rate:

1 Mbps for Version 1.2; Up to 3 Mbps supported for Version 2.0 + EDR

Up to 24 Mbps supported for Version 3.0 + HS

OVERVIEW OF OPERATION

RADIO:

The Bluetooth RF (physical layer) operates in the unlicensed ISM band at 2.4GHz. The

system employs a frequency hop transceiver to combat interference and fading, and provides

many FHSS carriers. RF operation uses a shaped, binary frequency modulation to minimize

transceiver complexity. The symbol rate is 1 Mega symbol per second (Msps) supporting the

 bit rate of 1 Megabit per second (Mbps) or, with Enhanced Data Rate, a gross air bit rate of 2

or 3Mb/s. These modes are known as Basic Rate and Enhanced Data Rate respectively.

RADIO CHANNEL:

During typical operation, a physical radio channel is shared by a group of devices that are

synchronized to a common clock and frequency hopping pattern.

Page 11: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 11/40

11

PICONETS CONSIST OF MASTER AND SLAVE DEVICES

One device provides the synchronization reference and is known as the master. All other

devices are known as slaves. A group of devices synchronized in this fashion form a piconet.

This is the fundamental form of communication for Bluetooth wireless technology.

FREQUENCY HOPPING AND ADAPTIVE FREQUENCY HOPPING

(AFH):

Devices in a piconet use a specific frequency hopping pattern which is algorithmically

determined by certain fields in the Bluetooth specification address and clock of the master.

The basic hopping pattern is a pseudo-random ordering of the 79 frequencies in the ISM

 band. The hopping pattern may be adapted to exclude a portion of the frequencies that are

used by interfering devices. The adaptive hopping technique improves Bluetooth technology

co-existence with static (non-hopping) ISM systems when these are co-located.

TIME SLOTS AND PACKETS- FULL DUPLEX TRANSMISSION

The physical channel is sub-divided into time units known as slots. Data is transmitted

 between Bluetooth enabled devices in packets that are positioned in these slots. When

circumstances permit, a number of consecutive slots may be allocated to a single packet.

Frequency hopping takes place between the transmission and reception of

 packets. Bluetooth technology provides the effect of full duplex transmission through the use

of a time-division duplex (TDD) scheme.

LINK AND CHANNEL MANAGEMENT PROTOCOLS CONTROL

LAYERS

Above the physical channel there is a layering of links and channels and associated control

 protocols. The hierarchy of channels and links from the physical channel upwards is physical

channel, physical link, logical transport, logical link and L2CAP channel.

Page 12: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 12/40

12

PHYSICAL LINKS:

Within a physical channel, a physical link is formed between any two devices that transmit

 packets in either direction between them. In a piconet physical channel there are restrictions

on which devices may form a physical link. There is a physical link between each slave and

the master. Physical links are not formed directly between the slaves in a piconet .

LOGICAL LINKS:

The physical link is used as a transport for one or more logical links that support unicast

synchronous, asynchronous and isochronous traffic, and broadcast traffic. Traffic on logical

links is multiplexed onto the physical link by occupying slots assigned by a scheduling

function in the resource manager.

LINK MANAGER PROTOCOL:

A control protocol for the baseband and physical layers is carried over logical links in

addition to user data. This is the link manager protocol (LMP). Devices that are active in a

 piconet have a default asynchronous connection-oriented logical transport that is used to

transport the LMP protocol signalling. For historical reasons this is known as the ACL logical

transport. The default ACL logical transport is the one that is created whenever a device joins

a piconet. Additional logical transports may be created to transport synchronous data streams

when this is required.

The link manager function uses LMP to control the operation of devices in the piconet and

 provide services to manage the lower architectural layers (radio layer and baseband layer).

The LMP protocol is only carried on the default ACL logical transport and the default

 broadcast logical transport.

L2CAP:

Above the baseband layer the L2CAP layer provides a channel-based abstraction to

applications and services. It carries out segmentation and reassembly of application data and

multiplexing and de-multiplexing of multiple channels over a shared logical link. L2CAP has

a protocol control channel that is carried over the default ACL logical transport. Application

Page 13: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 13/40

13

data submitted to the L2CAP protocol may be carried on any logical link that supports the

L2CAP protocol.

PRACTICAL OBJECTIVES:

  To understand the wireless control algorithm.

  To program the motor control by analyzing the wirelessly transmitted data

and to transmit the result of executed tasks to the server.

  To compile the slave-party program, port it to the controller using the boot

loader and connect it to server, and then check whether the program operates

normally.

MASTER OR SERVER

HARDWARE

SERVER PROGRAM

(BT-3000 WIRELESS

EMBEDDED TRAINING

SYSTEM SOFTWARE

AND CCS-C COMPILER)

COMPUTER (P IV)

SLAVE HARDWARE

USB 

POWER

DC MOTOR PRACTICE

MODULE

UART

9V, 1A SUPPLY

BLUETOOTH COMMUNICATION

(ACL) LINK

Page 14: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 14/40

14

SYSTEM INTRODUCTION 

BT-3000 system is divided into modules on the slave board so that the hardware and software

can be studied separately.

BT-3000 system is composed of the following components.

1. Server Bluetooth hardware for communication with a slave.

2. Server program for slave information monitoring.

3. Bluetooth module for mobile communication.

4. Controller for module control.

5. Module part that measures the surrounding values and detects.

The system uses a PIC series controller as a processor to control Bluetooth. Although other

 processors can be used depending on the function to be implemented.

BT-3000 Hardware Configuration

1)  System Connection Method

As shown above, BT-3000 connection between the program and hardware is communicated

through USB. When a command is sent to server hardware from the server program, the

server hardware performs wireless communication with slave hardware and controls module

that is mounted on a slave.

PICprocessor

UAR BT BT UARPIC

processor

Page 15: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 15/40

15

2)  Module Connection

Mount a module to be used in Con3 and Con4 practice on the right side of slave board. All

used modules are mounted here. When a user created his/her own module, it has to be tested

for power connector and ground before mounting. The serial number of module that is used

in practice ranges from BT-3000-04 ~ 16

When mounting the module, the module must be placed so that the module serial number can

 be seen from the left. Or, parts numbers must be seen clearly. If the direction of module is

incorrect, it cannot be mounted on the board.

3) Slave Board Parts Description

-. Bluetooth Chipset part

This part controls the communication to the slave. On the slave board, Class 1

Bluetooth chipset is used to enable nearby wireless communications. When a user becomes

familiar with programming, server side also can be embedded to reduce the communication

distance limitation.

-. Interface part

The interface part of a slave board can be used to individually learn Bluetooth chipset or to

load a program onto mycom. Direct programming through UART is not yet supported.

-. LED part 

This part is used to check the currently operating slave status. This part is largely divided into

two parts. LED part1 displays the operation status of Mycom and Bluetooth, and LED part2

is a LED that notifies the type of currently connected modules.

When a user mounts a power group or a motor group onto a slave board, Mycom

Recognizes the mounted module and displays a respective LED.

IDLE: In this status, only power is supplied to Bluetooth and no communication are being

 processed.

Page 16: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 16/40

16

CONN: This status shows that the device is in connection with a server.

Once a module is mounted, each group's respective LED is lit.

-. Power & Audio part 

BT-3000 system uses various powers to operate numerous sensors. Main power supplied to a

slave board is provided in adopter format and uses 9V 1A.

Also, for voice communication during basic communication practices, audio jack (ear

microphone jack) is attached.

Page 17: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 17/40

17

EQUIPMENTS AND MATERIALS

1)  BT-3000 master board

2)  BT-3000 slave board

3)  USB cable (computer server program and master board communication purpose)

4)  UART cable (for downloading a compiled program)

5)  C compiler for PIC (CCS-C recommended)

6)  PIC16F877 microcontroller

7)  Program

8)  9V,1A DC adopter (power supply for slave)

Page 18: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 18/40

18

CHAPTER-2

Module description

Dc motor module

Dc motor control practice

Page 19: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 19/40

19

Module Description

DC Motor Module

DC motor module receives a signal from a server and rotate/reverse-rotate the motor. A user

must refer to the provided circuit diagram to learn about the module properties, and then

write a PIC series controller program to confirm the normal operation of a module.

DC MOTOR MODULE [PN: BT-3000-3]

1. Power connector

: Connector to receive power for the module from the slave board.

2. L298 DC motor driver IC

: DC Motor driver chip.

3. DC motor connection socket

: Socket to connect the DC motor to the module.

4. Controller data connector

: Connector to transfer data from the controller to the module and vice versa.

Motor Control Practice

In this practice, a program is written that controls DC motor from a remote location.

<Required Devices>

-. Server Hardware

-. Server Program

-. Slave Hardware (PN:BT-3000-1)

-. Controller Module (PN:BT-3000-2)

-. DC Motor Module (Appl 1, PN:BT-3000-4)

-. PIC Compiler (CCS-C)

Page 20: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 20/40

20

DC MOTOR:

DC Motor used is universal type and the methods of control are also well known ones. The

motor is driven with the help of L298 circuit which is a universally used method. We can

drive motor by entering three control data (left clock, right clock, enable) to the circuit chip.

The DC motor driver chip used in this module, is one which can control two motors at the

same time.

The motor operation is very simple. It rotates either clockwise, counter clockwise, or stops

depending on whether there is a clock in the corresponding direction.

Programming the parts related with DC motor control. User composes the functions to

control DC motor, and compose the program calling the functions.

DC MOTOR CONTROL PRACTICE

In order to drive a DC motor, the controller should send data to the motor. When we apply

5V to the input port after setting the desired motor, the motor will run in the set direction.

SOURCE CODE:

Motor rotation functions (pins)

Pin_b1: left clock (the left motor rotates when this port value is set high)

Pin_b2: right clock (the right motor rotates when this port value is set high)

Pin_b3: motor enable (the motor stops when this port value is set low)

The pin number of these three pins on the controller is 34, 35, and 36 respectively. 

void App1_Left_MotorOn(int delay)

{

output_high(pin_b3);

output_high(pin_b1);

output_high(pin_b2);

}

Page 21: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 21/40

21

void App1_Right_MotorOn(int delay)

{

 put_high(pin_b3);

output_low(pin_b1);output_low(pin_b2);

}

void App1_Stop_MoterOn(int delay)

{

output_low(pin_b3);

}

}

Programming the functions that is transmitting the data as well as analyzing Bluetooth

command language. We programmed the functions which is handling every instruction by

analyzing the data delivered from Bluetooth.

Command execution function (cmd) is a routine to analyze commands sent from the server

and then execute them.

void App1_Cmd_Data(unsigned int cmd)

{

switch(cmd)

{

case 0x02: //APP1_LEFTMOTER

App1_Left_MotorOn(10);

Tx_Data[5] = 0x01;

Tx_Data[6] = 0x01;

Tx_Data[7] = 0x02;

Send_Data();

 break;

case 0x01: //APP1_RIGHTMOTER

Page 22: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 22/40

22

App1_Rtight_MotorOn(10);

Tx_Data[5] = 0x01;

Tx_Data[6] = 0x01;

Tx_Daa[7] = 0x01;

Send_Data();

 break;

case 0x03: //APP1_STOPMOTER

App1_Stop_MoterOn(10);

Tx_Data[5] = 0x01;

Tx_Data[6] = 0x01;

Tx_Data[7] = 0x03;

Send_Data();

 break;

}

}

The above functions are to analyze the data sent from the server to determine how to operate

and control the motor, and to enter the value to Tx variable (tx_data[]) to transmit the control

status. 0x01,0x02 and 0x03 beside the “case” are command codes transmitted from the

server, which indicate right motor on, left motor on, and motor stop respectively.

Storage values are tx_data[5], tx_data[6] and tx_data[7], which store 111,112 and 113

respectively

For right motor on, left motor on and motor stop.

Program to send the result of processed command to the server.

Create a function to analyze the data transmitted from the server and determine whether the

command is to check or to control the module.

Page 23: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 23/40

23

void hci_2_mcp()

{

switch(Rx_Data[5])

{case 0x80://MCP_CON

Module_Num_Rsp();

 break;

case 0x0d://CMD_DATA

Cmd_Buffer(Rx_Data[7]);

 break;

}

}

void Module_Num_Rsp()

{

Tx_Data[5] = 0xa0;

Tx_Data[6] = 0x01;// MCP_HANDLE

Tx_Data[7] = ModuleNumber;

MCP_Send_Data();

//Ack Module Number

}

Create a function to determine what module the input data applies to.

void Cmd_Buffer(unsigned int cmd)

{

switch(ModuleNumber)

{

case 1: App1_Cmd_Data(cmd);

Page 24: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 24/40

24

 break;

case 2: App2_Cmd_Data(cmd);

 break;

case 3: App3_Cmd_Data(cmd); break;

case 4: App4_Cmd_Data(cmd);

 break;

case 5: App5_Cmd_Data(cmd);

 break;

case 6: App6_Cmd_Data(cmd);

 break;

case 7: App7_Cmd_Data(cmd);

 break;

case 8: App8_Cmd_Data(cmd);

 break;

case 9: App9_Cmd_Data(cmd);

 break;

case 10: App10_Cmd_Data(cmd);

 break;

case 11: App11_Cmd_Data(cmd);

 break;

case 12: App12_Cmd_Data(cmd);

 break;

case 13: App13_Cmd_Data(cmd);

 break;

}

}

Program to send data:

void MCP_Send_Data()

Page 25: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 25/40

25

{

Tx_Data[0] = 0x02;

Tx_Data[3] = 0x03;

Tx_Data[4] = 0x00;

 putc(Tx_Data[0]); // uart

 putc(Tx_Data[1]); // handle

 putc(Tx_Data[2]); // handle

 putc(Tx_Data[3]); // length

 putc(Tx_Data[4]); // length

 putc(Tx_Data[5]); // data

 putc(Tx_Data[6]); // data

 putc(Tx_Data[7]); // data

}

Each data entry in the above program is programmed to be automatically stored by other

functions. If the data has been normally entered, you can call the above function to send data

to the server whenever it is necessary. After completing the program, user compile the

composed program and the compiled hex file should be ported to controller. In due course,

firstly the happened errors must be found out and adjusted. This includes composing the slave

 program and compiling it, and program porting to controller. We have used the “CCS-C

compiler (PICC)”.Connect the cable between BT-3000 master device and slave device. The

cable for server should be connected with computer and USB, the cable for slave should be

connected with computer and UART.

Convert the “SW1” which is located at slave board centre into “PC”, after then turn on the

 power on slave board. Execute the boot loader program. Set up the port to Com1 and speed to

9600 on boot loader program screen. Leave EEPROM option as it is. Press “search [F2]”

 button and select the file to record to controller.  Now press the “write [F4]” button one time

and press reset button. If recorded successfully, a message of completion will be shown on

the screen. After this convert “SW1” into “BC” on slave board and press reset on

microcontroller.

Page 26: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 26/40

26

Programming evaluation

It is the practice for identifying the facts whether it can be connected to the server or not,

after completing the installation program of Bluetooth slaves. If there are some errors, look

over the procedures from the first.

- Install the BT-3000 wireless embedded training system software.

- The LED on the slave board should light on “IDLE”. 

- Click the icon named basic practice among right side icons of server program. Amenu will appear. Click on the button of peripheral device.

-

- Click the retrieval button which will show an address that confirms normal execution

of program. Select the required slave address.

- Click return button and press the ACL linking button (data linking).

- After the ACL linking is complete, the message “DC motor module connected” wi ll

appear. Click the motor controlling button.

- The motor controlling practice screen appears. Select the DC motor practice screen.

Click the button on the bottom to control DC motor. The leftmost button rotates the

motor in reverse direction and the rightmost button rotates the motor in forward

direction.

- When practice is over, click the button located on the bottom of the right buttons to

move to the initial screen. Here the connection with slave side is automatically

disconnected.

Page 27: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 27/40

27

CHAPTER-3

Power control mode

Power control practice module

Page 28: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 28/40

28

POWER/CURRENT CONTROL

Program a system that controls general power source which has been controlled simply with

ON/OFF function, at a remote site and receives feedback of the control status.

POWER CONTROL MODE

The practice module is configured to control each LED’s by controlling the power source. In

actual use, relay is used to control AC power source. The practice module is configured with

a circuit to turn ON/OFF each LED which does not require a large current.

FIG: CONCEPTUAL DIAGRAM FOR POWER SOURCE OPERATION

POWER CONTROL PRACTICE MODULE:

We are using BT-3000-6(power control module) and BT-3000-7(current control module),

each of which is configured to operate being connected to the slave board BT-3000-1. To

each module power line from the slave board and the data line from the controller areconnected.

1.  POWER CONNECTOR

: Connector to receive power from the slave module

2.  LED

: Power source turned ON/OFF by the data sent from the server

PIC PROCESSOR

DATA

CLOCK

ENABLE

IC 74LS595

A

B

C

D

LED

LED

LED

LED

Page 29: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 29/40

29

3.  LED Driver IC

: IC that sends ON/OFF data to the LED

4: CONTROLLER DATA CONNECTOR

: Connector to transfer data from the controller to the module and vice-versa

SOURCE CODE:

POWER CONTROL MODE

Function to send data high to the port

Void App3_DataHigh()

{

output_low(pin_b2); //APP3_SERIAL_CLOCK

output_low(pin_b3); //APP3_SERIAL_SHIFT

delay_us(50);

output_high(pin_b1); //APP3_SERIAL_DATA

output_high(pin_b2);

delay_us(50);

output_low(pin_b2);

output_high(pin_b3);

output_low(pin_b1);

}

Function to send data low to the port 

void App3_DataLow()

{

output_low(pin_b2);

output_low(pin_b3);

Page 30: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 30/40

30

delay_us(50);

delay_us(50);

output_low(pin_b2);

output_high(pin_b3);

output_low(pin_b1);}

Function to receive control data and output it as high or low directly to the

port

void App3_PowerControlDataOut(unsigned int ControlData)

{

unsigned int i=0,ControlBit=0, Mask = 0x01;

int ControlBitSize =7;

for(i = 0; i<= ControlBitSize; i++)

{

ControlBit = ControlData & Mask;

Mask = Mask << 1;

if(ControlBit>>i) { App3_DataHigh(); }

else { App3_DataLow(); }

}

}

Page 31: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 31/40

31

Function to receive data input (room) about which of the four lights will be

controlled and choose to control light.

void App3_PowerControlCommand(int Room)

{

switch(Room)

{

case 0x01:

APP3_RoomContralInformation = (APP3_RoomContralInformation ^ 0x80);

  //1000 0000

 break;

case 0x02:

APP3_RoomContralInformation = (APP3_RoomContralInformation ^ 0x40);

  //0100 0000

 break;

case 0x03:

APP3_RoomContralInformation = (APP3_RoomContralInformation ^ 0x20);

  //0010 0000

 break;

case 0x04:

APP3_RoomContralInformation = (APP3_RoomContralInformation ^ 0x10);

  //0001 0000

 break;

default: break;

Page 32: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 32/40

32

}

App3_PowerControlDataOut (APP3_RoomContralInformation);

}

Function to decide which light the server is going to control, by analyzing

the rx_data.

void App3_Cmd_Data(unsigned int data)

{

int room = 0;

if(data == 0x01){room = 1;}

else if(data == 0x02){room = 2;}

else if(data == 0x03){room = 3;}

else if(data == 0x04){room = 4;}

else if(data == 0x11){room = 1;}

else if(data == 0x12){room = 2;}

else if(data == 0x13){room = 3;}

else if(data == 0x14){room = 4;}

App3_PowerControlCommand(room);

Tx_Data[5] = 0x03;

Tx_Data[6] = 0x01;

Tx_Data[7] = data;

Send_Data();

}

Page 33: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 33/40

33

CHAPTER-4

Current control mode

Current control practice mode

Page 34: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 34/40

34

CURRENT CONTROL MODE.

This mode is a little different from general power control mode. It controls the brightness of

the light bulbs with filament, which is applicable to the today’s lightning facilities or other

fields that require brightness control. We are using MAX5160 IC for controlling the current.

FIG: CONCEPTUAL DIAGRAM FOR CURRENT CONTROL MODEL

CURRENT CONTROL PRACTICE MODULE

1.  POWER CONNECTOR

: Connector to receive power from the slave module

2.  LIGHT

: Light bulb of which brightness changes with the change in current

3.  LIGHT Driver IC

: IC to control the light bulb

4: CONTROLLER DATA CONNECTOR

: Connector to transfer data from the controller to the module and vice-versa

PIC PROCESSOR

DATA

CLEAR

ENABLE

MAX5160

CURRENT

LIGHT

Page 35: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 35/40

35

SOURCE CODE:

The chip used in this practice can perform total 10 steps of control, which we can adjust by

 programming.

The function to increase one step by controlling the chip

void App4_StepInc()

{

int i;

for(i=0;i<2;i++)

{

output_low(pin_b3);

output_high(pin_b2);

delay_us(50);

output_low(pin_b1);

delay_ms(1);

output_high(pin_b1);

output_high(pin_b2);output_high(pin_b3);

delay_ms(50);

}

APP4_StepCount++;

if(APP4_StepCount>9){APP4_StepCount = 9;}

if(APP4_StepCount<0){APP4_StepCount = 0;}

}

Page 36: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 36/40

36

Program to decrease two steps at a count

void App4_StepDec()

{

int i;

for(i=0;i<2;i++)

{

output_low(pin_b3);

output_low(pin_b2);

delay_us(50);

output_low(pin_b1);

delay_ms(1);

output_high(pin_b1);

output_high(pin_b2);

output_high(pin_b3);

delay_ms(50);

}

APP4_StepCount--;

if(APP4_StepCount>9){APP4_StepCount = 9;}

if(APP4_StepCount<0){APP4_StepCount = 0;}

}

void App4_CurrentPortInit()

{

int i;

set_tris_b(0xf0); // 1111 0000

output_high(pin_b1); // INC=high

output_high(pin_b2); // U/D=high

output_high(pin_b3); // CS Port

for(i=0;i<30;i++) { App4_StepInc(); }

}

Page 37: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 37/40

37

Function to analyze the data sent from the server and execute the

corresponding command

void App4_Cmd_Data(int cmd)

{

switch(cmd)

{

case 0x02: // APP4_STEPUP

App4_StepDec();

Tx_Data[5] = 0x04;

Tx_Data[6] = 0x00;

Tx_Data[7] = 0x02;

Send_Data();

 break;

case 0x01: // APP4_STEPDN

App4_StepInc();

Tx_Data[5] = 0x04;

Tx_Data[6] = 0x00;

Tx_Data[7] = 0x01;

Send_Data();

 break;

}

}

Page 38: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 38/40

38

CONCLUSION

The aim of this project is to achieve remote control by establishing a wireless communication

with an application via Bluetooth. We have successfully tested the BT 3000 modules tocommunicate and control the target modules. According to the result of the project, a

conclusion is come to that wireless control of applications via Bluetooth technology is

feasible. The idea is to improve everyday instrument field technology by replacing wire

controlled parts with wireless parts and apply it to telemetric and home-automation to

develop ubiquitous systems.

Page 39: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 39/40

39

REFERENCES 

Sung-Jin Park, Kwang-Wook, Jung, “Wireless Embedded Training System”,2005

Mc Dermott- Wells, P; “ What is Bluetooth?” ,Potentials, IEEE, Volume 23, Issue 5, 

Dec 2003-Jan 2005, page(s): 33-35.

Yabin Liu; Shouqian Yu; Weihai Chen; Wei Li; “Wireless Communication Technology

 based on Bluetooth and its application to a manipulator”, Industrial Informatics, 2006 IEEE

International conferences 16-18 aug 2006, page(s): 1251-1256

Sturtman , Charles F, “Bluetooth: connecting without cables”, 2006 Bluetooth SIG,

“Bluetooth specifications version 1.1”, 

Available HTTP: http://www.bluetooth .com

R. Shepherd , “Bluetooth wireless technology in the home”, Electronics and Communications

Engineering Journal Vol.13, Issue 5, Oct. 2001, pp. 195-203

D Chomienne and M. Eftimakis. (2001). Bluetooth Tutorial.[Online].

Available: http://www.newlogic.com/products/Bluetooth-Tutorial-2001.pdf

Page 40: RUDRA_PROJECT.docx

7/27/2019 RUDRA_PROJECT.docx

http://slidepdf.com/reader/full/rudraprojectdocx 40/40