Biodiesel Processor Good
Biodiesel Processor Good
Arduino Program int led = 13; const int valve1 = 12; //valve that comes from solution tank const int valve2 = 11; // const int valve3 = 10; // const int valve4 = 9; //valve that comes from the oil tank to main reactor const int valve5 = 8; //valve that comes from the oil tank to heater const int stir = 7; const int pump1 = 6; // const int pump2 = 5; // const int pump3 = 4; // const int level1 = 3; //lower level float(oil) const int level2 = 2; //higher level float(oil+solution) const int analogInPin = A0; //temperature sensor int output = 0; int temp = 0; int level1state = 0; int level2state = 0; int x = 0; void setup(){ pinMode(led, OUTPUT); pinMode(valve1, OUTPUT); pinMode(valve2, OUTPUT); pinMode(valve3, OUTPUT); pinMode(valve4, OUTPUT); pinMode(valve5, OUTPUT); pinMode(stir, OUTPUT); pinMode(pump1, OUTPUT); pinMode(pump2, OUTPUT); pinMode(pump3, OUTPUT); pinMode(level1, INPUT); pinMode(level2, INPUT); Serial.begin(9600); } void loop() { do{ digitalWrite(led, HIGH); //level1state = digitalRead(level1); //level2state = digitalRead(level2); temp = analogRead(analogInPin);
//reads low level float //reads high level float //reads temperature
Serial.print("temp sensor = " ); //prints out temperature sensor Serial.println(temp); //Serial.print("\t output = "); //Serial.println(output); delay(1000); digitalWrite(valve5, HIGH); //open valve to pump oil thru heater; valve 5 is at the bottom of the oil tank; this heats the oil to at least 130 degrees digitalWrite(pump2, HIGH); // turns pump on at oil tank digitalWrite(valve4, HIGH);} // open valve to in line heater while(temp>470); if(temp<=470){ // temp = 442 is a temperature of 150 F; 442 = 150 F, 443 = 145 F, Serial.println("here"); do{ // 445 = 140 F, 447 = 135 F, 449 = 130 F digitalWrite(valve3, HIGH); //this begin to put the heated oil in main tank; valve 3 is reactor inlet digitalWrite(valve4, LOW); //closes valve to in line heater level1state = digitalRead(level1);} while(level1state == 1);} Serial.println("oil in main tank"); if(level1state == 0){ //this is the low level sensor for oil do{ digitalWrite(pump2, LOW); //this stops the oil. starts the solution digitalWrite(valve1, HIGH); //opens valve to let solution flow to main tank digitalWrite(pump1, HIGH); //turns pump on at solution tank level2state = digitalRead(level2);} while(level2state == 1);} Serial.println("solution in tank"); if(level2state == 0){ digitalWrite(valve1, LOW); //this stops the solution. starts the stirrer digitalWrite(pump1, LOW); //pump stops digitalWrite(stir, HIGH); //stir comes on and begins stirring for 10mins delay(10000) delay(10000); //this delay can be changed; 1000 = 1 sec level2state = digitalRead(level2);} Serial.println("mixer on"); digitalWrite(led, LOW); if(button == 0){ digitalWrite(valve2, HIGH); digitalWrite(pump3, HIGH);} else{ digitalWrite(valve2, LOW); digitalWrite(pump3, LOW); } //this pumps biodiesel out of system