Serial module setup


Tested on Ubuntu 8.04.01 desktop.
Works with SWIPL 5.4.7-190. See SWI-Prolog old binaries.


It is necessary to determine the MAC address of a LEGO Mindstorms NXT set. This can be done by scanning BT devices (of course after the BT adapter is connected and the NXT brick turned on):

hcitool scan

Device binding

The device can be bound manually:

rfcomm bind rfcomm0 MAC_ADDRESS

An alternative solution is to edit the rfcomm.conf file, which causes an automatic binding at system boot:

   gedit _etc_bluetooth/rfcomm.conf

Please add an entry to the file containing:

  • the appropriate device number (here 0 – rfcomm0),
  • the MAC address of the set instead of MAC_ADDRESS.


   rfcomm0 {
     bind yes;
     device MAC_ADDRESS;
     channel 1;
     comment "NXT";

After editing the rfcomm.conf file it is necessary to restart BT:

   _etc_init.d/bluetooth restart

Verification of the device binding:


Port settings

A serial port bound to the device must be properly configured to work with the NXT set:

sudo stty -F /dev/rfcomm0 -echo -icanon -iexten -isig -icrnl -inpck -istrip -ixon -cstopb cs8 parenb parodd -opost ispeed 115200 ospeed 115200

After that the first connection takes place, the device is paired and a PIN fixed.


In Ubuntu, on which the configuration has been tested, there is applet bt bluez 0.25 available.
NXT main unit asks to enter the PIN. Then, the same PIN has to be reentered in the mentioned applet, which ends pairing.

Previously paired devices can be seen by right-clicking the blue BT icon → Preferences → Bonded devices.
If the device is on the list, pairing should not take place. It is enough to set port parameters.
However, if the whole process of setting up the port and the possible pairing does not take place properly, please:

  • remove the device from the mentioned list,
  • you may also need to remove the entry in the NXT brick (please select in the menu → Bluetooth → My contacts {device} → Delete).

Then re-set the port parameters, please.

After a successful setup, you can proceed with the first steps.

mindstorms/plnxt/conf_serial.txt · Last modified: 2017/07/17 08:08 (external edit) Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0