Design of Inclination Measurement System Based on Inclination Sensor

Publisher:数字行者Latest update time:2012-11-08 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Introduction
At present, the industry's measurement of inclination is mostly based on MEMS acceleration sensors. SCA100T is a high-precision dual-axis inclination sensor developed by VTI of Finland using three-dimensional MEMS technology. It can simultaneously measure the inclination and pitch angle relative to the horizontal plane and has temperature compensation function. This paper takes tower crane as the application background, uses SCA100T inclination sensor to collect inclination information in real time, detects the balance performance of tower crane support frame, and avoids accidents caused by excessive inclination. Based on SCA100T, a compact and highly sensitive inclination measurement system is designed. The principle of angle measurement of SCA100T inclination sensor is analyzed, and the software and hardware design methods of each module of the system are given. At the same time, two scalable application methods are provided.

1 Overall design
Figure 1 shows the overall structural block diagram of this system. The system uses ATmega8 microcontroller to control SCA100T inclination sensor to detect the inclination change of the platform in real time, and converts the digital quantity output by the sensor into the actual inclination value after conversion. Users can set the warning angle value and the preset platform horizontal position according to their needs. The angle information can be displayed in real time on the LCD or output to the upper controller through the serial port. When the angle information exceeds the preset warning angle value, the system starts to alarm, which is manifested by the buzzer alarm and the flashing LED light.

b.JPG


The system can be divided into two application modes according to different output modes: one is to use it as an independent system and fix it on the platform to be tested; the other is to use the system as a tilt acquisition module and hang it in other circuits. The former uses LCD1602 to display the tilt information in real time, and uses the serial port super terminal to preset the tilt warning value and horizontal position; the latter outputs the tilt information through the serial port, allowing software programming to be configured by sending serial port commands. The configuration information is stored in the EEPROM inside the ATmega8 microcontroller.

2 Tilt measurement principle
The SCA100T selected in this article has a measurement range of ±30°. It contains silicon capacitor sensing elements, EEPROM memory, signal conditioning circuit, A/D converter, temperature sensor and SPI transmission interface, etc. The functional block diagram of SCA100T is shown in Figure 2. The sensor has two channels, X and Y, which are used to measure the acceleration of tilt and pitch respectively. Each channel has a self-test system, which can generate an electrostatic force internally to verify all signal channels. The signal output has two modes: SPI digital signal output and analog voltage signal output. At the same time, temperature information can be output for temperature compensation.

c.JPG


The angle measurement principle of SCA100T is: by measuring the change of static gravity acceleration, it is converted into the change of inclination angle. The silicon capacitance sensing element of SCA100T is composed of 3 layers of silicon wafers to form a three-dimensional structure. When tilting occurs, the middle mass sheet will lean to one side, so that the capacitance on both sides will change. The voltage value can reflect the corresponding acceleration value, and then the angle value can be calculated. Figure 3 shows the inclination angle change of the X-axis and Y-axis respectively (X/Y is divided from the tilt direction). Taking the X-axis as an example, the relationship between its acceleration value and gravity acceleration is:
Ax=g·sina→α=arcsin(Ax/g)
Among them, Ax represents the acceleration value measured by the X-axis, g represents the gravity acceleration value, and α is the inclination angle of the X-axis.

d.JPG [page]

3 System Hardware Design
The overall hardware circuit of the system is shown in Figure 4. The system uses the SPI interface of SCA100T to read the output information, which can avoid additional A/D sampling. Since ATmega8 has 1 SPI interrupt, the sensor can be directly connected to the SPI interface of the microcontroller as a slave device. The system controls the on and off of the buzzer and LED indicator by controlling the on and off of the transistor, thereby achieving the alarm function. Connect the PD2 pin of the ATmega 8 microcontroller to the base of the transistor, and set PD2 to a low level during normal operation. When an alarm occurs, set PD2 to a high level, then the transistor is turned on, the buzzer sounds, and the LED indicator lights up.

e.JPG


The system uses LCD1602 character liquid crystal module to display the inclination information. The module can display two lines of characters at the same time, which are the inclination information of the X-axis and Y-axis. The module usually uses HD44780 chip with standard 16 pin lines. For serial port transmission, the system uses two output modes: TTL level and RS232. The TTL output of the microcontroller can be converted into RS 232 signal after being converted by MAX232 chip, and communicate with the host computer through the standard serial port line.
Which serial port output mode is used depends on the working mode. When the serial port super terminal is used to preset the system, the TTL output of the ATmega8 microcontroller needs to be connected to the TTL input of the MAX232 chip with a short-circuit block; when the software programming method is used, the TTL output of the ATmega8 microcontroller can be directly connected to the TX/RX end of other circuits as its peripheral circuit. At this time, it is necessary to pay attention to the baud rate setting.
In addition, the system is designed with a mode selection function, which leads out PB0 and PB1 of the ATmega8 microcontroller. The former is used to select whether to use LCD display, and the latter is used to select whether to enter the serial port hyperterminal configuration mode. During normal operation, these two pins are high level, indicating that the serial port hyperterminal configuration mode is selected, allowing programming through the serial port software; when PB0 is grounded with a short-circuit block, it indicates that the LCD display mode is selected; when PB1 is grounded, it indicates entering the serial port hyperterminal and presetting the system.

4 System software design
The overall software flow of the system is shown in Figure 5. After the system is powered on, the microcontroller first initializes the pins, sets the SPI mode, and turns on the SPI and serial port interrupts. If the LCD display function is selected, the LCD control pins need to be initialized to display the initialization information. Then, the next step is determined based on whether the serial port hyperterminal configuration function is selected.

f.JPG


When this function is selected, the system enters the hyperterminal processing program, first sends a prompt character to the PC-side hyperterminal, waits for the user to select and enter the preset data, and after receiving the relevant data, feeds it back to the PC-side display, performs preset processing at the same time, and writes the preset value to the EEPROM. When this function is not selected, the system enters the normal working state. If a serial port interruption occurs, the serial port processing program is entered, and different processing is performed according to whether the received serial port data frame is a preset command or request data. The former writes the preset value to the EEPROM, and the latter uploads the inclination information to the upper controller. If no serial port interruption occurs, the main program collects the acceleration digital quantity output by the sensor through the SPI interface, converts it into actual inclination information, and determines whether the inclination exceeds the preset angle value. If it exceeds, an alarm will be started. At the same time, if the LCD display function is selected, the value needs to be output to the LCD1602 display through the parallel port.

[page]

4.1 Sensor data acquisition and calculation
For sensor acquisition, when the CSB pin is low, it is valid and data transmission is allowed. When data is transmitted, the high bit is in front and the low bit is in the back. The data on the MISO line is transmitted on the falling edge of SCK, and the data on the MOSI line is transmitted on the rising edge of SCK. The SPI transmission timing of acceleration data is shown in Figure 6. The microcontroller first sends a (group) command to the sensor through the MOSI line. After receiving the completion command, the sensor starts to transmit data continuously. The command here is 8-bit information, and the acceleration data is 11-bit information. Commonly used commands are RDAX (0001, 0000) and RDAY (0001, 0001), which respectively represent the reading of X/Y axis acceleration data.

g.JPG


The acceleration information of the X-axis and Y-axis output by the sensor is 11-bit digital quantity, ranging from 0 to 2 048, and the data volume corresponding to the zero-degree position is 1 024. The output acceleration digital quantity can be converted into the actual inclination value according to the following formula:
h.JPG
Where Dout represents the digital quantity of the X/Y axis output; Dout@0° represents the zero-degree offset (i.e. 1 024); Sens represents the sensor sensitivity, provided by the VTI manufacturer, and for the SCA100T inclination sensor, the value is 1683; α' represents the preset platform horizontal angle, which defaults to 0.
4.2 Serial port command
Figure 7 shows the data frame format for serial port communication with the microcontroller. In the figure, each frame has 16 bytes, the first two bytes are the frame header (0xFFAA), followed by two bytes of data type, which mainly has three types: request data (0x0001), preset warning angle (0x0010), and preset horizontal angle (0x0011). Then comes the 10-byte data bit, which is usually two 4-byte data (integer or floating point). To avoid data alignment problems, two bytes with a value of 0 are added at the end. Finally, there are two bytes of check bits, which are checked using CRC-16.

i.JPG


The data is sent actively by the upper controller, and the inclination measurement system responds passively. When the upper controller sends a data request to the single-chip microcomputer, its data position is 0; after receiving the request command, the system fills the inclination information into the data bit and sends it to the upper controller. When the upper controller sends a preset warning inclination value to the single-chip microcomputer, the preset angle value is filled into the data bit; after receiving the single-chip microcomputer, it writes the data into the EEPROM and sends feedback. The feedback frame is sent in the same type, but the data bit is filled with all 0. When the upper controller sends a preset horizontal angle value to the single-chip microcomputer, its operation is similar to the preset warning inclination value, but the type is different.
4.3 Serial port hyperterminal simulation
In Windows XP or Windows 2000 operating system, you can see "HyperTerminal" under Start → Menu \Programs\Accessories\Communication. This is a communication terminal tool that comes with Windows. When you enter characters in the hyperterminal, they will be automatically sent out, but if there is no feedback, the entered character information will not be displayed. Therefore, the simulation of the hyperterminal needs to do two things: one is to receive the characters entered by the user in the hyperterminal; the other is to feed back the entered characters for the user to view. The use of the hyperterminal method can avoid the process of users directly using commands. All commands are transparent to the user. The user only needs to enter relevant information according to the prompt information to complete the preset configuration work. Figure 8 shows a schematic diagram of the preset configuration.

a.JPG



Conclusion
This paper designs this inclination measurement system based on the tower crane as the application background. The system works well in actual application and achieves the expected effect. It can monitor the balance of the tower crane support in real time, which plays an important role in preventing construction accidents. The system explores the use of the SCA100T sensor and considers two application methods in the design, which plays a good role in the expansion of the system; at the same time, the serial port hyperterminal is simulated to configure the system information to replace the keypad.

Reference address:Design of Inclination Measurement System Based on Inclination Sensor

Previous article:Design of Virtual Test System for AC/DC and DC/DC Power Supply Modules
Next article:Fluke Multi-function Oscilloscope Measurement Technology Problems

Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号