Design of a Portable Digester and Prediction of Biogas Yield Using Artificial Neural Network ()
1. Introduction
The increasing world population and urbanisation have increased the need for energy, and over 80% of the world’s energy is being supplied by fossil fuels [1] [2]. Extensive extraction of fossil fuels has dwindled their reserves while at the same, high-levels of carbon emissions are generated in the process leading to poor air quality. These are even higher because of such factors as affordability, infrastructure, and energy security concerns of developing countries [3] [4]. This has caused renewable energy sources to suffer even as the world tries to push the Paris Accord and others similar to it for their use [5] [6]. This shift is therefore important if the world is to keep sustainable development goals on affordable and clean energy (SDG 7) and climate action (SDG 13) [7] [8].
However, the increase in waste generation worldwide, especially involving organic waste from agricultural activities, will create a set of environmental issues related to land-use problems, pollution, and climate change [9]. Organic wastes disposed of in landfills undergo methanogenesis, releasing methane with a global warming potential many times that of carbon dioxide. Subsequently, phasing out conventional energy sources and focusing instead on clean alternatives like biogas will help to mitigate those effects [10]. Hence, through this environmental waste conversion into energy by means of advanced technologies like anaerobic digestion, societies shall become economically self-sufficient while lessening their dependence on variations of global energy prices [11]-[13].
The increased efforts by researchers have shifted attention towards renewable energies to address these pressing issues. Anaerobic digestion (AD) of organic matter like agricultural wastes, kitchen wastes, and animal dung produces the biogas, which contains mainly methane (CH4) and carbon dioxide (CO2). It is a sustainable biofuel, and can be produced at 35˚C - 45˚C (mesophilic) or 50˚C - 60˚C (thermophilic) with hydraulic retention times of 12 - 25 days [14]-[16]. Global production of biogas and biomethane increased by 17% to 1.6 exajoules, while in 2022, about 70% of the biogas plants in Europe were incorporated within agricultural systems, showing its potential for rural and off-grid applications [17]. In the study conducted by Haque et al. [18], the performance of a PVC biogas digester with cow manure at varying feeding intervals was evaluated. Compared to daily feeding, a 4-day feeding interval increased biogas and methane outputs by 34% and 28%, respectively. Anaerobic digestion reduced the total viable count by 2 - 3 logs. They provide practical advice on optimising feeding for digester efficiency and sanitation.
Technology has greatly helped in increasing methane yields; in waste-activated sludge systems, microwave and alkaline pretreatments can increase biogas production by up to 150% compared to untreated controls [11] [13] [14] [16] [19] [20]. Liu et al. [21], found that microwave pretreatment of substrates increases cumulative methane generation by about 50% in sludge and food waste co-digestion systems. Khan & Ahring [16] investigated the effects of pretreatment methods, such as the physical, chemical, thermal, and thermal-alkaline pretreatments in semi-continuous bioreactors to enhance anaerobic digestion of manure fibres. The highest methane yield conversion was approximately 127%, while the volatile solids conversion increased by 42.2%. Machine learning algorithms like support vector machines, ensemble trees, random forest, and Gaussian process regression have improved biogas yield forecasts in high-solid anaerobic digestion [2] [22] [23].
In parallel with engineering developments, data-driven modelling has become essential to AD performance optimisation. Although mechanistic models like ADM1 provide deep system insights, their complexity and computational cost limit their real-time use [23]. Thus, Artificial Neural Networks (ANN) have gained popularity as flexible and scalable approach with which non-linear combinations between process inputs (temperature, organic loading, retention time) and outputs (biogas yield) can be modelled [24].
Recent studies have indicated the accuracy of ANN models for prediction of biogas production Tufaner & Demirci [25] showed scalable ANN predictions for hybrid reactors, and explainable machine learning frameworks are essential for AD dynamics, fault detection, and operational optimisation. Also, Li et al. [26], demonstrated the potential of ANN, deep feed forward backpropagation and deep cascade forward backpropagation network models for improving biogas yield production. The input parameters were the ratios of soluble and total chemical oxygen demand as well as the ratios of volatile to total solids as input parameters. Duan et al. [27] used a user-friendly optimisation and data-driven approach to improve on the efficiency and sustainability of an organic waste to energy transformation process to increase the biogas yield in a water treatment plant. Lalhriatpuia et al. [3] developed and evaluated a novel tumbling-based mixing design to enhance biogas yield and composition. The response surface methodology and improved grey wolf optimizer with ANN were employed to evaluate and predict the effects of temperature, mixing duration, and feedstock composition. Pradhan et al. [28] applied ANN for predicting and optimising cumulative methane production from agricultural solid wastes and obtained excellent accuracy with R2 up to 0.9985 in the validation period. Similarly, Suberu et al. [29] developed an ANN model for the prediction biogas generation from co-digestion of cattle and poultry droppings. Correlation coefficients of 0.9653, 0.9842 and 0.9245 were reported for the training, test and validation sets, respectively.
Despite promising progress, critical gaps remain. Most ANN models are calibrated using lab-scale or pilot-scale data, restricting their applicability to full-scale feedstock variability and process dynamics. Local feedstocks like cow dung and mixed agricultural leftovers are not integrated, especially in developing nations. The selection of suitable network designs, prevention of overfitting, and model stability under varying operating conditions, like input fluctuation and energy demand cycles, are neglected.
2. Methodology
A portable biogas digester was designed for the generation of biogas and for the attachment of various sensors for data collection and monitoring of the biogas generation process.
2.1. Digester Design
2.1.1. Design Considerations
1) A fixed dome cylindrical batch type digester was selected for the study.
2) The substrate used was cow dung using a mixing ratio of 1:1.
3) A 63 Litre High Density PolyEthylene (HDPE) drum was selected for the construction of the digester because HDPE does not corrode. The choice of HDPE was also made because the drum will be easy to drill in order to insert sensors for the process monitoring (Figure 1).
4) Total Solids of cow dung = 17535.55 mg/L (60.1%) and Volatile Solids (VS) = 20058.12 mg/L (68.6%) was obtained from a previous study by Olugasa et al. [30]
5) Hydraulic Retention Time (HRT) of 21 days was selected since the digester operating temperature was about 40˚C, which is slightly above mesophilic conditions. Mesophilic, with operating temperature of 30˚C - 37˚C usually utilizes HRT of 30 - 60 days; while Thermophilic, 50˚C - 55˚C operating temperature utilises HRT of 15 - 30 days [31].
2.1.2. Determination of Digester Volume
The volume of the digester has been selected as 63 Litres going by the nature of the study, which was to model biogas yield. The size of the digester is therefore adequate for the study.
The volume of the digester was estimated using Equation (1):
Volume of a batch type digester is equal to the volume of the slurry Vsl
(1) [32]
Wsl = Weight of slurry;
= Density of water
1000 kg/m3.
Working volume of digester, Vd = 0.040 m3 = 40 Litres.
Since most digesters operate at 75% of the maximum capacity of the digester [33]. Therefore,
VTotal = Vd/0.75 = 53.33 litres
2.1.3. Estimation of Total Solids
The Total Solids (TS) was calculated using Equation (2)
(2)
where Wcw = Weight of wet cow dung;
TS% = Percentage of Total solids = 60.1%;
TS = 20 × 60.1/100 = 12.2 kg.
According to Kusmiyati et al. [34], 1 kg of cow dung will generate 30 - 36 L (0.03 - 0.036 m3) of biogas. It is expected that 20 kg of cow dung will generate 20 × 0.036 m3 of biogas = 720 Litres of biogas. A tyre tube which served as a gas bag was therefore attached to the digester as an additional storage space.
2.1.4. Estimation of Volatile Solids (VS)
The volatile solids added in one batch VSbatch can be estimated by Equation (3).
VSbatch = TS × fVS(3) [35]
where fVS = Volatile fraction;
Fvs = TS/VS = 17535.55 mg/20058.12 = 0.8742;
VSbatch = 12.2 × 0.8742 = 10.67 kg.
2.1.5. Determination of the Organic Load (OL)
The organic load of a batch digester is expressed per batch volume. This is expressed in Equation (4)
(4)
2.1.6. Design of Stirrer
A stirrer made from a network of PVC pipes of 2 cm diameter was used to agitate the slurry in the digester. The length of the stirrer was estimated to be at a distance H/25 from the base of the digester as prescribed by Olugasa et al. [36], where H is the height of the digester. The diameter was determined using Equation (5)
(5)
here Ds is the diameter of the stirrer and D is the diameter of the digester [37].
2.1.7. Auxiliary Parts
Slurry Influent and Effluent pipes
The influent and effluent pipes were made of PVC since they are not susceptible to corrosion due to the moisture and alkaline conditions in the digester [34]. The diameter of the influent pipe was 11.5 cm so that it is wide enough to prevent clogging of the pipe when the substrate is being loaded into the digester. However, the diameter of the effluent PVC pipe was 10.5 cm which was slightly smaller than that of the influent pipe. This diameter is adequate because the effluent is composed of materials that have been broken down already by the methanogens.
PVC Ball valve
A PVC ball valve was attached to a brass connector at the top of the digester, which served as the gas outlet. A flexible hose was in turn attached to the valve and connected to a tyre tube. The PVC ball valve and the brass connector are corrosion resistant.
Digester stand/wheels
The digester was mounted on a mild steel stand fitted with four wheels to make it portable.
2.1.8. Fabrication of Digester
The drawings of the designed biogas digester were produced (Figure 1 and Figure 2) and subsequently fabricated using a 63 Litre drum, pipes and pipe fittings, valves. Holes were drilled in the drum to allow the insertion of pressure, temperature, pressure, PH and biogas yield sensors (Figure 3). The wheels of the portable digester were fabricated from steel and painted to prevent corrosion.
(a) (b)
Figure 1. Views of the digester.
Figure 2. 3D diagram of the digester.
Figure 3. Biodigester fabrication in progress.
2.2. Design of ANN
2.2.1. Problem Specification
The problem to be solved by the model was identified and the degree of accuracy required was determined. The model was set to predict the outcomes of anaerobic digestion of substrate using full-scale plant experimental data. The degree of accuracy of the model was evaluated using the Mean Squared Error (MSE) and the Correlation coefficient (R).
2.2.2. Data Preparation
Cow dung, which was mixed with water in ratio 1:1 was used as the substrate and fed into the digester for biogas production (Figure 2). The data used for developing the ANN models was collected from a data logger attached on the designed biogas digester which was situated at the Dairy Unit of the University of Ibadan Teaching and Research Farm (UITRF) and downloaded on the mobile phone set aside for this study. The data required for the neural network models were the input data and output (or target) data. The input sets were: mass of substrate (S), Total Solid (TS), Temperature (T), pH and feedstock (FS). The target data was the volume of biogas produced.
The physical quantities of the biogas system such as temperature, pressure and pH level were measured with electrical sensors and were recorded by a microcontroller, which stored the data on an SD card.
List and description of sensors/components used:
1) LM75: It is a temperature sensor module which converts analog to digital readings. It is cost-effective, consumes less power and is highly precise. It operates at a temperature range of −55˚C - 125˚C. It is effective in taking the temperature of the biogas system (Figure 4).
2) Analog Pressure Sensor: Internally the pressure sensor uses a piezo resistive semiconducting element. With a maximum pressure of 50 psi, the analog pressure sensor is capable of recording the pressure of the biogas system which does have a pressure slightly above atmospheric pressure ~14 - 15 psi (Figure 5).
Figure 4. LM75 temperature sensor.
Figure 5. Pressure sensor.
3) pH sensor: The pH sensor comprises a probe and a PCB board (Figure 6). The probe, when dipped in a solution, measures the voltage or potential difference of the solution. The hydrogen ion concentration is obtained from the potential difference using the Nernst equation. The pH sensor has a range of 0 - 14 pH.
Figure 6. pH sensor.
4) SIM800L: The SIM800L GSM/GPRS module is a miniature GSM modem that was integrated into the biogas digester. It is an IoT network device which communicates with the microcontroller over UART (Universal Asynchronous Receiver-Transmitter) using AT commands. It ensures real-time data is received on a mobile device. It makes a phone call to alert the users when the battery voltage of the system is low.
5) SD card/SD card module: The SD card module is used to connect the SD card to the microcontroller, which is used to store the data read from the sensors, it uses SPI (Serial Peripheral Interface) communication protocol. The SD card has to be supplied with a voltage of 3.3 v.
6) DS1302: The DS1302 trickle-charge timekeeping chip contains a real-time clock/calendar and 31 bytes of static RAM. It communicates with a microprocessor via a simple serial interface. The real-time clock/calendar provides seconds, minutes, hours, days, dates, months, and year information. Interfacing the DS1302 with a microprocessor is simplified by using synchronous serial communication. Only three wires are required to communicate with the clock/RAM: CE, I/O (data line), and SCLK (serial clock). The current time is obtained from the DS1302 which is stored alongside other recorded data.
7) ESP 32: It is a 32-bit microcontroller, that features WiFi and deep sleep which consumes a very low current. The data obtained from the sensors is stored locally on an SD card with the help of an embedded SQLite engine, the stored data is retrieved by downloading a CSV file which is obtained via a mobile phone or PC to the system WiFi, and accessing a webpage on the device web browser at I.P address: “192.168.4.1”. It also features an ADC (Analog to Digital Converter) which is used to convert the analog voltages from the pressure sensor and pH sensor into meaningful numbers.
2.3. Architectural Design
In this study ANN models were designed using the multi-layered feed-forward architecture. The networks were designed to contain one input layer containing five neurons, one hidden layer, and one output layer containing one neuron. The number of neurons in the hidden layer was determined using trial and error experimentation, which is a standard method for obtaining the optimal number of neurons. The architecture of the neural network models was determined by varying the number of neurons in the hidden layer (from one to ten neurons) for three different trials of data separation (70% of training set: 15% of validation set: 15% of testing set).
2.3.1. Neural Network Training
Neural network training involves the adjustment of the values of the connection weights and biases to generate the outputs with the given inputs. Training is a crucial step which determines the generalisation of the models. Levenberg-Marquardt backpropagation training algorithm (trainlm) was used to train the neural networks in this study.
The input data was normalized prior to the training using the min-max scaling approach. This enhances numerical stability and improves convergence. The mapminmax function was used, which linearly rescales each input variable independently to the interval [−1, 1]. The normalization parameters were estimated from the training dataset and applied consistently to validation and test data. The inverse transformation was used to restore network outputs to their original scale. In order to prevent overfitting, early stopping technique was employed and the number of epochs limited to 1000.
2.3.2. Model Validation
In this study, Mean Squared Error (MSE) and Regression R-value were calculated to evaluate and validate the performance of the neural network models in order to evaluate its capability to solve the problem.
2.4. ANN Modelling
Artificial Neural Network NS2 of MATLAB R2020a was used to develop the neural network model for the anaerobic digestion process of the substrate. The Neural Network Toolbox, which is a built-in tool in MATLAB has the ability to model complex nonlinear problems (MathWorks, 2020). The procedure for the neural network modelling is summarised in Figure 7.
Figure 7. The neural network modelling procedure. (Source: Mathworks, 2020).
3. Results
3.1. Digester Design
The values of the designed portable biogas digester are presented in Table 1.
Table 1. Calculated values in digester design.
Parameter |
Value |
Working Digester Volume |
40 Litres |
Total feed |
20 kg |
Organic Load |
266.75 kg∙VS/m3 |
Hydraulic Retention Time |
21 days |
The experimental data used for modelling the ANN models ranged as follows: The pH was seen to vary from 6 - 10.9 (slightly acidic-basic), Temperature (22.75 - 49.63)˚C, Pressure (9 - 15) atm, System battery voltage (0 - 4.05) V, Yield (0 - 88) dm3, Cumulative yield (0 - 987847.70) dm3, VS = 77.7% and TS = 36%.
3.2. Training Using Levenberg-Marquardt Algorithm
The result of ANN modelling using Levenberg-Marquardt algorithm with 10 neurons in the hidden layer and 15 neuron-hidden layer are presented in Table 2 and Table 3. The MSE for both 10 neuron-hidden layer and 15 neuron-hidden layer was observed to be very low and the R values for both cases were very high (0.99 - 99) for training, testing and validation samples (Figure 9). It however converged in 1000 epochs for both the 10 neuron-hidden layer and the 15 neuron-hidden layer as seen in Figures 8-10, respectively. It is still acceptable based on the complexity of the relationships to be modelled.
Table 2. Result of artificial neural networks modelling using Levenberg-Marquardt algorithm.
Separation (%) |
Number of Samples |
Sample Type |
MSE |
R |
70 |
23107 |
Training |
1.83634 × 10−9 |
0.9999 |
15 |
4952 |
Testing |
1.41678 × 10−9 |
0.9999 |
15 |
4952 |
Validation |
1.23339 × 10−9 |
0.9999 |
100 |
33,011 |
All |
– |
0.9999 |
Figure 8. Training of ANN Model with 10 neuron-hidden layer at 1000 Epochs.
Figure 9. Regression Plots of the ANN Model with 10 neuron-hidden layer with Levenberg Marquardt.
Table 3. Artificial Neural Networks Modelling using Levenberg-Marquardt (15 neuron-hidden layer).
Separation (%) |
Number of Samples |
Sample Type |
MSE |
R |
70 |
23,107 |
Training |
1.59761 × 10−7 |
0.9999 |
15 |
4952 |
Testing |
1.55670 × 10−7 |
0.9999 |
15 |
4952 |
Validation |
1.38032 × 10−7 |
0.9999 |
100 |
33,011 |
All |
- |
0.9999 |
3.3. Training using Bayesian Regularization(10 Neuron-Hidden Layer)
The model was trained with Bayesian Regulation algorithm using 10 neurons in the hidden layer and 20 neuron-hidden layer. It was observed that the training converged in 13 epochs and 11 epochs, respectively (Figure 11 & Figure 12). However, though the computing time was low compared to the Levenberg Marquardt algorithm, the R value was very low as seen in Figure 13 and Figure 14.
Figure 10. Training of ANN Model using 15 neuron-hidden layer using Levenberg-Marquardt algorithm.
Figure 11. Training of ANN Model with Bayesian Regularisation at 13 Epochs.
Figure 12. Training of ANN Model with 20 neuron-hidden layer using Bayesian Regularization.
Figure 13. Regression Plots of the ANN Model using Bayesian Regularization algorithm with 10 neuron-hidden layer.
Figure 14. Regression Plots of the ANN Model using Bayesian Regularisation with 20 neuron-hidden layer.
3.4. Training Using Scaled Conjugate Gradient (SCG) Algorithm (10 Neuron-Hidden Layer and 20 Neuron-Hidden Layer)
SCG algorithm was used to train the ANN Model using 10 neurons in the hidden layer as presented in Figure 15 and Figure 16. It was observed that though it converged at 177 epochs (Figure 15), a value higher than BR but lower than LM. The R value was very low (Figure 16). However, it was observed as seen in Figure 17 and Figure 18, that the model with the 20 neuron hidden layer converged in 93 epochs and had a R-value of 0.9987 for all the samples. Showing excellent accuracy and satisfactory computation time.
Figure 15. Training of Artificial Neural Networks (ANNs) Model with SCG algorithm at 177 Epochs.
Figure 16. Regression Plots of the ANN Model using SCG with 10 neuron-hidden layer.
Figure 17. Regression Plots of the ANN Model using SCG Algorithm with 20 neuron-hidden layers.
Figure 18. Regression Plots of the ANN Model using SCG Algorithm with 20 neuron-hidden layer.
The results of the study showed that the ANN model was able to accurately predict the biogas yield from the cow dung substrate. The values of R were very high when both Levenberg-Marquardt and scaled conjugate gradient algorithms were used. While the reported correlation coefficients are high, overfitting is unlikely since comparable performance was observed across the training, validation and test datasets and normalization parameters were derived solely from the training data. In addition to this, the data were strictly partitioned, with no overlaps. The high correlation values are attributed to the strong underlying relationships between the input variables and the output.
On the other hand, the values of R were very low when Bayesian regularization algorithm was used. This could be because Bayesian regularization prioritises generalization over correlation maximization, and can therefore deliberately reduce apparent fit quality, especially when the dataset is relatively small.
4. Conclusions
The application of Artificial Neural Networks (ANNs) for biogas yield from cow dung in a 1:1 ratio with water has the potential to predict biogas production with more accuracy than traditional methods. The ANNs have been shown to have the ability to capture complex relationships between variables that are not easily observed in traditional methods. This study was able to establish that:
1) Artificial Neural Networks (ANNs) have been successfully used to predict biogas yield from cow dung in the ratio 1:1.
2) ANNs are capable of capturing the intricate relationships between various parameters that influence biogas yield.
3) Levenberg-Marquardt algorithm predicted biogas yield with the highest accuracy (R value of 0.9999) and low mean square error of 1.23339 × 10−9. It however converged in 1000 epochs.
4) Bayesian regularization algorithm had very low R values and high mean square errors. It was found unsuitable in this study.
5) Scaled Conjugate Gradient algorithm had high R values, low mean square error and relatively low epochs when 20 hidden layers were used in the model. It seemed to have the best desirable qualities of high accuracy and high learning rate.
6) ANN models can be applied to other types of biomass and waste, to predict and optimize biogas yield.