V2xe is a new type of 2-axis compass and geomagnetic field sensor with integrated microprocessor as control and interface. V2xe 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 and 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 L.
Apply v2xe to GPS system. Read the measurement data of v2xe with AT89C2051 and transmit the data to GPS processor through serial port. Fig. 1 shows a schematic diagram of v2xe connected to a single chip microcomputer. 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 grounding. 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 is placed in the highest 8 bits, and the data with the highest 8 bits is placed in the lowest 8 bits, as shown in Figure 2.
The command format with data consists of a start flag (sync flag), an instruction type (frame type), and an end flag (Terminator). Figure 3 shows a setdatacomponents (ox03) command with parameters heading (0x02) and magnitude (0x05). Common v2xe command words include getmodinfo, Modin foresp, setdatacomponent, GetData, dataresp, set config, 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 response to a command, it will not process any input data. Therefore, when the host obtains v2xe data, it should send and receive at the same time. The transmit receive function spitransmit is written 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 out the version number to judge whether the device works normally. You can first send the command getmodinfo to v2xe, and then read the return value modlnfoesp. The procedure is as follows:
In this way, the obtained chip information is stored in the array Verson, and the read value can be compared with the actual version number (v2xev201) to determine whether the system works normally. If the system is normal, first set the return data format as required to determine that v2xe returns the values of interest to users, mainly including geomagnetic direction angle, magnetic field strength, temperature, calibration status bit, etc. In addition. Also set some initialization parameters, mainly including declination (local geomagnetic angle, which can be obtained from http: / / www.ngdc. Roaa. Gov / CGI bin / SEG / gmag / fldsnthl. PL), true Noah (set the reference angle to geomagnetic north), bigendian (select 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 calibration, v2xe device shall be placed horizontally as far as possible. From the beginning of calibration to the end of calibration, the device shall be rotated in place for two weeks, and the time of each rotation shall not be less than 30s. After calibration, you can query the parameter calstate to judge whether the calibration is successful. After initialization such as parameter setting and calibration, v2xe data can be obtained by sending the command GetData (0x04). Every time a command is sent to v2xe, its output must be read out. 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 deviation of the measured direction angle is within 2 ° and the measured temperature deviation is less than 1 ° C. 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