Design of a high-precision digital tilt measurement system
2026-04-06 06:38:15··#1
Abstract: The hardware and software design of a digital tilt measurement system using an A/D converter, a temperature sensor and a microcontroller is described in detail. The system has the advantages of high accuracy, stable operation, reliable performance and temperature compensation, and can be widely used in high-precision tilt angle measurement with a wide operating temperature range. Keywords: AT89C52 microcontroller tilt measurement ADS1210 In automatic control and engineering design, it is often necessary to measure the tilt angle of a plane or reference or to perform automatic leveling. Especially in automatic control, it is often necessary to perform dynamic leveling control of an object, which requires the instrument to automatically and dynamically track and measure the horizontal tilt angle [1]. In some high-precision measurement systems, it is also required to quickly level the system or quickly and accurately measure the tilt angle between certain devices and the horizontal plane. These are difficult to achieve with traditional tilt measurement systems and levels. A digital tilt measurement system or digital level designed with an electronic tilt meter as the sensor can not only meet the requirements of automatic measurement and control, but also greatly improve the accuracy and speed of measurement. Previous digital levels and electronic tilt measurement systems designed using electronic inclinometers as sensors did not consider the influence of ambient temperature on measurement accuracy, thus failing to meet certain high-precision leveling and tilt angle measurement requirements. To achieve high-precision measurement over a wide operating temperature range, temperature compensation for the electronic inclinometer is necessary. This paper introduces a high-precision digital tilt measurement system that utilizes the Jewelry Instruments LCF-100 inclinometer as the tilt sensor, whose output analog voltage is proportional to the sine wave of the tilt angle. This analog voltage is converted from an analog voltage to a digital voltage and then fed into a microcontroller. Simultaneously, a temperature sensor collects real-time ambient temperature data around the inclinometer, which is also fed into the microcontroller. A pre-programmed calculation program performs calculations, and the results are transmitted to a host computer via serial port interrupt. This paper will elaborate on the system's hardware circuit design and software design. 1 System Hardware Design 1.1 System Hardware Structure The hardware structure of the high-precision digital tilt measurement system is shown in Figure 1. The microcontroller used is the Atmel AT89C52, which utilizes its provided software and hardware resources to control the system and perform calculations on the acquired data. The main components of the system include: an electronic inclinometer, a second-order low-pass filter, an ADS1210 A/D converter, an AT89C52 A/D converter, a DS1624 temperature sensor, a power supply, and a communication interface circuit for transmitting data to the host computer. Figure 2 shows the Jewell Instruments LCF-100 electronic inclinometer, a force-balanced servo system inclinometer with a measurement range of -1° to +1°. Its output is an analog voltage proportional to the sine of the tilt angle. This inclinometer features high resolution, fast response, and good linearity. Because the analog voltage output by the electronic inclinometer contains high-order harmonics, a second-order low-pass filter is used to filter out the high-frequency components of the output signal. The A/D converter converts the analog output of the electronic inclinometer into a digital signal; its resolution directly affects the measurement accuracy of the system. According to the design requirements, the system uses Burr-Brown's ADS1210 as the A/D converter for the electronic tilt meter. It is a 24-bit resolution, wide dynamic range, single 5V power supply, and self-calibrating Σ-Δ high-precision A/D converter. It consists of a programmable gain amplifier, a second-order Σ-Δ modulator, a modulator control unit, a third-order digital filter, a microcontroller, a register group, a reference source, and a clock circuit [2]. The ADS1210 transmits the converted digital value to the microcontroller via the I2C bus. The temperature sensor is selected from Dallas Semiconductor's DS1624 digital temperature measuring instrument. It has the characteristics of high measurement accuracy, wide measurement temperature range, and easy interface with the microcontroller. It also has 256 bytes of E2PROM to store the correction parameters of the measurement system [3]. The temperature sensor collects the ambient temperature of the system in real time and sends the collected temperature value to the microcontroller via the I2C bus. 1.2 Interface Circuit between ADS1210 and DS1624 and AT89C52 The interface circuit between ADS1210 and DS1624 and AT89C52 is shown in Figure 2. The sensor output is connected to the AINP and AINN input terminals of ADS1210. Here, ADS1210 and AT89C52 use a three-wire connection: DRDY, SDIO, and SCLK are connected to P12, P13, and P14 respectively. SDIO is used for data input and output, CS is directly grounded, and MODE is grounded to indicate slave mode. Since only one ADS1210 is used in this system, DSYNC can be directly connected to DVDD. The P10 and P11 pins of the AT89C52's P1 port are connected to the SCL and SDA pins of the DS1624 respectively to form an I2C bus. The I2C bus is a serial data bus that uses only two signal lines: a bidirectional data line SDA and a clock line SCL. A data byte transmitted on the I2C bus consists of eight bits. The bus has no limit on the number of bytes transmitted at a time, but each byte must be followed by an acknowledge bit (ACK). Data transmission starts with the most significant bit (MSB). 2 System Software Design The system software is programmed in assembly language and consists of a main program, calculation subroutines, ADS1210 read/write subroutines, DS1624 read/write subroutines, and serial port interrupt service subroutines. The relevant parameters for tilter temperature compensation are stored in the DS1624's E2ROM, and the host computer corrects them via control commands when necessary. The interrupt service routine receives control commands from the host computer at any time, performing system self-checks, parameter corrections, and data output. 2.1 Main Program After initialization, the main program collects ambient temperature and electronic tilter data in real time and performs compensation calculations. To ensure the stability of the collected tilter data, after collecting ambient temperature data once, the tilter data is collected 10 times consecutively and averaged arithmetically, then the ambient temperature is collected again, and so on, repeating this cycle. (Please log in to: Power Transmission and Distribution Equipment Network for more information.) The flowchart of the main program is shown in Figure 3. 2.2 Calculation Subroutine The analog voltage V output by the electronic tilt meter is approximately linearly related to the sine of the tilt angle θ, i.e.: V=V0+K0×sinθ (1) Wherein, K0 is the conversion scaling factor of the electronic tilt meter. Since the measurement range of the tilt meter is ±1, the sine of the angle can be replaced by the radian value, and the calculation error is: This error can be ignored, so formula (1) is simplified to: V=V0+K0×θ From formula (2), it can be seen that the tilt angle θ is a function that changes linearly with the ambient temperature, and the temperature compensation of the linear sensor is the compensation for the zero position and sensitivity, so the output of the tilt meter after temperature compensation is: V=V0+K×ΔT+K0(1+K1×ΔT) ×θ Wherein, K is the zero position temperature coefficient, and K1 is the scaling factor temperature coefficient. Let AD represent the data output by the A/D converter; K_AD represent the output slope of the A/D converter, in units of 1/V; B0 represent the reference zero bias voltage, in units of V; B_temp represent the zero-point deviation coefficient, in units of V/℃; ΔT represent the temperature change, in units of ℃; SF_Temp represent the proportional factor temperature coefficient; and Title represent the corrected tilt angle, in units of "". Then equation (3) becomes: Multiplying both sides by K_AD, equation (4) becomes: The corrected tilt angle after temperature compensation can be calculated from equation (9). The flowchart of the calculation subroutine is shown in Figure 4. 2.3 Programming the ADS1210: First, initialize the ADS1210. Based on the system design requirements, determine relevant parameters such as gain (PGA), speedup factor (TMR), and data output rate (DR, decimation rate). In the initialization subroutine, write these parameters to the CMR. Start the ADS1210 conversion, then call the DOR register read subroutine to read the conversion result into the microcontroller. The initialization process and DOR register read process for the ADS1210 are shown in Figure 5. 2.4 Programming the DS1624: Since the DS1624's SCL and SDA pins are connected to the AT89C52's P10 and P11 pins to form an I2C bus, read and write operations on the DS1624 must follow the I2C bus protocol. The microcontroller can simulate the I2C bus read/write timing. The I2C bus control mainly includes the following five parts: start, read data, write data, acknowledge, and stop. Figure 6 Programming the DS1624 includes the following subroutines: initialization subroutine, temperature conversion start subroutine, and temperature value read subroutine. In the initialization subroutine, one byte of data is written to the configuration/status register to set the DS1624 to continuous conversion mode. The flowcharts of the DS1624's initialization subroutine, temperature value read subroutine, and temperature conversion start subroutine are shown in Figure 6. 2.5 If the electronic inclinometer is replaced, its corresponding parameters, such as fixed zero deviation, zero deviation temperature coefficient, scaling factor, and scaling factor temperature coefficient, will change. To improve the system's versatility, these parameters are modified via serial port interrupts. The result calculated by the microcontroller, i.e., the corrected angle, is also output via serial port interrupts. The serial port interrupt service routine of this system includes the following commands: write zero deviation, write zero deviation temperature coefficient, write inclinometer conversion scaling factor, write scaling factor temperature deviation, write ADS1210 conversion scaling factor, write ADS1210 conversion rate, write angle calibration value, initialize data in E2ROM, read temperature value, read calculated corrected angle value, check the correctness of written data, and check if the chip is working properly. The flowchart of the serial port interrupt service is shown in Figure 7. The high-precision digital inclinometer measurement system introduced in this paper has been implemented in engineering, and its measurement accuracy has been verified using a T3 theodolite. Experimental results show that its accuracy reaches 3” within a temperature range of -10℃ to +50℃, which meets the needs of a high-precision measurement system with a wide operating temperature range. Accuracy verification experiments over a wider temperature range are underway. The system has already been applied to the measurement of horizontal tilt angles in a certain project, demonstrating stable operation and reliable performance.