Automation - It Begins

Australia & New Zealand Homebrewing Forum

Help Support Australia & New Zealand Homebrewing Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

DJR

I'm out
Joined
7/2/06
Messages
2,217
Reaction score
36
So i finally got off my backside and have soldered up some DS18S20 temperature sensors and got myself a DS9490 USB interface.

Cranked out an old laptop and have put it all on there, used the great OWFS (http://owfs.org/) toolset to read the temperature sensors - all seems to be working.

I am going to be writing some control automation in Ruby - and have started here https://github.com/sykesey/tempcontrol/. Basically so far i have the things writing a temperature to a database every minute, and a simple gnuplot export to have a look at the temps.

The basic idea in stage 1 is to have a controlled HLT, using a 2400w SS element in a 40L Al Kettle or 50L keg, with 2 float switches, one for the boil dry protection (will be set up as an interlock on the element relay) and the other as an input to the system to tell it that the HLT is full.

The HLT filling won't be automatic but the float switch will be there for later.

Off the HLT i will then have a automated ball valve via TJFT - these come in at about $30 each and are good up to 90C apparently. Should be fine for HLT but to 90C means nowhere near kettle. No matter as i don't really want to automate anything in the kettle yet.

The mashtun will then have a ball valve automated for sparging, and then 3 (i think) float switches - one at about 60% volume, the other at about 80% volume, and the 3rd at just under 100% (more like 95%). For mashing and sparging rather than worrying too much about level sensors which seem too fragile and fickle, just fill the mash to 60% for a normal mash which still gives me the ability to either infuse (take it to 80% with hotter water) in the first stage, or recirculate at a later stage with a HERMs or RIMS tube setup as i add these bits in. Sparging just alternates between either 60-80% or 80-100% until the HLT empties - the a floatswitch in the HLT will tell me so.

I don't think having fixed 60%/80% steps will present a huge issue as i tend to use the same volumes anyway - i tend to just do beers at about 1.048 with 4-4.5kg of grain.

I/O will be all via other 1 wire devices - the DS2450 device provides 8 I/O pins which i'll use to fire off relays and valves. I have a 1wire ADC coming as well in case i need to do and ADC work - the one i ordered a sample of has 4 inputs 0-5v or 0-2.5v i believe with 16 bit accuracy.

I'll need a fairly beefy SSR and heatsink for the element relay but other than that most of this stuff is all going via the 1wire bus which means i have to be fairly safe in how it is designed - in the first stage i'll make sure the interlocks on the HLT element are there and then 100% float switch on the mashtun fires off a fairly hefty alarm in case it tries to overflow :)


Basic structure

USB control -> 1wire bus (RJ12 cable) -> 3x temp sensors (1 HLT, 1 Mash, 1 ambient) + DS2450 GPIO - GPIO connected with inputs from float switches (5) and outputting to 12V rail for ball valves (2) and 12V rail for HLT element SSR

HLT element SSR interlocked with extra boil dry floatswitch at least 1-2 cm above element level




Phase 2 stuff - HERMs build, march pump, multiple flows required (recirculation or drawoff) and maybe other things like automatic kettle fill and a better level sensor method

Photos soon - bit boring at the moment :)
 
Thought i should add a running total of costs

- DS18S20 x 4 - Sample order $0 (have 4 DS18B20 which are the newer version coming as a sample too)
- DS2450 and ADC (can't remember code) - $0 sample
- RJ12 phone cable x 5 m - free - old modem cables :)
- 2x SS thermowells - free from an air con tech a while ago (if i was doing now i'd use a simple SS tube on a comp fitting or just direct in)
- DS9490R USB 1wire bus master $42 inc shipping from thermodata.com.au

Total now $42

Note: already have 40L Al kettle, gas burner, ~22L mashtun with stainless braid, immersion chiller and some leftover copper coil if i want to do a HERMs heat exchanger

Plans

- Craftbrewer SS element and lead $45
- Al pot 40L or SS keg 50L $100
- Float switches - not sure
- Ball valves - around $35 each landed x 4 (2 now, 2 later)
- SSR - something like the ones OSCS have around $20 with heat sink
- HPM outlets and boxes about $60
- High current transistors (like TIP29A) $3 each or so x 4 (one for each ball valve)
- Battery charger for 12v supply - already have this so $0

total about $300 or so to go

Will probably need a march pump shortly too...
 
Bloke I am waiting for delivery for 2 of these float switches.
Search for Sellername "may139188" when the above link expires.
Seem better than the no temp rated plastic ones that Jaycar sells (at least on the interweb anyway :)
Cheers
Doug
 
Sounds awesome mate, can't wait to see it going. If you need to drill any holes I have my trusty step drill you can borrow. I'm building another brewery at the moment too, it's going to punch out about 11L because I'm finding 23L takes a long time to get thru that I kinda get bored with the beer on tap :).
 
These look good too and mount the right way for my setup

http://www.ebay.com.au/itm/Stainless-Steel...#ht_2343wt_1141

I want to mount them on the side of the vessel rather than in the top

Thanks matho - I have a step drill though - the edges are slightly blunted from the last time i drilled SS but it works :) good old cheap step drills

I can probably make mine do smaller batches with a couple more float switches
 
/snip
Cranked out an old laptop and have put it all on there, used the great OWFS (http://owfs.org/) toolset to read the temperature sensors - all seems to be working.
/snip
Would this work on something like Cygwin, to log to a txt file and live import that into a Windows based app?

/snip
I am going to be writing some control automation in Ruby - and have started here https://github.com/sykesey/tempcontrol/. Basically so far i have the things writing a temperature to a database every minute, and a simple gnuplot export to have a look at the temps.
/snip
Can you get it to log to a .txt file? What's the shortest log interval you can program? Is 1s practical?
 
Would this work on something like Cygwin, to log to a txt file and live import that into a Windows based app?


Can you get it to log to a .txt file? What's the shortest log interval you can program? Is 1s practical?


There is instructions on getting OWFS going on Windows here: http://owfs.org/index.php?page=ms-windows

I'd either use Linux or MacOS for it but that is just me - there is also other products that'll do the same thing such as the Maxim/Dallas supplied 1-wire SDK and some other things.

Once you have the data you can do whatever you want with it - a simple shell script running "owread" will return the data and then you can pipe the output to a text file if you want to do that.

Short intervals are problematic due to hardware limitations - the spec of the DS18S20 and DS18B20 calls for about 650-750msec to obtain the current temperature - the OWFS driver caches the result (you can disable caching) to make this a bit easier but it can take up to 2 or more seconds to read 3 sensor temps - the DS18S20 is a fairly complicated little device in that it has to get the temperature, write it to a bit of internal memory and then push the result down the wire complete with CRC error correction data

I'd say a run loop interval of about 10s is pretty manageable, so far i have just been using 60s for testing but in practice i'd want around 10-15s intervals for reads. As the 1wire is serial as well you can't read more than 1 device at the same time, if you want to speed that up you need multiple bus masters (usb/serial adaptors or microcontroller devices) running on different "buses" or connections
 
Btw i am not really using the FS-based functions of OWFS, just owserver to sit there and poll the USB bus and the "owread" command which polls the server - which means you don't need FUSE which won't work on windows. The OWFS page looks like that method will work with Windows - FUSE support definitely won't work as Windows can't do FUSE as far as i know.
 
tips from my brewbot building:

- Definitely prefer AL for the HLT. Since it is only for water corrosion isn't really a problem. But the important bit is that aluminium conducts heat much better than SS so you are much less likely to get stratification of the water (i.e. water at the surface is hot but water at the bottom is still cold)

- If you have a couple of float switches at known locations you can use software to get what ever volumes you want. For example on the brewbot I have 2 level probes that are 4 litres apart. In software I keep track of the time it takes for the water to go from one to the other. I then know the fill rate. From there calculate the time you need to get the ultimate volume. Not 100% accurate, but not too bad.

Also consider one of these:

http://www.seeedstudio.com/depot/g12-water...l?cPath=144_151

- It's only the temperature conversion on the DS1820s that take time. Retrieving the result takes a few milliseconds. You can get all devices to begin conversion at the same time (see the skip rom command in the data sheet). So you can actually read temperatures from all devices every 750ms. I haven't used any of the pre packed software, I have always just written my own One wire bus driver, so I don't know if they are capable of allowing this.

But anyway, on home brew scales, the temperate changes are slow enough that even a reading every 30 seconds would be quick enough.

- In my experience, conductive level probes have been pretty robust. Don't be too afraid of them. They will also be much easier to clean in a kettle environment.

- If you need 12v power, take a look at the ebay laptop power supplies. I got 12V 6A for $10 delivered and it's pretty small. Has stood up to some short circuits well too.

- Level switch locked to prevent dry firing is a good idea. I have had 2 dry firings on each of my brewbot. The last blew up the element (not a big deal, $10 element).

Keep us posted on the progress.
 
Cheers Zizzle - your brewbot is certainly an inspiration. The conductive level probes could work and might be a little easier to work with.

You're right on the RAM read time and commands - thinking about it you could also use the alarm function to set the target temp and then just read the alarm bit rather than the temp if you didn't need direct temp feedback. There is also a version - the DS1825 that you can isolate the pins from 1-wire on and then it becomes a temp probe that digitally switches on/off when a target temp is reached which seems useful but would require more work to isolate before setting.

Didn't realise flow meters could be had that cheaply - don't really need super accurate flow.

I am wondering if i am mad - one of the nice things i can do since the code's all in Ruby (now within a Rails stack) is use Cucumber to drive BDD - this should be used for testing but it actually makes a nice control language

Cucumber mash feature said:
Feature: create wort
Aspirational feature to drive wort mashing via Cucumber :)

Scenario: Heat water
Given I have water in the "hlt" at "> 0" degrees
Then heating the water in the "hlt" should give a temperature of ">= 70" degrees

Scenario: Simple single infusion mash strike in
Given I have water in the "hlt" at ">= 72" degrees
And there is grain in the mashtun
Then adding the strike water to the mashtun should give a temperature of "67C"
Then start the stage "mash-in"
And the dashboard shows the stage as "mash-in"

#optional scenario here - HERMs control?

Scenario: Mashout
Given I have mashed for "45" minutes
And I have water in the "hlt" at ">= 80" degrees
And the "mashtun" is at ">= 65" degrees
Then adding water to the mashtun should take the temperature to "72C"
Then start the stage "mash-out"
And the dashboard shows the stage as "mash-out"

Scenario: Sparge
Given I have mashed out
And I have water in the "hlt" at ">= 75" degrees
Then start the stage "fly-sparge"
And the dashboard shows the stage as "fly-sparge"
And the "hlt" should finally have no water
And the dashboard shows the stage as "inactive"


#end of feature - wort should now be in the kettle :)

I am also building a nice little HTML based dashboard overview page that 'cos it's in HTML will work across iPhone or web browser...
 
Btw OWFS calls that mode "Simultaneous" - it seems to create a special device called /mnt/owfs/simultaneous in the filesystem or within owserver as ./simultaneous - writing 1 to that device does that and then you can read the temperatures of each device, I think.

Haven't tested it but hopefully it works, if not i'll patch it up as it'll be a handy feature for sure
 
OK, so long between posts here but I have finally made some little progress.

I now have a 2400w kettle rigged up with an SSR and one wire control system to control the element - using a basic PID control. The switching works OK, used a Hongfa/Futurelec 40A SSR so it's well over spec, controlled by PIO on the DS2413. The DS2413 has an extra channel left over and I rigged up a LED in line so i can get a warning that the heater is on.

The DS2413 then has some DS18s20's off it, one into a thermowell in the kettle.

I am struggling with PID control in the kettle though, it takes about a minute to get the water, thermowell and probe up to the same temp as what's in the center of the pot near the element. It's not a huge problem, just needs some tweaking of my PID control in the code. I may end up having to do duty cycling of the element to allow more fine-grained control, or have something to stir the pot lightly to make it easier.

Not sure if I will go down ball valves etc, I am looking more at HERMs at this point and may use a small food grade pump like Gryphon's one and an SS tube coil in the HLT, I don't mind sparging and the expense of setting up float switches and automating sparges for a net saving of a few minutes of manual labour on brewday.
 
Got my PID control algo sorted out, in testing anyway...

To quote someone else - PI or the integral portion is evil and should be avoided :) Ended up with a good result in the testbench with PV=50, PI=0.02, PD=5, will test it out

Got a quote into a stainless fabricator to bend up a HERMS coil in 201 or 304 stainless, looks like it'll be pretty cheap and then i just have to manually run a pump and put ramp code into the control program and build a return manifold...
 
sounds awesome mate, I'll have to come up and have a squizy at it. So making the PCB worked OK?

cheers
 
sounds awesome mate, I'll have to come up and have a squizy at it. So making the PCB worked OK?

cheers

Yeah, making up the PCB worked fine, just had to remember NOT to print it mirror as we had the tracks on the bottom of the PCB - made one, soldered it then realised.

The heater got about 20L of 20deg water up to 80deg in about 45 mins, which is about 10mins behind "optimal" heating with 2.4kW, so I am going to broccoli box and gaffer tape the outside of the HLT to insulate it a bit.

The PID algo worked better today on a real batch, worked even better once i got the DS1820's further down the wells with less tape and better soldering. Overshot by about 2-3deg, i think next time it should be a lot better.

Have a DS1820 in the mashtun now too. Had a pretty crap run with temperatures with bad solder joins etc but you can see the gist here. P1 = HLT, P2 = Amb, P3=Mash. Times are 11h behind - my database is storing GMT time

plot.png
 

Latest posts

Back
Top