Lego Mindstorms NXT

From Wikipedia, the free encyclopedia
(Redirected from Lego mindstorms nxt)
Logo, with the word "mindstorms" on an orange background
Logo of Lego Mindstorms NXT
A small robot on a floor
"Golf bot", a robot built with the NXT set

Lego Mindstorms NXT is a programmable robotics kit released by Lego on August 2, 2006.[1][2][non-primary source needed] It replaced the Robotics Invention System, the first-generation Lego Mindstorms kit. The base kit ships in two versions: the retail version[3] and the education base set.[4] It comes with the NXT-G programming software or the optional LabVIEW for Lego Mindstorms.[5] A variety of unofficial languages exist, such as NXC, NBC, leJOS NXJ, and RobotC. A second-generation set, Lego Mindstorms NXT 2.0, was released on August 1, 2009, with a color sensor and other upgrades. The third-generation EV3 was released in September 2013.

NXT Intelligent Brick[edit]

Parts of the kit
Lego Mindstorms NXT Kit
A humanoid robot
Robot built from the kit

The kit's main component is the NXT Intelligent Brick computer, which can accept input from up to four sensors and control up to three motors with a modified version of RJ12 cables (similar to, but incompatible with, RJ11 phone lines). The plastic pin to hold the cable in the socket is moved slightly to the right. The brick has a 100×64 pixel monochrome LCD and four buttons that can navigate a user interface with hierarchical menus. It has a 32-bit ARM7TDMI-core Atmel AT91SAM7S256 microcontroller with 256 KB of FLASH memory and 64 KB of RAM, an 8-bit Atmel AVR ATmega48 microcontroller, and Bluetooth support. The kit has a speaker, and can play sound files at sampling rates up to 8 kHz. Power is supplied by 6 AA batteries (1.5 V each) in the consumer version of the kit, and a rechargeable Li-Ion battery in the educational version.

Development kits[edit]

Lego has released open source firmware for the NXT Intelligent Brick and schematics for all hardware components.[6]

Several developer kits are available with documentation for the NXT:

  • Software Developer Kit (SDK), with information on host USB drivers, executable file format, and bytecode reference
  • Hardware Developer Kit (HDK), with documentation and schematics for the NXT brick and sensors
  • Bluetooth Developer Kit (BDK), documenting protocols used for Bluetooth communications


Simple programs can be created using the menu on the NXT Intelligent Brick. More complicated programs and sound files can be downloaded with a USB port or Bluetooth. Files can be copied wirelessly between two NXT bricks, and some mobile phones can be used as a remote control. Up to three NXT bricks can communicate simultaneously via Bluetooth when user-created programs are run.

The kit's retail version includes software for writing programs that run on Windows and Mac OS personal computers. The software, based on National Instruments LabVIEW, provides a visual programming language for writing simple programs and downloading them to the NXT Brick; instead of requiring users to write lines of code, they can use flowchart-like blocks to design their program.

NXT-G v2.0 is a graphical programming environment that comes bundled with the NXT and can be used for real-world programming. The software can run a handful of parallel loops or blend autonomous control with Bluetooth or other remote control. It supports virtual instruments for all Lego and most third-party sensors and components. Version 2.0 contains new challenges, a remote control, custom graphics and sound designers, and Lego color sensor support.[7]
C# with Microsoft Robotics Developer Studio
Free tools (Visual Studio Express in combination with the Robotics Developer Studio) enable programming the NXT using the C# language.[8]
BricxCC, Next Byte Codes, Not eXactly C
Bricx Command Center (BricxCC) is the integrated development environment (IDE) used to write, compile, and edit NBC and NXC programs for the NXT. Also, as BricxCC was originally made for the RCX, programs for it can be written using NQC via BricxCC. Different firmware versions can be flashed to the NXT using BricxCC. Next Byte Codes (NBC) is a simple open source language with an assembly language syntax that can be used to program the NXT brick. BricxCC also has the capability to decompile standard .rxe NXT executables to NBC. Not eXactly C (NXC) is a high-level open source language,[9] similar to C and built on the NBC compiler. It can be used to program the NXT brick. NXC is basically NQC for the NXT.[10]
The newer programming environment originally used on the RCX programmable brick. Version 2.9 has been updated to program the NXT brick. Lego has announced that it will stop supporting Robolab, but Robolab 2.9 is still available.[11]
RoboMind is educational software to teach students about logic, programming and robotics. Scripts can be transferred to a Lego Mindstorms NXT robot for testing.[12]
Enchanting brings NXT programming to the Scratch IDE, designed by the Lifelong Kindergarten Group at MIT to make programming intuitive for young children.
A programming language based on C for VEX, the VEX Cortex, FIRST Tech Challenge, and Lego Mindstorms. ROBOTC allows the NXT to run programs quickly, and compresses files to accommodate a large number of programs.
A GCC toolchain for programming NXT firmware in C.
leJOS NXJ is a high-level open source language based on Java that uses custom firmware.[13]
nxtOSEK can be used to write in C and C++ with custom firmware.[14]
ICON can write files on the NXT itself.[15][16]
MATLAB is a high-level programming language for numerical computing, data acquisition, and analysis. It can control Lego NXT robots over a Bluetooth serial port (serial port communication is part of the base functionality of MATLAB) or via USB.[17] (free & open-source). Simulink is a block-diagram environment for modeling and simulating dynamic systems. A user can design and simulate control algorithms and Lego systems, and program the Lego NXT or EV3.[18]
plLua[19] is a port of the Lua programming language, a general-purpose scripting language, for Lego Mindstorms.
A port of GNAT[20] for the NXT. It relies on a dedicated run-time kernel based on the Ravenscar profile used on the Goce satellite, allowing high-level Ada features to develop concurrent and real-time systems on the Mindstorms NXT.
URBI is a parallel, event-driven language with interfaces to C++/Java and Matlab. It has a component architecture (UObject) for distribution. Urbi is compatible with many robots, including Nao (cf Robocup), Bioloid and Aibo.[21]
FLL NXT Navigation
FLL Nxt Navigation[22] is an open source program to aid navigation on the FLL competition table. It uses NXT-G and .txt files to write programs.
Ruby-nxt[23] is a library to program the NXT for the Ruby programming language. The code is not compiled to a binary file (unlike other languages for the NXT), but is transmitted to the NXT via Bluetooth.
Robotics.NXT[24] is a Haskell interface to NXT over Bluetooth. It supports direct commands, messages and many sensors, and supports simple message-based control of an NXT brick via a remotely-executed program. Basic NXC code is included.
LibNXT[25] is a utility library for talking to the Lego Mindstorms NXT intelligent brick at a relatively low level. It is targeted at platforms overlooked by official Lego Mindstorms NXT software (such as Linux), and works on any POSIX-compliant operating system where libusb 0.1 is supported. Windows support is also possible with libusb's win32 port.
C_NXT[26] is a library for controlling the Lego NXT licensed under the GPLv2. It allows users to control a Lego NXT via Bluetooth from other C programs. The library, which runs on Linux, provides low-level control and high-level abstraction.
PyNXC[27] is a project which converts Python code to Not Exactly C (NXC)[28] to download to Lego Mindstorms robots.
NXT-Python[29] is a Python module which communicates with the NXT via USB or Bluetooth. It supports commands and several aftermarket sensors.
LEGO Mindstorms EV3 Software
The software which ships with the newer Mindstorms EV3 set can program the NXT.[30]
Physical Etoys
Programming diagram
A Lego NXT car which avoids walls, implemented in Physical Etoys
Physical Etoys is a visual programming system for electronic devices which supports direct and compiled modes.
C/C++ Interpreter Ch
Ch is a C/C++ interpreter running C/C++ code to control Lego NXT or EV3. No firmware upload/download or compilation is needed. A C/C++ code running in Ch can control a Lego NXT, EV3, or multiple of NXT/EV3.[31]

Sensors and actuators[edit]

The Lego Mindstorms NXT base kit includes:[32]

  • Three servo motors with built-in reduction gear assemblies and internal optical rotary encoders which sense their rotations within one degree of accuracy.[33]
  • A touch sensor detects whether it is pressed, has been bumped, or is released. The orange enter button and the gray right and left NXT buttons can be programmed as touch sensors. In the NXT-G programming software, a value of 0 is given when it is not pressed and a value of 1 is given if it is pressed.[34]
  • A light sensor detects the light level in one direction, and includes an LED for illuminating an object. It can sense reflected light values with the built-in red LED, or ambient light. In the NXT-G programming software, it senses light on a scale of 0 to 100; 100 is very bright, and 0 is dark.[35] If calibrated, the sensor can be used as a distance sensor.
  • A sound sensor measures volume on a scale of 0 to 100; 100 is very loud, and 0 is silent.
  • An ultrasonic sensor can measure the distance from the sensor to something it is facing and detect movement. It can show distance in centimeters and inches. The maximum distance it can measure is 233 centimetres (92 in), with a precision of 3 centimetres (1.2 in). The sensor sends ultrasonic sound waves that bounce off an object ahead of it and then back, and senses the time it took.[36]

Other parts may be bought separately.[37] Third-party companies manufacture sensors such as a compass, gyroscope, infrared tracker, RFID reader and accelerometer sensors sold by Lego. The temperature sensor can measure in Celsius or Fahrenheit.


Sensors are connected to the NXT brick with a six-position modular connector with analog and digital interfaces. The analog interface is backward-compatible (using an adapter) with the older Robotics Invention System. The digital interface is capable of I2C and RS-485 communication.

NXT sensor interface pinout
Pin Name Function Color Pin number
1 ANALOG Analog interface, +9V supply Pin 1 – ANA
2 GND Ground Pin 2 – GND
3 GND Ground Pin 3 – GND
4 IPOWERA +4.3V supply Pin 4 – IPOWERA
5 DIGIAI0 I2C clock (SCL), RS-485 B Pin 5 – DIGIAI0
6 DIGIAI1 I2C data (SDA), RS-485 A Pin 6 – DIGIAI1

NXT 2.0[edit]

Lego Mindstorms NXT 2.0 is the second set in the Lego Mindstorms series, introduced on August 5, 2009, at the Lego Shop in the U.S. The set contains 619 pieces, including a sensor that can detect colors. It was followed by the Lego Mindstorms EV3.[38]


See caption
Model forklift constructed with the Lego Mindstorms NXT 2.0
  • A sound editor for recording a sound and programming the NXT brick to play it.
  • An image editor for downloading an image to the NXT brick to appear on the screen.

NXT intelligent brick[edit]

  • 32-bit Atmel AT91SAM7S256 main microcontroller (256 KB flash memory, 64 KB RAM)
  • 8-bit Atmel ATmega48 microcontroller @ 4 MHz (4 KB flash memory, 512 Bytes RAM)
  • 100×64 pixel LCD screen
  • Four RJ12 input ports (ports 1–4)
  • Three RJ12 output ports (ports A-C)
  • USB port
  • Bluetooth Class II V2.0
  • Loudspeaker – 8 kHz sound quality, 8-bit resolution, 2–16 kHz sample rate
  • Four push buttons to navigate menus and use in programs
  • Powered by six AA batteries or the NXT rechargeable battery

See also[edit]


  1. ^ "What's NXT? LEGO Group Unveils Lego Mindstorms NXT Robotics Toolset at Consumer Electronics Show" (Press release). Las Vegas, NV: The Lego Group. January 4, 2006. Archived from the original on July 8, 2009. Retrieved 2007-09-17.
  2. ^ "LEGO MINDSTORMS NXT Robotics Toolset Now Widely Available" (Press release). New York, NY: The Lego Group. August 2, 2006. Archived from the original on September 11, 2006. Retrieved July 3, 2022.
  3. ^ "8527Mindstorms NXT Kit". LEGO Group. Archived from the original on 2009-02-03. Retrieved 2008-12-26.
  4. ^ "Lego Mindstorms Education NXT Base Set". Archived from the original on 2011-12-10. Retrieved 2011-09-30.
  5. ^ "LEGO Education | Products > Middle School > NI LabVIEW for LEGO MINDSTORMS Software". Archived from the original on 2011-12-16. Retrieved 2011-11-16.
  6. ^ "All the tools to take your Lego Mindstorms NXT to the Extreme!". Archived from the original on 6 October 2009.
  7. ^ "Brickshelf Gallery - Example code fragments". Retrieved 3 July 2022.
  8. ^ "Shows". Retrieved 3 July 2022.
  9. ^ "Not eXactly C".
  10. ^ "NBC – NeXT Byte Codes, Not eXactly C, and SuperPro C".
  11. ^ "Lego Education".
  12. ^ " – Documentation > Lego Mindstorms NXT support".
  13. ^ Moral, Juan Antonio Breña. "LeJOS, Java for Lego Mindstorms".
  14. ^ "nxtOSEK".
  15. ^ "ICON". Retrieved 3 July 2022.
  16. ^ "Team Hassenplug". Retrieved 3 July 2022.
  17. ^ "mindstorms / ev3-toolbox-matlab · GitLab". Retrieved 3 July 2022.
  18. ^ "Search Hardware Support". Retrieved 3 July 2022.
  19. ^ "pbLua Home Page". 8 December 2008. Archived from the original on 2008-12-08. Retrieved 3 July 2022.
  20. ^ "Libre - Home > Tools > GNAT GPL for LEGO MINDSTORMS NXT – Ravenscar Edition". Archived from the original on 2012-03-05. Retrieved 2009-06-24.
  21. ^ "Gostai". Archived from the original on 2007-04-30.
  22. ^ "FLL NXT Navigation - Home". Archived from the original on 2016-03-04. Retrieved 2009-03-12.
  23. ^ "zuk/ruby-nxt". 14 November 2020. Retrieved 3 July 2022.
  24. ^ "NXT". Retrieved 3 July 2022.
  25. ^ "Google Code Archive - Long-term storage for Google Code Project Hosting". Retrieved 3 July 2022.
  26. ^ "C_NXT". 13 June 2016. Retrieved 3 July 2022.
  27. ^ "Google Code Archive - Long-term storage for Google Code Project Hosting". Retrieved 3 July 2022.
  28. ^ "NBC - NeXT Byte Codes, Not eXactly C, and SuperPro C". Retrieved 3 July 2022.
  29. ^ "Schodet/nxt-python". 18 June 2022. Retrieved 3 July 2022.
  30. ^ "FAQs available for". Retrieved 7 December 2019.
  31. ^ "UC Davis Center for Integrated Computing and STEM Education » Ch Robot Controller".
  32. ^ "Home – LEGO MINDSTORMS® - – Mindstorms". Archived from the original on 2012-05-29. Retrieved 2009-01-15.
  33. ^ "Home – LEGO MINDSTORMS® - – Mindstorms".
  34. ^ "Home – LEGO MINDSTORMS® - – Mindstorms". Archived from the original on 2012-02-17. Retrieved 2009-01-15.
  35. ^ "Home – LEGO MINDSTORMS® - – Mindstorms".
  36. ^ "Home – LEGO MINDSTORMS® - – Mindstorms".
  37. ^ "Home – Lego Mindstroms -". Archived from the original on 2009-10-06. Retrieved 2009-01-15.
  38. ^ Miles, Stuart (November 6, 2018). "LEGO Mindstorms NXT 2.0 launches". Pocket-lint. Retrieved January 28, 2009.

External links[edit]