# Reactive Obstacle-Avoidance Systems for Wheeled Mobile Robots Based on Artificial Intelligence
## 3 System Analysis
### Case II: Mobile Robot and Neural Networks  
The second case is a self-navigating robot, which uses data obtained from ultrasonic sensors and artificial neural networks to decide where to move in an uncontrolled environment: to the right, left, forward, backward, and, under critical conditions, stop. This information allows for smooth turns applying multilayer neural network architecture with supervised learning algorithms. The mobile robot decides to avoid fixed and mobile obstacles, providing security and movement in uncontrolled environments. Mobile robot construction. In this case, the mobile robot algorithm applies a multilayer neural network (MLP) utilizing backpropagation. The mobile robot structure was designed to be easily modified and adaptable. Its physical appearance was evaluated to be simple with reduced size, considering previous mechanical structures of robots. Figure 7 presents the top view of the mechanical structure of the mobile robot. The localization of each device applied for its movement is also shown there. A list of each device is shown in Figure 7, and the prototype picture is presented in Figure 7.  
The design of the electronic connection diagram implemented in the mobile robot is shown in Figure 8, where the microcontroller, SRF02 ultrasonic sensor, \(B02_{1}\)-180 geared motors, and an LCD screen that displays the motors and sensor status are presented. In Figure 9, the block diagram of the system operation is shown, where the system makes a decision after processing the signal from the ultrasonic sensors. Figure 8: Electronic connection diagram of the mobile robot. Figure 7: (**a**) Mechanical structure of robot (top view); (**b**) list of devices; (**c**) mobile robot prototype. The sensors described in the first block of Figure 9 are read by means of the following code:  
**Code 1: Ultrasonic sensor reading stage. **  
1 // Function analog sensor reading  
2 void read_analog ()  
3 {  
4 mq?_inanalogRead(AO);  
5 mq?_inanalogRead(A1);  
6 mq?_inanalogRead(A2);  
7 mq?_inanalogRead(A3);  
8 mq?_i=(mq4_i+9.481)+300;  
9 mq?_i=(mq4_i+9.481)+300;  
10 mq?_d=(mq4_d+9.481)+300;  
11 mq?_d=(mq?_d+1.935)+20;  
12 }  
ANN Design to make decisions. Several applications to avoid collision of mobile robots while controlling their movements and generating a path have been developed, showing a pattern classification problem. Networks such as single perceptron, multilayer perceptron, radial basis networks, and probabilistic neural networks (PNNs), among others, have been popularly used. In this case, a multilayer perceptron (MLP) is chosen because of its general characteristics. In addition, it is an architecture that is relatively simple to implement in a robot. Figure 10 presents the neural network structure. It consists of three input vectors and an output vector with four elements each; then, a 4-layer configuration was made [5; 4; 4; 4], in the first hidden layer using the \"tansig\" activation function, and a \"lossig\" function in the second and third hidden layer was used. The activation function applied in the output layer was the \"lossig\". Inside the robot, on the left, center, and right, ultrasonic sensors were placed, operating as the network's inputs. These sensors are activated depending on the proximity of the obstacle in the path. The network's output depends on these sensors that allow the proper position and hence obstacle avoidance. Decimal numbers will be the output network in the range [0 1]. After that, a comparison function in Arduino will be executed to establish the value of the output greater than 1 and the other two in 0. Figure 10: Network structure using a three-input neural network and a 4-element vector output. Figure 9: Block diagram of the system operation. Equation (5) represents the mathematical behavior of the neural network developed and implemented in the embedded system for decision-making of the mobile robot:  
\[