Please use the new download page!



(includes sourcecodes and documentation)

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 in this site. Works with MATLAB 7.3 or higher, tested under Windows and Linux. (0.8 MB) (0.7 MB) (0.5 MB)

System Requirements

  • Operating system: Windows or Linux
  • MATLAB Version 7.7 (R2008b)
  • LEGO® Mindstorms NXT building kit (e.g. Education Kit)
  • LEGO® Mindstorms NXT firmware v1.05 (recommended) OR a firmware compatible to the NXT's direct command interface
  • Bluetooth: Bluetooth 2.0 adapter recommended model by LEGO® (e.g. AVM BlueFRITZ! USB) supporting the serial port profile (SPP)
  • USB:
    • Windows: Official MINDSTORMS NXT Driver "Fantom", v1.02 or better
    • Linux: libusb or libusb-dev

Release History

Click here to see the Release History


NXC Motor Control (6 KB) NXC Motor Control program, which provides a better motor control
(no accumulated/error memory). The control program is a NXC program
and must be transferred onto the NXT using nbc.exe free available under
Linux Scripts (3 KB) Download scripts for Linux that help you to establish a Bluetooth connection
and prepare the NXT to be used as USB device
libusb package for Linux libusb Available for several Linux distributions
LEGO® MINDSTORMS ® NXT Software Updates Firmware NXT Firmware (v1.05 recommended)
Driver NXT Fantom Driver (required for the USB support on a Windows machine)

Browse Current Stable Release

(RWTH - Mindstorms NXT Toolbox v2.03)
(RWTH - Mindstorms NXT Toolbox v1.00)

Browse All Releases

Description Directory Link Status Comments
Stable Releases /tags/ /tags/ stable Stable and recommended releases.
The usage for normal users is recommended!
Developer Releases /branches/xxx/ /branches/ beta Individual developer versions maintained directly by the developer.
The usage for normal users is not recommended!
Working Release /trunk/ /trunk/ beta Current common working release includes merging progress.
The usage for normal users is not recommended!
Root Directory / / Repository root directory

SVN Repository Checkout

For developing the RWTH - Mindstorms NXT Toolbox the usage of the SVN repository and its revision management system is recommended. To check out and update the RWTH - Mindstorms NXT Toolbox repository to your local hard drive a SVN client has to be installed on your system. Under Windows we recommend the TortoiseSVN Client. A short tutorial how you can check out the toolbox is given on First steps with SVN.

The SVN repository server is located at

All files can be checked out and updated without limitations. But for full access permissions to the SSL-secured SVN repository you have to be a registered developer (register/login) first.

Stand-Alone Demos

In these archives you can find stand-alone applications of the toolbox-demos, that run without MATLAB installed. They can be used for diagnostic purposes, even when classic LEGO Mindstorms NXT programs (.rxe) are executing on the NXT brick at the same time. The demos require a working Bluetooth connection, read the included README.txt file or see the installation guide on this site how to edit the bluetooth.ini file to get the demos working.
At the moment the only supported operating system is Windows. (170MB)
(Archive includes MATLAB Component Runtime which has to be installed) (1.5MB)
(Requires installed version of MATLAB Component Runtime which is not included)


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 <>.

MATLAB Central

The current toolbox version is also available at the MATLAB Central an open exchange for MathWorks MATLAB and Simulink user community.
The toolbox is categorized under File Exchange - Production Code - ''RWTH - Mindstorms NXT Toolbox'' ( .

MATLAB Central

Installation Guide

(Applies to current stable version 2.03)

Quick Start

This is a very short summary of the next section (Installation guide):

  • Extract the archive anywhere you want, KEEPING DIRECTORY STRUCTURE
  • The destination folder should contain a directory called RWTHMindstormsNXT
  • 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 )
  • Press Save to remember settings for future MATLAB sessions
  • Compile and download MotorControl.nxc from /tools/MotorControl to your NXT. You need the NBC compiler for this step, get it here: On Windows, just run !TransferMotorControlToNXT.bat and follow the instructions! You can skip this step and do it later.
  • Run the command >>COM_MakeBTConfigFile<< from the MATLAB command window or: edit a bluetooth-example ini-file from the toolbox folder to suit your configuration. You can skip this and the next step if you don't want to use Bluetooth.
  • Establish a Bluetooth connection to your NXT using your adapter's driver software.
  • Authenticate with the NXT (a passkey request should appear)
  • You can now open Bluetooth or USB connections using the toolbox commands >>COM_OpenNXT<< or >>COM_OpenNXTEx<<

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 10 years ago Last modified on Nov 20, 2009, 8:02:52 PM

Attachments (4)

Download all attachments as: .zip