<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Juju: Bluetooth Serial Port To NXT in Linux</title>
    <link>http://juju.org/articles/2006/10/22/bluetooth-serial-port-to-nxt-in-linux</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Sufficiently Advanced Technology</description>
    <item>
      <title>Bluetooth Serial Port To NXT in Linux</title>
      <description>&lt;p&gt;I finally got around to playing with the NXT in linux with &lt;a href="http://rubyforge.org/projects/ruby-nxt/"&gt;ruby-nxt&lt;/a&gt;.  Since ruby-nxt currently only supports a serial port connection (hopefully a &lt;a href="http://rubyforge.org/projects/ruby-bluetooth/"&gt;native bluetooth module&lt;/a&gt; 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)...&lt;/p&gt;

&lt;p&gt;First you have to find the mac address of your NXT with the following command:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;abuser@wraith:/etc/bluetooth$ hcitool scan
Scanning ...
        00:16:53:04:B3:46       NXT&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Then sudo vim /etc/bluetooth/rfcomm.conf and add an entry like this:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;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 &amp;quot;NXT&amp;quot;;
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Then restart bluetooth with a sudo /etc/init.d/bluez-utils restart.&lt;/p&gt;

&lt;p&gt;Then to verify it's setup, run rfcomm and you should see output like this:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;abuser@wraith:/etc/bluetooth$ rfcomm
rfcomm0: 00:16:53:04:B3:46 channel 1 clean&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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 &lt;a href="http://www.jstuber.net/lego/nxt-programming/bluetooth-linux.html"&gt;these instructions&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Similar instructions for windows &lt;a href="http://juju.org/articles/2006/08/16/ruby-serialport-nxt-on-windows"&gt;here&lt;/a&gt; and osx &lt;a href="http://juju.org/articles/2006/10/22/bluetooth-serial-port-to-nxt-in-osx"&gt;here&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Sun, 22 Oct 2006 13:23:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:03829145-b02f-4072-bd05-8db41f7a3abf</guid>
      <author>Tony Buser</author>
      <link>http://juju.org/articles/2006/10/22/bluetooth-serial-port-to-nxt-in-linux</link>
      <category>Robots</category>
      <category>Mindstorms</category>
      <category>Linux</category>
      <trackback:ping>http://juju.org/articles/trackback/508</trackback:ping>
    </item>
  </channel>
</rss>
