  A new strategy was developed to investigate the effect of volatile fatty
acids (VFAs) on the efficiency of biogas production with a focus on improving
bio-H$_2$. The inoculum used, anaerobic granular sludge obtained from a UASB
reactor treating poultry slaughterhouse wastewater, was pretreated with five
different pretreatments. The relationship between VFAs and biogas compounds was
studied as time-dependent components. In time-dependent processes with small
sample size data, regression models may not be good enough at estimating
responses. Therefore, a deep learning neural network (DNN) model was developed
to estimate the biogas compounds based on the VFAs. The accuracy of this model
to predict the biogas compounds was higher than that of multivariate regression
models. Further, it could predict the effect of time changes on biogas
compounds. Analysis showed that all the pretreatments were able to increase the
ratio of butyric acid / acetic acid successfully, decrease propionic acid
drastically, and increase the efficiency of bio-H$_2$ production. As
discovered, butyric acid had the greatest effect on bio-H$_2$, and propionic
acid had the greatest effect on CH$_4$ production. The best amounts of the VFAs
were determined using an optimization method, integrated DNN and desirability
analysis, dynamically retrained based on digestion time. Accordingly, optimal
ranges of acetic, propionic, and butyric acids were 823.2 - 1534.3, 36.3 -
47.4, and 1522 - 1822 mg/L, respectively, determined for digestion time of
25.23 - 123.63 h. These values resulted in the production of bio-H$_2$, N$_2$,
CO$_2$, and CH$_4$ in ranges of 6.4 - 26.2, 12.2 - 43.2, 5 - 25.3, and 0 - 1.4
mmol/L, respectively. The optimum ranges of VFAs are relatively wide ranges and
practically can be used in biogas plants.
