Hello all,
I'm trying to build an open-source beer brewing robot (brewbot) using the arduino. There are a few that exist already, but I want to do a few things differently. I want to get the recipe from beerXML, I want to use serial+computer as my interface, I'm using a single pot brew-in-a-bag setup, and I want to use my propane and adjustable regulator to control the heat. I've taken a look at how others have build their brewbots (notably Brewtroller and HABS), but their code seems overly complicated to me. Also, they are using hardware controls.
At any rate, early prototypes show great promise, and I'm now working on greater automation of the system. What I need help with is understanding how I can break down a recipe into it's control steps.
For instance, if there is 1 strike, 2 mashes, and 1 boil, that's 4 control steps (states?). The problem is that what happens in each is a bit different.
For strike, I want to heat the water to a specified temp (say 152 degrees F), then I want to wait while I dump in some grain, then press a button and go to the next step - mash1. For mash 1, I want to hold a constant temp (150F) for a specified period of time, then go to the next step mash 2. For mash 2, I want to increase the temp to 160F, then start a timer and hold the temp for 30 minutes. Then I want to go to boil - get the temp to 212 then start a timer, stopping after 60 minutes.
During the boil, I want to set an alarm to remind me to put in my hops at certain times.
float getRecipe()
{
String steps[] = {"Strike", "Mash1", "Mash2", "Boil"};
float temps[] = {152,150,160,212};
int times[]={100,30,30,60};
int numSteps = (sizeof(steps)/sizeof(String));//number of steps
//what goes here?
return Setpoint;
}
So, my question is how can I get the recipe info and use that in some sort of state machine, taking inputs from either millis() or SimpleTimer, and control how the program goes from state to state?
Thanks,
JR
Attached is the full program code including my pseudocode and comments to myself(for the curious).
automatedBIAB_v1.ino (7.73 KB)