Internet-based Remote Setting and Data Acquisition for Fuel Cell

Data acquisition systems (DAQs) have a significant role in acquiring data for convenient analysis. With the spread of the Internet of Things, DAQs with remote access are in high demand in industry. The massive usage of free cloud storage provides an opportunity to build a remote DAQ that provides accessible data around the world. In this paper, a remote setting and DAQ for a fuel cell stack are presented. A prototype was made using Arduino Yun, sensors, and actuators. A data server from Flask Python was built using the Linux side processor of Arduino Yun. Then, the acquired data were sent to Google Drive and saved as Spreadsheets files. A user interface (UI) based on HTML was provided in Google Sites. The UI was used to display the data in table and graph form as well as to set the timing values of the purge valve. Google Apps Script was used to manage data communication with Arduino Yun and also manage the data stored on Google Drive. The proposed system takes 3 s to send data from Arduino to Google Drive, while the time taken to update the purge valve time values is 6 s.


Introduction
Data acquisition has become an important fundamental task in modern science and engineering. (1) This can be seen from the number of activities that require data recording against time to observe the progress of systems. Examples of such data are voltages in an electrical system, temperatures, and forces in a mechanical system. Data acquisition systems (DAQs) mostly acquire data from sensors or transducers that produce analog signals. (2) To process these analog signals, it is necessary to convert them to digital signals. (3) A DAQ consists of various components including sensors, signal processors, a computer, communication links, databases, and software. All of these components must work well together for a good DAQ to be built. (4) Microcontroller (MCU) boards such as Arduino have been implemented as low-cost DAQs. (5) González et al. used Arduino in the automobile field as a DAQ. The DAQ is made for automobile dynamics applications at frequencies of less than 80 Hz. (6) Mutha et al. used Arduino as a realtime DAQ for environmental data useful for agriculture and industry. (7) The previous examples illustrate that MCUs, especially Arduino, have been used in various fields to improve people's lives.
The internet has now become a commodity of people, and not only people but also devices are internet users, a concept known as the Internet of Things (IoT). (8) With this development, IoT-based DAQs have emerged. Cruz et al. used Arduino Leonardo as a DAQ and combined it with IoT to make a cost-efficient air quality monitoring system that can be accessed through the internet. (9) Then, Mohammad and Shahjahan developed IoT-based supervisory control and data acquisition (SCADA), where the data can be presented in real-time on websites. (10) Combining DAQ with IoT can provide convenience in accessing retrieved data because users can open it via the internet.
In addition to using Arduino, a DAQ can be built with a programmable computer board called Raspberry Pi. Raspberry Pi is a small, inexpensive, powerful, and education-oriented computer board that was introduced in 2012. It operates similarly to a regular PC, requiring a keyboard for command entry, a monitor, and a power supply. (11) Ferencz and Domokos used Raspberry Pi to collect sensor data and an Apache Cassandra database cluster with a web application as an alternative solution for IoT data acquisition and storage systems. (12) Smart boards, such as Arduino and Raspberry Pi, have triggered a revolution in the world of IoT. From another point of view, strategic development for IoT is towards the cloud. (13) Using cloud-based solutions makes it easier to manage big data and information from the IoT world. (14) Melo et al. developed a low-cost DAQ for monitoring a photovoltaic system. This DAQ used ESP32 and LoRa to send the data to the Google Cloud platform. (15) In this paper, a DAQ based on IoT with remote setting capability is presented. The system is made to monitor the data obtained from a fuel cell stack and maintain its performance. The fuel cell stack used is a proton exchange membrane fuel cell stack (PEMFC) with 200 W capacity. The system is built using Arduino Yun as the main component to acquire and log data and adjust the fuel cell system. The logged data are sent through the internet to a free cloud drive called Google Drive. The system is equipped with sensors, actuators, and a user interface (UI) in Google Sites. A UI made using Hypertext Markup Language (HTML) is provided to display the logged data and set up the purge valve of the PEMFC through the internet.

Materials and Methods
The DAQ and remote setting system that were made consist of a prototype and UI. A prototype was made to acquire the data from the fuel cell stack, while the UI was created to display the acquired data so that the data can be easily monitored. The system will be discussed further in the following subsection.

Prototype
The main components of the prototype are Arduino Yun, a temperature sensor (MAX31850K-1 wire thermocouple), a voltage sensor (a series of resistors), a current sensor (ACS712-20A), and a motor driver module (L298N). Supporting components include a purge valve, fans, a DC power supply, cables, jumpers, and screw terminals.
Arduino Yun has two processors, namely, ATmega32U4 as a microcontroller (MCU) and Atheros AR9331 as a microprocessor (MPU). The MPU has a Linux distribution embedded system (OpenWrt) with the full installation of Python 2.7. The Arduino board has 20 digital I/Os [seven of them can be used as pulse width modulation (PWM) outputs] and 12 analog I/Os. The board also has built-in Ethernet and WiFi.
A MAX31850K temperature sensor is used, which is a breakout board manufactured by Adafruit. The board includes a chip and a 3.3 V regulator. To measure the temperature, the board requires a thermocouple. In this prototype, a type K thermocouple is used. An ACS712 current sensor with a capacity of 20 A is used. This is because the current generated by the fuel cell stack can reach 10 A. Thus, the sensor can still measure the largest current generated by the fuel cell.
For the voltage sensor, this prototype uses seven resistors in series whose total resistance is 137 kΩ. The resistance of each resistor in order of appearance in the circuit is given in Table 1. In addition, the resistor circuit is shown in Fig. 1.
For the voltage sensor values to be read by Arduino, the order of the resistors in the circuit is very important because Arduino can only receive a maximum signal of 5 V. To determine the resistances that should be used, the total resistance is first calculated using Eqs. (1) and (2). Both equations are also used to determine the voltage reading point via Arduino. The amount of resistance used is designed so as not to have a load of more than 1 mA on the circuit and also the voltage signal transmitted to Arduino is not more than 5 V. 5 6 Equation (1) is used to ensure that V inAr in Eq.
(2) has a value of 5 V by determining the multiplier coefficient (CV). To obtain CV, R inAr is divided by the total resistance. Then, CV is multiplied by the fuel cell voltage (V fc ). In this study, the open voltage of the fuel cell can reach 38 V, so the value of V fc used is 40 V for safety. If the calculated V inAr is close or equal to 5 V, it indicates that the resistance is suitable for handling fuel cell voltages. As shown in Fig. 1, the circuit is connected to Arduino via point D. Before the voltage sensor is used, the calibration process is carried out manually. The tools used for the calibration are a voltmeter (multimeter), voltage sensor, power supply, the Arduino board, and a computer. A schematic of the arrangement of the tools used for calibration is shown in Fig. 2.
In the calibration, the multimeter is a reference tool used to compare the measured values of the voltage sensors. Calibration is carried out by supplying a voltage of 0 to 33 V from the power supply to the voltage sensor. When the voltage is applied, the voltage across the sensor is measured using the multimeter and then recorded. At the same time, Arduino also measures the voltage on the sensor as an integer value ranging from 0 to 1023, which in this paper is called the raw value. Both values are recorded in Microsoft Excel and plotted on a graph. Then, using the trendline feature of Excel, the formula for calculating the voltage value measured by Arduino is obtained. The formula is then applied to measure the voltage with Arduino. If the voltage values from the calculation and the measurement by the multimeter have a very large difference, the previous calibration steps are repeated until the calculated voltage value is close or equal to the measured voltage value. A flowchart of the calibration steps is shown in Fig. 3.
To calculate the current value that Arduino obtained from the current sensor, a formula based on the coefficients obtained from the sensor datasheet is used. In contrast, the temperature sensor is calibrated using a library that is already available on Arduino. Every time Arduino is turned on, the temperature sensor is calibrated immediately using the library.
Before all the previously mentioned components are assembled together, both the main components and the supporting components are tested to ensure that each component works properly. After that, the assembled components are tested to check that they work properly when turned on at the same time. Figure 4 shows a schematic of the prototype circuit.   As shown in Fig. 4, each sensor and actuator are connected to Arduino. The MAX3850K sensor is connected to a level shifter to protect the sensor board from voltage differences with Arduino, and each data line from each MAX3850K sensor board is connected to a 4.7 kΩ resistor and a 3 V connection from the level shifter. Then, the shared data line is connected to digital pin 2 (D2). The ACS712 sensor is connected to analog pin 5 (A5) and the output of the sensor is connected to the load of the fuel cell. The voltage sensor, which comprises a series of resistors, is connected to Arduino pin A0, while the output is connected to the fuel cell load. In addition to sensors, there are also actuators in the circuit. There are two motor driver modules: one has an attached solenoid valve as the purge valve in the fuel cell and the other has two fans attached to drive the fuel cell fan. The motor driver module is supplied with a 12 V power supply. The motor driver module for the purge valve is connected to Arduino pin D9 and the motor driver module for the fans is connected to pin D10. The two pins used for the motor driver module are PWM-type pins. To build the prototype, screw terminals are used to connect each cable and wire.

Arduino Sketches
Arduino Yun is programmed using Arduino Integrated Development Environment (IDE) software. The language of this software is a simplified form of C++. Sketches is the name of a program written using the Arduino IDE software. In this system, a written "sketch" contains libraries, variables, and commands allowing Arduino to manage sensors and actuators, as well as enable communication between the MCU and MPU.
First, the sketch initializes all the libraries and variables used. Then, a bridge to activate the communication path between Linux and the MCU is turned on. After that, Arduino reads the values of the interval time and purge time of the purge valve on the SD card. In the loop mode, Arduino applies these values to the motor driver to drive the purge valve. Then, all the sensors begin to acquire data and Arduino records each data into the SD card. The data are saved as a CSV file. When there is a change in the value of the interval time or purge time, a specific command prepared in the sketch accepts these values and Arduino applies the values to the purge valve. In addition, the values are also saved to the SD card.
The data are logged periodically every hour. Data files are named on the basis of the date and time the data are taken. Temperature, voltage, and current data are recorded. For each recorded data, the time of collection is also recorded with the data.

UI
The UI is created using HTML. The scripting language used is JavaScript. The UI is embedded in Google Sites and can be accessed via the internet. The designed UI has three tabs, a calendar, and a button to select files. The calendar is used to select a file and sheet name that users want to display. The desired sheet is selected on the basis of the selected hour in the calendar. The three tabs are the Data Table tab, Data Plot-Graph tab, and Setting Tab. The design of the UI is shown in Fig. 5.
The Data Table tab is used to display data in the form of a table. The columns of the table show the timestamp, temperature, current, voltage, and power. The Data Plot-Graph tab displays historical graphs for each type of data. To display graphics in HTML, a library called Flot is used. In Flot, there are many examples of suitable graphs and this library uses the JavaScript language that matches the UI created. To use the Flot graphs, it is only necessary to modify the given example and use the appropriate library. The Setting Tab is used to change the interval time and purge time of the purge valve. In this tab, there are two inputs where the values of the interval time and purge time can be entered.

Data management
All data from the sensor are recorded by Arduino into the SD card. Then the data are sent to be stored on Google Drive in the form of a Spreadsheets file. When the data are sent to Google Drive, each row of recorded data is sent one by one. A Python-based data server is created to transmit the data. The data server is built in an MPU that runs Linux and has a full Python 2.7 installation. A web framework for Python called Flask is used to build the data server. Data are sent using Hypertext Transfer Protocol (HTTP) communication. On Flask, HTTP tasks are executed using a library called Requests. In this library, the HTTP methods used are GET and POST. HTTP POST is used to send data to Google Drive, while HTTP GET is used to retrieve data from Google Drive to set the values on the purge valve.
On the internet side, data are managed by Google Apps Script, hereafter referred to as Apps Script. Apps Script receives the data sent by Flask and then manages the data storage on Google Drive. Apps Script was programmed in advance to save the data in the form of a Spreadsheets file and arrange the data according to the time retrieved. Apps Script also manages the data displayed on the UI; the data displayed are the data selected by the user through the calendar. A flowchart of the two steps described above is shown in Fig. 6.
To set the purge valve timing value, values entered in the Setting Tab of UI are saved in a Spreadsheets file; this step is also performed via Apps Script. Then, when Python detects a new value, it downloads the value in CSV format. The downloaded value is then sent to the MCU on Arduino via the communication socket and applied as the purge valve time value.

Implementation and Results
After assembly and testing, the prototype is then used to retrieve data from the fuel cell stack. The results of the assembled prototype are shown in Fig. 7. Figure 8 shows the setup of the experiment conducted using the prototype to retrieve the data from the fuel cell stack.
The experiment is carried out using a fuel cell stack with a capacity of 200 W. The data taken are temperature, current, and voltage. The data are taken at the same measurement point as the fuel cell test machine, which is used to conduct experiments on fuel cells in this lab. During the experiment, the data server actively sends data to Google Drive. The command prompt of Flask sending the data to Google Drive is shown in Fig. 9.
The orange rectangle in Fig. 9 shows the feedback messages indicating that the data are successfully sent to Google Drive. The delay time experienced is 3 s. Then the data are transferred into the appropriate Spreadsheets file by Apps Script. With the data saved in the Spreadsheets files, it is easier to access the data. In addition, there is a UI to display the data via    the internet. The Google Sites homepage used as the UI is shown in Fig. 10. As previously explained, the data in the UI can be displayed in the form of tables and graphs, as shown in Figs. 11 and 12, respectively.   The plotted graph shows historical data from the selected file. There are three types of graphs, namely, temperature graphs, current and voltage graphs, and power graphs. Graphs for historical data are plotted in the Data Plot-Graph tab.
The Setting Tab is used to enter the purge valve time values as shown in Fig. 13. To set the time, the user must enter the desired time value, then click the "OK" button. After that, the values are saved as a Spreadsheets file. Flask obtains these values and sends them to Arduino. Arduino then changes the interval time and purge time of the purge valve. Figure 14 shows a message in the command prompt acknowledging that the values have been accepted by Arduino, and the Arduino serial monitor also shows that the time value has been changed in accordance with the given value. Arduino takes 6 s to update the values of the purge valve.

Conclusions
A DAQ with remote setting capability for a fuel cell stack was made using Arduino Yun. A prototype was made using Arduino Yun, a temperature sensor, a current sensor, and a voltage sensor. The system was also equipped with a remote setting feature to change the time values of the purge valve. The settings are changed through a UI that was also made along with the prototype. The UI was created using HTML format. The data are sent to Google Drive via Flask, a Python web framework. In Google Drive, data are organized via Apps Script, so data can be stored according to the time of retrieval. It takes 3 s to send data from Arduino to Google Drive, and Arduino takes 6 s to update the time values of the purge valve. As the data are saved in Google Drive and can be accessed through the internet, the data can be provided anytime and anywhere for every user. In addition, the remote setting feature used to modify the interval and purge time of the purge valve enables the system to be IoT-based.