99Views4Replies

Author Options:

Controlling anaerobic digesters with arduino Answered

Hi I am new on the Arduino scene and I am trying to build eight anaerobic digester tanks to conduct experiments for my thesis in engineering.

The setup will look as follows:

-Arduino mega

-Arduino motor shield R3

-Two motor stirring the digester at different RPMs. Motors will run at 12 V and around 0.5-1 A.

-The motor shield will use the wall jack as power supply via an AC-DC adapter.

-Biogas volume measuring device (tipping sensor)

-Aquaria air pump to supply Hydrogen Sulphite consuming bacteria with oxygen. This will be controlled with a relay and the volume measuring device.

-The pump will use the wall jack as power supply

-Temperature sensors DS18B20.

-Immersion heater controlled by the temperature sensor and a relay. The digester is supposed to be kept at 37°.

Everything will be logged but I haven’t decided if I will connect a Ethernet shield or if I should log on a SD card.
I think that I can manage to build it but I have some questions (a lot) but will just post some and post more later.

The experiments will run for 4-6 months how will the Arduino, shield and relays handle being on for that long? Do I need something with higher quality? (It would suck to burn down the university)

Any spontaneous thoughts that I should know or that could help me?

Discussions

Ok so I have started trying out some stuff. Here is a picture
of one test with:

Air pump

Arduino

Arduino motor shield

Motor

Relay

Power switch

Temperature sensor

So some questions the motor is not running for 10 sec instead its running for 7 sec and is of for 6 sec? One sec after the motor starts the temperature sensor registers 85 Celsius?? The relay controlling the air pump is supposed to be one when the motor is of but stays on for 1,5 sec?

Is this bad coding or is the Arduino to slow?

// Temperature and relay

#include <OneWire.h>

#include <DallasTemperature.h>

#define RELAY1 7

OneWire oneWire(4);

DallasTemperature sensors(&oneWire);

// Motors

const int PWM_A = 3;

const int DIR_A = 12;

const int BRAKE_A = 9;

const int SNS_A = A0;

// some var

int kraft =0;

int motorState = 0;

// blick without delay

long previousMillis = 0;

long interval = 10000;

// writing to excel

long previousExcel = 0;

long excelinterval = 1000;

void setup() {

// Open Serial communication

Serial.begin(9600);

// Excel

Serial.println("CLEARDATA"); //clears any residual data

Serial.println("LABEL,Time,Motor,Number,Tempretur,airpump");

// configure motor

pinMode(BRAKE_A, OUTPUT);

pinMode(DIR_A, OUTPUT);

//relay

pinMode(RELAY1, OUTPUT);

sensors.begin();

}

void loop() {

// Temperature and relay

sensors.requestTemperatures();

float currentTemp0;

currentTemp0 = sensors.getTempCByIndex(0);

if(motorState==1){

digitalWrite(RELAY1,LOW);

}

else{

digitalWrite(RELAY1,HIGH);

}

// blink without delay

unsigned long currentMillis = millis();

unsigned long currentExcel = millis();

motorState=digitalRead(3);

kraft=analogRead(A0);

if(currentMillis - previousMillis > interval)

{

if(motorState==LOW){

digitalWrite(BRAKE_A, LOW);

digitalWrite(DIR_A, LOW);

analogWrite(PWM_A, 255);

previousMillis = currentMillis;

}

else{

digitalWrite(BRAKE_A, HIGH);

digitalWrite(DIR_A, LOW);

analogWrite(PWM_A, 0);

previousMillis = currentMillis;

}

}

// Excel

if(currentExcel - previousExcel > excelinterval)

{

Serial.print("DATA,TIME,");

Serial.print(motorState);

Serial.print(",");

Serial.print(kraft);

Serial.print(",");

Serial.print(currentTemp0);

Serial.println(RELAY1);

previousExcel = currentExcel;

}

}

WIN_20150704_234923.JPG

Have you thought of using a raspberry pi for your control than arduino? It is easier to interface with apps-tweet a runaway reactor/monitor remotely, easier to pass on or log data through the network - wireless/ethernet. Probably same cost/setup but with a more powerful controller that might be more flexible to add more functions during the run of the experiment. Having eight tanks to control can get complex beyond the means of an arduino. Good luck.

As I understand it raspberry pi would be more complicated to
program. And I think there are not
enough input pins but maybe you can add pins?? Every reactor will have a separate
controller because I will not be allowed to have wires all over the lab.

You can add more pins to the pi if needed https://learn.adafruit.com/mcp230xx-gpio-expander-on-the-raspberry-pi/overview. You program the pi with Python. The pi is essentially a tiny Linux machine. Maybe a little tougher to get started than an arduino but there are tons of tutorials and community support out there. The payback is the ease of monitoring, gathering data and remote controlling your experiment. Besides, you can probably program a cool graphic app to monitor and control your experiment.