bluetooth module for bigenners

25
1 KC Wirefree Bluetooth Beginner’s Guide Version 1.8 Nov 2006

Upload: laithnatour

Post on 20-Oct-2015

52 views

Category:

Documents


5 download

DESCRIPTION

KC Wirefree Bluetooth transceiver (transmitter and receiver) are welldeveloped and designed to be a robust, flexible and reliable product. All products aresuitable for OEM development, manufacturing, student’s research and developmentwork. KC Wirefree offers software or firmware customizations to help minimized thetime for new product to reach the marke

TRANSCRIPT

Page 1: Bluetooth module for bigenners

1

KC Wirefree Bluetooth

Beginner’s Guide

Version 1.8

Nov 2006

Page 2: Bluetooth module for bigenners

2

Table of Contents

Chapter

1. Introduction 3 1.1 Bluetooth Technology and Transceiver 3 1.2 Product range 4 1.2.1 Bluetooth OEM Modules 4 1.2.2 Bluetooth Serial Adaptor 5 1.3 Applications 7 1.4 Documents from KC Wirefree 7

2. OEM module - How to start? 8

2.1 Hardware Interface 8 2.2 Testing Functionality 11 2.3 Computer as host 13 2.4 Microcontroller as host 15 2.5 Independent 19

3. Serial Adaptor – How to start? 20

3.1 Hardware Interface 20 3.2 Testing Functionality 21 3.3 Computer as host 21 3.4 Microcontroller as host 22

4. Warranty 23 5. Re-flash firmware 23

4.1 Flashing KC Wirefree Bluetooth Transceiver 23

Page 3: Bluetooth module for bigenners

3

1. Introduction

KC Wirefree Bluetooth transceiver (transmitter and receiver) are well developed and designed to be a robust, flexible and reliable product. All products are suitable for OEM development, manufacturing, student’s research and development work. KC Wirefree offers software or firmware customizations to help minimized the time for new product to reach the market. 1.1 Bluetooth Technology and Transceiver

Bluetooth Technology is standard for short-range radio communication. It is a

low cost bi-directional (2 ways) wireless interface between mobile devices that provides low power consumption. Bluetooth Transceiver referring to Bluetooth Transmitter and Receiver and every Bluetooth node has Bluetooth Transceiver. The aim is to eliminate the usage of cables. Bluetooth system operates in worldwide unlicensed 2.4GHz Industrial-Scientific-Medical (ISM) frequency band. Bluetooth devices can form a network. The basic network is Piconet where there are a master node and other act as slave node/s. At least 2 nodes are required to form Bluetooth network, either one of the nodes can be master. The role of master is just to search and initiate the connection, once the link is established; the role of each node is equal.

Figure 1: Host to host communication through Bluetooth Transceivers

Bluetooth transceiver is a wireless transceiver that transmits and receives

signal wirelessly through Bluetooth protocol, thus a host, or in other words a controller is necessary if data processing is required in the application. As shown from the above figure, there are two hosts (Host 1 and 2, it can be microcontroller, computer, PDA, etc) and two Bluetooth transceivers. Both host need to communicate (exchange data), while Bluetooth transceiver is the tools to transfer the data between host. Thus, to process data and operate Bluetooth transceiver, a controller is necessary. There are few methods to connect Bluetooth transceiver to host, where most common

Bluetooth Host

Other Higher Layer Driver

SPP

Physical Bus Driver (Bus, PC Card, Other

Driver)

Host 1 Bluetooth Host

Other Higher Layer Driver

SPP

Physical Bus Driver (Bus, PC Card, Other

Driver)

Host 2

Physical Bus Hardware Physical Bus Hardware

User Data

Physical Bus (USB, PC Card, Other) Firmware

Bluetooth Transceiver

Baseband

SPP

Wireless

Physical Bus (USB, PC Card, Other) Firmware

Bluetooth Transceiver

Baseband

SPP

Page 4: Bluetooth module for bigenners

4

used are UART and USB. KC Bluetooth transceiver use UART to communicate. SPP (Serial Port Profile) is a Bluetooth standard profile which provides the platform for a host to communicate with Bluetooth transceiver serially. 1.2 Product Range KC Wirefree Bluetooth transceiver comes in 2 main categories:

KC Wirefree transceivers are compliant with Bluetooth spec v1.2. For more details, please refer to Bluetooth specification v1.2 at www.bluetooth.org. There are currently 4 types of OEM module and 2 types of serial adapter. 1.2.1 Bluetooth OEM Module

All OEM modules are powered with 3.3V and are small in size. It can be

loaded with SPP (Serial Port Profile) or HCI (Host Controller Interface) firmware. UART is the protocol interface between host and Bluetooth module. The pins involved are RxD, TxD, RTS and CTS. The advantage of KC Wirefree OEM module is it provides the flexibilities to interface with application. These include USB (reserved), CODEC for voice decoding, GPIO for general purpose feedback and control, and UART. Simplicity comes when SPP is used for host to communicate with Bluetooth module. AT command is used as understanding language if SPP is used,

Page 5: Bluetooth module for bigenners

5

please refer to KCserial User Guide and KCserial Reference Guide for more details on AT command. Brief of each module are listed as below: i. KC22

– Communication range up to 20 meters – External antenna – Size of 10mm by 13 mm – 4 general purpose I/O – High speed baud rates cover from 2.4K up to 921K baud – Point to point and point to multipoint connection – Multi device bonding – SPP and HCI firmware available – Hardware interface through UART

ii. KC20 – Communication range up to 20 meters – External antenna – Size of 15mm by 21mm – 11 general purpose I/O – High speed baud rates cover from 2.4K up to 921K baud – Point to point and point to multipoint connection – Multi device bonding – SPP and HCI firmware available – UART

iii. KC21

– Communication range up to 30 meters – Integrated antenna – Size of 15mm by 27mm – 11 general purpose I/O – High speed baud rates cover from 2.4K up to 921K baud – Point to point and point to multipoint connection – Multi device bonding – SPP and HCI firmware available – UART

iv. KC11 – Communication range up to 200 meters – Integrated antenna – Size of 15mm by 48mm – 14 general purpose I/O – High speed baud rates cover from 2.4K up to 921K baud – Point to point and point to multipoint connection – Multi device bonding – SPP and HCI firmware available – UART

Page 6: Bluetooth module for bigenners

6

1.2.2 Bluetooth Serial Adapter

KC Wirefree Bluetooth Serial Adaptor is designed to replace serial cable. Although it comes in larger platform, it is equipped with necessary component to provide instance and secure RS232 wireless link. Benefits for industrial and office equipment include immediate installation that eliminates the need to dig or route wired serial cables, and allows mobile, portable, or remote communications and control. KC Wirefree Serial Adapters are one of the most versatile solutions for serial data transmissions and control. Embedded Bluetooth Serial Port Profile (SPP) allows this serial adapter to work with industrial and other non-computer equipment, which eliminates the need to install any software or device drivers. All Serial Adaptor can be powered from 4V to 10V. UART is the interface between host and Bluetooth module. The pins involved are RxD, TxD, RTS and CTS. AT command is used as understanding language if SPP is used, please refer to KCserial User Guide and KCserial Reference Guide for more details on AT command. Briefs of each adaptor are listed as below: i. KC121

- High-performance communications up to 30 meters - High-speed data rates up to 921K baud (RS232) - Point-to-point & multi-point connections - Automatic, self-connecting paired adapters - Supports SPP - Bluetooth Serial Port Profile - Supports advanced serial port configurations

ii. KC111

- High-performance communications up to 200 meters

- High-speed data rates up to 921K baud (RS232) - Point-to-point & multi-point connections - Automatic, self-connecting paired adapters - Supports SPP - Bluetooth Serial Port Profile - Supports advanced serial port configurations

Page 7: Bluetooth module for bigenners

7

1.3 Applications

KC Wirefree Bluetooth transceiver act as a cable replacement tools. SPP provides secure and connected oriented wireless link. KC Wirefree Bluetooth transceiver is suitable to be interfaced with computer, microcontroller or even independent to create a wireless application. The SPP firmware allows computer with serial port and microcontroller with UART to be the host of KC Wirefree transceiver. The possible applications and development areas are: (not limited)

• Embedded systems • Stand alone sensors • Computer peripherals • Mobile phone and headset • Wending machine • PDA • Medical • Printer • Serial port replacement • Wireless bootloader • Remote control • RC car • RC airplane and helicopter • Home equipment • Mobile robot • More……

1.4 Documents from KC Wirefree

i. Getting Started Guide – Description of how to communicate with KC Wirefree Bluetooth transceiver using AT command through HyperTerminal.

ii. KC Serial User Guide – Explain how to configure hardware interface and communication flow between host and KC Wirefree Bluetooth transceiver.

iii. KC Serial Reference Guide – Explain the function of AT command in details. iv. Hardware Interface – Explain hardware interface between KC Wirefree

Bluetooth transceiver and host. v. Firmware Reprogramming Notes – Explain how to reprogramming KC

Wirefree Bluetooth transceiver. vi. Multipoint Guide – Explain the method to setup an multipoint network using

KC Wirefree Bluetooth transceiver. vii. KC20 – KC20 Bluetooth OEM module data sheet.

viii. KC22 – KC22 Bluetooth OEM module data sheet. ix. KC21 - KC21 Bluetooth OEM module data sheet. x. KC11 – KC11 Bluetooth OEM module data sheet.

xi. KC121 – KC121 Bluetooth Serial Adaptor data sheet. xii. KC111 - KC111 Bluetooth Serial Adaptor data sheet.

Page 8: Bluetooth module for bigenners

8

2. OEM module – How to start?

Generally, KC Wirefree has 4 types of OEM Bluetooth module which are KC22, KC21, KC20 and KC11. The common similarities among these 3 modules are:

- Powered with 3.3V - Host interface through UART - Equipped with GPIO - Small in size

From the features stated, works are required before Bluetooth module can be

used. Bluetooth module is suitable for embedded system. Interfacing with microcontroller or computer for application development is the most common practice. Nevertheless, it can also be a standalone unit as it has GPIO to read sensor status or to control electronics devices. There are several configurations to operate Bluetooth OEM module: independently (standalone module), microcontroller as host (interface to microcontroller) or computer as host. Anyhow, this document will provide the method to start with computer as host, followed by microcontroller as host. 2.1 Hardware Interface

Hardware is the most important part for a system to work. Without correct hardware interface, a system may not work correctly or even caused damage to other components when the power is turned on. Please be careful with hardware interface. The main hardware to be taken care is the voltage regulator. As stated, Bluetooth module is powered with only 3.3V (2.7V to 3.6V). Thus, higher voltage will definitely damage the Bluetooth module while lower voltage will caused unstable operation. One of the main reasons for KC Wirefree module to stop working is firmware corruption. Low voltage operation is the cause of firmware corruption, thus please ensure the operating voltage is within range. Cytron have upgraded KC module’s socket to include MAX809 which monitor the operating voltage and further prevent operation at low voltage. To provide 3.3V, LM1117 3.3 voltage regulator can be used, please refer to schematic below:

Figure 2: Schematic for Bluetooth module with voltage regulator

Page 9: Bluetooth module for bigenners

9

Please completed the connection for voltage regulator without connecting to

Bluetooth module, power up the voltage regulator; check the output voltage to confirm that it is approximately 3.3V. Complete the connection to Bluetooth module, please ensure the polarity (positive (+) should be connected to 3.3V of Bluetooth module while negative (-) should be connected to GND) before powering up again. For new version of KC21, a pull-up resistor of 10K ohm is required at reset pin (pin 3) to ensure the module work properly. However, if MAX809 is connected, no pull-up resistor is required.

After providing power to Bluetooth module, communication interface have to be taken care. Bluetooth module can be interfaced to host through UART. To begin, computer is the best and simplest device to interface to. The reasons are: - It comes will serial communication (hardware and software) - It is reliable - User can key in command and monitor response easily

Although computer is the simplest device to be interfaced with, some hardware interface is needed. Serial port of computer is RS232 standard while Bluetooth module is UART. The difference between these two standards is the voltage level for logic. RS232 used ± 13V as logic while Bluetooth module used 0V and 3.3V for logic 0 and 1. There must be a converter to translate this logic vise versa. MAX232 can be used to complete this task. However, to power the MAX 232, 5V regulator is required. Please refer to schematic for the complete interface.

Figure 3: Circuit of Bluetooth module with voltage regulator

Connection for power supply

Voltage regulator LM1117

KC21 with socket

LED to indicate power ‘On’

Page 10: Bluetooth module for bigenners

10

DB9 (Female) connector is needed to connect to computer’s serial port. The hardware needed for whole interface is listed:

a. 1 unit x PCB board b. 1 unit x KC21 Bluetooth OEM module with socket

Figure 4: Schematic for Bluetooth module with MAX232

Figure 5: Circuit of Bluetooth module with MAX232

MAX232Reset button

Voltage regulator LM7805

Serial cable connector

Page 11: Bluetooth module for bigenners

11

c. 1 unit x LM7805 voltage regulator d. 1 unit x DB9 female connector e. 1 unit x 10uF 16V electrolic capacitor f. 1 unit x 100uF 16V electrolic capacitor g. 6 unit x 0.1uF ceramic capacitor h. 1 meter of Jumping wire i. 1 meter of rainbow cable (3 ways) j. 1 unit x push button k. 1 unit x LED l. 1 unit x 2.2K Ohm resistor m. 1 unit x 4.7K Ohm resistor n. 1 unit x MAX232 o. 1 unit x 16 pins IC socket (optional) p. 1 unit x 1N4007 diode (optional) q. 1 unit x 2510 2 ways connector (optional) r. 1 unit x 2510 3 ways connector (optional)

2.2 Testing Functionality

Nothing has to be done for Bluetooth module side after the interfacing hardware is ready. Next step is to configure the computer. It has to be configured to the correct baud rate (UART data speed) to be able to receive and display data from Bluetooth module. Please follow the instruction as stated below to setup the computer. - Go to Start - Select Programs - Select Accessories - Select Communications (Or HyperTerminal for some system) - Select HyperTerminal

A HyperTerminal window appears (Figure 6) with dialogue box. Enter a name (e.g. test) and click OK.

Figure 6: HyperTerminal window

Page 12: Bluetooth module for bigenners

12

The Connect To dialogue box (Figure 7) appears. Choose the appropriate communication port for each computer and click on OK. The “appropriate communication port” is the port to which the Bluetooth transceiver is connected.

Figure 7: Connect to dialogue box

The Com Port dialogue box (Figure 8) appears. Choose the appropriate settings for each computer and click on OK. The default baud rate of KC Wirefree Bluetooth transceiver is 115.2K baud. Change Flow control to “None” where RTS and CTS is not used.

Figure 8: COM Properties dialogue box

After launching HyperTerminal, a window representing connection appears. Now, connect DB9 connector to serial port of computer, power up Bluetooth module. If everything is correctly configured, the HyperTerminal should show “AT-ZV -

Page 13: Bluetooth module for bigenners

13

CommandMode-”, followed by “AT-ZV BDAddress [Bluetooth address of local device]”. Also, on the bottom status bar of the window, the updated status and time of connection being established is displayed.

Figure 9: AT response from KC Wirefree Bluetooth transceiver These are AT command send from Bluetooth transceiver to host (computer).

These commands are sent to host regardless of host type. In other words, if the host is a microcontroller, these commands will also be sent. HyperTerminal is just a tool that displays the words being sent by Bluetooth transceiver. 2.3 Computer as host

If computer is used to be Bluetooth module host, the basic hardware interface has been shown in section 2.2. Computer is ready to configure the Bluetooth module. Now, is the time to decide this Bluetooth is master or slave node. If it is configured as slave node, there is not much thing to be done because KC Wirefree will automatically accept connection request. If Bluetooth module is configured as master node, it will have to search for Bluetooth module and initiate connection request.

AT command is the language used for communication between host (computer) and Bluetooth module if SPP firmware is loaded. Please refer to KC Serial Reference Guide for more details on AT command. Anyhow, this section will show an example of how to send AT command from HyperTerminal to create connection.

In order to facilitate using HyperTerminal with KC Wirefree Bluetooth transceiver, the use of pre-written test scripts is recommended. Since the firmware is not able to accept typed command corrections, any errors will require the command to be completely re-entered. To solve this inconvenience, follow the procedure detailed in this section to create HyperTerminal text scripts for AT type commands:

- Right click on the Desktop. A drop down menu box appears. - Select New then select Text Document. - Name the document “Connect_Command.txt” or choose an acceptable name.

Page 14: Bluetooth module for bigenners

14

- Open the document by double clicking on it. Type the following command with the desired remote BD address in place: AT+ZV SPPConnect [BD_Addr] BD_Addr can be obtained where a KC Wirefree Bluetooth Transceiver is power on and plug in to computer, as shown in previous section.

- Press Return/Enter at the end of the above text. If you forget to include the Return/Enter, the script will not work.

Figure 10: HyperTerminal text scripts for AT type commands

This section describes how to use the SPP Connect command to create connection with another Bluetooth transceiver. Follow the steps below to invoke a command to create connection:

- On the sending computer’s HyperTerminal main menu, click on Transfer and then select Send Text File. See Figure 11.

- After the browse window appears, locate the previously saved Connect Command script you wish to use. See Figure 12.

- Click on Open. A connection, via Bluetooth link, will be established to the receiving terminal. See Figure 13.

Figure 11: Transfer the script through HyperTerminal

Page 15: Bluetooth module for bigenners

15

Figure 12: Select the script

Figure 13: HyperTerminal at other end showing connection have been setup

“AT-ZV -BypassMode-” appears, Bluetooth transceiver with address 0x00043E008137 has connected to Bluetooth transceiver with address 0x000000E41213. Now every byte send from host will be sent to other Bluetooth transceiver and further to its host. If both Bluetooth transceivers are connected to computer as the host, setup HyperTerminal at both computers, initiate Bluetooth connection by send the SPP Connect command. After both HyperTerminal window show “AT-ZV -BypassMode-”, try to press a key at a computer, the character will appear at other computer HyperTerminal. The character has been send through Bluetooth wireless link to the other computer. Method to use Bluetooth Wireless application has been shown. Develop more applications; don’t let imagination limit it.

Procedures described have shown the method for a computer to communicate with KC Wirefree Bluetooth transceiver, the methods to embedded Bluetooth transceiver will be discuss in following section.

Page 16: Bluetooth module for bigenners

16

2.4 Microcontroller as host KC Wirefree module can be interfaced with microcontroller. Most

applications would likely use microcontroller as Bluetooth transceiver host. Microcontroller can be host of master or slave node. Which types of microcontroller are suitable to be host of Bluetooth module? The microcontroller must have these capabilities:

- UART (Universal Asynchronous Receiver and Transmitter) - Re-programmable (for development purpose) - I/O port (Application purpose) Any microcontroller with these capabilities is able to become host for

Bluetooth transceiver. There are many types of microcontroller come with these capabilities; one of them is PIC16F and PIC18F series of microcontroller. Motorola, Atmel, Philip and many other brand of microcontroller also come with these capabilities. No restriction of microcontroller types and brands. However, PIC seems to be the cheapest and easiest to develop type of microcontroller in the market.

The main concept to interface Bluetooth module with microcontroller is UART connection. The Rx pin of microcontroller must be connected to Tx pin of Bluetooth module, while the Tx pin of microcontroller to Rx pin of Bluetooth module. Voltage will be another important element in this interface. Most microcontroller operate at 5V while Bluetooth module operate at 3.3V. The board should have voltage regulator for both device. Furthermore, voltage from microcontroller must not overload Bluetooth module. To ensure this, a voltage divider is required for UART connection. Tx of microcontroller will supply 5V logic to Rx of Bluetooth module. Direct connection might spoil Bluetooth module slowly. It is good to have voltage divider for this connection. Figure 14 shows the connection if microcontroller is used as host for Bluetooth module.

Figure 14: Schematic of Bluetooth module with PIC16F877A

Page 17: Bluetooth module for bigenners

17

Figure 15: Circuit of microcontroller with Bluetooth module

No MAX232 is required in this case since RS232 is not involved. As

shown, there are some differences between interfacing to computer and interface to microcontroller. The components needed for microcontroller as host are:

a. 1 unit x PCB board b. 1 unit x KC21 Bluetooth OEM module with socket c. 1 unit x 0.1uF ceramic capacitor d. 1 meter of Jumping wire e. 1 unit x 2.2K Ohm resistor (voltage divider) f. 1 unit x 4.7K Ohm resistor (voltage divider) g. 1 set x PIC16F877A basic circuit (SK40A)

Combination of microcontroller and Bluetooth module can be configured

as master or slave node. For either configuration, is not easy for user to see the response from Bluetooth as shown in previous section (computer as host). Basic microcontroller circuit does not have component such as LCD to display the response. Furthermore, user is require to write program for microcontroller to display the response from Bluetooth module. This document will not show sample program as there are many possible way to write program and too many microcontroller and language to cover. As stated, no restriction on microcontroller types and brands, even the programming language too. User may choose the comfortable or familiar programming language to develop the algorithm. The basic requirement is able to send ASCII code serially (through UART), and also process the data received from Bluetooth module. The ASCII code will actually form the AT Command for microcontroller to communicate with Bluetooth module.

Of course, there must be some configurations for microcontroller too. The most important configuration is UART. UART depend on timing or the baud rate, therefore the most important task is to configure the baud rate of microcontroller.

Page 18: Bluetooth module for bigenners

18

Start

Is “Enter” received?

Configure UART

Start receiving data from receiver buffer

Save data in array

Process data, and decide what to send and which

mode to enter

Send data in Hex code to transmit buffer

Finish sending?

YesNo

Yes

No

Further configure the whole UART peripherals ready to communicate with Bluetooth module. The settings are:

i. Baud rate = 115200 bps or 115.2 Kbps ii. Data bits = 8 iii. Parity = none iv. Stop bit = 1

Of course all these settings have to be done using programming language of

each microcontroller. As example, for PIC microcontroller, developer has to use assembly language or C language to configure these settings. Figure 16: Flow chart for microcontroller to communicate with Bluetooth transceiver

Figure 16 shows a flow chart of general concept for microcontroller to

communicate and process data from KC Wirefree Bluetooth transceiver. After configuring UART engine of microcontroller, program should wait for data from UART’s receiver buffer. Store the received data array and checked whether the “Enter” is received. If “Enter” is not yet, continue to wait and keep receive data. If “Enter” is received, process the data array stored and decides which mode to enter or which AT command to be sent? For example, when the received array of data is “AT-ZV BDAdress 00043E008137”, microcontroller should send “AT+ZV SPPConnect 000000E41213” to Bluetooth transceiver. This data array should be sent to transmitter buffer. If “AT-ZV –BypassMode–” is received, the microcontroller has entered bypass mode and AT command should NOT be sent to Bluetooth transceiver, except RMC is used. This is an example of programming concept, developer may have better algorithm to write program for microcontroller.

What is AT command? AT command is a language originally used by modem. Now it has been applied in Bluetooth SPP. Every AT command start with AT and end with “enter” or <CR><LF> (i.e. “<CR>\n” in C, or in Hex value is 0x0D 0x0A). Some common description of AT command in KC Serial:

Page 19: Bluetooth module for bigenners

19

- “AT+parameter” is command send from host to module or serial adaptor. - “AT–parameter” is command send from module to host. - Every AT command must start with “AT” or 0x41 0x54 in Hex value. - Every AT command must be ended with “Enter” or 0x0D 0x0A in Hex

value.

There are 2 modes in Bluetooth configuration. First mode is Command mode, this mode indicate that all data send from host is a command for Bluetooth transceiver, and data send from Bluetooth transceiver to host is event reporting status of Bluetooth transceiver. Second mode is Bypass mode, this mode can only appear when connection between 2 Bluetooth transceivers is established. In Bypass mode, every single byte of data from host will be sent over Bluetooth wireless link to the other Bluetooth node. 2.5 Independent

KC Wirefree Bluetooth module can be configured as stand alone device, no computer or microcontroller is require. The idea is to configure the Bluetooth module as slave where it will auto accept connection from master node. It can be connected to certain sensor (as input) and electronics device as it have GPIO. The master node can control the GPIO of slave through Remote Command Mode (RCM). Please refer to KC Serial Reference Guide for more details on RCM. For stand alone application, please pull high Rx pin with 10K resistor to 3.3V.

Page 20: Bluetooth module for bigenners

20

3. Serial Adaptor – How to start?

Generally, KC Wirefree has 2 types of Bluetooth Serial Adaptor which are KC121 and KC111. The common similarities among these 3 adaptors are:

- Powered with 4V to 10V DC - Ready with RS232 interface - No available GPIO - Come with LED as indicator - Larger in size

From the features stated, less works is required before Bluetooth adaptor can

be used. Bluetooth serial adaptor is suitable to replace serial cable. Though it is bigger in size, it can still be interfaced with microcontroller. Of course with the RS232 interface ready on serial adaptor, it is equipped to be interfaced with computer. Bluetooth serial adaptor cannot be standalone unit from application point of view because its’ GPIO have been hardwarely disabled. Nevertheless, it can also be standalone unit if user is trying to make connection only. Same applied to Bluetooth serial adaptor, this document will provide the method to start with computer as host, follow by microcontroller as host.

The default UART setting for hardware flow control, CTS/RTS is enabled. If this setting is not desired, a feature called streaming serial mode maybe enable using DIP switch block on the back of serial adaptor. To enable streaming serial mode, place switch 1 of DIP into ON position and reset the serial adaptor. To disable it, do it the other way round. Switch 2 to 4 of DIP switch is not used. 3.1 Hardware Interface

As mentioned, serial adaptor comes with RS232 interface; it can be connected to computer easily. Anyhow, there is still some hardware interfaces needed to be done before it can be used. The first is power supply, user can either choose AC power adaptor to provide DC voltage from 4V to 10V or use battery to supply DC voltage. Serial adaptor come with DB9 male connector which is not suitable for computer serial port because both are the same type, DB9 female connector is required to connect both devices together. From figure 17, you will notice that pin 2 and pin 3 is cross connected which means that pin 2 of the Bluetooth module is connected to pin 3 of the computer’s serial port and vice versa. No voltage regulator is needed if the power source is within range. No MAX232 is required since it have been embedded on serial adaptor.

Figure 17: Schematic for connection between two DB9 female connectors

Page 21: Bluetooth module for bigenners

21

Figure 18: Connection of KC121 with AC adapter and DB9 female cable

The hardware needed for interface is listed:

a. 1 unit x AC power adaptor ( output DC 4V to 10V) or 1 unit x Battery with 4V to 10V

b. 1 meter x 3 ways ribbon cable c. 2 unit x DB9 female connector

3.2 Testing Functionality Please refer to section 2.2, is the same. 3.3 Computer as host

The hardware interface is the same as section 3.1. For the software section, this is the same as section 2.3.

Page 22: Bluetooth module for bigenners

22

3.4 Microcontroller as host.

As revealed earlier, Bluetooth serial adaptor can be interfaced with microcontroller. The hardware interface is slightly different from Bluetooth module. Since serial adaptor come with RS232 interface, microcontroller will requires same capability to enable the communication.

Figure 19: Schematic of KC121 interface with PIC16F877A

Figure 20: Connection of KC121 with DC adapter and PIC16F877A.

For the software section the same concept in section 2.4 applied. Thus please refer to corresponding section for further details.

Page 23: Bluetooth module for bigenners

23

3. Warranty Product warranty is valid for 12 months Warranty only applies to factory defect. Damage caused by mis-use is not covered under warranty. Damage unit will be send back to head office for failure analysis. Warranty does not cover freight cost for both ways.

4. Re-flash Firmware

Firmware of KC Wirefree Bluetooth module and Serial Adaptor can be re-flashed. Generally, there are 2 types of firmware for KC Wirefree Bluetooth transceiver. One is HCI firmware, with this firmware loaded, HCI protocol will be needed on host in order to communicate with Bluetooth transceiver. Another firmware is SPP; this profile is higher layer protocol which resized L2CAP and RFCOMM. Normally, Cytron Enterprises will deliver devices with final firmware pre-loaded, thus this should not need to be part of developing process. Typically, the following tools and equipment are requires to re-flash the module:

i. New flash image (firmware) and Flash Tool from Cytron Enterprises. ii. Null modem (crossed) serial cable to PC, available from Cytron

Enterprises. iii. TTL to RS232 level shifter if programming Bluetooth modules (KC20,

KC22, KC21 and KC11). MAX3225E or similar component is recommended.

The new firmware must be loaded using the UART interface. Access to this

interface depends on the transceiver type. The minimum UART pins that are needed are the RxD and TxD pins. RTS and CTS flow control pins are not necessary for programming devices at 115.2K baud (standard), but are required at higher baud rate until maximum of 921K baud. Though RTS and CTS are not necessary, we strongly recommended shorting these 2 pins at computer side. KC111 and KC121 serial adaptors come with DB9 serial connector and a RS232 level output; thus no additional hardware modifications or connections are necessary. KC20, KC11, KC21, and KC22 modules support TTL level UART communications, but a PC requires RS232 voltage levels. Therefore, a TTL to RS232 level shifter is required. The connections of shifter have been shown in section 3.b (hardware, microcontroller as host). 4.1 Flashing KC Wirefree Bluetooth Transceiver

KC Wirefree will deliver the appropriate firmware in a directory structure that

includes the flash tool batch (.bat) files and firmware image. The following procedure must be carefully followed to program the device:

i. Make the necessary serial connections to the PC.

Page 24: Bluetooth module for bigenners

24

ii. Start with the device powered OFF. iii. Run the BurnFirmware_pX.bat file, where X represents the COM port,

1-4, of the PC connection. iv. A DOS shell will appear, and prompt the operator to reset the device. v. Now, ON the device by applying power to it. vi. The program will automatically establish communication and flash the

firmware in memory. At 115K baud, this requires approximately 1 to 2 minutes.

Page 25: Bluetooth module for bigenners

25

Prepared by Cytron Enterprises

27A, Jalan Kebuadyaan 8, Taman Universiti,

81300 Skudai, Johor, Malaysia.

Tel: +607-521 1861 Fax: +607-521 1861

URL: www.cytron.com.my

Email: [email protected] [email protected]

Information contained in this publication regarding device applications and the like is intended through suggestion only and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. No representation or warranty is given and no liability is assumed by Cytron Enterprises incorporated with respect to the accuracy or use of such information, or infringement of patents or other intellectual property rights arising from such use or otherwise. Use of Cytron Enterprises’ products as critical components in life support systems is not authorized except with express written approval by Cytron Enterprises. No licenses are conveyed, implicitly or otherwise, under any intellectual property rights.