Connecting NXT to MAC using Bluetooth

Artículo nº 4 de la serie de 21 artículos sobre LeJOS

Bluetooth MACMany users have had problems with bluetooth connection between the NTX brick and MAC. Let’s take a brief look at the settings you need for everything to work correctly. In addition, we will see how to connect from NXT-G and from LeJOS (LeJOS installation in MAC).

Pairing

The first thing to do is to pair the NXT with the MAC. To make everything work properly, we recommend that the computer should be the one to perform the search and subsequent pairing.

Let’s go to “Open Bluetooth Preferences”


Bluetooth Preferences

MPORTANT! Before continuing, we recommend that you erase all NXT profiles which have been previously paired with your computer.

We ensure that our NXT has bluetooth on and discoverable.
Select “Add new device”, is the symbol + at the bottom left.

New device

When the MAC detects our NXT, select it and click continue.

Bluetooth Setup Assistant

We will see the pairing screen, by default, the Bluetooth pairing key of our MAC is 0000

passkey

We must check now our NXT, as it will ask us to confirm the key.
Here we have two options:

1. To change the pairing key of our NXT: 1234, for the default one of our MAC: 0000.
2. Confirm key 1234 in the NXT, and when the computer gives us an error, change the MAC pairing Key (choosing, obviously 1234)

If everything is OK, we should see a message like this one

Pairing succesful

Now, to verify that the process has completed correctly, we go back to “Bluetooth Preferences” and check the port configuration of our new device.

Edit Serial Ports

We should have exactly this config.

Port Config

If not, just change it.

This completes the pairing process, which is nothing more than make devices recognize each other.

Now we are going to connect to the NXT.

Connecting NXT to NXT-G using Bluetooth

The connection from NXT-G is very intuitive, we only have to check that the NXT is not connected to the MAC before we start (but it should be paired, do not confuse both terms).

Let’s select NXT window in the bottom right menu.


NXT

When the window is open, click Scan


NXT data_en

Then we will see a system window that will ask us what device do we want to add to the connections list of NXT-G.

select device

We look for our NXT on the list and click Select. This is where the search is different from Windows, if you remember, Windows shows a list of all that is available, however MAC only shows us that we indicate.

Once selected, we will go to our connections list in NXT-G, and we click Connect (if available, of course).

connect_en

Within seconds, if all is OK, we will have this screen

connected_en

Connecting NXT to LeJOS using Bluetooth

If you don’t have LeJOS and you want to use it with your MAC, you can follow the LeJOS installation tutorial for MAC.

By default, LeJOS version 0.85 for MAC has the BlueCove 2.1.0 library included, this library will let us connect to our NXT from LeJOS without problems.

Open the Terminal and type

cd lejos_nxj/bin
(we have LeJOS installed in Home)

We are now in of the LeJOS executable folder.
Now type

./nxjconsoleviewer

Commands

This utility lets you monitor NXT connections and outputs of the NXT console.

Select Bluetooth as the connection type, enter the name of the NXT (ours is called Mac) and click Connect. Address can be left blank, it will search by name.

nxjviewer

You may be asked for the pairing key (NXT key is 1234), type it and click Pair.

Passcode

Within seconds, we will see this confirmation.

Successful

If you don’t like this utility, or it is not working properly, you may use

./nxjbrowse -b

Terminal

-b forces bluetooth searching (-u is the same for USB search).
It may find the NXT in a moment, then hit Connect


nxj browse

This other application allows us not only to connect to the NXT, but also manage your files, upload and download programs or even execute them, rename brick, etc …

nxjBrowse success

This concludes the tutorial about Bluetooth connection between NXT and MAC , if you have any questions or problems, you can go to our forum.

Otros artículos de la serie LeJOSInstalación de LeJOS en MAC OS XInstalación de LeJOS en WindowsInstalación de Eclipse para LeJOS en MacBump&Go en LeJOS

Artículos relacionados:

  1. Bluetooth Management RobotC
  2. Bluetooth repeater robots

Escribe un comentario

You must be registrado para poder escribir un comentario.