For your NXT or EV3
Sensors
Accelerometer, Compass & Gyro
Motor Multiplexers & Controllers
Wireless Control
Sensor Adapters & Multiplexers
RC Servos, Mountings & Pneumatics

Sensor Kits
Flexi-Cables & Cable Extenders
Classroom packs of Flexi-Cables
Plugs and Connectors
Power Options
Other Robotics accessories

EV3 Console Adapter
EV3 Sensor Adapter for NXT or Arduino
EV3 Compatibility Info

Android App for NXT/EV3

Arduino Products
Shields and Controllers

Raspberry Pi Products
For your Raspberry Pi

Connect with us
Google+
Shopping Cart
Your cart is empty.

Ordering Information
Our Distributors
World Wide Shipping
How to Order and Pay
Paying by Credit Card
Your satisfaction is important to us
About mindsensors.com
Site Map

Yondering ...
Forums
FAQ
Videos
Coming Soon ...
End of Life Products
Robotics related Links

Downloads
NXT Product Docs and Software
User Guides
EV3 Blocks
API's and Sample Programs
NXT-G Blocks
All Downloads

EV3 Programming Environment
Which Programming Environment do you prefer for EV3?
EV3 Home Edition
EV3 Edu Edition
LeJOS
MonoBrick
RobotC
ev3dev
Other



[View Result]

Votes: 1232
Translate this site
Translate this site: (Courtesy of Google™)
Search Web Pages



Need Quote for your School?
Write e-mail to:
info
Need Technical Support?
Write e-mail to:
support
Note your order number in the support request.
You can find order number on your Packing-slip or Order confirmation e-mail.


Proud Supporter of:
Robofest


Trinity College Fire Fighting Robot Contest.

Contact:
E-mail:
info
Address:
mindsensors.com

8623 Mayland Drive
Henrico, VA 23294-4703 USA.
Phone: (804) 767-8116
Fax: (804) 747-5303
Official PayPal Seal
Compass Sensor for RCX
Features
LEGO Compass Sensor

Compass Sensor for RCX is high precision sensor that connects to an RCX input port. This sensor measures the earth's magnetic field and reports heading angle clockwise from magnetic north.

  • Easy to use.
  • Use it as a 'Light Sensor' on your RCX.
  • Can be used with ROBOLAB, RIS-1.0, RIS-2.0 or LejOS.
  • Can be used with AMUX (Active Sensor Multiplexer)

This sensor will work with NXT as light sensor attached using converter cables supplied with MINDSTORMS Education NXT set.
How to use Compass Sensor for RCX

On your RCX (or in your program) set this sensor as a 'Light Sensor'. The values reported by this sensor range from 0 to 100; where Zero (or 100) corresponds to magnetic north. Reading of 25 indicates heading of East, 50 indicates south and 75 indicates west. Each unit change in between corresponds to 3.6? change in heading.

This sensor is very sensitive to external magnetic fields, and needs to be calibrated for it's environment.
How to calibrate Compass Sensor
  1. Install Compass Sensor in its final position in the robot structure with all the motors, RCX and batteries in place.
  2. Power ON RCX and set the Compass sensor port as Light Sensor. Do not run any program.
  3. Press the calibration switch twice - this will begin calibrations and the display will increment from 1 to 100 slowly
  4. Slowly turn the robot two or three times around itself in clockwise direction (taking roughly 20 seconds per turn).
  5. Press the calibration switch on Compass Sensor when done.

Note: While in calibration mode, the Compass Sensor's reading increments from 0 to 100 slowly but continuously. It's an indication that your sensor is in calibration mode.
If you accidently press the calibration switch

If you pressed it once, the RCX display will be alternating between 25 and 75. In that case, you may wait for it to timeout (3 seconds) and then resume normal operations. Or you may power off the RCX.

If you pressed it twice, the Compass sensor has entered the calibration mode, and you must complete calibration process. While in calibration mode, the RCX display will increment from 0 to 100 slowly but continuously. When it reaches 100, it will begin from 0 again.
Direction aware Rover powered by Compass sensor
Direction aware Rover powered by Compass sensorThis Robot was made using rover base with two motors and tank trade. Compass sensor is used to detect direction and correct the motion accurately.
NQC program for above Rover
// following program makes the rover run in a square
// beginning at heading of 72 Degrees and then turning
// 90 degrees clockwise after that.
task main()
{
    // set the port 1 to read as light
    // where the compass sensor is connected.
    SetSensor(SENSOR_1, SENSOR_LIGHT);
    SetSensorMode(SENSOR_1, SENSOR_MODE_PERCENT);
    PlaySound(SOUND_CLICK);

    while(1)
    {
        ChangeHeadingTo(20,3);  // set the direction to heading 72
        // start motors to go forward
        OnFwd(OUT_A);
        OnFwd(OUT_C);
        Wait(200);  // keep the motors running.

        // turn by 90 degrees clockwise (a change of 25)
        ChangeHeadingTo(45,3);
        // start motors to go forward
        OnFwd(OUT_A);
        OnFwd(OUT_C);
        Wait(200);  // keep the motors running.

        // turn by 90 degrees clockwise (a change of 25)
        ChangeHeadingTo(70,3);
        OnFwd(OUT_A);
        OnFwd(OUT_C);
        Wait(200);  // keep the motors running.

        // turn by 90 degrees clockwise (a change of 25)
        ChangeHeadingTo(95,3);
        // start motors to go forward
        OnFwd(OUT_A);
        OnFwd(OUT_C);
        Wait(200);  // keep the motors running.

        // stop
        Off(OUT_A);
        Off(OUT_C);
        SetPower(OUT_A+OUT_C, 8);
    }
}

void ChangeHeadingTo(int target_angle, int ERROR_MARGIN)
{
    int error;
    SetPower(OUT_A+OUT_C, 8);
    while(1)
    {
        Wait(1);
        error=target_angle-SENSOR_1 ; // get current heading error
        if (error>50)
            error=100-error;
        if (error-ERROR_MARGIN)
        {
            // turn clockwise
            OnRev(OUT_A);
            OnFwd(OUT_C);
        }

    }
}