Would you like to tell us how we are doing?

You bet No thanks

Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

Simulating magnetometer information

Magnetometer

A magnetometer is a sensor that is similar to a compass. A compass detects the horizontal component of the direction of a magnetic field. Magnetometers detect both the directional components and the strength of a magnetic field.

Magnetometers in BlackBerry devices are calibrated to sense the magentic field of the earth. They are designed to measure and remove interference caused by local magnetic fields so that only the magentic field of the earth is measured. You can test the calibration quality of a magnetometer and trigger a new calibration when necessary.

An obvious use of a magnetometer is to create a digital compass by creating a UI that presents the directional magnetometer data. Because a magnetometer includes additonal information about the magnetic field, such as the field strength, you can use it for many other purposes. For example, magnetometers are used in metal detectors, geological exploration tools, stud and pipe finders, and applications that require precise inclination measurements.

Displaying magnetometer information

Because the BlackBerry Smartphone Simulator does not move, the simulator displays a small image showing the orientation of the simulated BlackBerry smartphone.

In the Manipulate Device window, you specify information about the current orientation and magnetic flux density for the simulated BlackBerry smartphone.

The Manipulate Device window consists of two sections. In the top section of the window, you can switch between the device rotation mode, where you can define the orientation of the BlackBerry smartphone, and the magnetic north mode, where you can define the magnetic flux data. You can switch between the two by clicking the icon in the upper-right corner.

In smartphone rotation mode, you can define the orientation of the BlackBerry smartphone along the x, y, and z axes. To specify an orientation, you can drag the circle representing the axis or you can type a number in degrees in a field in the Manual Input section. If you type the number of degrees manually, the image in the Device Manipulator window is not updated until you click Apply.

When smartphone rotation mode is displayed, the icon displays a picture of an N. Clicking the icon switches you to the magnetic north mode. Magnetic north mode shows the magnetic flux information. In this mode, you can define the declination, inclination, field strength, and the reading quality. You can define the declination and inclination graphically or manually, but you can only define the field strength and the reading quality manually.

When the compass is displayed, the icon in the upper-right displays a symbol representing a smartphone. Clicking the icon switches you to the smartphone rotation mode.

The lower section of the Manipulate Device window displays the playback information. You can record, load, or play back a series of readings using the Playback section. A series of readings is called a magnetic path. A magnetic path consists of a first key, a last key, and possibly other keys. A key contains both the smartphone rotation data and the magnetic flux data for that instant in the animation.

To add readings to the magnetic path, you can add keys to the path. The BlackBerry Smartphone Simulator tries to make the transitions between keys as smooth as possible when you play back the path animation.

You do not need to save an animation to play it back.

Create or edit a magnetic path

Each key in a magnetic path can specify both magnetic field data and rotational data for the position of the BlackBerry smartphone. During animation playback, the simulator presents a smooth transition between the values in each key.
  1. On the Simulate menu, click Manipulate Device.
  2. To edit an existing magnetic path, load it from a .mag file.
  3. If necessary, add or delete keys.
  4. For each key, add the necessary BlackBerry smartphone rotation data.
  5. For each key, add the necessary magnetic data.
  6. In the Playback section, in the Duration field, specify the length of time for the playback, in seconds.
  7. When the changes to the magnetic path are finished, save the magnetic path animation in a .mag file.

Example: Creating a magnetic path

The following steps demonstrate how to create a new magnetic path that takes 9 seconds to play. As a result of steps two through four, approximately one-third of the way through the path, the simulated BlackBerry smartphone tilts upside down and the magnetic field inclination changes to 90 degrees. For the remainder of the animation, both the inclination and smartphone rotation return to the original state.

  1. On the Simulate menu, click Manipulate Device.
  2. In the Playback section, click the playback line at about one-third its length.
  3. Click Add Key.
  4. In the Tilt field, type 180.
  5. Click in one of the other fields.
  6. Click Apply.
  7. Click the N icon in the top right corner.
  8. In the Inclination field, type 90.
  9. Click in one of the other fields.
  10. Click Apply.
  11. In the Duration field, type 9.
  12. Click the Play icon.

If you view the playback of the path in magnetic north mode, the inclination arrow rises and then slowly drops. If you view the playback in smartphone orientation mode, the simulated BlackBerry smartphone flips over and then slowly turns back.

Change the smartphone orientation in a key

Before you begin: Make sure that the Device Manipulator window is open and is displaying the smartphone orientation mode.
This task is part of creating or editing a magnetic path. The smartphone orientation in a key consists of the accelerometer data that is reported when the playback cursor passes that key.
  1. To add a key, in the Playback section, click in the playback line where you want the new key and click Add Key.
  2. Click the key that you want to change.
  3. Do one of the following:

    Task

    Description

    Set the rotation around the z axis.

    Do one of the following:
    • Click the green circle and drag it until the BlackBerry smartphone image points in the direction you want.
    • In the Manual Input section, in the Rotation field, type the angle, in degrees, and click Apply.

    Set the tilt around the x axis.

    Do one of the following:
    • Click the blue circle and drag it until the arrow points in the direction you want.
    • In the Manual Input section, in the Tilt field, type the angle, in degrees, and click Apply.

    Set the direction around the y axis.

    Do one of the following:
    • Click the black circle and drag it until the arrow points in the direction you want.
    • In the Manual Input section, in the Direction field, type the angle, in degrees, and click Apply.

    Move a key to a new location.

    1. Click and drag the key to the new location.
  4. If necessary, change the magnetic field reading.
  5. If necessary, save the magnetic path.

Change the magnetic flux information in a key

Before you begin: Make sure that the Device Manipulator window is open and displays magnetic north mode.
This task is part of creating or editing a magnetic path. Magnetic information in a key consists of the magnetic flux information that is reported when the playback cursor passes that key.
  1. To add a key, in the Playback section, click in the path window where you want the new key and click Add Key.
  2. Click the key that you want to change.
  3. Do any of the following:

    Task

    Description

    Set the difference between true north and magnetic north.

    Do one of the following:
    • Click the red circle and drag it until the N of the compass points in the direction you want.
    • In the Manual Input section, in the Declination field, type the angle, in degrees, and click Apply.

    Set the vertical angle of the magnetic field.

    Do one of the following:
    • Click the blue circle and drag it until the arrow points in the direction you want.
    • In the Manual Input section, in the Inclination field, type the angle, in degrees, and click Apply.

    Set the strength of the magnetic field

    1. In the Manual Input section, in the Field Strength(microTesla) field, type the field strength, in microTeslas.
    2. Click Apply.

    Set the reliability of the magnetometer reading.

    1. In the Manual Input section, in the Reading Quality field, select one of Unreliable, Low, Medium, or High.
    2. Click Apply.

    When you set the Reading Quality to Low, you can only recalibrate after a subsequent reading of High.

    Move a key to a new location.

    Click and drag the key to the new location.

  4. If necessary, change the smartphone orientation in the key.
  5. If necessary, save the magnetic path.

Play back the current magnetic path

Before you begin: Make sure that the Device Manipulator window is open.
In the Playback section of the Device Manipulator window, click the play icon.

Load a magnetic path file

The BlackBerry Smartphone Simulator can record and store magnetic path files.
  1. On the Simulate menu, click Manipulate Device.
  2. Click Load.
  3. In the Open Magnetometer animation file dialog box, click on the .mag file to load.
  4. Click Open.

Save the current magnetic path

Before you begin: Make sure that the Device Manipulator window is open.
  1. Click Save.
  2. Type a name for the magnetic path file.
  3. Click Save.
  4. Click OK.

Display rotation in the BlackBerry Smartphone Simulator window

Before you begin: Make sure that the Device Manipulator window is open and in smartphone orientation mode.

You can configure the BlackBerry Smartphone Simulator displays rotation happening in a magnetic path animation. When this feature is enabled, the image of the BlackBerry smartphone in the main BlackBerry Smartphone Simulator window rotates when you play a magnetic path animation that includes rotation.

Click the bottom icon on the right.