There is so much noise around LEGO Mindstorms on the web with enthusiasts and universities all attempting to do the NeXT big thing that it is hard for kids wanting to do more with their Mindstorms kit to figure out what is happening.There are three different Mindstorms kits and on top of this there is a plethora of tools for programming, different versions of NXT firmware and NXT software. This article aims to provide concise information and resources to budding Mindstormers.
Let’s get the terms clear first. So far the three Mindstorms NXT retail kits from LEGO are named Mindstorms 1.0 also called Robotics Invention System (RIS), Mindstorms NXT (kit 8527) and Mindstorms NXT 2.0 (kit 8547).
There is also an educational (non-retail) version of the NXT called NXT EDU (kit 9797) and educational extensions to the NXT (kit 9648) mainly for universities and schools. This article focuses more on the NXT series retail kits and somewhat on the RIS kit.
The visual programming language shipped with RIS was called ROBOLAB. The visual programming language shipped with the NXT kits is called NXT-G. Kit 8527 came with version 1.0 of NXT-G. Afterwards a patch was released for NXT-G 1.0 which added dynamic block update functions. This allowed for additional sensor blocks to be imported into the software and it also allows older sensors from the RIS to be used with the NXT-G. Patched NXT-G 1.0 became NXT-G version 1.1.
Later versions of kit 8527 and kit 8547 ship with NXT-G version 2.0. So NXT-G 2.0 is different from NXT 2.0. The first refers to the version of software shipped with kit 8547 while the latter is the kit 8547 itself.
|NXT 1.0 (8527)||NXT-G 1.0/1.1 or NXT-G 2.0*|
|NXT 2.0 (8547)||NXT-G 2.0|
|* Only on some newer 8527 kits|
What is LabView and what has it got to do with Mindstorms?
LabView (actually written as LabVIEW) is a visual dataflow based programming environment from National Instruments (NI) which uses a computer programming language called G. LEGO and NI have been working together since 1998 to develop a simple LabVIEW like environment for programming Mindstorms robots. The result of this partnership was initially ROBOLAB (1998) and then the NXT-G (2006) language. In other words NXT-G is a cut down version of the professional LabVIEW environment - now you know where the suffix G comes from. You will see LabVIEW mentioned in forums and advanced topics discussing Mindstorms. NI also hosted the first LEGO League competition in 2005.
The intelligent brick
The intelligent brick that came with RIS is called the 'RCX'. The intelligent brick that comes with both the NXT (8527) and NXT 2.0 (8547) is called the NXT brick. The RCX and the NXT brick are not hardware compatible and firmware for NXT should not be installed on the RCX. The NXT brick supplied with the NXT 2.0 (8547) is identical to the original NXT brick (8527), so those two are hardware compatible. In short there is only one NXT brick and it does not matter which NXT kit you have.
Firmware for the brick
The NXT brick in kit 8527 came with firmware version 1.01. LEGO later released an update to this firmware version 1.05 which works with NXT-G 1.0. A more recent firmware is version 1.31 but only works with NXT-G 2.0. You can upgrade/downgrade your firmware any time.
Drivers for the brick
LEGO has released updated version 1.1.3 (Fantom) USB and Bluetooth drivers for the NXT brick for PC and MAC which works with Windows 32-bit and 64-bit and OSX. You can upgrade drivers free of charge. Third party drivers are also available for the bricks.
To simplify choices, I have placed download links in a tabular format below:
|Kit||Driver (LEGO)||Driver (3rd Party)||Software||Firmware (LEGO)|
|RIS||USB IR Tower driver (PC/Win32)||PC/Win32||ROBOLAB||-|
|NXT 1.0 (8527)||PC/Win32+Win64, MAC (OSX)||PC/Win32, PC/Win64||NXT-G 1.0/1.1||version 1.05|
|NXT-G 2.0||version 1.31|
|NXT 2.0 (8547)|
NOTE: You can get (and share) tips on getting your RIS working with windows 64-bit here.
Getting NXT drivers working on Mac OSX 10.8 (Mountain Lion)
Some of you are having trouble getting the NXT brick to work on Apple Mac OSX 10.7 and 10.8. The problem is that the driver will only work in 32-bit mode while OSX by default will boot into 64-bit mode. I have found that installing version 5.1.2 of NI-VISA drivers from National Instruments will fix the issue for 64-bit mode. NI-VISA drivers must be updated after installing the OSX Fantom driver from Lego from above table. NI-VISA upgrade will enable the Lego driver to load and run under 64-bit mode. Bluetooth will not work with most Mac in-built Broadcom bluetooth cards. This is a known issue and Lego is working on it. If you need Bluetooth you will need to get a compatible external Bluetooth dongle.
Installing NTX-G 1.0 (kit 8527) on Windows 64-bit/7
If you try to use the NXT-G 1.0 software DVD supplied with kit 8527 on Windows Vista 64-bit or Windows 7 it will not work. The installation program will complete successfully but not install anything. So it is best to download and install the NXT-G 2.0 software from lego. You can then get building instructions for all kit 8527 robots here.
To upgrade firmware:
- Unzip the firmware file to the folder '\\Program Files\LEGO Software\LEGO MINDSTORMS NXT\engine\Firmware\'.
- Connect the NXT brick to the computer using the USB cable.
- Start the NXT-G software, go to the Tool menu and select Update NXT Firmware....
What is the role of firmware?
The firmware on the NXT brick is used in conjunction with the programming environment. The firmware obtained from LEGO will work with NXT-G. If you plan to use another programming environment, they may require a completely different firmware. We will discuss alternative programming environments and firmwares in the next section. However having the LEGO firmware and the NXT-G software installed and working is useful even if you will be using a different environment as it allows you to reset your NXT brick to its default state at any time. NXT-G also provides building instructions for the LEGO robots in your kit.
Alternate ways of programming Mindstorms
If you are beginning programming, the NXT-G or ROBOLAB language supplied with Mindstorms is great to get your hands dirty. However if you want to try something else, here are some good alternatives.
There are two ways the Mindstorms robots can be programmed.
Technique 1 (program mode): The program is downloaded and run on the Mindstorm robot.
- Programs have to be small and relatively simple.
- The robot works autonomously.
Technique 2 (immediate mode): The robot is remote-controlled via bluetooth by a program running on your computer.
- Programs can be quite complex because complex calculations can be performed quickly on your computer and the robot only receives simple directions.
- The robot will stop working if it goes out of Bluetooth range from the controlling computer.
- Requires an active Bluetooth connection, which will drain battery faster.
Most Mindstorms programming languages fall into one of the above categories. NXT-G programs the robot using technique 1.
Microsoft RDS is free, offers visual programming but uses technique 2 to control the robot. It runs on the standard LEGO firmware.
C like programming
You can use NQC for the RCX and NXC for the NXG LEGO bricks. Related to NXC is the NBC which is assembly level. These are free and work with standard LEGO firmware. However you can install a NBC enhanced firmware for more features. You also get the excellent BricxCC IDE which gives you much control over the NXT brick than NXT-G.
A non-free but extremely popular option for C like programming is ROBOTC which requires its own custom firmware.
All these mainly use technique 1 to control the robot.
Only for advanced programmers the NXTGCC uses Eclipse IDE and provides the GCC toolchain for writing your own firmware for the Mindstorms bricks. This is not suitable for beginners and requires good knowledge of Linux.
NXT++ uses technique 2 to control the robot from any C++ program. Requires knowledge of Visual Studio and is again only recommended for advanced programmers. It runs on the standard LEGO firmware. LesTat offers similar functionality to NXT++, but for Linux.
C# and Visual Basic
Microsoft RDS provides C# and VB programming options using technique 2. It runs on the standard LEGO firmware but is again not intended for beginners at programming.
LeJOS is free and provides a Java like language for the RCX and NXG bricks. Again custom firmware is needed for this to work. LeJOS uses technique 1 for controlling the robot though it provides some examples of using technique 2 and also allows the robot to log data to a computer. This is well maintained, actively developed and Java is simpler to learn than C. It is also cross platform and can be used to program the NXT from Windows, Linux or MAC. A nice tutorial of setting up JAVA, LeJOS and eclipse for programming the NXT is here.
BEWARE: LEJOS OSEK is completely different beast from LEJOS, don't confuse the two.
pbLua is a port of Lua programming language for the NXG brick. The syntax is extremely similar to C++ and it uses technique 1 to program the robot. It provides its own firmware and drivers and a very powerful API with data-logging capabilities. Try it and you might fall in love with it!
Taking your robot further
...where no robot has gone before!
The Idea Book: Great ideas for new robots, including RaSPy, the robot that plays Rock, Paper, Scissors.
Roila.org: Learn RIOLA and start talking to your robot! ROILA is a spoken robot interaction language designed such that it is easy for humans to learn and easy for robots to understand and is being developed for the NXT.