# Real-time Neural Networks Implementation Proposal for Microcontrollers
## 1 Introduction  
Microcontrollers (\(\mu\)Cs) have been applied in many areas: industrial automation, control, instrumentation, consumer electronics, and various other areas. Nonetheless, there is an ever-growing demand for these devices, especially in emerging sectors such as the Internet of Things (IoT), the smart grid, Machine to Machine (M2M), and edge computing [1]. A \(\mu\)C can be classified as programmable hardware platform that enables embedded system applications in specific cases. It is important to know that \(\mu\)Cs are mainly composed of a General-Purpose Processor (GPP) of 8, 16, or 32 bits. Then, this GPP is connected to some peripherals such as Random Access Memory (RAM), flash memory, counters, signal generators, communication protocol specific hardware, analog-to-digital and digital-to-analog converters, and others. An important fact is that in most products that are available today, the \(\mu\)Cs embedded into them encapsulate an 8-bit GPP with enough computational power and memory storage for use as a resourceful platform for many embedded applications. However, these same 8-bit \(\mu\)Cs are considered low-power and low-cost platforms when compared with other platforms that are used to implement AI applications with Artificial Neural Networks (ANNs) [2; 3]. The use of artificial intelligence algorithms, such as (ANN, Fuzzy, SVM, Genetic Algorithms, and other ) for embedded systems with real-time constraints, has been a recurrent research topic formany [4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14]. Many of the works devised from this topic are driven by the growing demand for AI techniques for IoT, M2M, and edge computing applications. A major problem with implementing ANN applications into embedded systems is the computational complexity associated with ANNs. In regard to the Multilayer Perceptron (MLP) described in this work, there are many inherent multiplications and calculations of nonlinear functions [4; 5; 6]. Besides the feedforward process between the input and the synaptic weights, the MLP also has a training algorithm associated with it to find the optimum weights of the neural network. This training algorithm is very computationally expensive [15]. If the training process is also performed in real time, the computational complexity is increased several times. This increase in complexity automatically raises the processing time and requirements for memory storage from the hardware platform used in the application [4; 5; 6]. The use of MLP neural networks for real-time applications in \(\mu\)Cs is not a new field. In [16], the authors describe a method to linearize the nonlinear characteristics of many sensors using an MLP-NN on an 8-bit PIC18F45J10 \(\mu\)C. The obtained results show that if the network architecture is right, even very difficult problems of linearization can be solved with just a few neurons. In [17], a fully connected multilayer ANN is implemented on a low-end and inexpensive \(\mu\)C. Furthermore, a pseudo-floating-point multiplication is devised to make use of the internal multiplier circuit inside the PIC18F45J10 \(\mu\)C used. The authors managed to store 256 weights into the 1 KB SRAM of the \(\mu\)C and deemed it enough for most embedded applications. In [18], [PERSON] et al. implemented a hurdle-avoidance system controller for a carlike robot using an AT89C52 \(\mu\)C as a system embedding platform. They implemented an MLP with a back-propagation training algorithm and a single hidden layer. The proposed system was tested in various environments containing obstacles and was found to avoid obstacles successfully. The paper [19] presents a neural network that is trained with the backpropagation (BP) algorithm and validated using a low-end and inexpensive PIC16F876A 8-bit \(\mu\)C. The authors chose a chemical process as a realistic example of a nonlinear system to demonstrate the feasibility and performance of this approach, as well as the results found using the microcontroller, against a computer implementation.