Getting Started with Mindstorms NXT

As we stated in our previous articles, Lego’s Mindstorms NXT is one of our favorite development platforms, providing enough processing power for most projects, together with ease of use beneficial for focusing on concepts and less on prototyping issues. A vast amount of resources is readily available online as well as in printed form, and a variety of programming environments, available for both Windows and Mac, can be used to develop pretty complex robots based on this. Developer kits for software, hardware, bluetooth and mobile applications are available at the Mindstorms support site, and even an open source firmware package is available, allowing for customization starting from the lowest hardware abstraction layer. Additional accessories, sensors and controllers are also available expanding even further the versatility of this platform. In this article we will focus on setting up the work environment based on the 8527 or Mindstorms NXT 1.0 kit.

Mindstorms NXT 8527

Mindstorms NXT 8527 | Photo: Lego

First of all we need to say a few words about the different versions of the Mindstorms NXT kits. The first version was released in 2006, as a direct replacement for the Lego Mindstorms platform featuring the RCX (Robotic Command eXplorer) brick, released in 1998, the “NXT” particle in its name denoting it as the “next” generation of robotic development platform.

The Mindstorms NXT platform comes in three flavors, all based on the 9841 NXT Intelligent Brick, which is the same for all kits, the only difference being the firmware version at the time of release of each kit, however NXT bricks from all three versions can be updated to the latest firmware, but we will discuss about this later in the article. The three kits are the 8527 – or Mindstorms NXT 1.0, now discontinued, the 8547 – Mindstorms NXT 2.0, released in 2009, and the 9797 – Mindstorms NXT Education Base Set.

The electric and electronic parts lineup is almost identical for the three kits, all of them containing the before mentioned NXT Brick, 3 servomotors, 1 ultrasonic distance sensor and 7 I/O cables. The 8527 kit contains one touch sensor and one microphone sound sensor, while 8547 kit contains a secondary touch sensor replacing the microphone. The light sensor in the 8527 kit is revised in the 8547 kit which contains instead a much more versatile RGB sensor. The 9797 kit also has 3 9V lights, conversion cables for connecting lights or RCX hardware to the NXT, a rechargeable battery and a charger.

The plastic parts number and type is different in all three sets, hence the types of robots that can be built, but NXT Resource sets containing more plastic parts are available, the discontinued 9648 and the current 9695.

Mindstorms NXT 8527 and 8547

Mindstorms NXT 1.0 and 2.0 packaging

The graphical programming software version bundled is slightly different between 8527 and 8547, the 8547 comes with the NXT Mindstorms 2.0 software, which has several bug fixes to run more smoothly and a few nice features have been added. Since the NXT bricks are identical, the 2.0 software can be used with any kit with no issues. The software is available for download on the Mindstorms website here.

Hardware components

We will now take a look at the hardware provided with the Mindstorms NXT kit in order to better understand our system.

NXT Intelligent Brick

The NXT Brick is the core of the system, holding processing, I/O, power and communications hardware. What we can find comprised in the unit:

  • 32-bit ARM7 microcontroller manufactured by Atmel as the CPU with 256 kB of flash memory and 64 kB of RAM;
  • 8-bit Atmel AVR chip for data management with 4 kB of flash and 512 Byte RAM;
  • Bluetooth 2.0 wireless interface;
  • USB 1.0 interface;
  • I2C interface for communicating with I/O devices;
  • Integrated dot-matrix LCD display with 100×64 resolution;
  • Integrated speaker with 8 kHz sound quality over an 8 bit resolution;
  • 4 input and 3 output ports for 6 wire cables;
  • Housing for 6 AA batteries power source, alkaline or rechargeable.

Mindstorms NXT 8527

The I/O ports on the unit have predefined purposes and it is better to use them with their predefined designations when using graphical programming environments. The input ports are labeled from 1 to 4, output ports from A to C and are assigned in the following fashion:

  • Port 1 – touch sensor;
  • Port 2 – microphone;
  • Port 3 – light sensor;
  • Port 4 – ultrasonic sensor;
  • Port A – various functions servo;
  • Port B – left motion servo;
  • Port C – right motion servo.

All connected devices can be tested using the pre-programmed routines found under the “Try Me” option on your NXT and simple programming can be done when accesing the “NXT Program” option found in the main menu.

Touch sensor

The sensor is a simple switch with two states, pressed or depressed, 0 or 1. It can be used for instance to sense when an object is in reach, or as and end of line switch.
Mindstorms NXT 8527

Sound sensor

The sound sensor is a microphone that can be used to measure ambient sound levels, to record sounds or even to control your robot with loud noises. Depending on programming, sound levels can be measured in dB, dB(A) or percent. The maximum supported level is 90 dB.
Mindstorms NXT 8527

Light sensor

The light sensor can be used to measure ambient light levels or, when the integrated LED is turned on, to provide relative distance readings based on reflected light intensity, useful when navigating with markers or to detect distance to objects, the higher the contrast between colors in the environment, the better the accuracy. In the 9547 Mindstorms NXT 2.0 kit it has been replaced by a color sensor (9694) which can discriminate between 6 different colors.
Mindstorms NXT 8527

Ultrasonic sensor

The ultrasonic sensor is a much more effective way to provide distance readings. It has a measuring range from 0 to 255 centimeter and an accuracy of 3 centimeters.
Mindstorms NXT 8527

Servomotors

The kit comes with three servomotors that have integrated optical encoders to provide positioning feedback with a precision of up to one degree of the output hub, and a resolution of 1 impulse per degree, i.e. 360 impulses per revolution. The maximum rpm of the servo output hub is about 165 rpm at 9 Volts power or around 130 rpm when using rechargeable batteries powering the system at 7,2 Volts. The final gear ratio is 1:48.
Mindstorms NXT 8527
Mindstorms NXT 8527

Cables and power source

The 6-wire I/O cables supply power and I2C communication to devices. The NXT connectors resemble modified RJ12 connectors with clip on the right.
Mindstorms NXT 8527
You can power your NXT by using 6 AA 1,5 Volt alkaline batteries, AA rechargeable batteries or the 9693 rechargeable battery pack from Lego.
Mindstorms NXT 8527

Setting up the software

We will discuss how to set up your NXT with a Windows OS, using the bundled or downloaded Mindstorms NXT software package containing the USB driver and the graphical programming environment (NXT-G). Installation is pretty straightforward, requiring minimal user input in selecting the interface language and items to be installed. Once the installation procedure is complete, the NXT brick can be connected to the computer using a cable with an USB type B connector at the unit side. When turned on, the configuration should start automatically, and the device should appear in the Windows XP device manager as shown in the image below.
Mindstorms NXT 8527

A general view of the 2.0 software interface can be seen below. The project building and programming instructions preinstalled in the Robo Center are only those corresponding to the 8547 kit so projects that can be built using the 8527 kit have to be manually installed if required, when not using version 1.0 of the software.
Mindstorms NXT 8527

Program blocks can be dragged and dropped from the block selector palette to the work area and a configuration panel, specific to each block, will appear on the lower part of the window. There is also a quick help section, providing information on how to program the current block.

The quick command section, persistent in the lower right corner of the work area, provides quick access to NXT status window, download program to NXT, run and stop commands.
Mindstorms NXT 8527

Since we are using a 8527 kit, corresponding to Mindstorms NXT 1.0 we opted for upgrading the firmware of our NXT brick. It came with version 1.03, so we downloaded the latest firmware version 1.31 from the support site, copying the files to [drive_letter]:\Program Files\LEGO Software\LEGO MINDSTORMS NXT\engine\Firmware location. After that we accessed the Tools->Update NXT Firmware… option, to update our NXT brick.
Mindstorms NXT 8527
Mindstorms NXT 8527

Another feature is the Calibrate sensor tool through which you can customize the measuring domain of various sensors connected to the NXT.
Mindstorms NXT 8527

The Remote Control is a tool through which you can control your NXT robot from the computer, a feature not found in version 1.0 of the software.
Mindstorms NXT 8527

More interesting additions are the sound and image editors, useful for creating custom graphics and sounds played back by the NXT, as well as the block import/export wizard designed to easily implement and share custom blocks.
Mindstorms NXT 8527
Mindstorms NXT 8527
Mindstorms NXT 8527

 

Epilogue

This article is the first from a series of articles to come, dedicated to the Mindstorms NXT platform, in which we will discuss on how to program, expand and customize your NXT, using the NXT with other programming environments as well as presenting interesting Smashing Robotics projects.

Resources