• Lego Mindstorms Magnetic Compass Sensor for NXT / EV3
Expand your NXT experiences with the new NXT Compass Sensor and add accurate navigation to your Mindstorms® NXT projects. The NXT Compass Sensor is a digital compass that measures the earth's magnetic field and outputs a value representing the current heading. The magnetic heading is calculated to the nearest 1° and returned as a number from 0 to 359. The NXT Magnetic Compass Sensor updates the heading 100 times per second. The Compass Sensor operates in two modes, Read mode and Calibrate mode. In Read mode, the current heading is calculated and returned each time to the NXT program executes a read command. In Calibrate mode the compass can be calibrated to compensate for externally generated magnetic field anomalies such as those that surround motors and batteries, thereby maintaining maximum accuracy.
 
The NXT Compass Sensor contains a digital magnetic compass that measures the earth’s magnetic field and calculates a heading angle. The Compass Sensor connects to an NXT sensor port using a standard NXT wire and uses the digital I2C communications protocol.  The current heading is calculated to the nearest 1° and refreshed 100 times per second. 
 
The Compass Sensor is housed in a standard Mindstorms sensor housing to match the other Mindstorms elements.
 
To test your new sensor, plug it into port 2 of your NXT and select View > Ultrasonic cm > Port 2. As you swing the sensor around, you’ll notice that the readings will change from 1 – 179. (0 will display as ?????? while in View mode.)
 
Programming
 
Mindstorms NXT-G
 
The compass can be programmed using LEGO Mindstorms NXT Software Compass Block*.  If the Compass Block is not available you may also use the standard Ultrasonic Block.
 
Ultrasonic Block
 
If using the Ultrasonic Block to program the compass, configure the block to centimeter mode as shown.
 
 
The Ultrasonic Block can only return values from 0 to 250 so in order to return the full range of headings, 0 to 360, the heading value returned when using the Ultrasonic Block will be the current heading divided by 2.  For example, if the current heading is 220°, the value returned will be 110.  North will return a value of 0, East, a value of 45, South, a value of 90 and West, a value of 135.  To get the actual magnetic heading, simply take the number returned and multiply by 2.
 
Compass Sensor Block
 
The Compass Block is designed to support the HiTechnic Compass Sensor and supports all compass features.
 
 
1.  This plug wires the number for which of your NXT’s ports are connected to the compass sensor.
2.  This plug wires the number of the Action to be performed.
3.  This plug wires the Target heading, see section on Relative Heading further down this page. 
4.  This plug wires the lower limit number for the Inside/Outside compare function. 
5.  This plug wires the upper limit number for the Inside/Outside compare function. 
6.  This plug outputs the current Absolute Heading number. 
7.  This plug outputs the current Relative Heading number, see section on Relative Heading further down this page.
8.  This plug outputs the Inside/Outside logical value.
 
Compass Front Panel
 
 
Port allows you to select the NXT port the compass is plugged into.
 
Action
 
Action has three options.  These are;
 
Absolute Reading:  Allows you to read the Absolute Heading, a value from 0 to 359, corresponding to the current magnetic heading in degrees.  (Plug 6 on the data hub)
 
Relative Reading: Allows you to set a Target and read the Relative Heading (Plug 3 and 7 on the data hub).  
See Using Relative Reading below for more information.
 
Calibrate: Set the compass sensor into Calibrate mode allowing you to go through the calibrate sequence to minimize the influence of metal and other other sources of magnetic interference such as motors or batteries.
See Calibrating the Compass Sensor below for more information.
 
Compare
 
Compares the Absolute Heading to the range set and sets the logic value to show if the value is inside or outside the range. 
See Using Range below for more information.
 
Using Relative Reading
 
Relative Reading makes it easy to stay on a selected heading.  To use this feature select the Relative Reading action.  Then enter a Target that is the heading you wish to maintain. 
 
If you wanted to navigate South, you would  enter a Target of 180 (South is 180 degrees).  The Compass Sensor block would then calculate the difference between the Absolute Heading and your Target and return the difference as the Relative Heading. (plug 7).
 
For example, with your target set to 180, if the Absolute Heading were 175, then the Relative Heading would be 5 (Target – Absolute Heading or 180 – 175 = 5).  This indicates a turn to the right or clockwise of 5 degrees is required to get back to the Target. 
 
If the Absolute Heading were 185, then the Relative Heading would be -5 (Target – Absolute Heading or 180 – 185 = -5).  This indicates a turn to the left or clockwise of 5 degrees is required to get back to the Target.  
 
Calibrating the Compass Sensor
 
The HiTechnic compass sensor will be influenced by local magnetic interference in the same way as any other magnetic compass.  Objects such as metal items, motors, batteries and wires can cause magnetic interference.  Local magnetic interference may cause the compass to output a heading several degrees different than the actual magnetic heading.  This is called compass deviation.  To correct for deviation, the HiTechnic compass sensor has a built in calibration function that calculates correction offsets and stores them in the compass.  
 
Calibration is optional and usually not required for normal operation. To minimize the need for calibration make sure you mount the compass at least 4 – 6 inches (10 – 15 cm) away from the NXT and NXT motors.
 
To calibrate the compass under program control, select calibration mode (value 2 wired to the Action plug input) and then program your robot to rotate (turn in a tight circle) between 1 ½ and 2 times (more than 360 degrees) so it completes a full turn in about 20 seconds.  Once the turns have been completed, set the Action to a Read function (Absolute or Relative) and the compass will be calibrated.  The compass will retain the calibration settings until another calibration is performed, even if it is unplugged.
 
Using Range
 
The Compare lets you set a range and easily determine if you are inside or outside the range.
 
The Components for using the Range function are;
 
Inside Range / Outside Range:  Select if you want to test for an Absolute Heading inside the range or outside the range.
 
A: The lower limit of the range (0 – 359)
 
B: The upper limit of the range (0 – 359)
 
To use the Range function, set the lower and upper limit of your range and whether you want to test for inside or outside the range. 
 
Examples showing the logical result.
 

A

B

Range

Absolute Heading

Logical Value

85

95

Inside Range

90

85

95

Inside Range

100

85

95

Outside Range

90

85

95

Outside Range

100

Sensor Register Layout

 

Address

Type

Contents

00 – 07H

chars

Sensor version number

08 – 0FH

chars

Manufacturer

10 – 17H

chars

Sensor type

18 – 3DH

bytes

Not used

3E, 3FH

chars

Reserved

40H

byte

Not used

41H

byte

Mode control

42H

byte

Heading }  two degree heading

43H

byte

Heading }  one degree adder

44, 45H

word

Heading (low byte, high byte)

46 – 7FH

bytes

Not used

 
The Sensor version number field will report a revision number in the format “²Vn.m” where n is the major version number and m is the revision level. Revision numbers will typically reflect the firmware level. The version number will be used to indicate the hardware level.
 
The Manufacturer field will contain “HiTechnc”.
 
The Sensor type field will contain “Compass”.
 
The Mode control field may be set to 0x00 or 0x43 to define measurement mode or hard-iron calibrate mode.
 
The Heading fields will return the currently measured heading during measurement mode operation. During hard-iron calibrate mode operation, this field will jam.
 
The heading is obtained by reading location 0x42 to obtain the two degree heading and 0x43 to obtain the one degree adder. The heading can then be computed as
 
Heading = (two degree heading *2) + one degree adder.
 
If the sign is a problem, then the conventional 16 bit value can be obtained from 0x44 (low byte) and 0x45 (high byte).
 
Locn 0x41 is the mode control. Defaults to 0, which is measurement mode. Change to  0x43 to set calibration mode. Must be changed back to 0 when calibration is completed. (If cal. fails, locn. 0x41 will be set to 2 after the host has set it to 0 at the end of the failed calibrate attempt.)
 
Other Programming Environments
 
RobotC
 
All features of the HiTechnic Compass can be accessed using RobotC.  For more information go to http://www-education.rec.ri.cmu.edu/robotc/.  
 
NBC
 
Next Byte Code (NBC) is a simple programming language that can access all compass features.  For more information go to http://bricxcc.sourceforge.net/nbc/.
 
 Notes:
  • The HiTechnic compass sensor will only operate correctly in a horizontal plane so you must keep the compass level for it to read correctly. This is very important so remember this when you build it into your robot.
  • NXT Firmware version 1.03 must be loaded in the NXT for the compass to operate correctly.  You can check the firmware version by  displaying the NXT Window in the Mindstorms software.
  • It is highly desirable to mount the compass at least 6 inches (15 cm) away from the motors and 4 inches (10cm) away from the NXT brick itself.
  • Try to make sure it is firmly mounted, if it bounces around, the readings may bounce around too.

Downloads

Write a review

Please login or register to review

Lego Mindstorms Magnetic Compass Sensor for NXT / EV3

  • Brand: HiTechnic
  • Product Code:Hitechnic-Magnetic-Compass-Sensor
  • Reward Points:76
  • Availability:Order now and get it in 07 days
  • रo 8,909.00
  • रo 8,714.30

  • Ex Tax:रo 7,385.00
  • Price in reward points:7550

Related Products

Lego Mindstorm Acceleration / Tilt Sensor for NXT / EV3

Lego Mindstorm Acceleration / Tilt Sensor for NXT / EV3

Now you can make robots that know which way is up! The Accelerometer / Tilt Sensor measures accelera..

रo 8,165.60 रo 8,909.00 Ex Tax:रo 6,920.00

Lego Mindstorms Infrared Seeker V2 for NXT / EV3

Lego Mindstorms Infrared Seeker V2 for NXT / EV3

Play robot soccer and zero in on your infrared (IR) beacons with IRSeeker. You can use most TV remot..

रo 8,165.60 रo 8,242.30 Ex Tax:रo 6,920.00

Lego Mindstorms Color Sensor V2 for NXT / EV3

Lego Mindstorms Color Sensor V2 for NXT / EV3

Add a spectrum of color to your models with the new and updated Color Sensor. Detect an extended ran..

रo 8,165.60 रo 8,909.00 Ex Tax:रo 6,920.00

PICAXE I2C Explorer Kit AXE216

PICAXE I2C Explorer Kit AXE216

A self-assembly kit for the PICAXE-20X2 (included) for those wishing to interface and experiment wit..

रo 1,593.00 Ex Tax:रo 1,350.00

BrickPi+ Base Kit

BrickPi+ Base Kit

BrickPi is best for someone who already has LEGO MINDSTORMS sensors and motors. The BrickPi connects..

रo 20,724.34 Ex Tax:रo 17,563.00

EV3 Infrared Beacon

EV3 Infrared Beacon

This has been designed for use with the EV3 Infrared Seeker Sensor. The beacon emits an infrared sig..

रo 5,221.50 Ex Tax:रo 4,425.00

EV3 Infrared Sensor

EV3 Infrared Sensor

The digital EV3 Infrared Seeking Sensor detects proximity to the robot and reads signals emitted by ..

रo 5,221.50 Ex Tax:रo 4,425.00

EV3 Color Sensor

EV3 Color Sensor

The digital EV3 Color Sensor distinguishes between eight different colors. It also serves as a light..

रo 6,106.50 रo 6,944.30 Ex Tax:रo 5,175.00

EV3 Ultrasonic Sensor

EV3 Ultrasonic Sensor

The digital EV3 Ultrasonic Sensor generates sound waves and reads their echoes to detect and measure..

रo 5,221.50 Ex Tax:रo 4,425.00

EV3 Gyro Sensor

EV3 Gyro Sensor

The digital EV3 Gyro Sensor measures the robot’s rotational motion and changes in its orientation. S..

रo 5,221.50 Ex Tax:रo 4,425.00

Lego Mindstorms NXT Magnetic Sensor

Lego Mindstorms NXT Magnetic Sensor

The NXT Magnetic Sensor will enable you to build robots that can detect magnetic fields. The sensor ..

रo 3,380.70 Ex Tax:रo 2,865.00

Lego Mindstorms NXT IR Receiver Sensor

Lego Mindstorms NXT IR Receiver Sensor

The NXT IRReceiver Sensor receives signals from a LEGO Power Functions IR remote control, decodes th..

रo 7,410.40 Ex Tax:रo 6,280.00

Lego Mindstorms NXT PIR Sensor

Lego Mindstorms NXT PIR Sensor

Detect people or pets with the HiTechnic PIR Sensor. This Passive Infrared Sensor is similar to the ..

रo 8,165.60 Ex Tax:रo 6,920.00

Lego Mindstorms NXT EOPD

Lego Mindstorms NXT EOPD

Accurately detect objects and small changes in distance to a target with the HiTechnic EOPD. The EOP..

रo 8,165.60 Ex Tax:रo 6,920.00

Lego Mindstorms NXT Angle Sensor

Lego Mindstorms NXT Angle Sensor

Measure axle rotation position and rotation speed with the HiTechnic Angle Sensor. The Angle Sensor ..

रo 8,165.60 Ex Tax:रo 6,920.00

Lego Mindstorms NXT Force Sensor

Lego Mindstorms NXT Force Sensor

The NXT Force Sensor will enable you to build robots that can measure a physical force applied throu..

रo 5,900.00 Ex Tax:रo 5,000.00

Lego Mindstorms NXT Barometric Sensor

Lego Mindstorms NXT Barometric Sensor

The NXT Barometric Sensor can be used as part of a weather station or to monitor altitude. The senso..

रo 8,165.60 Ex Tax:रo 6,920.00

HiTechnic NXT Extended Connector Cable

HiTechnic NXT Extended Connector Cable

Extend your Mindstorms NXT robotic designs with the HiTechnic Extended Connector Cable . Build creat..

रo 118.00 Ex Tax:रo 100.00

HiTechnic NXT Touch Sensor Multiplexer

HiTechnic NXT Touch Sensor Multiplexer

HiTechnic NXT Touch Sensor Multiplexer for LEGO Mindstorms NXT Introduction The NXT Touc..

रo 4,259.80 Ex Tax:रo 3,610.00

HiTechnic 9V-6xAA Battery Box

HiTechnic 9V-6xAA Battery Box

This Battery Box can be used to power the 360 IR Beacon replacing the beacon's optional 9v internal ..

रo 761.10 Ex Tax:रo 645.00

HiTechnic NXT SuperPro Prototype Board

HiTechnic NXT SuperPro Prototype Board

HiTechnic SuperPro Sensor for LEGO Mindstorms NXT Introduction The HiTechnic SuperPro Sensor..

रo 4,012.00 Ex Tax:रo 3,400.00

Tags: NXT, Magnetic, Compass, Sensor, lego, mindstorms

The product is currently Out-of-Stock. Enter your email address below and we will notify you as soon as the product is available.

Name
Email
Phone
Comments