Bluetooth Serial Port To NXT in Linux

Posted by Tony Buser Sun, 22 Oct 2006 17:23:00 GMT

I finally got around to playing with the NXT in linux with ruby-nxt. Since ruby-nxt currently only supports a serial port connection (hopefully a native bluetooth module will be ready soon), you have to use rfcomm to setup a serial device. Here's how you do it (using ubuntu 6.06 and a linksys usb adapter)...

First you have to find the mac address of your NXT with the following command:

abuser@wraith:/etc/bluetooth$ hcitool scan
Scanning ...
        00:16:53:04:B3:46       NXT

Then sudo vim /etc/bluetooth/rfcomm.conf and add an entry like this:

rfcomm0 {
        bind yes;
        # Bluetooth address of the device
        device 00:16:53:04:B3:46;
        # RFCOMM channel for the connection
        channel 1;
        # Description of the connection
        comment "NXT";
}

Then restart bluetooth with a sudo /etc/init.d/bluez-utils restart.

Then to verify it's setup, run rfcomm and you should see output like this:

abuser@wraith:/etc/bluetooth$ rfcomm
rfcomm0: 00:16:53:04:B3:46 channel 1 clean

You should now have a /dev/rfcomm0 that you can use with ruby-nxt. The first time you run a ruby-nxt program, it might pop up a message for the PIN, just enter 1234.

If you want to setup a connection FROM the NXT to your computer, (where your computer is a slave to the NXT where you can send BT messages from a program running on the NXT to your computer) follow these instructions.

Similar instructions for windows here and osx here.

Trackbacks

Use the following link to trackback from your own site:
http://juju.org/articles/trackback/508

Comments

Leave a response, Track co.mments

Comments