Journal of Sensor Technology
Vol.1 No.4(2011), Article ID:8945,8 pages DOI:10.4236/jst.2011.14015

Design of Omni-Directional Tilt Sensor Based on Machine Vision

Yiping Tang1, Caiguo Chen2

1College of Information Engineering, Zhejiang University of Technology, Hangzhou, China

2College of Computer Science, Zhejiang University of Technology, Hangzhou, China

E-mail: typ@zjut.edu.cn, suibian19880827@126.com

Received August 22, 2011; revised September 30, 2011; accepted October 9, 2011

Keywords: ODTS, Machine Vision, Digital Image Processing, Embedded System, Tilt Angle and Tilt Directional Angle

Abstract

This paper presents a new Omni-Directional Tilt Sensor (ODTS), which consists of the LED light, transparent cone-shaped closed container, mercury, camera, embedded systems and so on. The volume of the mercury in the container is equal to half of the container’s. When the detected surface is horizontal, the shape of mercury in the image captured by the camera is a black disc since the mercury is lightproof. When the detected surface tilts, the mercury flows and the mercury surface always maintains horizontally due to the gravity force of the earth. At this time, some area of the transparent cone-shaped closed container is not shaded by mercury and the border of the mercury’s shape in the captured image is a half circle and a half ellipse. Thus there is a translucent crescent-shaped area in the image. With analyzing this area by the specific algorithm based on machine vision, the tilt angle and directional angle can be obtained. The experimental results show that the ODTS proposed has some advantages, such as simple maintenance, high precision, wide range, low cost, real-time, reliability and high visualization.

1. Introduction

Tilt sensor is mainly applied to measuring the horizontality of a system and widely used in construction of bridges, laying of railway, civil engineering, oil drilling, aviation and maritime, industrial automation, intelligent platform, machining and other important fields. There are several kinds of commercial sensor for tilt angle measurement, which are available in the market. It mainly can be divided into three kinds solid pendulum [1,2], liquid pendulum [3] and gas pendulum [4] based on different working principles. They all have their advantages and disadvantages in terms of their working principles. In the gravitational field, the sensitive medium of solid pendulum is the weight of pendulum, while liquid pendulum’s is electrolyte and gas pendulum’s is gas. With a lot number of applications, the research of tile sensors of solid pendulum has been quite mature, but it is easy to be interfered by the external factors, such as the vibration caused by mechanical shock. The tilt sensor of liquid pendulum, however, has many advantages, such as high sensitivity, corrosion and moisture resistance, etc. But its fatal weakness is that its working performance is easily affected by the change of temperature and this fatal weakness limits its development and applications. The tilt sensor of gas pendulum has a simple structure, strong resistance to vibration and shock, but it can be greatly affected by environmental temperature and is low in measuring precision. In addition, some experts proposed a method to detect tilt angle according to the images [5]. However, it can only get the one-dimensional tilt angle because only the position of bubbles is detected.

The literature [6] has proposed a vertical-pendulumbased fiber Bragg Grating tilt sensor, which can detect the magnitude as well as the direction of the inclination from the horizontal direction. Fiber Bragg Grating (FBG) sensors is based on the modulation of the reflection wavelength of FBGs in response to temperature and strain. Compared to other types of fiber-optic sensors, FBG sensors have advantages of being inherently self-referencing and the capability in multiplexing a large number of FBG sensing elements. The sensor encodes the tilt angle with the wavelength separation between two FBGs to overcome the problem of temperature cross-sensitivity. Also it has high accuracy and accuracy of 0.1˚and resolution of better than 0.007˚can be achieved. But it is hard in maintenance and is not an optical system. Thus it can’t give us direct visual results.

The literature [7] has proposed an optical sensor including an opto-electronic sensor with laser, optical components and image sensor. Its working principle is based on optical interferometry. And it has high measurement accuracy and is insensitive to magnetic environment. Also it can measure two axes at the same time. But because the liquid medium is oil and it can wet the glass, the quality of captured image may be affected thus lead to the measurement error.

Here we propose the Omni-Directional Tilt Sensor (ODTS) based on machine vision. In terms of tilt perception, it belongs to the tilt sensor of liquid pendulum. Different from existing tilt sensor of liquid pendulum, the liquid medium of ODTS is mercury whose advantages include avoiding wetting the glass and plastic, light-proof, good conductivity, etc. It minimizes the temperature interferences to the ODTS and can be used in the environment of large temperature range. Also the energy saving design is added to the sensor using the conductivity of mercury. The tilt angle and tilt directional angle is obtained by analyzing the image formed by the mercury in the container in the way of digital image processing. Thus it avoids some indirect measurement segments that may result in unnecessary measurement error. A prototype sensor is designed and experimental results show the tilt angle relative to the sea level can be detected at the accuracy of 1˚and at the resolution of 0.01˚

2. Design of the ODTS

The ODTS based on machine vision consists of shell of the ODTS, LED light, transparent cone-shaped closed container, mercury , camera , embedded systems, power supply and compass, showed in Figure 1 (“1” is the shell of the ODTS, “2” is the LED light, “3” is the transparent cone-shaped closed container, “4” is mercury, “5” is the camera, “6” is the embedded system, “7” is the power supply, “8” is the compass). The power supply provides the LED light and the embedded systems electricity. Then the embedded systems offer electricity to the camera through USB interface. And the transparent coneshaped closed container is composed of two cones with the same size and shape in the way back to back. It is fixed in the middle of the shell of ODTS and is always parallel with the detected surface, above of the container is the LED light and below is the camera. The LED light, facing right down to the transparent cone-shaped closed container, projects the white light. The camera captures pictures of the transparent cone-shaped container. At the

Figure 1. Structure of ODTS.

same time, the embedded system reads the data of pictures from the camera through the USB.

2.1. Design of the Transparent Cone-Shaped Container

When assembling the transparent con-shaped container, the mercury is poured into it and the volume of mercury is half of the container’s. According to physical principle, when the ODTS is in the level state, because the light is shaded by the mercury in the transparent cone-shaped container, the camera can’t catch the transmitted light penetrating the container from the LED light, showed in Figure 1 (“9” is the captured image by camera, “10” is the image of the transparent cone-shaped closed container). When the surface to be detected tilts, the mercury flows and the mercury surface always maintains horizontally due to the gravity force of the earth. Because the transparent cone-shaped container is composed of two cones with the same size and shape, the volume of mercury flowing out of one cone is equal to the volume of mercury flowing into the other one and the level surface always passes the central point of the transparent coneshaped container. In other words, the level surface of mercury in the state of tilt rotates around Y axis. Thus some area of the transparent cone-shaped container between the LED light and the camera is in the state of non-shelter, showed in the Figure 2. From the capturing angle of camera, the shape of mercury is a disc in the projection image if the tilt condition doesn’t happen, however, it would be a half-circle and a half-ellipse if the tilt condition happens. The major axis of ellipse is equal to the radius of disc and the tilt angle has functional relationship with length of the minor axis of ellipse. The smaller the minor axis of ellipse is, the bigger the tilt angle is. And the tilt directional angle is in the negative direction of ellipse’s minor axis.

The resolution of the tilt angle is related to the radius R and the cone angle α of the transparent cone-shaped container. The equation of their relation is below.

(1)

Figure 2. Image in state of tilt.

In the equation, R is the radius of the transparent coneshaped container, α is the cone angle of it, δ is the middle width of the crescent-shaped translucent part, θ is the tilt angle.

According to the Equation (1), the longer the radius R of the transparent cone-shaped container is, the higher the resolution of tilt angle θ is, and the resolution of tilt angle θ has functional relationship with the cone angle α. Generally speaking, the pixels of the transparent coneshaped container’s radius R in the captured image is up to the vision range of camera and in this paper, the radius R of the transparent cone-shaped container is 38 mm and possesses 188 pixels in the captured image. Also the cone angle α is determined by the actual level measurement range. The top of Figure 3 is several cones with different angles, the bottom of it is the curve diagram of the relationship between the middle width δ of the crescent-shaped translucent part and the tilt angle θ under the condition that the radius R of the transparent cone-shaped container is 38mm and the cone angle α is 15˚, 30˚, 45˚, 60˚ and 75˚. Figure 3 shows that the small tilt angle θ has high resolution when the cone angle α is 15˚. Therefor the choosing or design of the cone angle α of transparent cone-shaped container is determined by the actual measurement precision.

2.2. Liquid Medium for ODTS

Mercury is suitable to be the liquid medium in the ODTS with the advantages of not wetting the glass and plastic,

Figure 3. The curve between the cone angle α and the resolution of tilt measurement.

light-proof, good conductivity, etc. Because mercury keeps liquid state in a large temperature range (–38~ + 356.66˚C), the ODTS with mercury as the liquid medium has great adaptability of the environmental temperature. Besides, it can avoid the interference to the tilt measurement caused by the vibration in the vertical direction with the strong surface tension and large proportion of mercury and is able to makes the ODTS get the tilt angle and directional angle accurately using the light-proof of mercury. Besides, the electrode is connected when the tilt sensor leans to one side with the good conductivity of mercury, which can be applied to power saving. That means it activates the embedded system and connects the power supply for camera and LED light when the tilt condition happens. And the power supply is off and the embedded system is in dormant mode when the tilt condition doesn’t happen. It is known the thermal expansion coefficient of mercury is 1.8 × 10–4 ˚C, in other words, if the temperature changes one degree, the volume of mercury changes 1/5556. According to the volume calculating equation of the cone, we calculate the derivative of temperature varying for the volume and get the Equation (2).

(2)

In the equation, is the thermal expansion coefficient of mercury. Combining with the Equation (1) and calculating the derivative, the change of tilt angle θ caused by temperature’s change would be attained. According to the tilt detecting method in this paper, the measurement error caused by the temperature change can be controlled in within the scope of 1/1000.

2.3. Software Design for ODTS

The calculating part of the ODTS includes the embedded hardware and embedded software including system software and user software. Because of the paper’s length limit, only the user software will be discussed in the paper. The user software consists of image obtaining unit, tilt angle and tilt directional angle detecting unit, system data storing unit, detecting data storing unit, displaying unit of the detecting result. And the overall block diagram of system software is showed in Figure 4. The image obtaining unit, including system initialization module and image reading module, is mainly used to read the video data from camera. The initialization module of the system is used to read some system constant which are stored in system data memory unit such as the radius R and the cone angle α of the transparent cone-shaped container, initial directional angle β0, resolution of the camera, the calculating table of tilt angle θ and the width δ of the translucent part, etc. And the image reading module is mainly used to read the video data from camera and

Figure 4. Overall block diagram of system software.

save them in the dynamic memory unit. The tilt angle and tilt directional angel detecting unit is used to detect and calculate the tilt angle θ and tilt directional angle β of the detected object, including tilt directional β detecting module, tilt angle θ detecting module, the calculating module of the change rate of tilt angle θ and tilt directional angle β.

2.4. Detecting Algorithm for the Directional Angle β of ODTS

The definition of tilt directional angel expressed in angle β in this paper is a clockwise angle started from north direction. The tilt directional angle detected in the image is clockwise from the X positive axis, and it is expressed as angle βx, showed in Figure 5. Thus there is a following

Figure 5. Detecting algorithm of tilt angle and tilt directional angle.

relationship between tilt directional angle β and detected tilt directional angle βx, showed in Equation (3).

(3)

In this equation, β is the tilt directional angle, βx is detected tilt directional angle, β0 is initial directional angle.

The initial directional angle β0 is determined by the angle between the line of the cylindrical outer wall and the X axis’s direction of obtained video image during the ODTS’s calibration test, and it is written into the system data memory unit. The detected tilt directional angle βx is calculated based on the geometry of translucent part in the captured image, shown in Figure 5. It is known that the tilt directional angle is in the negative direction of ellipse’s minor axis mentioned above. And the location of the minor axis would be in the middle of the crescentshaped’s part. The detecting algorithm is showed as follows:

Step 1: generate a line in X axis’s positive direction and search around the center point of the image in clockwise direction, if there is no bright pixel in X axis’s positive direction, then search in the way mentioned above, if there is, skip to the step 3, if the circular outer pixel which the rotating line meets is bright pixel, the angle between the rotating line and the X axis’s positive direction is β1.

Step 2: continue searching around the center point in clockwise direction, if the circular outer pixel which the rotating line meets is not bright pixel, the angle between the rotating line of last bright pixel and the X axis’s positive direction is β2, then skip to step 5.

Step 3: continue searching around the center point in clockwise direction, if the circular outer pixel which the rotating line meets is not bright pixel, the angle between the rotating line of last bright pixel and the X axis’s positive direction is β2.

Step 4: continue searching around the center point in clockwise direction, if the circular outer pixel which the rotating line meets is not bright pixel, the angle between the rotating line of last bright pixel and the X axis’s positive direction is β1.

Step 5: use Equation (4) to calculate the angle βc of the ellipse’s minor axis;

(4)

And the detected tilt directional angle βx must be in the negative direction of ellipse’s minor axis, therefor the detected tilt directional angle βx can be expressed in Equation (5),

(5)

2.5. Detecting Algorithm for the Tilt Angle θ of ODTS

The tilt angle is calculated with the Equation (1), and the parameters such as the radius R of the transparent coneshaped container, the cone angle α of the transparent cone-shaped container and so on, are attained from system data memory units as system constant. The width δ of the translucent crescent-shaped’s middle part is calculated with the analysis algorithm of the image, specific algorithm is followed:

The pixel number of the translucent crescent-shaped’s  middle part is calculated according to the angle βc of the ellipse’s minor axis resulting from the Equation (4) and the translucent crescent-shaped area which is formed by the transmitted light. If the resolution of the camera is 640 × 480, and the radius R of the transparent cone-shaped container is 200 mm, every pixel represents 0.83 mm. If the calculated pixel number of the translucent crescentshaped’s middle part is five pixels, the width δ of the translucent crescent-shaped’s middle part is 4.15 mm.

3. Realization of the ODTS

According to the above-mentioned design thought, the prototype of the ODTS in this paper is designed, shown in Figure 6. To avoid the detecting interference from the environmental light, the transparent cone-shaped container, camera, and LED are fixed in a closed cylinder so that the ODTS can be used even in the harsh environment.

The transparent cone-shaped container filled with mercury whose volume equals to half of the container’s is composed of two opposite faced cones with the cone angle of 15˚ showed in Figure 6(a).

According to the software block diagram showed in Figure 4, we have developed the application-oriented

Figure 6. Prototype of ODTS.

software of the ODTS, showed in Figure 7. With the aim to confirm the feasibility of the prototype and the application-oriented software, we had experimental study for the prototype on the platform of Windows XP/2000, JAVA (JDK1.5 version) system development language, Java Media Framework 2.1.1e video multimedia-based software.

In order to make the software versatile and more userfriendly in various environments for users, the system is designed to have four custom-designed windows: 1) custom-designed window of video data source; 2) customdesigned window of system parameter; 3) custom-designed window of control parameter; 4) custom-designed window of detection area.

The custom-designed window of video data source is used to determine the obtaining devices of the tilt image video data, considering there are many interfaces of image sensor, such as USB video data interface, IP video net interface, simulation video interface, and AVI video data. The custom-designed window of system parameter is used to determine the radius R and cone angle α of the transparent cone-shaped container and to make the software more flexible. The custom-designed window of control parameter allows the users to carefully observe the detecting process of the tilt and provide real-time detection data for artificial leveling. The custom-designed window of detection area is used to customize the video source detection area. Because the body part of the disc of the image captured by camera is not in the center of image for sure, customizing the detection circle manually is needed to eliminate all kinds of errors in the process of assembling the ODTS.

4. Experimental Results and Discussion

The ODTS is placed on the detected surface and is parallel with the detected surface. When the ODTS is horizontal, the shape of mercury in the image captured by the

Figure 7. User interface of ODTS application software.

camera is a black disc and the RGB value of pixel is (0, 0, 0) which means black. At the same time, the RGB value of remaining pixels in the image is (255, 255, 255) which means white showed in Figure 8. The captured image is 640 × 480 pixels. With the Hough circle detecting algorithm based on diameter [8], the detected center of the black disc in the image was (331,267), and the radius of which possessed 188 pixels. The experimental research for the prototype showed in the Figure 6 was done under the condition that the cone angle α of transparent coneshaped container was 15˚, the actual radius R of the transparent cone-shaped container was 38mm, the light source was a white LED, and the resolution of camera was 640 × 480 pixels. So every pixel in the image represented 38/188 mm.

When the ODTS tilted 7˚ artificially, the formed shape of mercury in the image and the detected results are showed in Figure 9. With the detecting algorithm of tilt directional angle, the angle βc of the ellipse’s minor axis was obtained, then the pixel number of the translucent crescent-shaped’s middle part was calculated and the number was 59. Because the width of each pixel in the image was known, so the middle width δ of the crescent-shaped translucent part was 11.9 mm. With the Equation (1) and the known parameters of R, α and δ, the detected tilt angle θ was 6.98˚. Also we have done some experiments under the condition the ODTS tilted 9˚, 12˚ and 15˚ artificially, and the detected results are showed in Table 1.

By analyzing the table, the detected error of each tilt angle is within ± 1˚, and the relative error is within ±5%. The detected error is relatively small when detecting a small tilt angle. The reason for that is the resolution of the ODTS with a small cone angle reacts sensitively when detecting a small tilt angle. It is consistent with the earlier analysis above.

Figure 8. The image shape of mercury when ODTS is horizontal.

Figure 9. The image shape of mercury when ODTS tilts 7˚.

Table 1. The detected results in different artificial tilt angle.

The experimental results show that the detecting precision is relatively high. Moreover, because the detecting algorithm is mainly based on the analysis of the captured image, the detecting range can be very wide (0˚ ~ 90˚). With the different video sources, all the images are processed one by one, thus the ODTS would has good realtime.

The ODTS in this paper includes a camera and an embedded system. It doesn’t need the special power supply and the power of the camera and the LED light is offered by the embedded system. When the ODTS doesn’t tilt, the embedded system is in dormant state, when it tilts, the mercury switch is connected and the embedded system is in working state (watchdog technology for saving energy). The fully sealed ODTS can work in harsh environment and the working temperature range of the mercury, camera, LED in the tilt sensor is wide. So we can conclude the designed ODTS has simple maintenance, low cost, reliability and high visualization.

Now the experiment for prototype is done on the computer. In the future, the embedded system seen as a central controller will be added into the ODTS and gives the signal to start capturing image when the detected surface tilts. At same time, the detected results will be displayed on the interface of the embedded system. The embedded system can also have internet interface to realize remote measurement easily. With remote accessing, we can see the video image of mercury as well as directly get the tilt angle, tilt directional angle and other information at remote computer when the ODTS tilts. Moreover, the embedded system equipped with platform automatic adjustment software would be seen as the upper computer of platform leveling to directly control the lower computer of anchor position servo system and to realize the automatic leveling. Two ways are available to get the access to the measurement data. Users can directly access the system database or also use the API interface provided by the system software. According to the special needs of users, the system can be equipped with wireless communication unit to support various wireless communication network accesses.

5. Conclusions and Future Work

In this paper, we have proposed a novel tilt sensor (OmniDirectional Tilt Sensor) based on machine vision and presented a reliable detecting algorithm. A prototype has been built up and evaluated. The experimental results show that accuracy of 1˚ and resolution of 0.01˚ can be achieved. Compared with other tilt sensors, the ODTS has following main advantages: simple maintenance, high precision, wide range, low cost, real-time, reliability and high visualization.

The content of future study will focus on the applications of the ODTS, such as Car alarm electronics, dam safety monitoring, mudslides, landslides and other security monitoring area, offshore platforms, land surveying instrument automatic level school, swing control of ship, ship with chairs, ship bed, mouse, game input devices, civil engineering, water engineering, weapons platforms (tanks, mobile arms control plane), the radar antenna, bridge engineering, agricultural machinery (land leveling, combines, uenae machine and other tilt control.), earthquakes, volcanic detection, vehicle chassis, automatic leveling, automatic welding machines, automatic cutting machine, aviation, aerospace, mobile satellite antenna and other applications that requiring high real-timing. According to the different applications, different ODTSs all based on machine vision would be produced. The study of intelligent video analysis technology with the combination of machine vision to develop series of ODTS for the practical application should be furthered and the measurement precision should be improved further. With the further study, the ODTS that is simple in maintenance, adjustment and calibration, high in accuracy and visualization, wide in measurement range, low in cost, good in remote access, real-time, security and reliability, will be created and applied to important.

6. References

[1]       C.-T. Wang, E.-H. Yang, J.-G. Zhang, Y.-X. Ma, B. Zhang, “The Omni-Directional Electronic Level Structure and Measuring Analysis Principle,” Journal of Scientific Instrument, Vol. 27, No. 2, 2006, pp. 183-185.

[2]       J.-F. Liu and M.-Y. Li, “The Principle Analytics of Gravity Sensor Level Measuring Instrument,” Sensors and Instrumentation, Vol. 24, No. 7, 2008, pp. 159-160.

[3]       Y. Wu, Y.-H. Song and W.-J. Su, “The Research of Liquid Pendulum Tilt Sensor,” Coal Mine and Machinery, No. 6, 2004, pp. 31-32.

[4]       Y. Lin, L.-H. Pu and F.-X. Zhang, “The Structure Principle of the Omni-Directional Gas Pendulum Tilt Sensor,” Electronic Components and Materials, Vol. 25, No. 5, 2006, pp. 19-22.

[5]       J.-H. Zhou, J.-Z. Wu and M.-Q. Xu, “The Micro Tilt Sensors of Image-Based Identification,” Automation, Vol. 27, No. 11, 2006, pp. 39-44.

[6]       B.-O. Guan, H.-Y. Tam and S.-Y. Liu, “TemperatureIndependent Fiber Bragg Grating Tilt Sensor,” IEEE Photonics Technology Letters, Vol. 16, No. 1, January 2004, pp. 244-226. doi:10.1109/LPT.2003.820101

[7]       F. Hua, I. Reading and Z. P. Fang, “Novel Opical Sensor for Precise Tilt Angle Measurement,” Control, Automation, Robotics and Vision, 2006.ICARCV’06. 9th International Conference, Singapore, 5-8 December 2006, pp. 1-4.

[8]       H.-Q. Liu, “Circle Detection Based on Hough Transform,” Master’s Thesis, Northeastern University, Shenyang, 2005, pp. 34-38.