| Configuring Bluetooth to Serial Adapter |
Last Modified: 2006-09-21
The Bluetooth to serial adapters are designed into the Garcia circuit board in a modularized fashion. This was done intentionally to allow the greatest potential for flexiblity among what devices get connected to the Bluetooth serial port.
Since a core belief at Acroname is to provide cross platform integration, this tutorial will focus around configuring the adapter through a generalized serial terminal program.
A detailed User Manual is available for download that includes technical information about the adapter, command line details and additional information. Sena, the manufacturors of the Bluetooth to Serial adapters, provide a Windows based GUI for configuring the Bluetooth to Serial adapters. Be sure to download the software for the ESD modules.
In this tutorial, we will step through the configuration process for the Bluetooth adapters to be interfaced with the BrainStems inside the Garcia to serve as a wireless serial hop to a host computer.
A header for interfacing the Bluetooth serial adapter is located on the Garcia circuit board and is based on the Acroname Serial Standard. The header outputs TTL (3.3V) logic on the Bluetooth adapter transmit pin. The Bluetooth adapter receive pin requires a CMOS (5V) logic line to work properly.
Establish Serial Communication with the Bluetooth Adapter
The defualt BLuetooth Serial adapters when brand new (or after a hardware reset) are configured slightly differently then when they are shipped from Acroname inside the Garcia. Open a serial terminal and configure it to have the following settings:
Determine the information of the Bluetooth adapter by typing the command to display the Bluetooth settings (first line only). If the adapter is powered up and working, it should respond with something similiar to the following:
AT+BTINFO? 000B531323CF,ESDv3a-1323CF,MODE0,STANDBY,0,0 OK
The first entry is the MAC address. Every hardware device will have a unique address for identification. Next entry is the friendly device name. This is the name that will show up when a host device is searching for other Bluetooth devices. The next entry is the operational mode. See the user manual for the different modes that can be configured to. Next, is the current operation status is indicated. The next two parts are the authentication and encryption flags. Not activated when set to 0.
Changing the Device Name
The name of the device can be changed to a more meaningful name by altering issuing a name change command. It seems appropriate to change the broadcast name of the bluetooth device to "Garcia". Do this by typing the following command:
Change the Operational Mode
For this tutorial, we want any device to be able to connect to our wireless Garcia when it is powered up. The Bluetooth adapter can be set up to continually broadcast the fact that it is open and can accept connections by changing the operational mode to Mode 3. See the user manual for a listing of other additional modes. Change the mode by issuing the following command:
Perform a Software Reset
Since we have made a change to the Bluetooth's operating mode, we can check to make sure the change has been applied by either cycling the power or by issing a soft reset command. This command disconnects any connected Bluetooth devices and halts all current tasks. Issue a soft reset by typing:
Check to make sure all the changes have been applied by issuing the display Bluetooth settings command. Type the following:
AT+BTINFO? 000B531323CF,Garcia,MODE3,PENDING,0,0 OK
Notice the device name and operation mode are both changed. Also, the operation status is now in PENDING. This means the device is ready to get paired to by another Bluetooth device.
Changing the Baudrate Settings
A default Garcia is configured to run at a serial baudrate of 38400. This means we should change the baudrate setting for the Bluetooth to match. Type the following command:
At this point, either power cycle the Bluetooth adapter or issue a software reset command.
Optimizing Bluetooth Throughput
When running a Garcia with a Bluetooth link, you will notice a significant delay from the moment you send a command to the robot from a host machine. One source for this delay is by default, the Bluetooth adapters are configured to optimize throughput to increase communication efficiency. Since the packet length for the BrainStem are very small we want the information transmitted as fast a possible to the robot.
A number of device registers can be manipulated to maximize the performance of the Bluetooth adapter. Since we send very small packets of information back and forth, we want to change the UART Stream Policy to favor latency over throughput (the default setting). Setting the UART Stream Policy to latency minimizes the delay time for sending the packets. To change the policy, type the following command:
Alternatively, you could increase the baudrate of the GP BrainStem and the Bluetooth devices, but you increase the chances that data will get lost during communication. Depending on your application, this may or may not be a concern.
Bluetooth Passkey Settings
Bluetooth devices require that they be paired to establish a connection. The pairing process checks for the proper key, and initiates a bond between the two devices. We will set the key password to the default setting (from the manual it is "1234"). Changing the passkey can be accomplished by entering the following command:
| voice: 720-564-0373, email: firstname.lastname@example.org, address: 4822 Sterling Dr., Boulder CO, 80301-2350, privacy |
© Copyright 1994-2012 Acroname, Inc., Boulder, Colorado. All rights reserved.