The XY-MRS-01 Electronic Compass is composed of highly reliable industrial-grade microcontrollers, high-precision magnetometers, and drive chips. It integrates hard-iron and soft-iron interference compensation technologies. The XY-MRS-01 is characterized by its compact size and low power consumption, making it suitable for modern miniaturized measurement systems. It is widely used in various fields such as antenna stabilization, vehicles, and system integration.
1. Technical Specifications
| Compass Heading Parameters | Measurement Range | 0~360° (0° is the geomagnetic south pole) |
| Heading Accuracy | 1° | |
| Resolution | 0.1° | |
| Repeatability | 1° | |
| Calibration | Hard-Iron Calibration | Yes |
| Soft-Iron Calibration | Yes | |
| Physical Characteristics | Dimensions | 47.2mm × 31.2mm × 12.5mm |
| Weight | <50g | |
| Interface Characteristics | Startup Delay | <50ms |
| Maximum Sampling Rate | 20 SPS (Samples per Second) | |
| Communication Rate | 2400~19200bps (default 9600bps) | |
| Power Supply | Supply Voltage | +5VDC |
| Supply Current | 50mA | |
| Environment | Storage Temperature | -40℃~+125℃ |
| Operating Temperature | -40℃~+85℃ | |
| Shock Resistance | 2500g |
2. Dimensions

3. Interface Definitions
| Signal Definition | Positive Power | Ground | TXD | RXD |
| Plug Wire Color | Red | Black | Blue | Yellow |
4. Measurement and Installation
Although the XY-MRS-01 can mitigate and compensate for magnetic interference, selecting a location with minimal magnetic interference is crucial. Place the XY-MRS-01 as far away as possible from iron, steel, magnets, engines, and other magnetic materials. If these magnetic materials are present, maintain a minimum distance of 12 inches. While the XY-MRS-01 can compensate for moderate deviations in a stable magnetic environment, it cannot compensate for changing magnetic interference. Remember that electric wires carrying DC current generate a magnetic field, and if the DC current changes, the magnetic field strength will also change! Batteries are another source of variable interference. Each installation is unique, and users must assess the feasibility of installation in all possible operating environments.
The heading accuracy of the XY-MRS-01 can reach 1 degree, which is scientifically verified and indisputable. The most scientific testing method is also crucial. We recommend the following testing method: Mount the XY-MRS-01 electronic compass on a vertically erected aluminum (or other non-magnetic material) rod to measure heading accuracy (of course, the rod should be perpendicular to the rotating platform, and efforts should be made to avoid significant external magnetic interference). This can reduce the radius of rotation of the compass and scientifically improve measurement accuracy. This is only a laboratory installation suggestion; for specific situations, flexibility is required. For example, when installing in a vehicle, the XY-MRS-01 should be mounted perpendicular to the direction of movement.
5. Calibration Method
- Place the compass parallel on a plane away from interference, then correctly connect it to the RS232 communication port and power it on.
- Send the calibration start command in hexadecimal format: “68 04 00 08 0C”.
- The compass will respond with a command, and the blue indicator light on the compass will light up.
- Rotate the compass on-site from 0° to 360° to collect magnetic field data around the compass. (The rotation speed should not be too fast, controlled at more than 40 seconds per rotation.)
- After returning to 0°, send the stop calibration command in hexadecimal format again: “68 04 00 0A 0E”. Calibration is successful.
Note: If the compass is fixedly installed in other equipment, after installing the compass, rotate it together with the equipment to collect interference sources from the equipment, ensuring accurate measurement by the compass.
6. Compass Communication Format
6.1 Data Frame Format: (8 data bits, 1 stop bit, no parity bit, default baud rate is 9600bps)
| Identifier (1 byte) | Data Length (1 byte) | Address Code (1 byte) | Command Byte (1 byte) | Data Field | Checksum (1 byte) |
| 68h |
Identifier: Fixed at 68H.
Data Length: The length from Data Length to Checksum (including Checksum).
Address Code: Address of the acquisition module, default is 00.
Data Field: Varies in content and length depending on the command byte.
Checksum: Sum of Data Length, Address Code, Command Byte, and Data Field, ignoring carry.
6.2 Command Format
6.2.1 Read Heading Angle
Send Command: 68 04 00 03 07
| Identifier (1 byte) | Data Length (1 byte) | Address Code (1 byte) | Command Byte (1 byte) | Data Field (0 bytes) | Checksum (1 byte) |
| 68h | 03 |
Response Command:
| Identifier (1 byte) | Data Length (1 byte) | Address Code (1 byte) | Command Byte (1 byte) | Data Field (3 bytes) | Checksum (1 byte) |
| 68h | 83 | SXXX.YY |
Note: The Data Field is a 3-byte angle value in compressed BCD format. S is the sign bit (0 for positive, 1 for negative), XXX is the three-digit integer part, and YY is the decimal part. For example, 012680 represents +126.8 degrees.
6.2.2 Set Magnetic Declination
Send Command: 68 06 00 06 02 08 16
| Identifier (1 byte) | Data Length (1 byte) | Address Code (1 byte) | Command Byte (1 byte) | Data Field (3 bytes) | Checksum (1 byte) |
| 68h | 06 | SXXY |
This command is used to set the angle between the Earth’s magnetic north pole and the geographic north pole, which varies in different regions globally. After setting the data, the actual output direction data is the sum of the set value and the measured direction data.
S is the sign bit (0 for positive, 1 for negative), XX is a two-digit integer, and Y is a one-digit decimal. For example, 02 08 represents +20.8 degrees.
Response Command:
| Identifier (1 byte) | Data Length (1 byte) | Address Code (1 byte) | Command Byte (1 byte) | Data Field (1 byte) | Checksum (1 byte) |
| 68h | 86 | 00 for success, FF for failure |
6.2.3 Read Magnetic Declination
Send Command: 68 04 00 07 0B
| Identifier (1 byte) | Data Length (1 byte) | Address Code (1 byte) | Command Byte (1 byte) | Data Field (0 bytes) | Checksum (1 byte) |
| 68h | 07 |
This command is used to read the set magnetic declination value.
Response Command:
| Identifier (1 byte) | Data Length (1 byte) | Address Code (1 byte) | Command Byte (1 byte) | Data Field (0 bytes) | Checksum (1 byte) |
| 68h | 87 | SXXY |
6.2.4 Start Calibration
Send Command: 68 04 00 08 0C
| Identifier (1 byte) | Data Length (1 byte) | Address Code (1 byte) | Command Byte (1 byte) | Data Field (0 bytes) | Checksum (1 byte) |
| 68h | 08 |
Response Command:
| Identifier (1 byte) | Data Length (1 byte) | Address Code (1 byte) | Command Byte (1 byte) | Data Field (1 bytes) | Checksum (1 byte) |
| 68h | 88 | 00 for success, FF for failure |
6.2.5 Save Calibration
Send Command: 68 04 00 0A 0E
| Identifier (1 byte) | Data Length (1 byte) | Address Code (1 byte) | Command Byte (1 byte) | Data Field (0 bytes) | Checksum (1 byte) |
| 68h | 0A |
Response Command:
| Identifier (1 byte) | Data Length (1 byte) | Address Code (1 byte) | Command Byte (1 byte) | Data Field (1 bytes) | Checksum (1 byte) |
| 68h | 8A | 00 for success, FF for failure |
6.2.6 Set Baud Rate
Send Command: 68 05 00 0B 02 12
| Identifier (1 byte) | Data Length (1 byte) | Address Code (1 byte) | Command Byte (1 byte) | Data Field (0 bytes) | Checksum (1 byte) |
| 68h | 0B |
Response Command:
| Identifier (1 byte) | Data Length (1 byte) | Address Code (1 byte) | Command Byte (1 byte) | Data Field (1 bytes) | Checksum (1 byte) |
| 68h | 8B | 00 for success, FF for failure |
6.2.7 Set Angle Output Mode
Send Command: 68 05 00 0C 00 11
| Identifier (1 byte) | Data Length (1 byte) | Address Code (1 byte) | Command Byte (1 byte) | Data Field (1 bytes) | Checksum (1 byte) |
| 68h | 0C | 00 for single output, 01 for automatic output every second |
| Identifier (1 byte) | Data Length (1 byte) | Address Code (1 byte) | Command Byte (1 byte) | Data Field (1 bytes) | Checksum (1 byte) |
| 68h | 8C | 00 for success, FF for failure |
