V2xe is a new type of 2-axis compass and geomagnetic field sensor with integrated microprocessor as control and interface. U2xe uses the 3V working power supply commonly used in the new system, which has the advantages of low power consumption, small size, strong anti noise ability under various conditions, large measurement sensitive sensing area and so on. V2xe combines the patented magnetic field induction sensor and measurement circuit technology of PNI company, which is not affected by compensation drift, and the measurement results are very stable at different temperatures. V2xe inputs / outputs data through a simple standard SPI interface.
2. Performance characteristics
The typical characteristics of v2xe are as follows:
Low power (3V DC, 2mA output);
Small package size (25.4mm) × 5.4mm × 11.5mm）；
High ground magnetic induction (0.01 °);
High magnetic accuracy (2.0 °);
Digital interface output (3V standard SPI interface);
High magnetic field induction (0.00015gauss);
It has a large magnetic field range (± 11gauss).
The pin functions of v2xe are listed in Table 1.
V2xe is applied to GPS system, the measurement data of v2xe is read with AT89C2051, and the data is transmitted to GPS processor through serial port. Fig. 1 shows the schematic diagram of v2xe connected to MCU. Since AT89C2051 has no standard SPI port output , P1.7, P1.6 and P1.5 are used to simulate SCLK, miso and MoSi terminals respectively. The reset pin sync of v2xe is controlled by P3.7 pin, ssnot is grounded, and v2xe works in slave mode.
3. Data format and command word
V2xe has two data formats: big endian and little endian. Big endian data is stored from high to low, and little edit data is stored in reverse order, that is, the data with the lowest 8 bits in the highest 8 bits and the data with the highest 8 bits in the lowest 8 bits. As shown in Figure 2.
The command format with data consists of sync flag, frame type and terminator. Figure 3 shows a setdatacomponents (0x03) command with parameters heading (0x02) and magnitude (0x05). Common v2xe command words include getmodinfo, modinforesp, setdatacomponent, GetData, dataresp, setconfig, getconfig, configresp and saveconfig. Its instruction codes and functions are shown in Table 2.
4. Programming example
The data receiving and sending of SPI interface are synchronous. Each time v2xe receives a data, it will send 0x00. When v2xe sends a command response, it will not process any input data. Therefore, when the host obtains v2xe data, it should send and receive at the same time. Write the send receive function spitransmit in C language as follows:
The typical application flow of a v2xe system is shown in Figure 4.
When v2xe leaves the factory, the version number of the chip is solidified in its ROM. When the user applies v2xe for the first time, the system can first read the version number to judge whether the device works normally. First, send the command getmodinfo to v2xe, and then read the return value modinforesp. The program is as follows:
In this way, the obtained chip information is stored in the array Verson. You can compare the read value with the actual version number (v2xev201) to determine whether the system works normally. If the system works normally, first set the return data format as required to determine that v2xe returns these values of interest to users, mainly including geomagnetic direction angle, magnetic field strength, temperature and calibration status bits. In addition, some initialization parameters should be set, mainly including declination (local geomagnetic angle, which can be obtained from http://www.ngdc.noaa.gov/cgi-bin/seg/gmag/fldsnth1.pl), true north (setting the reference angle to geomagnetic north ), big endian (selecting large and small modes of data), dampingsize (data buffer: average the data in the buffer as the actual output of v2xe).
In the practical application of v2xe, calibration is often required. Common commands include startcal, stopcal, getcaldata, caldataresp and setcaldata. The instruction code and function description are shown in Table 3. During the standard process, v2xe device shall be placed horizontally as far as possible, and the device shall be rotated in place for two weeks from the beginning of calibration to the end of calibration. The time of each revolution shall not be less than 30s. After calibration, you can query the parameter calstate to judge whether the calibration is successful. After parameter setting, calibration and other initialization work are completed, you can obtain the data of v2xe by sending the command GetData (0x04). For v2xe, you must read out its output every time you send the command. Otherwise, the next normal output will be affected.
The system has been successfully applied to handheld GPS positioning and navigation products. At room temperature, the measured direction angle deviation is within 2 ° and the measured temperature deviation is less than 1 ℃. The geomagnetic sensor v2xe has broad application prospects in GPS positioning and magnetic field detection because of its simple interface, low power consumption, small volume and simple software design.
Responsible editor: GT