# Limits of a pid



## mrsupraboy (20/1/15)

In the process of researching my build.

Ive come across pids as being very commonly used. Ive researched them but was wondering what are there limits. Are they only used to switch things on and of via ur programing a certain times.

Can u variable the output voltage. 

Anygood guides that are easy to understand.


----------



## klangers (20/1/15)

PID is just a control algorithm which decides the output based on various combinations of gain which is proportional to the error (difference between actual and setpoint), differential function of the error and derivative function of the error.

Usually the cheap controllers available take the output and convert it into pulse width modulation (PWM) which is essentially turning the output on and off quickly to mimic a partial output.

Realistically with controlling temperature in brewing, PID is massive overkill as the rate of change is so small and there are no significant derivative or integral influences. PID are most effective on systems such as cruise control where proportional, integral and derivative terms come into play (eg acceleration - derivative of velocity, distance - integral of velocity).

So all they do is control an output based on an input. It would probably be more helpful if you could let us know what you're trying to do, otherwise you'll get a shotgun approach of advice.


----------



## mrsupraboy (20/1/15)

I want a fully automated brew system. I want thermostats for the hlt and mash tun as well as havin float levels for water.

I want pumps as well as gas burners and electric elements coming on automatically . I was hoping that the pids could give like a 1-12v signal so for the gas i could use it for the demand it needs. Having a restrictor in the gas line which automatically slows down once reached temperature


----------



## Pokey (20/1/15)

Make sure you install flame detectors


----------



## Adr_0 (20/1/15)

PIDs are great, but if you have a system with a lot of pipe length, lag in your measurement vs controlled variable (ie temp is measured in the middle of mash, but control of temp is from a 50L pot of water with a HERMS coil) then you will struggle to get a system with good response (hits set point quickly without overshoot or oscillation). 

So think about your layout and where you measure temp and make sure this will ensure your measured temp is close to the source of heat, then your controller has the best possible chance. 

Elements are typically driven by a solid state relay, for a proportion of a nominated time, eg 40% output is 800ms of a 2s band. So conventional relays won't like this, nor will fridges. Reducing this 100% time (it could be 2s or 2min) will theoretically give you better response but you will quickly reach the limit where this gives you benefit, and the only way to improve is through adjusting your system.


----------



## squirt in the turns (20/1/15)

mrsupraboy said:


> I want a fully automated brew system. I want thermostats for the hlt and mash tun as well as havin float levels for water.
> 
> I want pumps as well as gas burners and electric elements coming on automatically . I was hoping that the pids could give like a 1-12v signal so for the gas i could use it for the demand it needs. Having a restrictor in the gas line which automatically slows down once reached temperature


Not sure why klangers thinks PIDs are overkill - they're perfect for maintaining/changing the temp in a recirculating mash. Everything else he says is spot on as far as I understand it. With a resistive load like an electric element that's drawing a lot of current but doesn't mind being switched rapidly, the PWM output of a PID is perfect. I believe voltage regulation can be done but PWM is easier. As Adr_0 says, that rate at which a mechanical relay would be switched is too fast and it would likely fail quickly. This is why the combination of a PID controller and SSR (solid state relay) is so common. The SSR can be switched as rapidly as you like without wearing out as it has no moving parts.

You could just use a basic temperature controller like the STC-1000 to control the mash temp but this is NOT a PID, it just switches when it deviates too far from a set point and therefore won't be as accurate. The STC has a normal mechanical relay and won't switch fast enough to wear itself out.

You don't mention where in your system you want to use gas or electric. For bringing the HLT and kettle up to a set temperature, you could switch the gas on/off using controllers and solenoid valves. I wouldn't even attempt to automate the mash temperature using gas when an electrically heated recirculating system is so much easier. Not saying it can't be done but I'm not aware of anyone that's doing it. Happy to be corrected.

If you want to control pumps based on input from float switches, as well as automating other processes all from one controller, you'd need something like the BCS-460, or you could build something yourself using an Arduino or similar.

For a unit that just takes a temperature input and does PWM output, look at Auberins or Sestos.

In terms of an easy to read guide on PIDs you're probably SOL, sorry. There are plenty of build blogs and threads on AHB and elsewhere. The Electric Brewery is also a great resource that has inspired many builds.


----------



## klangers (20/1/15)

squirt in the turns said:


> Not sure why klangers thinks PIDs are overkill - they're perfect for maintaining/changing the temp in a recirculating mash.


 I guess I was more speaking from a theoretical perspective. PIDs were originally design for rapidly changing systems (eg robot servo motor control). The temperature of a mash changes very very slowly by control system standards. There is very little hysteresis in this system too, ie when you stop heating the temperature stops rising. Realistically, the derivative term will never come into play, and the integral term will miniscule to correct for steady-state error that the proportional control may introduce. In terms of control systems, the amount of heat you add is directly proportional to the temperature rise, so the additional complexity introduced by the other terms isn't really warranted.

That said, they're cheap so who cares if you're killing a fly with a hammer.

EDIT: I'd strongly advise you against attempting to control temperatures using gas burners. Accurate gas control valves are very, very expensive and the amount of tuning required to make it work will be way out of the realm of an amateur brewer. The possible consequence (catastrophic explosion) from malfunction with gas compared to electric is so high that I'd never recommend direct gas heating to any of my brewery clients (they use steam which is a lot safer and easier to control).

That said, if you're dead keen on getting it going then I'd suggest cannibalising a gas-fired continuous hot water system and figuring out a way to change the temperature setpoint (mine is set at 50 deg C). I would be extremely wary of trying to make one from scratch.


----------



## seamad (20/1/15)

klangers said:


> I guess I was more speaking from a theoretical perspective. PIDs were originally design for rapidly changing systems (eg robot servo motor control). The temperature of a mash changes very very slowly by control system standards. There is very little hysteresis in this system too, ie when you stop heating the temperature stops rising. Realistically, the derivative term will never come into play, and the integral term will miniscule to correct for steady-state error that the proportional control may introduce. In terms of control systems, the amount of heat you add is directly proportional to the temperature rise, so the additional complexity introduced by the other terms isn't really warranted.
> 
> That said, they're cheap so who cares if you're killing a fly with a hammer.
> 
> ...


Depends on what type of system you have for mashing, eg , I use a RIMS and it is very dynamic in terms of temp change, only a PID could control it.


----------



## husky (20/1/15)

I wouldn't want to control my mash RIMS with anything but a PID, this is exactly where they are used best. Our systems may not need the D function in the controller but 99.99% of the industrial systems I have ever commissioned do not either, generally P and I are all that is required. PID controllers are cheap and make controlling temps dead easy. My understanding is that these small PID controllers do not operate as a regular PID function as they use fuzzy logic. I have only experience in using these small PIDs and electric elements in my brewery as I have a manually adjustable gas fired kettle, all I can say is consider doing it all electric.


----------



## mrsupraboy (21/1/15)

This is just a quick picture i put together of what my system will be kinda like.

There is a top float for filling the hlt.
Followed by 2 electric floats for controlling the mash as well as sparge water. 

The hlt is controled by gas. I wana fit some time of flow control to the gas so when it needs heating it works on full and when it doesn't closes down to 10%. That way i wouldnt need a pilot light. Well i hope not. Then i would pump my strike water in and once done refil to the 66lmark. And heat to temp.

Followed by 2 33l sparges. Im basing this automated setup on 90l to 80l finished batches.

There is gonna be a pump to recirculate the mash tun then once done empty straight into the boiling pot. 3way actuator or solenoid would easily sort this out meaning only 1 pump needed. Tho might be as cheap to just buy another pump.

Then gas to boil. Yes electric would be so much easy but you need the power to back it. I could wire this easily with out a pid but pids would obviously save room and be more acurate.


----------



## mrsupraboy (21/1/15)

Sorry if unclear ahb really took the clarity out of the pic


----------

