DIY Brew Controller Design Ideas

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

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

segallis

Well-Known Member
Joined
May 2, 2011
Messages
92
Reaction score
7
Location
melbounre
I am in the middle of designing a DIY Brew Controller for my new Electric BIAB setup. I believe am incorporating a few features that I have not seen in the commercial units. Please let me know your thoughts and ideas.

My initial idea was a WiFi based controller using an ESP8266 that I would interact with via my phone. I had a small 1" OLED display, so I figured I may as well add that so I could see things like temperature and time, and maybe some other info like what stage in the brewing process, etc. The display was a bit small for my aging eyes, plus OLED isn't the best for outside, so I bought a 4.2" 400x300 eInk display that is large and easily seen in daylight. I needed a couple of push-buttons to control two pumps, and then figured it would be nice to also be able to quickly adjust temp and time without needing my phone, so that's 4 buttons. Maybe one more to change modes or something? So I adding a 16 key telephone-style keypad seemed cleaner and future-proof.

The extra GPIOs for the keypad pretty much pushed me over the ESP8266 pin-count, so I decided to use a Raspberry Pi Zero W instead. This also avoids some of the other limitations of the ESP, and gives me more flexibility and power, plus some enhanced features like hosting it's own webpage for the display via my phone, data logging, recipe storage, etc.

To drive the heater I'm using a zero-crossing optoisolator triac driver that then drives a 40A power triac (with a B.A. heatsink to dissipate approx 30W of heat). The zero-crossing reduces noise and electrical stress. The Pi will be set to a PWM frequency of 120 Hz, which allows precise control in half cycles of the 60 Hz. So the 0 to 120 range for the PWM gives 120 steps of power from 0 to full-on, which is less than 1% resolution. And at 120 Hz, the worst-case dynamic "pulsation" of heat is less than a second - I doubt this really matters, but some people swear they see boil pulsation with a 2 second duty cycle.

For the pumps, I am using 2 more of the same zero-crossing optoisolator triac drivers and 40A power triacs, since they are a fraction of cost of an "arduino-style" 5V Relay, plus they are solid state and take up less space. They will strictly be driven ON/OFF, no PWM. No heatsink needed, but I will mount them to the inside of the enclosure, so they will actually have a substantial heatsink.

I have two DS18B20 temperature sensors feeding the Pi. One through an oring seal a couple of inches up from the bottom of the kettle (direct sense, no thermowell). Then I have a second sensor inside an 8" thermowell attached to the lid to measure close to the surface, and/or actually inside the grain bed during a mash.

One thing I am experimenting with is a piezo vibration sensor. My plan is to differentiate between "no boil", "low rolling boil", and "violent boil" using the sensor so the Pi can adjust the heater during the boil phase.

I'm writing the code in Python, and my initial cut will have separate phases for each part of the brewing process: heating strike water; recirculating mash; mash-out/lauter; boil (and maybe something I am not thinking of?) I will need to characterize the heater response so I can adapt the PID algorithm so avoid overshoots, etc. Things like lowering the heater power as temp gets within a few degrees of the target. Maybe have the total water volume & grain bill as inputs to software to help the algorithm adjust? I also plan to input or measure ambient temperature, so I can have the mash cycle be smart enough to adjust the PID gain/lead/lag terms to keep things right at desired mash temp, regardless of whether its a typical Florida 95 degree day, or a 40 degree, 20 mph wind day.

Thoughts?

-Greg
 
I am curious if the piezo element will reliably/accurately measure boil intensity.
I'll let you know what I find. I have the piezo detector working, and my next step is to capture actual data on a boiling kettle.

I will not only be looking at amplitude, but plan to do an FFT on the signal and use frequency as well. Based on my ears alone, I suspect that differentiating the boil activity will be doable, if not trivial. :)

BTW, my goal is to integrate the sensor into my base/dolly if possible. Else, I will clamp it onto the rim or handle of the kettle. I will be taking test data on both approaches.

-G
 
Why are you using discreet zero crossing opto isolators, and triacs? The common SSR's combine both in a single package, for a reasonable price.

Brew on :mug:
 
Why are you using discreet zero crossing opto isolators, and triacs? The common SSR's combine both in a single package, for a reasonable price.

Brew on :mug:
Several reasons:
1) I'm not 100% sure all the amazon SSRs are ACTUALLY zero-crossing (even if they claim to be).
2) They typically don't have large enough heatsinks for the actual heat dissipated driving a 5.5 kW load. Mine is 13 in-sq, and an inch tall, plus I'm using 15 W/m-k silver thermal paste. I prob get about 10X the heat dissipation. Keeping the Tj under 100C will extend the life of the triac and avoid a failure mid brew-day.
3) A 40A SSR with (small) heatsink runs about $20, my driver and triac are $2.
4) My driver and triac are about 1/100 the size.
5) Easier to replace a TO-220 triac when it fails.
6) Same circuit for the two pumps.
7) I like knowing all the specs of what is probably the single most important component (certainly the most vulnerable).

:)
-G
 
I am curious if the piezo element will reliably/accurately measure boil intensity.
My initial data was not reliable, but it was whatever the ESP8266 could capture, so I had no concept of sample rate. I repeated the experiment using a known sample rate from the sound card into my computer. What I discovered right off was a huge 60 Hz baseline - makes sense. That made the amplitude of the raw samples meaningless. But riding on that 60 Hz noise, the samples clearly showed an easily discernible difference in the samples pre-boil, low-boil, and high-boil.

So I have zero doubt that the piezo approach will accomplish the intended goal of level of boil detection. I am still working on the post processing of the raw data, but will l will update with useful data soon.

I also need to see if I can get useful data with the piezo mounted in the base or just beneath the kettle (more convenient than clipping to the handle or lip).

I am still going to try the ultrasonic ranging idea as well.

Stay tuned...

-G
 
I went custom as well I think the level of automation and user interface is very much a matter of personal taste.

If you are using an inbuilt pwm function it won't do what you want for a zero crossing output circuit. At 50% duty cycle you will get a pulse from the pi at 120hz that is on for half of the 120hz period. This will turn the output on every cycle giving you 100% output. Otherwise if you made your own pwm function ignore my comment.

I too wanted to avoid long on times if nothing else to avoid all the local heating/carmelizing/element caking.

with my lcd writes broken up the best I can do is a 12ms cycle time on my SAMD M0 so I forced it to a fixed 60hz frequency or 1 full ac cycle. At anything above 50% duty cycle I calculate the total number of on cycles needed subtract from the number of periods I'm working over. Then divide all the ons by the number of off cycles and track the remainder since we can only work with integers with the zero crossing output. So at 74% duty cycle in my setup I want 148 on cycles in every 200. That leaves 52 off cycles. I divide the on cyclces evenly so Off one cycle on for 2.8 cyclces. Cant do on for point .8 so I add the remainder in the back ground when it is greater than 1 I turn the output on for an additional cycle in this case it would be on3 and off 1 when the remainder was greater than one. I do the opposite below 50% duty.

Obviously people use the ds218 sensors and make it work. I found the fastest I could poll them was every .6 seconds making derivatives difficult . I'm not a software engineer but I have spent about 10calendar years and 18person years developing high speed position and force control and for no good reason I wanted to control within +/- .1 degF. I know it's not that accurate, but it is repeatable and its my time and dime. Using a pt100 sensor and the 31865chip I can sample in a few ms with reduced delays in the library. This lets me get the sample rate I want to use my favorite derivative feedback integral term so I can work without overshoot.

I'm curios how the boil sensor works out I just have boil power as one of my recipe settings. for 7gallon boil in a 16gallon pot I'm normally setting it to 2500-2700watts.


For my pump I settled on a 3 position toggle off/on/auto. I use the switch a lot especially when cleaning or when I mess up.

I'm always tweaking and sometimes some bugs creep in even though I test with a built in plant model and normally wet test as well. I have one rotary encoder that lets me skip brewing steps or go back and a second encoder to override values. I use the same encoders for settings and my recipe. These have saved a couple of brewdays.
 
I went custom as well I think the level of automation and user interface is very much a matter of personal taste.

If you are using an inbuilt pwm function it won't do what you want for a zero crossing output circuit. At 50% duty cycle you will get a pulse from the pi at 120hz that is on for half of the 120hz period. This will turn the output on every cycle giving you 100% output. Otherwise if you made your own pwm function ignore my comment.

I too wanted to avoid long on times if nothing else to avoid all the local heating/carmelizing/element caking.

with my lcd writes broken up the best I can do is a 12ms cycle time on my SAMD M0 so I forced it to a fixed 60hz frequency or 1 full ac cycle. At anything above 50% duty cycle I calculate the total number of on cycles needed subtract from the number of periods I'm working over. Then divide all the ons by the number of off cycles and track the remainder since we can only work with integers with the zero crossing output. So at 74% duty cycle in my setup I want 148 on cycles in every 200. That leaves 52 off cycles. I divide the on cyclces evenly so Off one cycle on for 2.8 cyclces. Cant do on for point .8 so I add the remainder in the back ground when it is greater than 1 I turn the output on for an additional cycle in this case it would be on3 and off 1 when the remainder was greater than one. I do the opposite below 50% duty.

Obviously people use the ds218 sensors and make it work. I found the fastest I could poll them was every .6 seconds making derivatives difficult . I'm not a software engineer but I have spent about 10calendar years and 18person years developing high speed position and force control and for no good reason I wanted to control within +/- .1 degF. I know it's not that accurate, but it is repeatable and its my time and dime. Using a pt100 sensor and the 31865chip I can sample in a few ms with reduced delays in the library. This lets me get the sample rate I want to use my favorite derivative feedback integral term so I can work without overshoot.

I'm curios how the boil sensor works out I just have boil power as one of my recipe settings. for 7gallon boil in a 16gallon pot I'm normally setting it to 2500-2700watts.


For my pump I settled on a 3 position toggle off/on/auto. I use the switch a lot especially when cleaning or when I mess up.

I'm always tweaking and sometimes some bugs creep in even though I test with a built in plant model and normally wet test as well. I have one rotary encoder that lets me skip brewing steps or go back and a second encoder to override values. I use the same encoders for settings and my recipe. These have saved a couple of brewdays.
Sorry, I meant to say the PWM clock is 120 Hz, with a range of 0-120, so the period of the PWM signal is actually 1 Hz. Each step of the PWM duty cycle in code corresponds to one half cycle. So at 25% duty cycle, the triac will be on for 30 half-cycles, then off for 90. The "pulsation" will be under a second. Yes, I thought about what you mentioned - on for 1 half cycle then off for 3, but I can't imagine needing "smoother" heat cycles than 1 Hz. Plus since the controller doesn't really know when the zero-crossing occurs it prevents a aliased beat frequency where it's adding an extra half cycle each time it turns on.

Probably more significant is that the triac only gets cycled at 1 Hz, rather than, say 120Hz, which seems would help reliability as well as EMI (if at all).

All that is to set the power level to 0 to 100% in < 1% steps. As you also point out, there is the matter avoiding local heating/carmelization. At 1 Hz or 120 Hz, power control should not be the issue. This is where th PID algorithm comes in. Trading the use of more time and less power to get to the desired target. Which is one reason I have a "max power" setting in my initial code - it limits the heater power regardless of what the PID control thinks it needs to close the loop. I don;t care for HLT heating, but definitely for Mashing, and possibly even the boiling phase?

Btw, there is so much thermal mass as well as enough latency due to thermal impedance that polling temp sensor much faster than 1 sec is probably of zero practical benefit. The movement of actual heat drives the control loop more than the sensor BW ever will. Anyone familiar with PLLs know that too fast feedback (i.e. high loop BW) can make the loop noisier or unstable. I have two temp sensors to help alleviate the problem with localized temps (at least for mashing - HLT heating probably doesn't matter)
 

Latest posts

Back
Top