Professional Documents
Culture Documents
Table of Contents
Chapter 1. Introduction 1.1 Bluetooth Technology and Transceiver 1.2 Product range 1.2.1 Bluetooth OEM Modules 1.2.2 Bluetooth Serial Adaptor 1.3 Applications 1.4 Documents from KC Wirefree 2. OEM module - How to start? 2.1 Hardware Interface 2.2 Testing Functionality 2.3 Computer as host 2.4 Microcontroller as host 2.5 Independent 3. Serial Adaptor How to start? 3.1 Hardware Interface 3.2 Testing Functionality 3.3 Computer as host 3.4 Microcontroller as host 4. Warranty 5. Re-flash firmware 4.1 Flashing KC Wirefree Bluetooth Transceiver 3 3 4 4 5 7 7 8 8 11 13 15 19 20 20 21 21 22 23 23 23
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, students 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.
Host 1 Bluetooth Host User Data Host 2 Bluetooth Host
Other Higher Layer Driver Wireless Bluetooth Transceiver Baseband SPP SPP Physical Bus Driver (Bus, PC Card, Other Driver) SPP Bluetooth Transceiver Baseband
SPP
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 3
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.
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.
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,
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
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
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.
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 modules 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:
Connection for power supply Voltage regulator LM1117 KC21 with socket
Figure 3: Circuit of Bluetooth module with voltage regulator 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.
Reset button
MAX232
Figure 5: Circuit of Bluetooth module with MAX232 DB9 (Female) connector is needed to connect to computers 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 10
c. d. e. f. g. h. i. j. k. l. m. n. o. p. q. r.
1 unit x LM7805 voltage regulator 1 unit x DB9 female connector 1 unit x 10uF 16V electrolic capacitor 1 unit x 100uF 16V electrolic capacitor 6 unit x 0.1uF ceramic capacitor 1 meter of Jumping wire 1 meter of rainbow cable (3 ways) 1 unit x push button 1 unit x LED 1 unit x 2.2K Ohm resistor 1 unit x 4.7K Ohm resistor 1 unit x MAX232 1 unit x 16 pins IC socket (optional) 1 unit x 1N4007 diode (optional) 1 unit x 2510 2 ways connector (optional) 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.
11
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.
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 -
12
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.
13
- 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 computers 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.
14
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; dont 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.
15
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 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.
17
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.
Start Configure UART Start receiving data from receiver buffer Save data in array Is Enter received? Yes Process data, and decide what to send and which mode to enter Send data in Hex code to transmit buffer No Finish sending? Yes No
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 UARTs 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 ATZV 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:
18
AT+parameter is command send from host to module or serial adaptor. ATparameter 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.
19
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 computers 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 20
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.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.
21
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.
For the software section the same concept in section 2.4 applied. Thus please refer to corresponding section for further details.
22
3. Warranty