AN IN-HOUSE COMPUTER-BASED DATA ACQUISITION AND CONTROL SYSTEM FOR ANAEROBIC FERMENTATION PROCESSES

A computer-based Data Acquisition and Control System (DACS) capable of monitoring the temperature, pH and gas production as well as maintaining a pre-determined temperature profile and feeding regime in anaerobic reactors was developed and tested. The hardware for the DACS was a series-based system consisting of a host processor which drives three modules-a digital input mode (MODULE 255), an analog input node (MODULE 254) and a digital output node (MODULE 253)-through a Serial Communication Adaptor connected to the serial asynchronous communication port of the host processor. The system was tested using two sets of laboratory model reactors maintained under two diurnally cyclic temperature ranges of 20-40 (cid:176) C and 15-25°C. Hydraulic retention time was varied from 10 to 25 days using the control system. The temperature and pH of the reactors were monitored at 30 sec interval. Results showed that the system was able to maintain the desired temperature to within ±2.5 (cid:176) C for the 20-40 (cid:176) C and ±1.0 (cid:176) C for the 15-25 (cid:176) C cycle. It was also able to maintain the desired feeding regime and to monitor and record the temperature, pH and gas production at the desired interval of time.


INTRODUCTION
Anaerobic digestion is a biological treatment process in which organic materials are decomposed in the absence of free oxygen to yield methane (CH 4 ), Carbon Dioxide (CO 2 ) and small quantities of other gases (hydrogen sulfide, carbon monoxide, nitrogen,) (Ghaly and Al Hattab, 2012). Compared to other biological treatment processes, anaerobic digestion has several advantages including: (a) A useable biogas that is about 60-80% methane with a fuel value of 22.4 MJ/m 3 is produced in the process (Ghaly and Echiegu, 1993), (b) the digested residue is almost odourless with reduced solids content, enhanced fertilizer value, lower pathogenic bacteria content and loss of viability of contained weed seeds (Engeli et al., 1993;Allan et al., 2003;Eckford et al., 2012).
Despite the advantages of anaerobic digestion, the system is generally relatively unstable as a result of the high sensitivity of anaerobic bacteria to changes in environmental conditions including: Temperature, pH and organic loading rate (Ben-Hassan et al., 1991a;1991b;Ghaly and Ramkumar, 1999;Ghaly et al., 2000). It is, therefore, important that these parameters be monitored and controlled continuously for successful operation of anaerobic digesters.
Presented in this study is a computer based data acquisition and control system developed for the continuous monitoring of the temperature, pH and gas production of a pilot scale anaerobic digestion system Science Publications AJEAS having 4 digesters. The system is also designed to control the temperature and feeding rate of the digesters.

CONTROL SYSTEM COMPONENTS
The control system consisted of a feeding unit, a temperature control unit, a gas collection unit and a data acquisition and control unit.

The Feeding Unit
The manure feeding unit consists of a manure storage tank, a feed pump (peristaltic pump, Model 110-030, TAT ENGINEERING CO., North Branford, Connecticut, USA), a set of tygon tubbing connecting the storage tank, feeding pump, solenoid valves, manifold and the digesters (Fig. 1).
The pump and the solenoid valves were used to deliver a pre calculated amount of manure into each digester based on the desired retention time as determined by the signal from the host processor. The manure was pumped from the storage tank through the tygon tubings, the distribution manifold and the automatically controlled solenoid valve to each digester. The specially designed solenoidal valve was used to control the amount of manure delivered to the digester at the preset time. A digital timer controlled and synchronized the operation of the feed tank stirrer (MODEL 5935932, Type NSI-10R93, BODINE ELECTRIC CO., North field, Illinois, USA).
During a typical feeding cycle, the timer started the fed tank stirrer about 5 min prior to the commencement of the feeding of reactor #1. At the end of this period, the timer opened the first Solenoid Valve (SV1) while simultaneously turning on the feed pump. Manure was, thus, fed to reactor #1 for a predetermined time period depending on the operating hydraulic retention time. When the feeding of the first reactor was completed, the timer shuts off the first solenoid valve and opens the Second (SV2) while the feed pump and the feed tank stirrer were still on. The procedure was continued until all the four digesters were fed and the feeding cycle was completed. At the end of the cycle, the timer turned off the manure stirrer and the feed pump. The same procedure was repeated at the next cycle. Eight feeding cycles were carried our daily at an interval of 3 h.

The Temperature Control Unit
The temperature control system was designed to maintain the desired temperature profile in the digesters.
It consists of an insulated chamber which formed the ambient environment for the digesters, a refrigerated chiller, two heaters, two cross flow heat exchangers, two fans, temperature control transducers and ducts for directing the circulation of air (Fig. 2).
On the floor of the chamber was a U-shaped galvanized steel duct of 100 mm inside diameter. Inside one arm of the duct were located a thermally insulated electric fan (Model 4C02A, DAYTON ELECTRICMFG CO., Dayton, Texas, USA), a heat exchanger and a 500 W heater in that order. A digital rapid cool refrigerated bath (Series 900, POLYSCIENCE, Niles, Illinois, USA) with an operating temperature range of -35 to 150°C and an accuracy of ±0.02°C supplied chilled water for the system.
A submersible pump (Model 1-MA, LITTLE GIANT, Fort Wayne, Indiana, USA) immersed inside the chiller delivered chilled water to the heat exchanger as determined by the signal from the host processor. The air circulation was a closed loop system. The fan drew air from the chamber into the duct. The air circulated over the heat exchanger and the heater and after being conditioned, left the duct through the perforations on the other side of the u-shaped duct to bath the digesters positioned between the two arms of the U-shaped duct.
In operation, the temperature transducers continuously sampled the air temperature in each of the chamber compartments and transmitted the sampled signal through the digital input node of the data acquisition to the host processor. Every 30 sec, the host processor computed the average temperature in each chamber and compared the result with the set values. Depending on the error signal, the host processor generated a correction signal which either turned the heaters and the chiller submersible pumps on or off, respectively.

The Gas Collection Unit
Y-shaped nipples fitted over the top of the digesters provided an outlet for the evolved gas. Over one arm of the Y-shaped nipple were fitted a rubber septum through which gas samples were drawn with a syringe. The other arm was fitted with flexible tubing which conveyed the evolved gas through a water column, a gas scrubber, gas meter and then to storage (Fig. 3).
The gas was bubbled through 5 cm head of water in the water column which was sufficient to provide adequate back pressure to the head space in the digester in order to maintain constant working volume in the digester. The gas was subsequently fed into the scrubber for the removal of hydrogen sulfide. The scrubber was filled with a mixture of wood sharing and steel wool. The iron oxide reacted with the hydrogen sulfide to form iron sulfide, thereby stripping off the hydrogen sulfide from the gas. A specially designed cumulative gas meter was used to measure gas production. The outlet of the scrubber was connected to the gas meter. An electrical counter was used to keep a record of the number of the gas meter tips. The tipping chamber in the meter was fitted, at a center point, with small disc-shaped magnets. A normally-opened, read switch was attached to the outer wall of the meter so that the magnet would pass by it on each tip and momentarily closes the counter circuit and increases the count by one. Thus, the cumulative gas production for any period was measured taking the counter readings at the start and at the end of that period and multiplying the number of tips by 50 mL.
The gas released from the meters was collected in a temporary storage bag and then pumped to a gas cylinder. The storage bag was a polyethylene bag of 75 cm height and 47 cm diameter. A pump (Cat. No. 7543-10 and serial no. 108778, COLEPARMER INST. CO., Montreal, Quebec, Canada) was used to pump the gas from the bag into the gas cylinder. The pump was operated at a speed of 10 rpm. Two propane cylinders, 62 cm high and 100 cm diameter, were used to store the gas. Each cylinder can store up to 10 kg gas.

Data Acquisition and Control Unit
The instrumentation for the data acquisition and control unit consists of the temperature and pH transducers which were mounted in holders.

Temperature Sensors
The temperature transducers are integrated circuit sensors (Model LM35CZ, NATIONAL SEMI-CONDUCTORS, Santa Clara, California, USA) with an operating temperature range of-40 to 110°C and an accuracy and sensitivity of 1.5°C and 10 mV/°C, respectively. The sensors were configured to operate over a temperature range of 0-60°C with a sensitivity of 0.15 mV/°C. The Integrated circuit sensors produce a highly linear output that deviate little with time and are ideal for accurate temperature measurement.

AJEAS
The temperature transducers were calibrated using a refrigerated water bath (Precision 280 Series, THERMO SCIENTIFIC, Marietta, Ohio, USA). The transducer were immersed in the water bath and hooked up to the data acquisition and control system. While the temperature of the bath was gradually increased from 2°C to 60°C the voltage (equivalent to the given temperature recorded by the sensor) was simultaneously recorded. The procedure was repeated while the water bath temperature was gradually lowered from 60°C to 2°C. The purpose was to remove any hysteresis effects on the calibration. A calibration equation of the form shown below was written for each sensor Equation 1: Where T = Temperature measured by the sensor, a and b are constants mV = The voltage reading in mV

Ph Sensors
The pH transducers were double junction blue glass industrial electrodes (model N05994-22, COLEPALMER, Quebec, Canada) with operating pH and temperature ranges of 0-13 and 0-110°C, respectively. The sensors are ideal for fluids with heavy metal, organics and sulphides such an aerobically treated organic wastes. They are also suitable for compounds that react with silver.
The pH transducers were calibrated using standard buffers of known pH values. Three buffers of 4, 7 and 10 (Fisher Scientific, Montreal, Quebec, Canada) were used. Several milivolts readings were taken for each sensor immersed in different buffers. Similar calibration equation was written for the pH sensors Equation 2: Where pH = The pH value a and b are the constants mV = The voltage reading in mV

Gas Meter
The gas meters consist of plexiglass boxes 200×200×60 mm. Each box was partially filled with water and contained diamond shaped plexiglass tipping unit provided with two recesses in its lower section. The gas let into the meter is located in such a way that the evolved gas bubbled into one of the two recesses in the tipping unit. When this recess is filled, the imbalance results in the tipping of the diamond shaped unit to bring the second recess into position while releasing the previously accumulated gas. The tipping brought the field of a small magnet (embedded at the upper end of the tipping unit) over a reed switch (Model MARZ-185, Hamlin, Wisconsin, USA) mounted at the outer face of the box. A reed switch (a magnetic switch) closed or opened when brought into or removed from the effect of a magnetic field.
For the calibration of the gas meters, each meter was filled with water to the desired level. Air was passed through the meter and the volume of air (at atmospheric pressure and ambient temperature) that resulted in a tip of the gas meter in one direction was noted. The volume that required to effect a tip in another direction was also noted and the average taken to represent the volume of gas recorded for each tip of the meter.

Actuators
These consisted of solenoid valves, the manure feed pump, the manure mixer motor, the heaters and the submerged pump in the bath of the refrigerated chiller. The lower end of the armature of the vertically mounted solenoid valve carried a horizontal metal bar which, when the valve was in a closed position, squeezed tygon tubing feeding the reactor against a fixed plate thus shutting off the feed inlet to the reactor. The solenoids were actuated by the digital input mode of the data acquisition and control system.

The Hardware
The hardware for the data acquisition and control system was a series-based system consisting of a host processor which drives three modules: A digital input mode (MODULE 255), an analog input node (MODULE 254) and a digital output node (MODULE 253)-through a Serial Communication Adaptor connected to the serial asynchronous communication port of the host processor (Fig. 4).
The system is controlled and the information is received through the RS232 serial port of a personal computer equipped with real time clock. Although a personal computer was used, any computer with such serial communication port and sufficient memory (depending on the programming language) can be used.

AJEAS
A Serial Communication Adaptor and Reset (SCAR) was introduced because the computer language used did not support the 8-data even parity, which was required by the Addressable Receiver and Transmitter (ART). Data from the host processor were, therefore, reframed to 8-data, even parity, before being sent to the nodes and re-framed to 8-data no parity before being transmitted to the host processor.
The hardware solution was chosen, although it was possible to solve this problem using the software alone if a better knowledge of the computer BIOS routines are known. A logically separate function, the Power-up the ART-based nodes responded correctly after power was first applied (Fig. 5).
Each of the nodes was built around an Addressable Receiver/Transmitter (ART). Each of the nodes has a separate address and an independent clock but it was possible to incorporate this function with the SCAR. The Digital Input Node (Module 255) was a four-channel, 4bit counter which was linked with the system through the ART. The reed switches of the gas meters were connected to this counter. When any of the gas meters caused its reed switch to close, a 4-bit binary counter was incremented. The Host Processor accessed this node by inputting an 8-bit node address as well as a dummy byte. The dummy did not supply the node with any information but was necessary for format reasons. The counter returned two consecutive bytes (of 8 bits each) each of which was decomposed (by using integer division) to yield two values. The values were converted into volume rate of gas production by the host processor. A de-bounce filter was provided to eliminate erroneous inputs generated by mechanical Contacts bouncing when forced together.
The Analog Input Node is a 12-channel, 13-bit integrating Analog-to-Digital Converter (ADC) which was linked to the DACS through the ART. The ADC had a conversion rate of 7 Hz. A multiplexer was provided as part of the module multiplexed 4 pH and 8 temperature channels by selecting particular temperature or pH sensors. The pH sensors had extremely high output impedance, typically 1×10 6Ω . This signal must, therefore, be buffered with CMOS op amp before further processing. The op amp had typical input leakage current of 1×10 −12Ω at 25°C, so the signal was not degraded. A 3terminal semi-conductor type temperature sensors were used. Since they were intended for short lead length (a small capacitance load), they were re-configured for current output by connecting an appropriately sized resistor between the output and the common terminal of the device. This arrangement worked very well with the 4.5 mm cable used. Once the signal entered this node, a resistor associated with the multiplexer converted the current to voltage. This approach required one resistor instead of 8 and eliminated the need to use closely matched components. To select a particular input channel, instruction must be received from the host processor. This instruction was transmitted to the node as two bytes of 8 and 7-bits, respectively. The first was the node address while the second (channel address) selected the node address to be digitized and initiated the conversion process.
The Digital Output Node (Module 253) was a 10channel node which controlled the devices connected to the switched receptacles on the receptacle panel. The microprocessor communicated with the channels by sending two bytes of 8-bit and 7-bit respectively. The first was the node address while the second addressed and wrote a specific Flip-Flop (FF). The FF output would not change until the opposite value was written to it, or if it was high, until all the FF's were reset using the software. Buffered FF outputs drove the low voltage inputs of the Solid State Relay (SSR) which switched the AC power to devices connected to the switched receptacles of the receptacle panel.

Software
The software structure composed of different tasks articulated on the CPU and regularly activated by the internal clock of the host processor. The software was developed in QuickBasic ® and consisted of a main module which called two main types of procedure (subroutines): The internal clock activated node drivers and the user-activated procedures for viewing stored data and downloading them onto removable storage devices. There were also safety/security routines such as one that turned off all devices if an error is detected. A simplified flowchart for the main module is shown in Fig. 6.
The flowchart was implemented by entering a seven-character password which allowed access to programme. On logging on, the microprocessor checks and turns off all devices initially as a safety measure. This is followed by a dialogue in which the user is requested to enter a list of parameters. These includes: (a) The operating Hydraulic Retention Time (HRT) for the four reactors, (b) the minimum and maximum temperature expected in the chamber, (c) time interval to check and adjust chamber temperature as required and (d) time interval to display and store acquired pH, temperature and gas production data. At the end of the dialogue, there is a provision for making any changes to the entered data before programme execution is started. All variables are also initialized at this point. The main programme was terminated by pressing CONTROL-Q while the stored data were viewed by temporarily suspending programme execution using CONTROL-V.
Among the procedures activated by the internal clock were Gas Meter, Temp HSensor (temperature and pH sensors), TempContol (temperature control) and Feed System (feeding system). Gas Meter decoded the output from the Digital Input Node, converted them into gas output and displayed and stored the data in the hard drive of the host processor. TempHSensor checked the Science Publications AJEAS validity, polarity and range of the converted analog signals from the temperature and pH sensors. It also computed 30-min averages for each of the sensors and displayed and stored the data at regular intervals. Temp Control called a host of other procedures for reading and computing average temperature of each chamber, comparing them with set points (which are a function of the time of the day) and turning on or off the chiller submersible pump and/or heaters in the chamber. Feed System, when activated, started a feeding cycle and synchronized the operation of the manure mixer, feed pump and solenoid valves as earlier described.
The user activated procedures include ones for viewing stored data and terminating the programme. When the result-viewing procedure was activated by pressing CONTROL-V, a menu was displayed to enable the user select the type of result file to view. These included periodic or cumulative gas output files, pH and average pH files, temperature or average temperature files and daily gas production files. For each selected menu, there is a provision for downloading the file and/or making hard copies while viewing. When the programme-terminating subroutine is called, all devices are first turned off by the host processor. A short output file, which was used in initializing the programme when started again was created after the programme was terminated. An error check subroutine was called automatically if an error is detected. The nature of the error was displayed and must be corrected before the programme could be restarted.

RESULTS AND DISCUSSION
Evaluation of the system was carried out by using the system to maintain a diurnally cyclic temperature Science Publications AJEAS profile in the reactor. A diurnally varying temperature function given by (Hill, 1983;Echiegu and Liberty, 2013) was imputed in the computer programme used by the host processor to determine temperature set points at each given time. The function is as shown below Equation 3 Where T h = The hourly dry bulb temperature T dmax = The maximum daily temperature T dmin = The minimum daily temperature h = The hour of day (1.00 am = hour #1) Four continuous-mix laboratory size (25 L each) anaerobic digesters operated on dairy manure at fourlevels of HRT (25, 20, 15 and 10 days), two levels of influent total solid concentration (6.4 and 3.5%) and two diurnally cyclic temperature ranges (15-25°C and 20-40°C) were used in evaluating the system. Figure 7 shows the designed and measured temperature of the chamber temperature for the two diurnally cyclic temperature ranges. From the figure, it is seen that temperature control system was able to maintain the diurnally cyclic temperature patternthat was desired for both the temperature ranges of 20-40°C and 15-25°C. In fact, the temperature was maintained to within ±2.5°C for the 20-40°C and within ±1.0°C for the 15-25°C cycles. The control was thus finer during the lower cyclic temperature range. Figure 8 shows typical diurnal variation in biogas production rate as a result of the diurnally cyclic temperature variation maintained in the reactors by the DACS while Fig. 9 shows similar results for pH. As can be seen from the figure, the system was able to accurately monitor the variation of in biogas production with time of day as influenced by diurnal aeration of temperature. The same was also obtained for pH. Also the feeding control system was able to maintain a feeding regime that resulted in the desired hydraulic retention times of 25 days, 20 days, 15 days and 10 days. Although the system during the evaluation was programmed to maintain two diurnally cyclic temperature regime provided the correct temperature function is programmed into the software.

CONCLUSION
The data acquisition and control system gave a very satisfactory performance in terms of monitoring the temperature, pH and gas production. The temperature control system maintained the desired diurnally cyclic temperature ranges of 20-40°C to within ±2.5°C and 15-25°C to within ±1.0°C during the evaluation. It equally maintained the desired feeding regime and hence the desired hydraulic retention time.

ACKNOWLEDGEMENT
This study was sponsored by the Canadian International Development Agency under the TUNS-UNN-DAE Linkage project.