Sensors and Materials, Vol. 25, No. 6 (2013) 389–396
MYU Tokyo
S & M 0931
Development of Noncontact Height Measurement
Device Fabricated Using Microcontroller
HT46R232 as Foundation
Jen-Yu Shieh*, Shun-Ming Lo1, Kun-Hsien Lin1 and Bai-Hao Chang1
Department of Electro-Optics Engineering, National Formosa University, Yunlin, Taiwan, ROC
1Graduate Institute of Electro-Optical and Materials Science,
National Formosa University, Yunlin, Taiwan, ROC
(Received November 5, 2012; accepted February 4, 2013)
Key words: inertial sensors, trigonometric functions, microcontrollers, ultrasonic ranging
This study presents a low-cost, extremely practical, and easy-to-operate composite
instrument for measuring height. This instrument uses the level-, distance-, and heightmeasuring devices typically employed in construction works for further integration.
Because most instruments used in construction and architecture are expensive and
have only single functions, the system developed in this study combines laser modules,
ultrasonic sensors, inertial sensors, and an HT46R232 microcontroller. We also
used SolidWorks to design a multifunction construction measurment device that can
measure distance and level, and measure height by a noncontact method. This system
adds the tangent theorem of trigonometric functions to the microcomputer controller
for height calculation. Experimental verification indicated that this system can use
sensors to obtain correlation coefficients for measuring height. The tangent theorem of
trigonometric functions was used to measure object height. This facilitated noncontact
height measurements in the microcomputer controller. Measurement system analysis
(MSA) was employed to verify that the measurement system adheres to the QS9000
measurement system specifications.
In construction works, few tools exist for measuring height. Commonly employed
measuring tools include tape measures and handheld tape measures. Their curl makes
measuring height difficult. Therefore, they lack convenience of use. This often
forces construction projects to use expensive laser rangefinders as measuring tools.
Additionally, construction must not lack level calibration instruments. Whether the
construction design is level or not, it influences the household quality of life. It also
highly correlates with the interior and exterior appearances of a building. Among the
Corresponding author: e-mail:
Sensors and Materials, Vol. 25, No. 6 (2013)
numerous types of level measuring device, the line laser measuring level instrument is
the most maneuverable level measuring instrument and marking device for on-site use.
Differentiated by functionality, a number of laser level measuring devices have internal
automatic level correction or calibration functions. These laser ink lines can project both
level and vertical ring lasers at 180 or 360°. Therefore, line laser level measuring devices
are extremely accurate and maneuverable. For interior design, they are indispensable
for level measuring and marking devices. Their cost is generally higher than that of
conventional devices. Line laser level measuring devices with complete functionality
typically cost over ten thousand dollars (NTD). However, this system costs about six
thousand dollars (NTD).
Literature Review
2.1 Ultrasound applications
The scope of ultrasound applications is extremely broad ranging from basic
environmental sensing and ultrasonic cutting to medical applications. In applications
of extended time-frequency domain average to ultrasonic detection,(1) specific objects or
points can be continuously measured and followed. Ultrasound can also be used at fixed
rates in air to determine the gas composition in air.(2) Monitoring can be performed at
specific sites to ensure environmental and public safety. Ultrasound is most frequently
applied to sensors for robots and automated vehicles.(3) The reason ultrasound modules
are included in robots and automated vehicles is that it enables them to sense the
distance of obstacles. Ultrasound is also used to sense a specific area and establish an
environmental map. The various applications of ultrasound are shown in the table below.
2.2 Inertial accelerometer applications
Inertial sensors have a wide range of uses today. They can be categorized on the
basis of their various processing methods as piezoresistive, piezoelectric, capacitive,
thermal, or tunneling accelerometers.(4,5) Inertial sensor micro-electromechanical
systems (MEMS) devices are used most successfully in automobiles. When a moving
or static vehicle collides or falls, the inertial sensors immediately sense the dramatic
changes and deploy airbags. This is the most successful commercial application.(6) A
number of navigation companies have added inertial sensors to their products. When
equipment cannot obtain a global positioning system (GPS) signal, the inertial sensors
can be used to sense moving information and provide signals to navigation equipment
to complement and supplement the GPS signal errors.(7,8) Accelerometers can also be
embedded in or on the human body(9) to record statistical information of various activities
in daily life. These data can be used to provide human metabolic consumption data
estimates or to care for patients.(10) They are convenient for long-term monitoring and do
not affect patients’ daily activities. Accelerators and electromyography (EMG) devices
are used to assess gestures.(11) They can also be used for playing games or placed into
pens.(12) Wireless transmission systems in the pen combine written numerical data and
neural networks to increase the sensor recognition rate of handwritten digits or numbers.
Seismic piezoelectric accelerometers can be designed to monitor tremors.(13,14) Table 1
shows these applications.
Sensors and Materials, Vol. 25, No. 6 (2013)
Table 1
Inertial sensor applications.
Shock or vibration
Incline angle
Airbag crash sensing
Electronic control of automobile suspension systems
Inertial measurement, targeting, and navigation systems
Vehicle and traction control systems
Pacemakers (measuring human activity)
Vehicle traction controllers
Seismic monitoring
Engine management systems
Collision and impact monitoring
Incline instruments and incline monitoring
Vehicle stability and shake monitoring
Computer peripherals (video games or entertainment devices, handles)
Handwriting recognition devices
Smart phones
2.3 Height calculation methods
In this study, we used the tangent theorem of trigonometric functions for
computation. Then, we designed a method of measuring the distance between any two
points. Parameters such as elevation angle and bottom edge length were obtained and
matched with those obtained using tangent theorem eq. (1) to derive eq. (2). These
were inputted into the microcomputer controller to calculate height. Figure 1 shows the
height measurement schematic. This measurement method is usually performed using
optical measurement instruments. In this study, however, we used laser point sensors
and inertial accelerometer sensors to determine angle parameters, and used ultrasound
ranging to obtain bottom edge length. The values obtained were then used to calculate
tanθ = x ,
y = x × tanθ,
compiled into
where θ is an elevation angle, x the bottom edge length, and y the height.
The building height measurement is divided into a top triangle and a bottom triangle.
The height of the top triangle is first calculated using eq. (3):
Y1 = XS × tanθ1.
The height of the bottom triangle is then calculated using eq. (4):
Sensors and Materials, Vol. 25, No. 6 (2013)
Fig. 1. Building height measurement schematic.
Y2 = XS × tanθ2.
Finally, the two calculated heights Y1 and Y2 are summed to obtain the height of the
Today, there are many test methods, with at least four experimental methods: the trialand-error method, a one-factor experiment, full factorial experiment, Taguchi method(15)
and measurement system analysis (MSA). After the comparison, MSA was found to be
more suitable for this system examined.
Measurement System Design
3.1 System architecture
Figure 2 shows the system architecture. The HT46R232 microcontroller provides
8-channel 10-bit resolution A/D conversion input. This is used to monitor accelerometer
analog signals. The pulse width measurement mode function in the timer is used to
monitor the ultrasonic ranging module return pulse width. The I/O port is used as a
channel for an LCD to display signal transmission. Users similarly employ the I/O port
as a channel for button control of signal transmission.
Figure 3 shows the equipment architecture. The front of the device contains two line
laser modules. After adjusting the mechanism to a level position, it was used to project
horizontal or level and vertical line laser markings. The top of the device comprises a
physical bubble level measuring apparatus. This was used as a simple basis for nakedeye observation of the level. The inertial sensor, which measured the level and the angle
with respect to the level, and the dot laser were located in the same component. This
component was for measuring the level and also primarily employed the point laser
as the target-marking point in later procedures. Additionally, the angle between the
marking point and the level was also measured. The ultrasound module and the inertial
sensor were placed at the same level. In addition to using the dot laser for measuring
the distance of the point from the target, the primary reason behind this process was
to accommodate the mechanism design during height measurement. The device also
contained an LCD module. This module was a 4 × 20 words display screen.
Sensors and Materials, Vol. 25, No. 6 (2013)
Fig. 2 (left). Device system architecture.
Fig. 3 (right). Device architecture diagram.
3.2 Height calculation process
During the measurement process, the ultrasound continued distance measurements
for the test plane. After users adjusted the angle to the required value, the button control
was employed and the microcomputer controller substituted the measured distance and
angle statistics into the tangent theorem for computation to perform the first part of
triangle height calculations. The angle flag was set on the basis of whether the angle
was positive or negative. This angle flag was then used for comparison to determine
whether the angle flag of the triangle height in the second part was positive or negative.
The number flags were summed. The calculated height was then displayed on the LCD
screen. The second button confirmation calculated the triangle height for the second
part, similarly indicating whether the angle was positive or negative on the angle flag.
The number flags were again summed. When the confirmation button was pressed again,
the microcontroller judged this as the third measurements on the basis of the number of
flags, and the final height calculation was performed. At this time, the microcontroller
compared the angle flags from the first two height calculations. When the angle flags
are similarly positive or negative, the triangle heights from the first and second parts are
summed. By contrast, when the angle flags have opposing signs, the system determines
whether the triangle height is larger in the first part or in the second part. Subtraction is
then performed. With this simple operation control, the height between any two points
of a vertical line on a test plane can be obtained.
3.3 Experimental verification
In the height measurement test, the test object was a planar object with a height of
approximately 51 cm. After placing the main body of the device at a level position, the
inertial sensor component was adjusted to a level position. During the first step, we
aligned the laser point with the top of the tested object, which indicated that the distance
from the level to the top was 48 cm, as shown in Fig. 4. The laser point was then aligned
to the bottom of the test object, which showed that the height from the level to the bottom
was 3 cm. Finally, we obtained an actual height measurement of 51 cm, as shown in Fig. 5.
Sensors and Materials, Vol. 25, No. 6 (2013)
Fig. 4 (left). Top laser marking of test object and device display.
Fig. 5 (right). Bottom laser marking of test object and device display.
After understanding the height measurement method, we began to perform height
measurement tests under various conditions. First, we performed top-triangle height
measurements of objects of the same height at various distances (Fig. 6). We performed
the bottom triangle height test at various distances from objects of the same height
(25 cm). Then, we used the top-triangle and bottom-triangle height measurements to
measure height at various distances.
To analyze this measurement system more precisely, we performed MSA (Fig. 7).
Three persons measured objects with heights of 50, 100, 150, and 200 cm. The sampling
and analysis results were as follows: The data sheet indicates that R-bar average = 2.875;
X-bar diff (max XBAR − min XBAR) = 1.0415; and Rp = 153.333. Reproducibility (Ev) is
the variability due to the measurement apparatus, as shown below.
Ev = 2.875 × 3.05 = 8.7688
Reproducibility (Av) is the variability due to persons performing the measurement, as
shown below.
AV =
(1.0415 × 2.70)2 −
× 3 = 2.3118 10
Reproducibility and reproducibility (R&R) can be calculated as follows:
R&R = EV2 + AV2 = 9.0684 (7)
VP = Rp × 1.62 = 153.333 × 1.62 = 248.3995
VT = R&R2 + PV 2 = 248.5650 (9)
Partial variation (VP):
Total variation (VT):
Sensors and Materials, Vol. 25, No. 6 (2013)
We performed P/T value calculations. Table 2 shows what the P/T values represent.
× 100 = 3.648% T VT
QS9000, ISO9001, and ISO9002 are quality management systems. As shown in Table 2,
the P/T value of the height-measuring instrument developed in this study was less than
10%. This confirms that the measurements provided by the height-measuring instrument
developed in this study are acceptable in QS9000.
Fig. 6. Height measurement test curves.
Fig. 7. MSA data.
Table 2
QS9000 P/T assessment criteria.
P/T value range
< 10%
10 to 30%
> 30%
Assessment results
Measurement system is acceptable
Possibly acceptable, depending on the company
Unacceptable, reasons must be assessed and improved
Sensors and Materials, Vol. 25, No. 6 (2013)
The experiment confirmed that the tangent theorem of trigonometric functions
can be used to calculate height. However, although ultrasonic ranging modules are
convenient for distance measurements, they are restricted by their characteristics and
cannot measure objects smaller than 1 cm. Additionally, inertial sensors can be used
to calculate the linear range of angles and the accuracy limit, which further restricts
the height measurement range and accuracy. Therefore, these devices cannot carry out
height measurements more accurately. Although they can perform noncontact height
measurements, the measurement results are still slightly different from the actual height.
The factors influencing these errors are listed below.
(1)During ranging with ultrasonic modules, distances can only be measured at the
centimeter level, not the millimeter level. Thus, the millimeter accuracy of the
measured results is insufficient. Distances measured only in centimeters indirectly
lead to errors in height calculation results.
(2)The tanθ angle can reach only single digits and the HT46R232 instruction space
is insufficient to express beyond the first decimal point. Therefore, inertial
accelerometers can measure the angle with the level in only single digits and not
decimal points. This leads to errors in the calculation results.
(3)In the mechanism design, the swing angle was changed manually. This manual
operation method still results in errors, regardless of whether the same object height
is used every time.
(4)Although we used SolidWorks for mechanism design, its size still led to errors during
manufacturing. This software created a gap between the program and the mechanism
design, resulting in slight disparities in the measured heights.
Y. X. Wang, Z. J. He and J. W. Xiang: J. Vibroeng. 13 (2011) 619.
Z. W. Zhu, Y. P. Sun, B. X. He and C. C. Yang: ICEMI 9th Int. Conf. (2009) p. 2620.
S. Toyama and M. Hoshina: J. Vibroeng. 13 (2011) 694.
S. Luczak, W. Oleksiuk and M. Bodnicki: IEEE Sens. J. 6 (2006) 1669.
D. Vybiral, M. Augustynek and M. Penhaker: J. Vibroeng. 13 (2011) 663.
J. S. Chae, H. Kulah and K. Najafi: Microelectromech. Syst. 14 (2005) 235.
H. H. S. Liu and G. K. H. Pang: IEEE Trans. Ind. Appl. 37 (2001) 812.
C. W. Tan: IEEE Trans. Instrum. Meas. 54 (2005) 2520.
D. M. Karantonis, M. R. Narayanan, M. Mathie, N. H. Lovell and B. G. Celler: IEEE Trans.
Biomed. 10 (2006) 156.
L. Atallah, B. Lo, R. King and G. Z. Yang: IEEE Trans. Biomed. Circuits Syst. 5 (2011) 320.
X. Zhang, X. Chen, Y. Li, V. Lantz, K. Q. Wang and J. H. Yang: IEEE Trans. Man Cybern. 41
(2011) 1064.
J. S. Wang and F. C. Chuang: IEEE Trans. Ind. Electron. 59 (2012) 2998.
A. Bertolini, R. DeSalvo, F. Fidecaro and A. Takamori: IEEE Trans. Geosci. Remote Sens. 44
(2006) 273.
F. A. Levinzon: IEEE Sens. J. 12 (2012) 2262.
J. Y. Shieh and M. N. Lee: Int. J. Eng. Technol. Innovation 2 (2012) 163.