Setting up Bluetooth for NXT

Revision as of 20:03, 5 June 2012 by Jwatson (Talk | contribs)

Jump to: navigation, search
NXT → Setting up NXT Bluetooth

For ROBOTC Bluetooth NXT functions, see: NXT Bluetooth Functions.
For information about Bluetooth and the NXT, see: Bluetooth Overview.

Connecting via Bluetooth - Pairing

Each BT device is identified by a unique 12 hexadecimal digit address. It's a little awkward to refer to devices with this address so the BT protocols include a "friendly name" that is a more conventional 15-character string. The default friendly name for a NXT brick is "NXT" but you can modify this using the NXT's on-brick user interface, or from the ROBOTC IDE, or directly from within a ROBOTC program.

Before you can connect two devices via BT they must be "paired". The pairing process exchanges messages between the two devices where they share their BT address, their friendly names and their supported profiles. The devices confirm that they support the same profiles and that the (optional) password matches. Once two devices have been paired, you can make subsequent connections using just the friendly names. The devices remember the passwords so that they don’t have to be re-entered each time

There's a lot of low-level messages used in establishing a paired connection. Fortunately, this is hidden from the user on the NXT with a simple user interface via the user interface on the NXT.

From the BT menu on the NXT, a search is performed to build a internal list in the NXT of all the devices that are currently available via BT. The NXT simply broadcasts a "who's available" message over BT and collects a list of all the devices that replied.

Once connected, the "slave" device will be added to the NXT's internal table of paired devices, i.e. the "My Contacts" list on the NXT. Next time you want to make a connection you can select the device from the "My Contacts" and avoid the 30-second search.

NOTE: Sometimes you'll find that you cannot get two previously paired devices to connect. One cause of this is that one device is no longer powered on. Another cause is that somehow the devices have got out of sync on the pairing status where one device has "lost" the paired status. If this happens, try removing both devices from the "My Contacts" list on each NXT and restart the connection using the "Search" function.

Installing USB Adapter Drivers

Before you can use your Bluetooth USB adapter with ROBOTC, you must install the drivers and set up the device for use.

Note: Not all Bluetooth adapters will work with the NXT brick due to its built-in chip limitations. ROBOTC community member Laurens has compiled a great list of adapters that are known to work with the NXT bricks, complete with a listing of internal laptop adapters. Check it out at her blog,

1. Start Windows and plug in USB adapter. Windows should automatically recognize and install your device. If you do not see a popup near the notifications area like the one shown below, click here for some workarounds.
Windows Install 1.jpg
2. Open the Start Menu, click on Devices and Printers, right click on the appropriate adapter, and select "Bluetooth Settings".
Windows Install 3.jpg
3. Make sure "Allow Bluetooth devices to find this computer", "Allow Bluetooth Devices to connect to this computer", and "Alert when a new Bluetooth device wants to connect" are checked.
Windows Install 4.jpg
4. Turn on the NXT brick, navigate to the Bluetooth menu, and make sure Bluetooth is turned 'On' and Visibility is set to 'Visible'; then, select 'Search'. This will start the pairing process between the NXT and the computer. You will still need to register the device in ROBOTC to compile wirelessly (instructions below).
5. The NXT will pull up all available devices within range, including other eligble NXT bricks, that have Bluetooth enabled and turned on. Select your computer from the list and select 'Connect'. If you do not know your computer's name, navigate to Start Menu> All Programs> Accessories> System Tools> System Information. Your computer's name is "System Name".
6. Select which port on the NXT you would like to save the connection to and enter your passkey when prompted (1234 by default) and select the check mark.
7. Windows should recognize that there is a new connection and will pop up another notification saying so. Click on the notification and enter the passkey for the NXT when prompted, then click 'Next'.
Windows Install 5.jpg
8. Windows will finish connecting to the NXT and display "Your device is ready to use notification" when completed.

PC/NXT Pairing with ROBOTC

To pair your NXT with your Bluetooth adapter to use ROBOTC, follow these steps.

Note: You cannot download firmware to an NXT over Bluetooth. Please download ROBOTC's firmware before trying to connect via Bluetooth.

1. Go to the "Robot" menu, and under the "NXT Brick" submenu, select "Communication Link Setup."
Bluetooth Link 1.jpg
2. In the NXT Brick Link Selection screen, we want to enable Bluetooth seaching. Change the "Search Selection" drop menu to "USB or Bluetooth" and click "Repeat Search".
Bluetooth Link 2.jpg
3. ROBOTC will use the bluetooth adapter to search for NXT bricks. This may take 30 seconds.
Bluetooth Link 3.jpg
4. When ROBOTC has completed searching for Bricks, you can select which brick you would like to connect to. Click the name of the brick under the "NXT Bricks Reachable via Bluetooth Wireless or Wifi" menu and then click the "Select via Bluetooth" button on the right.
Bluetooth Link 4.jpg
5. ROBOTC will remind you to press the orange button on the NXT brick when it makes a sound. Click "OK" to continue.

This is the NXT requiring input for the Bluetooth passcode. The default passcode (1234) will automatically be entered, so just press the orange button.

Bluetooth Link 5.jpg
6. ROBOTC will start to pair with the NXT. This may take 15-30 seconds and you will have to press the orange button once during this time.
Bluetooth Link 6.jpg
7. Once the brick has connected via Bluetooth, you will see the brick's name appear under the "NXT Brick Connection History" and "NXT Bricks Reachable via Bluetooth or Wi-Fi". Your NXT is now connected via Bluetooth! You can continue to use ROBOTC as if your brick was connected via USB... everything will work, including the debugger and program downloading. Click "Close" to exit this screen.
Bluetooth Link 7.jpg

Connecting Two NXT Bricks

1. Use the NXT user interface to select Bluetooth commands.
Bluetooth connect 1.gif
2. The top left of the NXT LCD status display shows the Bluetooth status. The leftmost icon is the BT symbol and indicates that BT is enabled on the NXT. The icon indicates that the NXT BT visibility is enabled -- if visibility is disabled, then the NXT will not respond to search commands from other BT devices. "ROBOTC2" is the friendly name for the NXT.
Bluetooth connect 1.2.gif
3. Then select "Search" command and run the command.
Bluetooth connect 2.gif
4. Once search has been performed, you'll be presented with a menu of the NXTs that were found via Bluetooth. In this case, only a single item -- the device "ROBOTC1" was found.
Bluetooth connect 4.gif
5. Select the target device for the connection from the search results -- i.e. "ROBOTC1" -- and then select "Connect"
Bluetooth connect 5.gif
6. The NXT supports connections to up to three "slave" devices. You need to select the appropriate "slot" (1, 2, or 3) for the connection. Select an empty slot -- all three slots are empty in the following picture -- and hit the orange button.
Bluetooth connect 6.gif
7. The NXT screen will show "Connecting" as the connection is attempted. Depending on the settings on your NXT, you may be prompted for a password.
Bluetooth connect 7.gif
8. Once the connection is made, the status ICON will change to "<>". The ">" indicates that the NXT is connected to another BT device.
Bluetooth connect 8.gif

Disconnecting Two NXT Bricks

1. Use the NXT user interface to select Bluetooth commands.
Disconnect bluetooth 1.gif
2. Select the "Connections" Menu item.
Disconnect bluetooth 2.gif
3. You now get a list of the devices connected via Bluetooth. In this case, there is a single connection to the "ROBOTC1" Bluetooth device.
Disconnect bluetooth 3.gif
4. Select this item. Then select the "Disconnect" command.
Disconnect bluetooth 4.gif
5. The connection will be removed and the NXT GUI will return to the Bluetooth commands menu. Note that the Bluetooth status icon in the top-left of the screen has changed from "<>" (visible + connected) to "<" (visible + not connected).
Disconnect bluetooth 5.gif