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 πŸ™‚

ArduFerm, Custom PCB

Today i’ve spent some more time playing around with Eagle and this link, seeing how hard it was to design a custom Arduino Shield PCB for the fermentation controller.

Here’s a pic of the circuit diagram from Eagle:

Well, admittedly, I don’t really know what i’m doing, but it’s been fairly easy following the guide and building a PCB. It lacks a bit at the end though when it comes to exporting Gerber files (which is what a PCB manufacturer expects) so I’m kind of stuck for now; but i’ll do some more research later and find out what I need to do.

There are a number of relatively inexpensive manufacturers of custom PCB’s around on the net, so I’m thinking of ordering some just to see how they come out. Might even use one πŸ™‚

ArduFerm progress.

Last week I was home looking after a crook kid (and not 100% myself) but I figured I would make use of the time to work on my Arduino Fermentation controller. I have been coding on it every now and then when I have spare time, and plugging in the Arduino when I can to test it on there.

Last week I also received my 4 OneWire temperature sensors from China. They’re perfect for the job, and with only a little work should do what I need.

ArduFerm OneWire

Single sensor connected only here, had two going as well in the test program no worries during the day. Should handle all 5 πŸ™‚

Honestly I don’t know for sure if I can get everything working properly, I read that solid state relays require only a digital pin each (will need 4), All temp sensors only need a single pin, LCD uses 6 pins (not using the buttons, that needs another pin), Ethernet 4 pins, going by the number of pins I have on the Arduino, I should have a couple spare. I’m sure there’s something I don’t know or haven’t factored in as yet – but see what happens I guess.

Interesting playing with this stuff, though!

Arduino Fermentation Controller

So, my Arduino PWM controlled stir-plate didn’t quite happen. At least it hasn’t happened yet. Anyway, I still have a couple of Arduino’s here so I may as well use at least one of them.

Kind of just thinking out loud (if it can be called that while i’m actually just typing) but the plan is to replace my STC-1000 temp controller with an Arduino-based temp controller. I was actually thinking about using a Raspberry Pi, but I think I’ll have a hell of a time getting hold of one, when they eventually are available after all the pre-orders have been filled! Plus, It would be a waste for this. It’s tiny, but it’s way too powerful to do this πŸ™‚

I may be getting another fermentation fridge soon as well, and while I do have another STC-1000 here ready to use for that – I want something a bit more flexible. I want to be able to log and track the temps, and even ramp the temps inside the fridges automatically for diacetylΒ rests etc. (On that subject I smacked a pack of Hella Bock today, it’s over 6 months old and still had fair viability! It’s now in a flask on the stir plate right now..)

Dot point ideas:

  • Multiple fridge control
  • Control Heating and Cooling cycles of both fridges independently. SSR per device%.
  • Ethernet. I have Ethernet in the garage already, and a free point. Will just have to run a cable over the top of the door to the fridge.
  • Arduino to offer data in an easily parseable format for external graphing (Cacti or custom RRDTool graphs from a VM)#.
  • Temperature sensors for each fridge – one for wort temp (in thermowell), one for fridge internal temp (for each fridge) and an external ‘ambient’ temp sensor as well. Each will be graphed remotely.
  • OneWire temp sensors for simplicity and easy of use. 4 of these already ordered:Β
Ramping control:
Again, just thinking out loud on this. So that I can ramp fermentation temps properly (ideally remotely) the Arduino needs to have the target temp for each fermentation fridge to be set to at a specific time. I’m not sure I can trust the Arduino to keep time (but it may, I actually don’t know), so it may require a script running on one of our VMs to set these temps, and the Arduino just gets it’s target temps from the script, say every hour or so. A simple web interface would allow a schedule to be programmed, say 18c for the first X days, then allow the ferment to raise to 22c (for example) at the end so that the yeast clean up properly. This should also have the ability for this rise to be a ‘free rise’ where the Yeast are generating the heat, rather than a heater pad in the fridge itself.
I know I could set an STC-1000 manually to do all this, but what can I say, I’m lazy! And a sucker for technology.

# A JSON library exists, but aparently it’s large (for an Arduino program) and may cause memory issuesΒ on certain Arduino hardware. A simpler format may be required – but because i’ll only be outputting basic information such as current temp it should be good enough to output something like: %FRIDGE1#23.5#18.5#0#0%FRIDGE2#22.1#12.5#1#0% (device, temp one, temp two, cool state, heat state) which would be super easy to parse using a PHP script in two steps. Split the line by % to get each device, then split by # to get each value.

% A quick read shows it’s super easy to control a SSR with an Arduino. Hopefully that is true! I’ll know soon enough πŸ™‚

Stir Plate v1.1

Two nights ago I did a little more research into building a stir plate because I was concerned at what I was seeing with my plate, because the stir bar didn’t look like it was doing the right thing.

The stir bar wasn’t linking in magnetically, only one end would be attracted and the other was being repelled. That isn’t right. I found a German how-to site linked from AHB which explained that the polarity of the magnet needed to be setup correctly, so that the stir bar would work correctly.

I was able to confirm this as well, because one of the major parts people use when building one of these themselves is a hard drive magnet. They’re long and flat, but they have a distinct North at one end and South at the other end. The long and flat magnet I bought from Jaycar had North on one SIDE and South on the other SIDE, not at either END.

So, off to Jaycar, and I picked up a pack of 4 smaller rare-earth magnets, and stuck those down in place of the larger bar magnet. Now when the stir bar is layed over the top of the magnets it attracts correctly, north to south and south to north.

Stir plate v1.1

I also picked up a 500k potentiometer as suggested by some other people – I guess it will end up having some of the sensitivity issues previously mentioned but at least it’s SOME control over the speed rather than none πŸ™‚ It was $2.50 so if it pops, meh. Hopefully my Arduino powered Stir Plate V2.0 will be ready around then πŸ™‚

Stir Plate v1.1