Development of a Low-Cost Data Acquisition System for Biodigester

The objective of this work is to develop a low-cost data acquisition system, which aims to optimize the anaerobic biodigestion process in an Indian model biodigester prototype, by monitoring the main parameters of the process. In this development, we decided to create a system from scratch, including the entire measure-process-show procedure using hardware tools and free software as means of reducing costs. This platform must be capable of obtaining analog data from the sensors arranged in the biodigester in long periods for the creation of more accurate reports. The system must be able to send this information to a Web server, so these values can be continuously tracked anywhere with access to the internet. The monitoring must be done in a hybrid application for Android, iOS and web browser.


Introduction
In the process of data acquisition, a real-world physical phenomenon is received, transformed into an electrical signal, which is measured and converted to a digital format through processing, analyzed and stored by a computer. In the vast majority of applications, data acquisition systems are designed not only to acquire data, but also to act controlling for later visualization, storage, processing and analysis [1] [2] [3] [4] [5].
Commonly, the data acquisition system used is called Datalogger [6], in industrial and agricultural automation processes. This is designed for the acquisition and recording of data over a period without human intervention in this collection. The data are passed to the Datalogger in analog or digital quantities Journal of Sustainable Bioenergy Systems from sensors. These data in analog magnitude are converted to digital, in order to allow them to be measured in mathematical quantities and then processed by a controller and stored [7].
On the other hand, studies focused on industrial automation are very limited due to the high cost and time demand. In this context, the development of low cost data acquisition systems is seen as a promising alternative for the refinement and consolidation of this technology. Therefore, the objective of this work is to develop a low cost data acquisition system, which aims to optimize the anaerobic biodigestion process in an Indian model biodigester prototype, by monitoring the main parameters of the process.
In this development, we decided to create a system from scratch, including the entire measure-process-show procedure using hardware tools and free software as means of reducing costs. This platform must be capable of obtaining analog data from the sensors arranged in the biodigester in long periods for the creation of more accurate reports. The system must be able to send this information to a Web server, so these values can be continuously tracked anywhere with access to the internet. The monitoring must be done in a hybrid application for Android, iOS and web browser.

Organization of the Work
This paper is organized as follows: the general and specific objectives of the project will be described in Section 2, the sensors and the technology used, which will be necessary for the execution of the project, are discussed in Section 3, whereas the results will be described in Section 4 and, finally, the conclusions of the paper in Section 5.

Objectives
The objectives of this work are presented in the form of general and specific objectives.

General Objectives
Develop a system for low-cost data acquisition, which aims to monitor the process of anaerobic biodigestion in biodigesters.

Specific Objectives
• Study programming tools and software development; • Understand the operation of temperature, pressure, pH and methane gas sensors; • Implement a system of data acquisition of sensors and its storage; • Present data read from sensors arranged in a multiplatform biodigester from the internet.

System Architecture
The operation of the system is described in Figure 1, from the data acquisition  until its monitoring by the user through the application.
Temperature, pressure, pH and methane gas sensors are arranged in the monitored Biodigestor, according to the specification of where the data must be read.
The sensor information is acquired by Rapberry Pi (RPI) that follows its particular forms of communication. All processing and control of these read data is RPI's responsibility. In it, the data is treated, converted, filtered and stored in a local database. It also runs a RESTful service, which makes available the data stored in the database in JSON format, for use in a Web Service. We created a web application to receive this data and show in real-time the sensor readings in the biodigester acquisition system. Additionally, it can be used to generate reports and graphs according to previously read values.
This way, there is a real time monitoring of the application with all the data that were and will be acquired over time, thus allowing better monitoring and management of the read data.
The sensor used in this project is an encapsulated version with wire exit and waterproof for use in distant environments and in wet conditions.
The sensor operates at temperatures up to 125˚C, and the PVC cable that covers the wires supports up to 100˚C without degradation of the digital signal with the sensor information. Due to these characteristics, this encapsulated model is suitable for the prerequisites of use in the system and it can be seen in

Digital Pressure Sensor BMP180
The BMP180, shown in Figure 3, is a digital pressure sensor that came to succeed the BMP085 in a new generation of sensors with high digital accuracy. This Figure 2. DS18B20 encapsulated and waterproof [8]. sensor produced by BOSCH has been optimized for applications in mobile systems such as PDAs and GPS navigation. It uses the I2 C communication protocol for easy integration with microcontrolling systems as well as computational ones. It is based on piezoresistive technology that gives it high robustness, accuracy and great time of use [9]. This sensor takes readings between 950 and 1050 hpa working at a temperature of 25˚C, giving it an accuracy of 0.12 hpa. This read pressure is internally converted to altitude by using an international formula described in Equation (1), where p is the pressure read and po is the base pressure for the calculation.
BMP180 operates with voltages between 1.8 and 3.6 V, but it can be powered by a voltage of 5 V, however it is recommended to use a regulated voltage of 3.3 V. It also has an internal temperature sensor and it is fully calibrated. It has a high speed of reading and conversion, which can take 4.5 ms between samples. The BMP180 was designed to be connected directly to a controller and to communicate on an I 2 C bus. This is made up of a piezoresistive sensor, an analog to digital converter, a control unit, an E2PROM and a serial I 2 C interface. The E2 PROM has stored 176 bits of data for individual calibration. It is used for temperature and pressure compensation [9].

MQ-4 Gas Sensor
The MQ-4 gas sensor was created for use in the detection of gas leaks in equipment and in industry. Its greatest suitability and sensitivity is to detect methane (CH4) and natural gas (LPG), but it can also be used in the detection of alcohol and smoke. It works with voltages of 5 V and detects concentrations between 200 and 10,000 ppm (particles per million) [10]. In the context of the application it is necessary only to read methane gas in ppm to calculate the concentration of gas in the biodigester, in order to monitor the process and the amount of gas production. The output of this sensor is analogous in nature following a sensitivity curve, characteristic that can be observed in Figure 4.

pH Sensor
We used a pH sensor kit from Atlas Scientifc composed of a pH sensor, Figure  5(a), and an EZOTM circuit, seen in Figure 5(b), to read the pH values. The sensor performs pH readings between 0.001 to 14.000 with resolution of ±0.002 and it communicates directly with a microcontroller or computer system via an asynchronous serial UART connection or via I 2 C. It works with input voltages between 3.3 V to 5 V with an average consumption of 0.995 mA in 3.3 V [11].
The pH Probe directly connected to the EZO circuit provides, directly to the protocol being used, the pH value at its set value without the need to manipulate the read data, since the sensor is pre-calibrated.

MCP3008 Analog-to-Digital Converter
Analog-to-digital converters are devices that convert analog input voltages into digital codes as output. This generated code can be used directly by digital devices as in microcontrollers and computers. The use of analog-digital converters has its application in the reception of values coming from analog nature, such as temperature sensors, for the use of this data in digital systems.
The MCP3008 has a 10-bit resolution digital-analog converter, which can receive up to 8 separate and parallel analog inputs with an SPI communication interface. It can receive and treat the 8 analog inputs digitally [12] using a Journal of Sustainable Bioenergy Systems communication language from this interface. The MCP3008 is used in applications when the digital system that will process analog level information does not have an internal A/D converter. Another use for it is when the system already has A/D converter, but not enough for the application [12] [13].

Raspberry Pi
Raspberry Pi, shown in Figure 6, is a small computer developed by the Raspberry Pi Foundation, a British charity organization, in order to stimulate the study of computer science. The computer components were selected in order to optimize the cost. It is a very simple instrument, but capable of performing several specific tasks.
Raspberry Pi's great advantage is that there is not only one way to use it. The user defines how it will be used and has the ability to perform several functions, such as just watching videos and browsing the internet or using them to control a home automation system. This hardware platform is extremely flexible, which enables a multitude of applications [14].
Launched in 2011, this small computer has established itself as a great lowcost alternative to Linux-based systems. More than 2 million devices have been sold since its launch and they have been worked on in many areas, especially educational and professional ones [15].
The RPI does not use hard disk, having an SD card with capacity greater than or equal to 8 GB as secondary memory. The operating system, as well as the user files, are stored in this card. It has a network interface controller (NIC) with a standard RJ-45 ethernet connection, enabling a connection to the Internet or just a local area network. It has two video outputs, one HDMI output and a second RCA video output. It even has two USB ports and one audio output. It Figure 6. Raspberry Pi 1 Model B [18]. Journal of Sustainable Bioenergy Systems has eight programmable general purpose input/output (GPIO) pins, which can be connected, for instance, to sensors, motors or relays (switches controlled by electricity) to control other equipments. The model 2 of the device in its version B is used in this project, which has the following specifications: • Architecture: Quad-core ARM Cortex-7; • CPU: 900 MHz; • RAM: 1 GB; • GPU Broadcom VideoCore IV; • Chip: Broadcom BCM2836 SoC; • Connector for GPIOS with 2 × 20 pins; • Camera connector; • Display connector.

Database
There are several ways to store data, for using it in applications or after them, such as organizing in text files, in .csv formats for direct processing in spreadsheets, as well as in relational or non-relational databases. This choice must be taken into account according to the needs of the application developed.
Databases have been used since the beginning of computing and undergo a constant evolution, always changing, updating and evolving according to the needs. In this update context, relational databases have emerged in a data collection stored and interconnected with multiusers needs in different sessions, while maintaining data reliability, integrity, and availability of these data. Broader access, data integration, ease of access and reduced data redundancy lead to a constant use of these databases. It is necessary a software which allows the management of this information. This is the Database Manager System. This is responsible for all input, output, and logic interactions involved in data management [16].
The MySQL database management system (DBMS) is used in this application.
This is a free tool created and maintained in the base of free software, with great benefits in use, such as: quality, robustness and security. This is the most famous DBMS in the world and widely used in web applications for being fast and efficient.

Web Server
The data received from the sensors and processed by Raspberry Pi are sent directly to a web server, which was used to make the data acquisition available in a distributed and immediate way. Web server is a specific software for displaying files to clients connected on the same network. These data are in HTML and use protocols such as HTTP in most contexts. These are responsible for making websites and content available on the internet. Some examples are Apache, Tomcat and Nginx servers [17].
Apache Server is used in this application. It receives the information directly from the Raspberry PI, it is stored in database and made available to applications later. The information acquired from the sensors was saved in a local and remote database, both of them used MySQL as DBMS. The wireless internet network available on the campus was used to send this information to the remote database.

Biodigestor
The search for efficient alternative means of production has become commonplace in scientific and industrial production with the imminent cessation of fossil fuels. Means of obtaining energy from, for instance, wind, the sun and the water movement were created in this context. Ways of using biomass for the energy generation were created in this environment as well. It can be found in the most diverse forms in nature such as firewood, residues generated by agricultural crops, animal husbandry and municipal solid waste [18].
In the use of residues, such as those produced by animal husbandry, anaerobic biodigestion has been gaining strength in the use of this biomass in the implementation of biodigesters for energy generation, as well as biofertilizers [19].
There are two extremes in the use of biodigesters, they are the Indian and Chinese models. The Chinese model seeks the creation of biofertilizers for use in food production. The Indian model is used, in the best form, for the production of biogas [20].
The monitored biodigester is a prototype constructed from PVC pipes (polyvinyl chloride) following the Indian model that exalts a higher production of biogas. It could be constructed at a low cost due to the ease of finding the materials and it allows the use of the study of the variables in a bench-level for the continuous improvement of the anaerobic digestion process [21].
The built prototype is based on the Indian model, because this type of model has an extraordinary capacity in the waste treatment, as well as in the production of biogas and biofertilizer. The measures adopted in the construction of the prototype can be visualized in Figure 7.  • M: length of inlet pipe whose diameter is 32 mm = 46 cm • M: length of the outlet pipe whose diameter is 32 mm = 42 cm • P: partition wall height = 20 cm Figure 8 shows the biodigestor constructed and instrumented with the sensors for data acquisition.

Hardware Specification
• For the proper functioning of the system for data acquisition, a determining factor is the type of hardware to be developed in detriment of the environmental factors of its place of operation. In anaerobic biodigesters, the places for monitoring are generally in open environments and at high temperatures, unprotected against rainfall and away from the power grid and the internet.
These factors must be taken into account when specifying the hardware components used. Taking into account the objectives of the work to the detriment of environmental issues of application, the hardware to be developed must have some prerequisites: • Robustness: Inherent characteristics to the environment, such as the ability to withstand high temperatures and humidity, must be supported by the hardware, as well as restoration capacity in cases of failures, such as a momentary power interruption.
• Self-management of data: The hardware must allow the acquisition of information from the sensor at defined intervals, so it can be acquired, processed and stored without human interference, and in the event of a failure, reorganize itself in a way that will not lose information, which are the most important assets of the application.
• Storage: Information must be stored over long periods, which requires sufficient storage capacity to supply this demand for information according to the time defined.  • Interoperability of protocols: The hardware must allow communication with peripherals (in this case, sensors) in various communication protocols to receive and process the information coming from them.
• Internet communication: In order to access the information acquired in the biodigester in continuous monitoring, the hardware must allow this information to be sent over the internet, so that it can be made available to the application once the reading is carried out in the field.
• To solve this problem in relation to the established points, there are several platforms and means to solve them, we could use a microcontroller, such as Arduino. However, some peripherals should be used to obtain all the proposals. It would be necessary to use Shields, as a Real Timer Clock (RTC) to determine the time, a GPRS, for internet connection, and a SD, to record information. We use a small computer, Raspberry Pi, in order to needs to be satisfied and still with some additional means, which give greater capacity to construction.
• The RPI does not have an internal analog-to-digital converter, which is required for the application. For this, we include the MCP3008 analog-digital converter of the microchip. • All sensors were connected to the RPI, as shown in the electrical scheme defined in Figure 9. The DS18B20 temperature sensors communicate via the 1-wire bus with the RPI, each one of them has a specific address defined by the protocol for different readings of temperature values. The BMP180 pressure sensor communicates with the RPI via the I2 C protocol, and the analogue pH and methane gas sensors (MQ-4) are connected to the analog-todigital converter MCP3008, which in turn communicates with the RPI via SPI, passing the information in digital values for treatment in the control system.

Software Specifications
We take into consideration the construction of two platforms in the development of the software logic for this data acquisition system. One to acquire, process and deliver the data and another one to receive these data and to show in a customized interface to the user.
We used the python programming language for its development in the acquisition application. This is a high-level, object-oriented, dynamic typing, strong, interpreted, and interactive language. It favors readability and makes itself more productive with clear and concise syntax. It is open source and used in the creation of systems and also as a scripting language in various software [22].
We have built a hybrid application from the mobile application framework, Ionic, to develop an agile, intuitive and efficient interface for monitoring the data by the user. It has an interface layout built to fit the devices natively and responsively.
Having a clean and efficient design when we run the application as a fundamental feature. Currently, there is a high demand for the creation of compatible P. F. S. Teixeira et al. applications with at least most of the various existing software platforms. In this context, platforms were created for hybrid application development, such as Phonegap. On these platforms, web applications that run within a browser on the device are created. The browser is included in the application, and it is adapted to each platform at the time of compilation. In this way, a single application can run on several platforms. This is how the Ionic Framework was created, in 2013 [23].
The framework includes a set of visual elements that are identical to the native ones. Ionic is responsible for the interface and the way the data is shown. We used the AngulaJS language to receive data from the sensor, its treatment, interaction with the user and all the logic involved. This is a framework maintained by Google and works as an extension to the HTML document, which adds new parameters and interacts dynamically with various elements. This language makes use of directives to change the standard HTML behavior, it makes the connection between the visual created in Ionic and the logic that must be developed in the application [24].

Results
The monitoring of the parameters of anaerobic biodigestion is of fundamental importance, both for the process and to improve the results achieved, according to the literature. These parameters include: temperature, pressure and pH.
According to [25], the monitoring and accompaniment of the data provide optimum conditions of activity, help in a better use of the organic residues and, consequently, improve the production of its by-products, biogas and biofertilizers, besides contributing in the fermentation process of the bacteria.
The temperature is the most relevant among the several factors that interfere with anaerobic biodigestion, as shown previously, due to the different ranges of microbial growth. According to Bischofsberger et al. (2005), fermentative bacteria reach a maximum growth rate of 100% in the mesophilic conditions, between 20˚C and 45˚C, considering 36.5˚C as the ideal temperature. On the other hand, thermophiles reach maximum growth at temperatures higher than 45˚C, being ideal around 56˚C.
In Figure 10 an initial screen of the application was shown being run on an Android operating system tablet. It shows the location where the User must enter the address of the server where an application is hosted. After entering the information, the application receives the data that was acquired as representation in Figure 11.
Analyzing the data obtained during the temperature monitoring both in the campanula and in the digestion chamber (Table 1 and Table 2), it is noticeable that temperatures remained within the expected throughout the experiment, creating optimal conditions for the development of bacterial activities, contributing to the production of biogas and biofertilizer.
Given the data collected, we sketched a graphic with the minimum, average    and maximum values of temperature, during the 20 days of reading of the system. This graph is shown in Figure 12. It is possible to perceive the temperature variation in the two sensed locations in the biodigester throughout the day.
In Table 1 and Table 2, we have the temperature values read by the sensors located in the campanula and digestion chamber, respectively, between June 9th and 15th, at 9:00 PM, 3:00 PM and 9:00 PM, according to Brasilia time and following the specifications of the WMO (World Meteorological Organization) of the ONU. Below the temperature readings, we have the average temperature in the day, taking into account the three times read.
These changes did not affect the capacity of methanogenic bacteria to produce biogas, although there is variation in temperature, as can be seen in Figure 12.
We can observe that methane production already occurred at the beginning of the data collection, with its higher production in the fourth week of analysis, due to favorable weather conditions.
In Figure 13, we have data on the temperature in the campanula of the monitored biodigestor, demonstrating the maximum, minimum and average values , as well as a graph of the temperature as a function of time.
In Figure 14, we have the data on atmospheric pressure in the monitored biodigestor, which shows the maximum, minimum and average values, as well as a graph of temperature as a function of time.
The values read from the pressure in the campanula are shown in Figure 15, with the maximum, average and minimum values during the 20th day of acquisition. Figure 16 shows a graph generated from the application and saved locally Journal of Sustainable Bioenergy Systems  from the weekly methane gas production summary. We can note that the production had a growth since the beginning of the data collection and that had its Journal of Sustainable Bioenergy Systems  greater production in the fourth week of production and monitoring of the biodigester. Figure 17 also shows a summary of the pH values in the monitoring period, which proved to be very stable, favoring the bacteria that perform the digestion of the biomass for biogas production.
Another factor that affects the bacteria involved in the process drastically is the pH. According to the literature, its value ranges from 6.0 to 8.0, with pH 7.0 as the optimum point. Analyzing the data obtained during the analyzes (Figure 17), we can conclude that the pH remained within a range expected in the literature throughout the experiment. It is important to highlight that biogas production was very significant in the fourth week, in which the pH was closer to 7, as we can see in Figure 16.  Analyzing all the graphs, we realized that it is possible to make an optimization of the system, due to the existence of a peak of biogas production in the fourth week of experiments. We believe that we would be able to further improve production if there was better control in the reactor under study (what the acquisition system allows), which enables us to study reactor control systems in future works.
On the other hand, the system showed an appropriate behavior in relation to the objectives set out in the development of the application, which was to monitor the data coming from a biodigester in a simple and efficient way. By sending this information to the internet, the continuous and uninterrupted monitoring of the information received from the RPI by the sensors installed in the biodigester became possible. We can have direct and momentary information with this continuous monitoring, according to the application interactions of the biomass and environmental factors, such as temperature.
The hardware presented efficient behavior when it comes to sensor data acquisition and restoration of normal functions, even in the face of power outages. The monitoring system built on a hybrid platform allowed the tracking of information, both in the web browser and on the Android mobile platform installed, making it easier for users to receive information. For the improvement of the system in future works, we must let it self-sufficient energetically by using batteries in order to avoid losing data in the event of a power outage.

Conclusion
In general, we can say that all the objectives were achieved. Through this study, we built a functional data acquisition system with low cost materials and they are easy to acquire in the local market. Thus, we see the system as a feasible and easily implementable alternative for the experimental research on monitoring the anaerobic biodigestion process for the production of biogas from biomass, reducing the temporal and material cost of the research.