ARDUINO OPEN HARDWARE TEST THROUGH CHEMICAL SYSTEM SIMULATION UNDER LUMPED MODEL DYNAMICS

RESUMO – Arduino boards are interesting computing tool due to low cost and power consumption, as well as I/O ports, both analogs and digitals. Yet, small memory and clock frequency with truncation errors may disrupt numerical processing. This study aimed to design and evaluate the performance of a dynamic simulation based on ODEs in the Arduino, with three evaluated microprocessors; ATMEGA 328P and 2560, both 8 bits, and SAM3X8E Atmel ARM CORTEX – 32 bits. The study case was a batch reactor dynamic simulation. The Runge-Kutta 4th order algorithm was written in C++ and compiled for EPROM utilization. The output was a 115000bit/s serial connection. Processing time was almost identical for 8 bits architectures, while 32 bits was 25% faster. Without the serial connection the 8 bits architectures were 16 times faster and the 32 bits was 42 times faster. Error truncation was similar, since the floating points is done through software. The Arduino platform, despite its modest hardware, allows simple chemical systems simulation .


INTRODUCTION
Chemical processes mathematical modeling and digital simulation are useful tools when dealing with daily chemical engineering situations.Enabling not only to describe, analyze, evaluate and optimize plant operations, but also to conceive new process technologies and/or new industrial unities.
As microcomputers prices decreased and miniaturization occurred, their popularization began.Enabling chemical system simulations analysis as a tool to a broader spectrum of institutions.
In a similar manner to microcomputers popularization during the 70's, the current dissemination of microcontrollers, due to low cost and energy consumption, as well as, processing power comparable to earlier full microcomputers, allows digital simulation in smaller hardwares.Generating a wider range of chemical engineering simulation platforms for classes, research and technological development However, memory limitations for data and coding, as well as limitations in numerical precision due to faulty floating point operations, in these platforms, such as the Arduino Free Hardware Platform, may pose as a treat for numerical methods, inherent to most simulation algorithms.
This paper objective is to evaluate the computational performance of Arduino Boards regarding processing time, precision and accuracy from implementations of Runge-Kutta 4th order numerical solutions to ordinary differential equations from simple systems with concentrated parameters.More specifically, the first order reaction kinetics of a batch reactor.Three Arduino platforms were evaluated: ATMEGA 328P and 2560, both 8 bits, and SAM3X8E Atmel 32 bits ARM CORTEX -M3.

LITERATURE REVIEW
The Arduino microcontroller is an open hardware tools design to be easily integrated to sensors and actuators.One of its most important characteristics is how user friendly the coding is to even non advance developers in hardware development areas (LEUNG,2013).
The platform was conceived in 2005 in the Ivrea Institute by Barragan, Banzi, Cuartielles, Mellis, Marino e Zambeti (GIBB, 2010).All moved by the necessity of teaching basic electronics, in a short period of time, to design students within the institute (Banzi, 2012).
The board gained popularity among hobbyists, hackers and scientists in small to medium projects.Resulting in several extension boards (shields) to enhance the Arduino capabilities (VICENTE, 2012).
The cited applications main focuses are monitoring, automation and development of standalone devices, not in simulation.One point that may explain this behavior is that the board is optimized to deal with standalone applications, and does not posses an I/O interface.Such visual output must be programmed by the user for each application.Thus, the utilization of microcontrollers in digital simulation of chemical processes is restricted, especially when compared to other computational hardware platforms.
The digital simulation field generally demands a great computational effort, not only forced by the mathematical system, but also due to the necessity of running computational packages and toolboxes alongside the algorithm.One example is the necessity of running an Artificial Neural Network Model toolbox with MatLab, such as in the work of Khaouane et al. (2013).The toolbox provides faster developments within the computational application, since the packages are usually well documented and user friendlily, enabling its utilization by an intermediate user.However, loading the entire toolbox, even when all its features are no applied, sacrifices computational speed.Gödeke et al. (2013) reports that computational solutions based on ARM (Advanced Reduced intructions set computer Machine) architectures are more efficient under an energy utilization point of view when compared with x86 platforms.
The Arduino platform has also been utilized in entry level Chemical Engineering classes.For datalogging or small scale automation during practical lectures (BUTTERFIELD, 2013).
The computing power, associated with the flexibility of a multipurpose computational systems and standard interface, makes microcomputers general architectures more attractive to simulations.However, microcontrollers are far more inexpensive and more robust (VICENTE, 2012).

MATERIAL AND METHODS
During the simulations, three boards performances were evaluates; Arduinos Nano (Provider: Funduino, China), Mega (Provider: Funduino, China) e Due (Provider: Arduino Store, Italy).The main characteristics of each board are described on Table 1.The Nano board is the smallest of the three, and thus, the one with the least hardware resources and also the most inexpensive.The Mega board is an extension of the Arduino Uno concept, with extra serial ports, more input/output ports and approximately 8 times more memory than a Nano board.The most recent board architecture, among the evaluated, is the Due board.It has a 32 bit processor, more memory, and a clock speed 5 times higher than the 8 bit processors.The interface was realized through a serial communication, by USB port.Where a notebook was used solely as output for the numerical results developed by the Arduino boards.
The study case was based in modeling of elementary first-order reaction occurring in ideal batch reactor isothermal (LUYBEN, 1990) example, following Equation 1.
The case is the first order differential equation that describes the concentration behavior of a generic chemical specie "A", according to Equation 2.
Subject to the initial condition represented by Equation 3.
The analytical solution to the problem was determined, according to Equation 4, in order to evaluate the precision of the numerical solution.
The numerical method was a Runge-Kutta 4 th oder method, according to Balsa (2013), displayed in Equation 5.
Where the 4 increments are calculated by Equations 6 through 9.
The coding was constructed using the Arduino interface, version 1.5.4,according to Figure 2.

RESULTS E DISCUSSION
Throughout the simulations, it was proven that the utilization of the Serial interface for results output greatly limits the processing capacities and speed.A summary from the simulation speeds are presented in Table 2.As it was expected, the Due board was approximately 25% faster when executing the code.The memory allocation, even with the relative small capacity for code and data in the Nano board, was not a limitation.The entire experiment code occupied 5572 bytes, with 240 bytes of memory occupied by the program global variables.
The percentage minimal and maximum errors, respectively -2,2x10 -3 % e 5,1x10 -3 %, were identical in all three boards.The numerical solution was very similar among the boards.The concentration profiles, as well as the error percentage, was identical in the 8 bits boards, but differed in the 32 bits board.The results shown in Figure 4 confirm that the behavior of the numerical solution in the ODE was very similar in all Arduino boards.The concentration profiles and percent errors were identical in the two 8 bits cards, and slightly different in 32-bit card, as showed in Figures 4 (a

CONCLUSION
The boards utilization in rapid prototyping is extremely welcome.Since its constructive characteristics are prone to easy utilization, low energy consumption, low cost, signal acquisition capacities, digital outputs and the capacity of emulating analog outputs, making the platform an excellent experimentation platform.
Regarding the field of dynamic simulation, even with small computing capacities, utilizing the Arduinos boards is a feasible option to emulate numerical solutions for ordinary differential equations with concentrated parameters systems.This is enabled since the deviation between the numerical and exact solution to the problem was acceptable, in spite of using simple precision and the way the floating point is handled.
Processing time was almost identical for 8 bits architectures, while 32 bits was 25% faster.Without the serial connection the 8 bits architectures were 16 times faster and the 32 bits was 42 times faster.
These features may represent a step towards a new technology within process control.A plant where microcontrollers may be responsible by not only controlling actuators, but also by evaluating current state and tuning future actuations based on predictions made by itself.

Figure 2 -
Figure 2 -Computational Experiment Dynamic Simulator Code

Figure 4 -
Figure 4 -(A) Concentration Profiles in Numeric Solution on Arduino Nano, Mega and Due; (B) Numeric Error (%) Profiles on Arduino Nano, Mega and Due.

Table 1 -
Main Characteristics from the Evaluated Arduino Boards