Implementation of anti-collision train prototype based on arduino microcontroller

Received Apr 15, 2020 Revised May 20, 2020 Accepted Jun 15, 2020 Because the electrical train become a popular mode and Eco-Friendly of transport in largest cities in the world in our day life and due to increase in the train accidents. In this paper a train collision avoidance system is designed and implemented using Arduino NANO and an ultrasonic sensor. A prototype is used to explain the system function using; two train samples on single track. The ultrasonic sensor is connected to the Arduino NANO to transmit the measured distance to the microcontroller and make the decision to stop the train. The ultrasonic sensor on both trains from the front end and continually measures the distance between them and when they reach the decided distance a signal to the trains engines will slow down or stop both trains to avoid a collision while when the ultrasonic sensors from the rear-end continually measure the distance between them and when it reaches the decided distance a signal to the train engine will slow down and stop the first train to avoid a collision.


INTRODUCTION
Decision making systems are widely used automatically at places that human can't deal with it alone, or places that necessarily more care, safety and accident avoidance. Smart automatic decision-making systems are classified as systems or device that human independent systems which doesn't require any enter for human, which are programmed and designed to operate independently. Anti-collision systems are smart systems that are used within vehicles, trains and airplanes to avoid accident problems. These systems must be potent and dependable in order to avoid mistakes and catastrophes [1].
In general, traffic administration and tracking decrease the amount of accidents that happen in roads or on railways. Especially, train collision avoidance is to be considered in this project. The railway is a popular mode and Eco-Friendly of Transport in largest cities in the world. One of the most comfortable and widely used of the transportation system is train. As the railway network is considered to be the safest and easiest network. More than 10 billion of people and 1050 millions of cargo travel by train per annum. Transport by Railway irreplaceable in our daily modern life, both for business and private users [2].
Today, rail networks across the world become deals with trains that travelling faster and carrying more passengers and heavier loads than ever before. For these factors the existing infrastructure has put under considerable pressure, which leading to increased request in the maintenance and check of rail assets. But nowadays, it is not that much safer as the lot of accidents occur due to improper communication between the network, wrong signaling, worst weather condition or immediate route change. The proper information doesn't get to the train driver on time and before time, so the probability of accidents occur is high [3]. Due to increase in the used of the electric trains in the world and the high speed with the low fares more people prefer to use train but with many risks in the train accidents. In this paper a prototype will be designed and implemented for train collision avoidance system using Arduino NANO and an ultrasonic sensor to reduce the occurrence of accidents between trains on the railways due to many reasons that may be technical or human made errors.

TRAIN COLLISIONS
Collisions are the worst accidents. Due to speed moving of trains it will be very difficult to stop such a collision, which need a lead distance to stop. Collisions are happening due to human errors and/or faulty equipment. There are two types of collisions are available. A Head-On collision is one where the front ends of two ships, trains, planes or vehicles hit each other [4]. Figure 1 illustrates the Head-On Collision and A Rear-End collision often implies a collision on a single line railway as illustrated in Figure 2.

ANTI-COLLISION TRAIN PROTOTYPE SYSTEM PARTS
In this section of the paper, the used hardware to implement the proposed system, such as the Arduino microcontroller, motor driver unit, and the ultrasound sensor, will be described.

Arduino microcontroller
Arduino Nano is an integrated microcontroller board based on the SMD ATmega328p microcontroller. An FTDI FT232RL on the board channels this are a serial communication over USB and the FTDI drivers (included with the Arduino software) provide a virtual COM-port to the software on the computer [5].
The board can operate via an external supply from 7-to 20 volts. When the supplied voltage less than 7V, the 5V pin may supply less than 5volts and the board may be unstable in performance. If using more than 12V, the voltage regulator may be overheating and damage the board, the recommended range is 7 to 12 volts [6][7][8].  Table 1 shown below illustrate the specifications of ATmega-328 microcontroller that used in the architecture of the Arduino NANO and Figure 3 illustrates the Arduino NANO microcontroller [9].  Figure 3. Arduino UNO microcontroller

Ultrasonic sensor
The Ultrasonic convert ultrasound waves into electrical signals or vice versa, this type of sensors is consisting of a transmitter and a receiver enabling to determine the distance from an object without losing in the accuracy, except in presence of objects made of sound-absorbing materials which obviously make the measurements inaccurate. The Timing diagram is shown in the Figure 4, to start the operation of ultrasonic only need to supply a short 10 pulse to the trigger input to start the ranging, and then the module will send out an 8-cycle burst of ultrasound with 40 kHz and wait the reflected signal as an echo that can hit objects within range from (2cm to 400cm) [10,11]. The speed of signal in free space approximately within 345m/s and according to newton's law can determine the distance ultrasonic and colliding object as the (1). Figure 5 illustrates the ultra-sonic HC-SR05 module.
where: d= Distance between ultrasonic and colliding object, N=Speed of travelling signal. t=Time of echo signal.

L293D motor driver
The most common method of a DC motor speed control through pulse width modulation technique, the motor speed mutation is accomplished by decreasing or increasing the time interval of the signal, the signal has the logic value "1" (TON) and logic "0" value (TOFF), the duty cycle is the ratio of TON over the time periodic, the speed of DC motor directly proportional with applied voltage, at a duty-cycle of 100% this meaning full output voltage and the motor run with full speed. At a duty-cycle of 50 %, the motor will run with half of the rated speed. The figure 6. Illustrate the relation between speed and applied voltage, the duty cycle can be calculated by (2) [12,13].

= +
(2) Figure 6. Speed versus applied voltage The L293D a simple and low cost used to drive a small DC motor, this driver is a typical Motor driver or Motor Driver IC which allows DC motor to drive on either direction or speed control. L293D is a 16-pin IC which can control a set of two DC motors simultaneously in any direction [14,15]. The Figure 7 shown below illustrate the pin configuration of the L293D motor driver

SYSTEM DESIGN AND IMPLEMENTATION
This part explains the design and the implementation of train anti-collision system. The anticollision designed system can be used for both (Head-On Collision and Rear-End Collision); Figure 8 shows the block diagram for system designed. The ultrasonic sensor will send the signal and wait for the collision to return echo and send it to the Arduino for the purpose of calculating the distance, which will in turn be directed to the motor driver to reduce the speed or stop. At the head-on anti-collision case the ultrasonic sensor is planted on the front head of the train. When a running train approaches another train from the front end the ultrasonic sensor on both trains continually measures the distance between them and when they reach the decided (threshold) distance (25 cm in this project) a signal to the train's engines will slow down and stop both trains to avoid a collision. The Figure 9. Shows two trains on the same track, both are in the Head-On case and are stopped at a distance. At the Rear-End anti-collision case also, the ultrasonic sensor is planted on the head of the train. When a running train approaches another train from the rear-end the ultrasonic sensors on the first (approaching train) continually measure the distance between them and when it reaches the decided (threshold) distance a signal to the train and with help of motor driver engine will slow down and stop the first train to avoid a collision. The threshold distance that is specified in this project is (25 cm). As shown in the Figure 10.

CONCLUSION
The system is implemented in the prototype railway networks; train accidents can be prevented. This collision between trains is calculated and colliding trains were alerted. The proposed system in this paper help to reduce the train collision, many human lives can be saved in this system because if someone is stuck or wants to cross the railway network, the ultrasonic sensor will send a signal Arduino and the Arduino take the proper decision to make the train engine slow down or stop the train. The scenario of accident in Trains due to collision will be controlled with the help of this paper. The HC-SR05 ultra-sonic module sensor was used in the design measuring small range of distance, but can develop this work in practice should using the "LIDAR lite V3" this type that measures a distance of up to 40 m with high accuracy.