Pages: [1] 2   Go Down
Author Topic: home distillation project  (Read 5955 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Guys,
I am building an Arduino based controller for my home brew alcohol distillation project.
I have no idea of how to wright code, or read it, but I have a fair idea of how all the circuitry and hardware are connected. I have basically finished building my project but just get confused when I look at writing a code for it. I'd imagine the code would be a fairly complex one. I need help adding libraries for all the components and tying it all into one code.
 I'll try to explain what hardware I have so far and the functions i want the project to perform. I really need help with this as its starting to do my head in, i've gone round & round with searches & havn't had much luck getting anywhere. I'll need patience & commitment from you as i'm only new at this, & I think it may take a bit of trial & error. At the moment, I have to basically sit with the still to keep an eye on the temperature of the cooling head so that the alcohol condensates at a constant rate, plus perform other operations such as turn on a cooling system when a certain temp. is reached, separate the heads, Body and tailings of the operation, and for it all to shut down at the finish. Please help me, I'll explain more indepth into the procedure, functions and hardware I have, when I know I have people committed to helping me out.
  I want other people to be able to use all this as well, I have only found little segments which could help with my project, no one(to my knowledge) has completed a project like this, the only thing I found close was home brew beer manufacture with temperature & flow control. smiley
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8822
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Perhaps you can find some local help if you give some idea of where you are.

I'm sure some moderator will move this to "Gigs and Collaboration".
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for your reply John. I think what I need to do is study c++ & learn how to do it myself. At least then I'll be able to say that I completed the whole project. If I get stuck along the way I'll have some code already which would be easier to seek help.
Logged

Germany
Offline Offline
Full Member
***
Karma: 0
Posts: 110
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
as an arduino cannot brew anything the first thing to think about should be: What are the devices, sensors and perhaps displays you want to connect?
Than you should design an algorithm. What should your arduino do? when? and how?

When you get this far the third step is to dive into coding and transform your algorithm into an arduino code. It gets easier to understand, when you split your code into independant sub-programs first, merging them together in a fourth step. When you are able to read a temperature AND you are able to control a heater it is an easy task to control a heater  based on the temperature.

Kevin
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks KevinT, I had actually thought of doing this but didn't know it was called an algorithm. I was planning on writing up all of the functions as comments ( //...) then filling in the all the code in between after. You have supported an idea which I think is my best plan of attack. Cheers mate.
Logged

New River, Arizona
Offline Offline
God Member
*****
Karma: 19
Posts: 935
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

There's a technique called pseudocode where you put the steps down and then expand on them as you go.  Something like

turn on hotplate
check temperature
if boiling (temperature >= bp of alcohol), turn off hotplate

That kind of thing.  You'll want to do things like check the temperature to be sure it hasn't risen above the boiling point of alcohol because that will mean you're done.  If you're using some kind of reflux device, you may want to monitor the flow rate of the distillate and reduce heat if it gets going to fast.  You'll probably want to monitor the liquid level in the main body to be sure it doesn't get to low as a failsafe and maybe the catch bucket (or whatever) to be sure it doesn't run over.

I recommend you do a batch by hand and take notes of EVERYTHING you do and then think about automating it.  When you get part of it automated like the temperature control, you can expand your project like KevinT suggested.  It's easier to keep adding things once you have something (pretty much anything) working.
Logged

Trying to keep my house under control http://www.desert-home.com/

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 46
Posts: 2500
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From the description of what you're automating I think you'd be better served by just buying a couple off-the-shelf temperature controllers. You can find these on eBay.
Logged

Sussex UK / CT USA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1028
Forums forever
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

For a "Getting started with (Arduino) programming" guide, may I commend my...

http://sheepdogguides.com/arduino/FA1main.htm

It won't immediately tell you how to do the thing you are after... but it will get you going, give you the tools.
Logged

Offline Offline
God Member
*****
Karma: 7
Posts: 647
"In this house, we obey the Laws of Thermodynamics" Homer J. Simpson
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Distillation of alcohol should be done with care
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
CJH Innovations
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

FYI: The department of Alcohol Tobacco and Firearms (ATF) will give you a premit to distill up to 10,000 gallons of ethanol per year.

Ethanol can be used do fuel your flex vehical, with a minor adjustment to the engine control calibration.

Maybe this project should be turned toward a more universal problem which is fuel for your car or truck.
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
CJH Innovations
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is just an opinion from someone who has been there and done that.

Building a PID controller is your goal. You can purchase them from several sources and re-sellers. Blichman Engineering comes to mind, based in Lafayette Indiana. Just do a web searh for PID controllers and you'll see the various manufacturers.

After you discover the detail that is needed to build a good PID temperature controller you may also discover that you are embarking on a one or two year project. The temperature proble for instance must be able to deliver the accuracy that you need to maintain a constant temperature plus or minus 0.1 degree F. You'll need to write code that builds a closed loop system where you constantly read the temperature and change the heat source to adjust the temp up/down. Like Chagrin said, you should probably buy these.

Then you have to decide whether the heating source should be gas or electric. If you choose gas, then your best path would be to purchase one. The gas burner controls are heavy with safety features that you do not want to learn about the hard way. If you go with electric heat, then you are going to have to build or purchase a high power SSR (Solid State Relay) that you can control with PWM.

Good luck with the project. Take the first year learning how to build any kind of control with the Arduino. That will give you enough experience to know whether you will need an UNO or a Mega2560.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok guys, this project is coming along quite nicely. I'm starting to understand how c++ works, but not entirely. I have come to a point where I am a bit stumped and I guess now is the time to seek help. The code i have, has no problems compiling or uploading, but the trouble with it is such that the servo's just keep cycling back & forth. The job servo2 has is basically like a soliniod valve but I have a hobby servo attached to the top of a 90 degree ball valve type tap to control coolant flow according to temperature. It seems like a fairly basic concept which I tried diong with a series of if & else statements. This is the hardware I want to use because of the way i have the cooling system set up. I have already made a coolant resivior with a pump, radiator,fans and said servo tap. I have planned this project for a long time now, so some of my hardware may seem out-dated. I'm using the Alpha 0022 IDE as my libraries were adapted to that. There is nothing wrong with my circuit as it was all tested with small sketches such as servo_sweep e.t.c. The two K-type thermocouples are both working fine,as is the temp readings on the shifted out 16x2 LCD. I'm not sure if the "temperature1" & "temperature2" are getting data from "thermocouple1" & "thermocouple2", which I'm guessing they should be attached with an 'int' or a statement in the void setup. The big series of 'if' & 'else statements to control the servo-valve/tap might look a bit messy but all this is very hard for me to understand as I'm new to this. The only info I could find on temp-controlled servo's would only perform a full open or full shut type procedure, which is no good for this project. If you've taken the time to read this far, please take the time to read my code & help fix it. You'll notice I hav'nt added any comments in there. The reason for this is, I thought that if someone has no idea of how electronics, coding & distillation work, then they probabaly shouldn't be messing with it. Therefore they would have trouble understanding my code.

code:-
#include <Servo.h>
#include <max6675.h>
#include <ShiftLCD.h>

int thermoDO = 7;
int thermoCS = 6;
int thermoCLK = 4;
int thermoDO2 = 8;
int thermoCS2 = 9;
int thermoCLK2 = 10;
int units = 1;      
int relay1 = 1;
int relay2 = 2;
int button = A0; 
int pos = 0;
float temperature1 = 0.0;
float temperature2 = 0.0;
Servo servo1; 
Servo servo2; 

MAX6675 thermocouple1(thermoCLK, thermoCS, thermoDO);
MAX6675 thermocouple2(thermoCLK2, thermoCS2, thermoDO2);

ShiftLCD lcd(11, 13, 12);

uint8_t degree[8]  = {140,146,146,140,128,128,128,128};

void setup() {
  Serial.begin(9600);
 
  lcd.begin(16, 2);
  lcd.createChar(0, degree);
  servo1.attach(3);
  servo2.attach(5);
  pinMode(button, INPUT);   
  pinMode(relay1, OUTPUT);
  pinMode(relay2, OUTPUT);
  delay(1000);
}

void loop() {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("TEMP.1");
  lcd.print(" ");
  lcd.print(thermocouple1.readCelsius());
  lcd.print(0, BYTE);
  lcd.print("C ");
  lcd.setCursor(0, 1);
  lcd.print("TEMP.2");
  lcd.print(" ");
  lcd.print(thermocouple2.readCelsius());
  lcd.print(0, BYTE);
  lcd.print("C ");

  delay(1000);
 
   if (temperature1 >93)
  {
   relay1 = (LOW);
  }
  else
  {
   relay1 = (HIGH);
  } 
  delay(1000);
    if (temperature1 >65)
  {
   relay2 = (HIGH);
  }
  else
  {
   relay2 = (LOW);
  } 
  delay(1000);

  if (digitalRead(button) == HIGH)
  {
   pos = 90;
   servo1.write(90);
  }
  else
  {
   pos = 120;
   servo1.write(120);
  }
  delay(1000);
  if (temperature1 >90)
  {
   pos = 30;
   servo1.write(30);
  }
  else
  {
   pos = 90;
   servo1.write(90);
  }
  delay(1000);
 //valve starts here
   if (temperature2 >15)
  {
   pos = 180;
   servo2.write(180);
  }
  else
  {
   pos = 175;
   servo2.write(175);
  }
  delay(1000);
  if (temperature2 >18)
  {
   pos = 175;
   servo2.write(175);
  }
  else
  {
   pos = 170;
   servo2.write(170);
  }
  delay(1000);
  if (temperature2 >21)
  {
   pos = 170;
   servo2.write(170);
  }
  else
  {
   pos = 165;
   servo2.write(165);
  }
  delay(1000);
  if (temperature2 >24)
  {
   pos = 165;
   servo2.write(165);
  }
  else
  {
   pos = 160;
   servo2.write(160);
  }
  delay(1000);
  if (temperature2 >27)
  {
   pos = 160;
   servo2.write(160);
  }
  else
  {
   pos = 155;
   servo2.write(155);
  }
  delay(1000);
  if (temperature2 >30)
  {
   pos = 155;
   servo2.write(155);
  }
  else
  {
   pos = 150;
   servo2.write(150);
  }
  delay(1000);
  if (temperature2 >33)
  {
   pos = 150;
   servo2.write(150);
  }
  else
  {
   pos = 145;
   servo2.write(145);
  }
  delay(1000);
  if (temperature2 >36)
  {
   pos = 145;
   servo2.write(145);
  }
  else
  {
   pos = 140;
   servo2.write(140);
  }
  delay(1000);
  if (temperature2 >39)
  {
   pos = 140;
   servo2.write(140);
  }
  else
  {
   pos = 135;
   servo2.write(135);
  }
  delay(1000);
  if (temperature2 >42)
  {
   pos = 135;
   servo2.write(135);
  }
  else
  {
   pos = 130;
   servo2.write(130);
  }
  delay(1000);
  if (temperature2 >45)
  {
   pos = 130;
   servo2.write(130);
  }
  else
  {
   pos = 125;
   servo2.write(125);
  }
  delay(1000);
  if (temperature2 >48)
  {
   pos = 125;
   servo2.write(125);
  }
  else
  {
   pos = 120;
   servo2.write(120);
  }
  delay(1000);
  if (temperature2 >51)
  {
   pos = 120;
   servo2.write(120);
  }
  else
  {
   pos = 115;
   servo2.write(115);
  }
  delay(1000);
  if (temperature2 >54)
  {
   pos = 115;
   servo2.write(115);
  }
  else
  {
   pos = 110;
   servo2.write(110);
  }
  delay(1000);
  if (temperature2 >57)
  {
   pos = 110;
   servo2.write(110);
  }
  else
  {
   pos = 105;
   servo2.write(105);
  }
  delay(1000);
  if (temperature2 >60)
  {
   pos = 105;
   servo2.write(105);
  }
  else
  {
   pos = 100;
   servo2.write(100);
  }
  delay(1000);
  if (temperature2 >63)
  {
   pos = 100;
   servo2.write(100);
  }
  else
  {
   pos = 95;
   servo2.write(95);
  }
  delay(1000);
  if (temperature2 >66)
  {
   pos = 95;
   servo2.write(95);
  }
  else
  {
   pos = 90;
   servo2.write(90);
  }
  delay(1000);

}
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi folks,

Just chiming in. I see a lot of people have read this. Is there anyone out there willing to help?
Does anyone recommend that I apply the comments so they can understand my code a little better?
I've come to a bit stand still with this project, please help. Once I have this all operating properly I plan
to post up pics of everything so that people can be free to copy it.
Logged

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 46
Posts: 2500
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you clearly explain the purposes of relay1, relay2, servo1, servo2?

The code i have, has no problems compiling or uploading, but the trouble with it is such that the servo's just keep cycling back & forth.

Trying to match flow rates with temperatures is going to be difficult using large if/else constructs. Because there's a delay between the change of the temperature and the influx of new coolant or wash (is that the right term?) it's quite likely that you'll find the valves and heat control constantly swinging back and forth. To avoid this basic problem, read up on PID control, then take a look at this PID controller library. Study it and try to understand it because it's a fundamental subject then give it a shot with some code and ask for help if you get stumped.

Also, when you post code enclode it in CODE tags so it's readable. It will look like: [COWD]my code[/COWD] except with "COWD" spelled "CODE" smiley-wink
Logged

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 722
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

May I also steer you in a slightly different direction?

Have you checked out the Brewtroller project? It's Arduino IDE-based, has a strong user base, and does exactly what you're trying to do, i.e. control fermentation and so on, with debugged custom-designed hardware, etc.

It's maybe not as fun as discovering all the issues for yourself, but may also get you closer quicker to actually controlling the process in question.

They have well-visited forums with very knowledgable folk in all things brewing, so I'd start there, not here.
Logged

Pages: [1] 2   Go Up
Jump to: