Please note:

  (!) Toolbox version 4.04 is available (new sensors, minor bug fixes, documentation issues)

Download Version 4.03

Toolbox download

Download the full toolbox below, including all functions with sourcecodes, documentation, examples and demos. For installation see the included README.txt file or the installation guide below on this site. (0.8 MB)

System Requirements

  • Operating system: Windows, Linux, or Mac OS
  • MATLAB Version 7.7 (R2008b) or better
  • LEGO® Mindstorms NXT building kit (compatible with NXT 1.0 retail, NXT 2.0 retail, and NXT Education)
  • LEGO® Mindstorms NXT firmware v1.26 (recommended) or compatible
  • For Bluetooth connections:
    • Bluetooth 2.0 adapter recommended model by LEGO® (e.g. AVM BlueFRITZ! USB) supporting the serial port profile (SPP)
    • An incomplete list of some tested adapters is available here
  • For USB connections:
    • Windows, Mac OS: Official MINDSTORMS NXT Driver "Fantom", v1.02 or better
    • Linux: libusb or libusb-dev (might also be called libusb0)
    • 32bit version of MATLAB and/or 32bit operating system

What's new & release notes

Browse the complete Release History (also available in section "Release Notes" inside MATLAB on the Toolbox help page).
The correct changelog for just this version 4.03 is availabe here (text format).

Software requirements, utilities, and drivers

NXT Firmware You can use any of the following Mindstorms NXT firmware versions:
USB Driver For Windows and Mac OS: For Linux:
  •  libusb version 0.1 or compatible (you may use your packet manager to install "libusb-0.1")
  • Rule-files for udev, see LinuxReadme.txt in toolbox-folder /tools/LinuxConnection
Bluetooth For Windows:
  • Bluetooth stack & driver software supporting the "SPP" (Serial Port Profile)
For Linux: For Mac OS:
  • Parts of the above requirements, see installation guide below and included file readme.txt
NXC Motor Control In order to transfer the NXC program MotorControl to the NXT, you need:

Browse this release

Browse files of the current release in our SVN repository:

Frequently answered questions

If you have problems the documentation and readme-file cannot solve, you might want to consider our FAQ-Page.


The RWTH - Mindstorms NXT Toolbox is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The RWTH - Mindstorms NXT Toolbox is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the RWTH - Mindstorms NXT Toolbox. If not, see <>.

Installation Guide


Extract files

  • Extract the archive anywhere you want, KEEPING DIRECTORY STRUCTURE
  • The destination folder should contain a directory called RWTHMindstormsNXT

Set MATLAB path

  • In MATLAB, go to "File", "Set Path…", "Add Folder…"
  • Browse to the location you extracted to, and add the folder RWTHMindstormsNXT
  • Also add the folder tools (it is a sub-directory of RWTHMindstormsNXT) to the MATLAB path
  • Press Save to remember settings for future MATLAB sessions

Check NXT Firmware

Transfer MotorControl to NXT

Check other software requirements

  • Linux:
    • USB: Install libusb
    • See LinuxReadme.txt in /tools/LinuxConnection

First USB connection

  • Inside MATLAB, execute COM_OpenNXT
    The command should complete without an error!

First Bluetooth connection

  • Inside MATLAB, execute COM_MakeBTConfigFile
    Enter the serial COM-Port of your Bluetooth driver or the rfcomm device you're using
  • Or edit a bluetooth-example ini-file from the toolbox folder to suit your configuration. The most important thing is the correct serial port.

  • Establish a Bluetooth connection to your NXT using your adapter's driver software, or using the script btconnect we provide in /tools/LinuxConnection
  • Authenticate with the NXT (a passkey request should appear)
  • The BT-icon on the top left of the NXT screen should turn from B< to B< >, otherwise it won't work!
    • If this doesn't work, use the NXT menu to navigate to Bluetooth, Search, select your computer, connect. Again, you need the symbol B< > on your NXT screen.
    • If this still doesn't work, your Bluetooth hardware might be incompatible, or maybe you need a different driver! Check

  • Disconnect the USB cable from the NXT.

  • You can now type the following commands in MATLAB, given that you created a file called bluetooth.ini:
    The commands should complete without an error!

Optimize performance

  • Inside MATLAB, type OptimizeToolboxPerformance
  • Confirm the dialog with yes, the script should complete without an error!

Try the examples

  • Look inside the folder demos of your toolbox directory
  • Enjoy the examples

Alternative installation guide

An alternative installation guide by one of our external users is available here.

Full Installation Guide

The RWTH - Mindstorms NXT Toolbox is a collection of MATLAB-functions (so called m-files) and documentation / help files (mostly HTML). You have received these files in a compressed archive, that just needs to be extracted to a directory of your choice. This folder can even be on an external hard disk, USB stick or network drive. However it is recommended to use a folder on a normal hard disk drive for performance reasons. So just uncompress the archive and remember the folder you extracted it to. Make sure that the internal sub-directory structure is kept! Also it is important that all files are located in a sub-folder called RWTHMindstormsNXT for identification purposes.

Now inside MATLAB, go to the menu "File" and choose "Set Path…". Inside the new window, press "Add Folder…", and browse to the location where you extracted the files from the archive to in the previous step. Now select the folder RWTHMindstormsNXT and confirm. Repeat this step, and add the folder called demos, which is a sub-folder of the previously added RWTHMindstormsNXT-directory. When done, press "Save" to remember these settings for future MATLAB sessions.
Open the "Set Path" window Add the RWTHMindstormsNXT folder and its subfolder demos

After adding these 2 folders to the MATLAB search path, the installation is complete. To verify the installation, you can type the following line
info = ver('RWTHMindstormsNXT')
inside the MATLAB command window. Also the command COM_CloseNXT('all') should work and complete without an error.

The First Bluetooth Connection

Before you can begin working with Bluetooth connections, you have to create a settings file that contains information about your Bluetooth adapter and serial port. Either you can use the toolbox-command COM_MakeBTConfigFile inside the command window. A dialog window lets you enter the required parameters. The other way is to edit the example-files called bluetooth-example-windows.ini or bluetooth-example-linux.ini, that are provided in the toolbox root folder.

You can leave the default values for the beginning, the only thing you will have to enter is the COM-Port. The Bluetooth SPP (serial port profile) maps a virtual COM-Port to your adapter. Find out which port this is (under Windows you can use the Device Manager) and enter it in the dialog window (example: COM4). The other parameters are explained in the documentation. Advanced users should refer to the first chapter Bluetooth connections and serial handles of the section Functions - Overview.

If there is more than one additional Bluetooth COM-Port, this is most likely caused by the adapter's driver software. Most of the time it is the lowest available COM-Port (above the classic "real ports"). The only way to be sure is to try which ports are working. (Sometimes there are certain ports that only work for sending OR receiving. The toolbox however needs a bidirectional port.)
Device manager with correct Bluetooth serial port Dialog window of COM_MakeBTConfigFile command

Linux users should use the bluez Bluetooth stack. The serial port will then be called /dev/rfcomm0 or similar. This is the parameter that has to be added instead of COM3 for example. The sample ini-file for Linux does not contain all settings as they are not needed here.

Once the correct ini-file is created, it can be put inside the toolbox root path or anywhere inside the MATLAB search path for better convenience.
You can now try the demos (which require a correct configuration file called bluetooth.ini) or start opening connections using the toolbox command COM_OpenNXT. Note that before this works, you have to establish a physical connection to your NXT. Depending on your Bluetooth adapter's driver software, this can be different. Once successful, the NXT and driver software will prompt you for a passkey. The authentification is then complete, and the toolbox should work properly.

For further details see the included readme.txt file located in the toolbox directory.

Disclaimer: The RWTH - Mindstorms NXT Toolbox for MATLAB is neither affiliated with nor endorsed by the LEGO Group. LEGO, MINDSTORMS, TECHNIC, and NXT are registered trademarks of the LEGO Group.

Last modified 7 years ago Last modified on Oct 11, 2010, 6:02:25 AM