Moving Object Detection Using Ultrasonic Radar with Proper Distance, Direction, and Object Shape Analysis

Background: In its early development, radar (radio detection and ranging) was primarily used by the navy, the military, and the aviation services, as well as space organizations for security and monitoring purposes. Nowadays, the demand of radar is expanding. Research has been conducted to overcome the limitations of radar. Objective: One of the current limitations to detect moving object. The current paper aims to fill the gap in the literature by using a radar system in the identification of moving object, capturing the distance, direction, radar pulse duration and object shape simultaneously. Velocity or the object’s speed towards or away from the radar was determined by using an algorithm to obtain the precision. Methods: The accuracy of distance measurement and angle is ensured by comparing the real values and the values obtained by the radar. The objects under study consist of metal and non-metal. Novelty of this work is the accurate detection of moving objects with suitable algorithms using only one


I. INTRODUCTION
The concept of radio detection and ranging (radar) is originated in the 19 th century during the 2 nd World War. Initially, it was developed to the detect aircrafts. Generally, there are two kinds of radar: practical radar, which uses electromagnetic waves; and ultrasonic radar, which uses use sound waves. To determine object distance, direction and velocity, electromagnetic wave is impeded by opposition, which is then reflected back to the source. Fig. 1 shows the outfit of ultrasonic sensor as well as how an ultrasonic sensor works as an object detector and transmits and receives sound waves. The difference of ultrasonic radar and practical radar is the transmitted signal and the range. An ultrasonic sensor is an electronic device that works with sound pulses. The transmitter of an ultrasonic sensor transmits sound waves and if they get reflected by an object, the signal is picked up by the receiver end. The time between transmission and reception is calculated to determine the distance.
Another system [1] uses an ultrasonic sensor attached to a microcontroller. The idea of distance measurement by using such sound waves was first done experimentally [2]. Subsequent research [3] strongly agree that ultrasonic sensor is the cheapest way to determine the distance of an object and that the suitable microcontroller is P89C51RD2, which is a family of 80C51 microcontrollers. This experiment was constructed with a transmitter module, a receiver module and a sensor module. The results obtained from the experiment showed that the smaller the distance between the sensor and the object, the smaller the error [2]. In 2017, a research project [4] examined an The major limitation of ultrasonic radar are the detection of a moving object or multiple objects. This paper aims to solve one of these limitations. If the object is moving towards or away from the radar, the system will detect the speed. The practical implication is to avoid accidents because knowing speed is necessary formulating a prevention system. Detecting an object's movement accurately is not easy. Authors of this paper aim to contribute to the body of knowledge by solving this problem using an algorithm to evaluate the precise value by comparing the real distance and the ultrasonic-measured distance.
In the early development of indirect distance measurement, James Watt used light [5] but light cannot travel a long distance (only up to 40 cm), unlike sound. Radar could be an alternative because of its extended range, cheap price, a variety of object selection, and accurate measurement when used as an ultrasonic sensor. The range of ultrasonic radar is not interrupted like IR sensors [6]. High-impact application of ultrasonic radar includes tracking of heartbeats [7] and evaluation of group velocity [8], tracking a large area and wireless distance measuring [9], and obstacle detection in robotics [6].
The novelty of this work is in the moving object detection with only one ultrasonic sensor and against different shaped and sizes. In addition, there is increased efficiency and cost minimization. Detailed explanation of the working principle is described in the methodology section with a flow chart and a block diagram. Two distance values are recorded within a fixed time along with the calculation of the velocity to avoid confounding variables [3,4,5] The findings are also presented as a visual representation depicting the "processing" application and the accuracy.

II. LITERATURE REVIEW
Research on the use of radar is increasing and has been published in journals in various disciplines. For example, there was a proposal of a system that can detect an object and a human in still or motion by using two ultrasonic sensors, LPC2148 and DC geared motor [10]; a distance measurement by using Arduino ultrasonic sensor [11]; a radar system that can detect distance and direction of object [12]; distance and direction mapping with a processing App [12]; distance and direction measurement by using an Arduino ultrasonic radar embedded system [13]; distance and direction detection by using a microcontroller ATmega16 [14]; and a height detector with ultrasonic sensor by using a microcontroller ATmega16 [15].
What should be noted is that the detection of moving object has not examined in the previous papers [10,11,12,13,14,15]. The current study aims to fill the gap by examining this by using a low cost device and an algorithm to solve the calculation problems. Arduino code and salient analysis were also used to observed objects in different shapes and sizes.
In previous research, ultrasonic sensor was used to detect the presence of human in a place is filled with smoke [16]. The height of an object could also be detected by using an ultrasonic sensor connected to a smartphone [17]. The length of an object could also be detected by using an ultrasonic sensor combine with an additional equipment named Raspberry Pi [18]. Another system can detect more than one object position [19]. A radar system can also be developed to cover a larger range of ultrasonic sensor and turned into a mobile robot with a sonar system [20]. However, the technologies used in the research projects above are expensive. The current research proposes a method that is simpler, more affordable but effective.

III. METHODS
In this study, ultrasonic sensor and servo were both major components. These were connected with and controlled by an Arduino UNO. Ultrasonic sensor transmits ultra sound and the servo motor rotates the ultrasound sensor. The Arduino UNO consists of USB connector, microcontroller, analogue input pins, power port, digital pins, crystal, oscillator reset switch, USB interface chip, TX RX LEDs. It functions as a controller and provides a coding environment so it requires direct connection to a computer. HC-SR04 ultrasonic sensor is used in this study as it transmits the sound wave of high frequency near about 40 kHz to 70 kHz. Humans cannot hear it. If the wave gets reflected by an obstacle, then the reflected sound will be picked up by the receiver. Sonar is used to identify the object.
The four pins of the sensor are: VCC=5VDC, trig pin=trigger pin/input pin, echo pin=output pin and GND or ground pin. A10us trigger pulse is generated with the help of trig pin and to produce sound wave of 8 cycles. Normally echo pin stays in a low state (0V) but when it receives the sound wave it goes to a high state of 5V. The total high state (5V) of echo pulse is counted as the travelling time of the sound wave.
Servo motor (SG90) is a rotatory motor which runs with the help of servo mechanism. Servo motor is used here to detect the angle of the moving object. 0 to 180 degree is the rotatory range of servo motor, but depending on the manufacturing it can go up to 360 degrees [21]. Servo motor receives the control signal and tunes the shaft. Servo motor is used to set up the position and velocity of the ultrasonic sensor. Three wires from the servo motor have to be connected manually.
For the implementation of the components, the trig pin and the echo pin of the ultrasonic sensor (HC-SR04) are connected to the PWM pins and the SPI pins of Arduino UNO. Servo and ultrasonic sensor are connected in such a manner where ultrasonic sensor can be mounted on the servo motor. The Arduino UNO power is supplied by the computer. The code that has been uploaded onto the Arduino UNO software will run through the data generate results.
A. Hardware Design/ Connection Setup Proteus, EasyEDA and Fritzing are popular software nowadays. EasyEDA simulates the circuit before the implementation to test experiment as shown in Fig. 2.
Where, D is distance, T is duration or travelling time of echo pulse, V is velocity of the object, Δd is the difference between two distances, Δt is the time difference for displacement of the object, d2 is the final distance of the object, d1 is the initial distance of the object, t2 is the final time of the displacement, t1 is the initial time of the displacement, e is the error between the two distance (%), du is the ultrasonic distance, da is the actual distance, η is the efficiency of the ultrasonic sensor (%). This algorithm (Fig, 3) is designed in a way that main improvement is done through the modification of the software. The algorithm was formulated to calculate the velocity of the object in an easiest and accurate way possible (2). The main point was to read two distances in a fixed duration. There is an equation to measure the distance of object with the help of sound wave travelling time (1). The code follows this algorithm, which is then run to generate the experimental output at the serial monitor. Then, the result is compared with the real value which measured with a conventional scale. The comparison shows that this experiment yielded high accuracy than previous works.

D. Flowchart
The experiment can also be represented in a flowchart to reflect the algorithm, as shown in Fig. 4. When the ultrasonic sensor and moto receive power supply they start to work. Arduino UNO sends the 10us trig pulse, which the starts the high echo pulse position. Servo starts to work when the angle range was 3<θ<180 degree. After that Arduino UNO waits when the echo pulse returns to its previous state. If echo pulse goes back that means there is an object and an initiated calculation distance (if the object is static). After the calculation is done, the result it shown on the display. Again, if there is a moving object then the speed is calculated, and the results are shown on the screen. As it is a radar system, the servo motor will continuously move and cover the range to detect if there is another object.  As shown in Fig 5, Arduino UNO receives power supply from the computer. Then microcontroller sends signals to the other two components: the ultrasonic sensor and servo motor. The feedback from these components is sent back to the microcontroller. The ultrasonic sensor has a transmitter to send out the ultrasound and a receiver to catch the reflected sound waves. The total travelling time of this sound wave is the distance. 104 Fig. 6 Hardware implementation Fig. 6 shows the practical implementation of the overall radar system. The setup worked properly as expected.
The system was able to experimentally detect metal, non-metal and a still and moving human. The outcome of the practical implementation was analyzed in the following section.

IV. RESULTS
During the implementation of the experiment, the serial monitor continuously produced data. There were in total of 18 data sets collected for evaluation and validation checking, as shown in Table 1. The result shows whether the object is static or moving. If the object is moving towards the radar then it produces a negative value and vice versa. If the object is static, then the speed is zero. With this, the system is able to locate a moving object. Table 1 shows the results of a non-metal square 3D object. Object distance was increased with various speed to observe the validity of algorithm. The serial monitor output shows the four important parameters speed, distance, angle and pulse duration.    Table  Table 2 shows the range detection capacity in changed environments. For the same setup, it showed different values when it was inside the room and when it was outside the room. It is important to explore maximum and minimum range of proposed radar system in different environments. Table 3 is constructed from data which was taken from the radar readings. The actual values of object's distances were measured inside the room for both metal and non-metal objects, showing the actual and the ultrasonic distance. From this, efficiency and error are calculated to evaluate the performance of connection setup using equation (3) and equation (4). Table 4 is constructed from the data taken from servo reading and the actual value of the measured angle for the square metal object. Efficiency is also calculated for each data set to see the nature of response. Meanwhile, Table 5 evaluates the object direction and the angle error distortion. Table 5 is important to show the performance of the radar against different shapes and sizes. Small object, medium object and large object were used in this experiment. Table 5 shows that the proposed radar system was unable to detect small objects and the accuracy decreases with the decrement of size and shape. Fig. 7 The result of system is represented by Processing software, short distance view Fig. 7 was taken in the movement of the radar when the processing sketch also started to move. Where radar finds an obstacle, a red color shows to identify that an object is detected. By using coding, arc line and distance line were drawn. The code continuously took the value from a serial port. If there was no object detected then it shows green color. At the bottom of the screen, it is showed that angle was 72 degree and distance was 4 cm. The sketch was done for 0 degree to 180 degrees.

C. Graphical Representation
To evaluate the performance of the proposed radar system, a visual was created. Fig. 8 is drawn from Table 1. The graph represents the travelling time of sound wave (high echo pulse duration) with the increment of distance. The graph conveys that the relationship between travelling time and distance is proportional. As soon as the echo pulse comes to low state (0 V) from high state (5 V) means the travelling time of echo pulse is decreased. The object distance also shorter in that case as the ultrasound reflects back to receiver of radar.  Fig. 9 Comparison of actual distance and ultrasonic distance for metal object over several samples Fig. 10 Comparison of actual distance and ultrasonic distance for non-metal object over several samples In Fig. 9 and Fig. 10, X-axis indicates the number of samples and Y-axis indicates the value of the measured distances for the metal object and non-metal objects sequentially. The graph shows the difference between the ultrasonic value and the actual value. It indicates that initially ultrasonic distances (blue bar) are more than actual measured value (orange line or orange bar) but gradually both of the bar become equal with distances. Fig. 11 Evaluation of error for metal object Fig.12 Evaluation of error for metal object Fig. 13 Efficiency graph where X-axis includes the ultrasonic distance and Y axis includes the metallic and non-metallic object efficiency Fig. 11 and Fig. 12 represent the error for the corresponding to actual distances of the metal and non-metal objects. The graphs show the percentage of error of the objects against the distance is high initially, at about 50%. Gradually, with the increment of distance from the radar, the error is reduced to 0%. The metal object gives the better performance in this case. There is less error and the error rapidly decreases. Fig. 13 is a comparison between the two efficiencies of metal and non-metal objects. For the first stages of the graph the difference is larger and when the distance increased, the fluctuation is decreased. It should be noted that efficiency performances are not same for metal and non-metal objects.

V. DISCUSSION
Ultrasonic sensor is mostly used to find distances, but the current paper aims to measure three parameters (distance, speed and direction) at the same time. The radar's performance is also evaluated against different objects' shapes and sizes. In Table 6, the novelty and effectiveness of the work can be evaluated by looking at the comparison results of the current study with those of the previous ones. Cost, complexity, efficiency, decremental value of error and simplicity are the key success factors.
The proposed system can detect moving object with the speed of 3.00 cm/s as shown in Table 1, which is similar to what has been done in previous research [21,24,25]. In Table 2, what makes differences in the maximum range inside (366 cm) and outside of the room (251 cm) is the soundwave's speed as influenced by the environment parameter. For the same ultrasonic distance of 5 cm, a metal object shows 88.88% efficiency and a non-metal object shows 75% efficiency. That means this radar system provides better efficiency for metal objects compared to the non-metal objects. The results in Table 5 are identical to other works [6,27] with a new numerical analysis done for different shape of objects. Fig. 14 is constructed from Table 5 to show that ultrasonic radar responds better to a square-shaped object than a cylindrical-shaped object. When a cylindrical object is very close to the sensor, it fails to detect it. The best identification is when the object is big. The accuracy of small object and cylindrical object identification started to decrease after 8 cm distance and totally fails to detect when the distance reaches 10 cm. The radar is unable to detect small objects like LEDs in any distances. The connection setup also fails to differentiate between two different objects; and detect object size of unknown object. Future studies will benefit from examining these areas.  Previous research [9,21,25] did not analyze the shape response. Table 7 shows the shape identification with 100% efficiency. 7 Better Efficiency With a distance of 15 cm, the efficiency was 100%.

Maximum detection range
The maximum range of ultrasonic sensor observed from the experiment was 366 cm.
Note: e = error between the two distance (%), du = ultrasonic distance, da = actual distance, η = efficiency of the ultrasonic sensor (%)  Radar is a remarkable invention from various perspective, including measuring velocity and calculating distance. The proposed radar system had only small error when calculating distances and can predict velocity accurately. When the object is static, the serial-monitor of the radar system shows the speed is 0 cm/s. When the object moves, the number goes along with it. Direction of the object was also observed with the best efficiency. The radar system detected the square and large cylindrical objects more precisely than small objects. The object size and distance are important variables in the shape analysis. Overall, the system can provide 100% efficiency unless of the distance is less than one centimeter and the size is extremely small. However, it important to note that the experiment was done in a constant environment.