Brewery and Fermentation Controller, Software updates!

To run all this hardware, there clearly needs to be software, too… Part of the decision when thinking about which platform to go for was the software. Whatever I chose I would be doing some coding, and honestly when I looked at the BrewTroller code, it kind of scared me off. So many #ifdefs! I guess it’s a single codebase that needs to work with a lot of hardware, which has matured over time, which could explain some of it. And, I’d be lying if I said I wasn’t REALLY attracted to the idea of having a full GNU/Linux OS running my brewery 🙂

Anyway, I didn’t think I could do better than they have, but one of the major reasons I’m building this system is so that I know and understand every part of the brewery. EVERY part! That includes the software! Luckily I work as a software developer, so I think I have something of a brain for this kind of thing. Daily I work in PHP – so many people will say I’m not a “real developer” because I don’t work with a compiled language, or because the language is loosely typed (believe me, both things have been said to me!). Without firing up over that too much, the thought processes are identical – but strongly typed languages such as C/C++ and the like are a bit more to get your head around, granted. But, Object Oriented concepts are not foreign to me, so I’m not concerned.

Having got that out of the way, the other day I couldn’t get how I wanted the software to work straight in my head, and rather than try and prototype something in an unfamiliar language, I opened up Eclipse and hacked up an OO structure in PHP. Only took me 1/2hr to prototype the basic structure of how I wanted the objects to work.

I did know I wanted to do this in a ‘real’ language (now I’m sounding like one of those people..) so it was always going to be C/C++. I haven’t spent enough time with Python to like it yet, I really HATE Perl (yes I HAVE spent enough time working with it to grow to absolutely hate it!), and PHP, well that’s not the right language for this task 😉 I’m mostly interested in having this perform well, all the time, hence the choice of a compiled language (and the complexity that will come with that; threading etc).

After I prototyped the object structure, I then installed the C++ IDE into Eclipse, and got coding! It took me a bit longer than in PHP as I was having to get my head around the intricacies of how C++ does it’s OO (and it’s a LOT different to how I’m used to!), and the like. As it stands right now, I have a base project working locally, which doesn’t do much as yet (as you would expect, given that I have a family and job, too!) but what it does do is load up a batch, initialise objects for all 3 vessels, and add steps to each vessel. Also considering adding ‘vessel’ objects for things like a plate chiller and adding stubs for a HERMS vessel (though I won’t be using it). Depends how I go with getting logging etc working, they may not be required.

The plan is to have every action, such as HLT Fill, Mash Tun Fill, Dough In, Mash Steps each their own Step object, comprising of a number of variables such as temps, child objects for sensors and pumps, weather pumps should be active, heating controls etc.

That’s a very ‘high level’ look at it, but it could work.

Naturally the plan is to incorporate timers into the system, as that’s one thing I’ve been REALLY wanting too. I’ve got a few other thoughts around this, which will require some work and testing too. If I write into the software that I plan to ‘mash in’ at, say, 7am – the system will then be able to work backwards from that point and know exactly what time things need to happen. So, to have water at 75c at 7am, things will need to happen. The system might need to fill the HLT automatically at 4am. Would it be a good idea to have a ‘HLT Boil’ step perhaps, too? What would happen then, would be the HLT would fill automatically at 4am, and the water would heat up to 100c (ie Boiling) and boil for 15 mins. Good to volatilise any chlorine etc in the water, and to sanitise it (but of course it does not need to be at this point). Nice to have? Happy to hear opinions on it; but not required. Boil for 15 mins, then let the water cool naturally for, say 2hrs, and the PID software keeps it at 75c (example) until ready for 7am mash-in.

The other thing I’ve started work on, is parsing a BeerXML export (from BeerSmith), and loading that into the brewery software directly so that it get’s all it’s data from there, rather than requiring manual input. BeerSmith Cloud API would be nice, Brad!

Slow progress on that so far, i’m using pugixml as it was supposedly the most ‘noob friendly’ library for parsing and handling XML files. So far it’s a bit more difficult than I expected, I was hoping for something more like SimpleXML in PHP 🙂

It’s setup at the moment with automake/autoconf as well, which I’m glad I did from day one. Screw writing Makefiles by hand 😉 Planning to release the code under the GPL licence, and the project will be called ‘OpenBrew‘. Nothing there yet, though!

Anyway, getting tired… Hopefully these insights into the brewery have been interesting! And, there’s more to come, but not tonight 🙂