Digital Compass for LEGO MINDSTORMS NXT
The compass sensor for your Lego Mindstorms NXT robots
This sensor reads magnetic fields and more specifically the magnetic field of earth. Using this compass sensor, your Lego Mindstorms NXT robots will be able to use a fixed reference to navigate. Indeed, this feature is very useful and widely used in mobile robotics when your robot move around and have to get back to a specific location.
The dCompass sensor for NXT robots can be used as is, without calibration. However, a calibration feature exists and allows taking into account magnetic fields around the robots to calibrate your compass sensor and therefore gets more accurate readings.
Programming the compass sensor for Lego Mindstorms NXT
The dCompass sensor from Dexter Industries is programmable using the following languages:
Programming the compass sensor for Lego Mindstorms NXT robots using NXT-G
Two NXT-G blocks are available. The first one reads the heading returned by the compass sensor. The second NXT-G block allows calibrating more accurately the dCompass sensor for Lego NXT robots. Let's have a look on the first NXT-G block:
As presented in the two images above, the NXT-G block for the dCompass sensor can read the heading of the robot relative to north (in degrees). This is the information we need and which proves to be very useful in the context of a mobile robot that must find his way after many movements. This NXT-G block also allows setting the difference between true north and magnetic north also called the declination.
To download the two NXT-G blocks for the compass sensor and also some examples in RobotC, NXT and Lejos, go to the download page of the manufacturer: Download page of Dexter Industries