waldzinator
Well-Known Member
Hi,
I've been slowly chipping away at making a fully automated, electric brewery for about 6 months now. Up until now, I've been focusing on the sensing, display, and user interface components, mainly because my current house doesn't have 240V hookups in my little detached garage. Big news though...I'm relocating to Charlotte, NC next month and my attached garage will have the necessary hookups. So, it's time to ramp up the work. My ultimate goal is to use an Uno for all my firmware. I figure the challenge of using a limited number of pins would be fun...lots of shift registers and heavy use of i2c.
I purchased a 4x3 matrix keypad and PCF8574 shift register. The idea is here is that under my setup function, I ask the user (me) for the number of mash steps. Once entered, I then ask for the mash length and temp for each. I started working on a function to write each to an array, but then it dawned on me that there are some issues here. Initially, I'm going to heat my water up to my strike temperature, not my target mash temperature. The remainder of the rests would not be an issue, since the grain is already mixed with the water. The issue comes up again when I sparge, especially if I am batch sparging.
Anybody run into this issue with their firmware? I guess my options are to manually heat the strike water, but what fun is that? Not looking for a "do you hez the codez" type of response haha, but suggestions would be great.
Here's the relevant code (the two input functions are untested) Once I got to the function void getmashsteptemp(), I realized I needed to rethink. If anyone is interested in full code or my ugly breadboard setup, let me know. For time display, I use a 4-digit 7-segment clock. :
EDIT: I do realize I could probably prompt for the strike temperature and not populate an entry in my time array (not shown below yet). I could then write some code in my loop to heat to that temperature, add the water, and once added, run through my mashtemp array. I was just wondering if there was a better way.
I've been slowly chipping away at making a fully automated, electric brewery for about 6 months now. Up until now, I've been focusing on the sensing, display, and user interface components, mainly because my current house doesn't have 240V hookups in my little detached garage. Big news though...I'm relocating to Charlotte, NC next month and my attached garage will have the necessary hookups. So, it's time to ramp up the work. My ultimate goal is to use an Uno for all my firmware. I figure the challenge of using a limited number of pins would be fun...lots of shift registers and heavy use of i2c.
I purchased a 4x3 matrix keypad and PCF8574 shift register. The idea is here is that under my setup function, I ask the user (me) for the number of mash steps. Once entered, I then ask for the mash length and temp for each. I started working on a function to write each to an array, but then it dawned on me that there are some issues here. Initially, I'm going to heat my water up to my strike temperature, not my target mash temperature. The remainder of the rests would not be an issue, since the grain is already mixed with the water. The issue comes up again when I sparge, especially if I am batch sparging.
Anybody run into this issue with their firmware? I guess my options are to manually heat the strike water, but what fun is that? Not looking for a "do you hez the codez" type of response haha, but suggestions would be great.
Here's the relevant code (the two input functions are untested) Once I got to the function void getmashsteptemp(), I realized I needed to rethink. If anyone is interested in full code or my ugly breadboard setup, let me know. For time display, I use a 4-digit 7-segment clock. :
EDIT: I do realize I could probably prompt for the strike temperature and not populate an entry in my time array (not shown below yet). I could then write some code in my loop to heat to that temperature, add the water, and once added, run through my mashtemp array. I was just wondering if there was a better way.
Code:
#include <stdlib.h>
#include <LiquidTWI2.h>
#include <i2ckeypad.h>
#include <Wire.h>
//mash temps and and times
int intMashSteps = 0;
double mashTemp[10];
int mashTime[10];
///more LCDs to be added later using i2c
LiquidTWI2 lcd(0x20);
void setup()
{
lcd.setMCPType(LTI_TYPE_MCP23017);
lcd.begin(16, 2);
Wire.begin();
kpd.init();
while (intMashSteps == 0)
{
intMashSteps = mashNumStepsPrompt();
}
for (int c; c<intMashSteps+1;c++)
{
getmashsteptemp(c);
}
Serial.begin(9600);
}
int mashNumStepsPrompt()
{
int mashStepsIter = 1;
char mashSteps[3];
char key = kpd.get_key();
//Need function for prompting
while (strlen(mashSteps) < 2)
{
lcd.setCursor(0,0);
lcd.print("Type # mashsteps");
lcd.setCursor(0,1);
lcd.print("and press #");
key = kpd.get_key();
///TODO: Error handling here
if (mashStepsIter < 2 & key != '\0')
{
mashSteps[mashStepsIter] = key;
mashStepsIter++;
}
}
if (mashSteps[2] == '#')
{
int numMashSteps = mashSteps[1] - '0';
return numMashSteps;
}
else
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Invalid entry");
delay(1000);
return 0;
}
}
void getmashsteptemp(int mashstepnum)
{
char mashTempEntered[7]; ///6 spots for temp xxx.xx and one for null term
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Enter Mash1 Temp");
lcd.setCursor(0,1);
lcd.print("Use * and # end");
key = kpd.get_key();
}