Introduction to Lego Mindstorms Successor
Today, a successor, NXT, forms the core of the new Mindstorms system. This advancement empowers computer enthusiasts to not only develop and construct robots but also program them extensively. The featured compass sensor described here enhances the NXT’s capabilities, enabling it to determine direction with remarkable accuracy, down to a few degrees.
Navigation Capabilities through Compass Sensor
The compass sensor facilitates the creation of robots capable of navigation. Devantec 121 offers a convenient solution with their pre-built compass module, CMPS03. Utilizing two perpendicular Philips KMZ51 hall sensors, this module detects Earth’s geomagnetic field. A PIC controller processes this data, generating a digital output ranging from 0 to 360 degrees. This information can be accessed through the module’s I2C protocol or a PWM output, allowing seamless communication with the external world.
Module Specifications and Compatibility
The module operates on a 5 V supply voltage and consumes approximately 20 mA. It is highly compatible with the NXT platform, which supports sensors using the I2C protocol. To connect a sensor to the NXT through an RP 2 plug, external pull-up resistors are required, as the NXT lacks internal pull-up resistors on the I2C bus. Lego recommends using 82 kΩ resistors on both the data line (SDA) and the clock line (SCL) for proper functioning.
Software Options for NXT Programming
While the standard Lego Mindstorms software relies on dragging graphical function blocks with fixed functionality, Not Exact C (NXC) offers an alternative programming language for the NXT, resembling C. NXC provides greater flexibility, especially for hardware not officially supported by Lego, such as the compass sensor. The compiler, BricX (131), is freely downloadable, user-friendly, and provides extensive programming options for the NXT.
Implementation and Readout
The program “compass.nxc,” available for download on the Elektor Electronics website (file number 070156-11.zip), continuously reads data from the compass sensor. The measured values are processed by the robot, allowing it to sequentially identify North, South, East, and West. Additionally, the NXT brick’s display can also show the values obtained from the electronic compass.