BruControl: Brewery control & automation software

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.
Ooh, I like that... New plan C. :) I think I had mentally blocked that as an option b/c I had put flow meters on my reverse osmosis system's "clean" and "waste" water lines and had nothing but trouble with them...

I had kind of forgotten about them though... They were originally going to be how I measured volume going into the HLT (and into my waste water tanks) but it wasn't working so I added on the pressure transducers. After all that, I added a booster pump to the RO system and (by chance) that wound up fixing the flow meters too (just wasn't enough flow to make them work previously, it seemed). But I had mentally moth-balled them because I solved the volume problem with the transducers..........

If my tests this morning don't line up with the vision I have in my head, I'll go shopping for a 1/2" flow meter.

Thx for the idea!



Could you use a flow transducer on the HLT output and stop when flow is less than some minimal value? I would think a simple Hall effect would work since it doesn't need accuracy, just flow or no flow.
 
👍
... I had a pressure transducer on my mash tun too, but it has even fewer ports, so I was using a tee with the pressure transducer on one side and the pump on the other. It's a bottom drain on the mash tun and I was having accuracy problems with that setup...

You likely know this, but you will not have success measuring in this config when the pump is running... (and may even damage the sensor). When it is stopped, the negative pressure created by the pump goes away and you will get an accurate reading of the liquid column once again.
 
Yeah, that's pretty much what I was running into, so that one isn't attached any longer.

Just came back in from several rounds of testing various volumes of water with the flowrate-based pump timer in place and it is actually working really well! May still throw a flow meter in there in case I do something boneheaded the night before like forget to open up a downstream valve. Need to win the lotto and finish replacing all of my manual valves too.

Thanks again everyone for your ideas and help!
Jason



👍


You likely know this, but you will not have success measuring in this config when the pump is running... (and may even damage the sensor). When it is stopped, the negative pressure created by the pump goes away and you will get an accurate reading of the liquid column once again.
 
FYI just learned from a user a hiccup when using ESP8266 Generic FW on the Wemos D1 Mini... bottom line is the Mini is short a few GPIO pins compared to the full ESP8266 versions, so the 1-wire scanner was looking at pins that don't exist, which caused a recurrent reset loop. Posted an update in the FW package for this alone... No need to do anything unless you are not a Wemos Mini user (in which case you would have seen this already!)

Who's ready to retire the ESP8266 in favor of the ESP32?!? Me!
 
Dead Mega?

I had intermittent Ethernet issues on a Mega that was once running fine. Now I can't connect at all via USB with termite or Ethernet. Router won't see the connection either.

I've tried various power voltages, sources etc...disconnected all IO, tried new router and new Ethernet cord. Can't figure this out.

Maybe I should replace Mega and try with existing Ethernet shield?
 
The way it works... wonky as it may seem... is that if a port is PWM output capable, then a PID will generate a PWM output on that port. If it is not, then it will generate a duty cycle output on that port. We will eventually add a switch to give the user the ability to de-select proportional control, but its not built in yet.

So for example, on the MEGA, port 43 is D,R and 44 is D,P,R capable, respectively. A PID on 43 (no PWM capability) will create Duty Cycle, and on 44 (PWM capable) will create a PWM output. If you are using a standard SSR (on/off only, aka binary), it will need to be on port 44. If you are using a proportional SSR, it will need to be on port 43. That said, for 43, you can't wire it directly from the pin to the SSR if the SSR expects an analog input. You would either need a R-C circuit (low-pass filter) to convert the PWM output to an analog signal, or use the analog amplifier board to handle it. The analog amplifier board not only converts the PWM signal to analog, but amplifies it, so that the current drain on the interface's micro is not exceeded.

I think I may have my SSR's connected to the wrong port on the MEGA. I have standard SSR's connected to ports 42 and 43 using PID elements in BC. According to this I should have my standard SSR's connected to ports 44 & 45. I just want to be sure I'm reading this right.
 
We remedied that with BC version 1.1 build 9 along with firmware version 45k. There is now a PWM switch that controls this. So you don’t need to move these if you don’t want... just update the software and firmware to the current versions.
 
Dead Mega?

I had intermittent Ethernet issues on a Mega that was once running fine. Now I can't connect at all via USB with termite or Ethernet. Router won't see the connection either.

I've tried various power voltages, sources etc...disconnected all IO, tried new router and new Ethernet cord. Can't figure this out.

Maybe I should replace Mega and try with existing Ethernet shield?
Sorry, man. That’s aggravating for sure. Yes, you need to work backwards... stripping things out until it you find the source of the evil.
 
Sorry, man. That’s aggravating for sure. Yes, you need to work backwards... stripping things out until it you find the source of the evil.
I ordered a new mega. I'll try that first then the Ethernet shield. Know anywhere that supplies the Ethernet shield stand alone?
 
Thx Oak, I definitely could have solved this by using a global element and manually calculating. My system knows (sort of) the volume of the HLT and the flow rate of my pump, so I was going to experiment with seeing how close I could time things to get the pump to drain the HLT and shut off.

...

Plan D will be to just sit there and watch it, but filling the HLT with reverse osmosis water takes quite a while. BruControl takes care of filling up the HLT with a valve on the RO system, so ideally I'd like to just wake up to nice hot strike water in my mash tun and nice hot sparge water in my HLT.

You could create a little script that changes volume to seconds. That way you could plug in your volume and it would automatically convert to time.
 
You could create a little script that changes volume to seconds. That way you could plug in your volume and it would automatically convert to time.


Yup! That's what it's doing, actually! Once filled to a predetermined amount, it calculates the final volume from the HLT's pressure transducer and uses Pete's looping code that he shared a few posts back to increment a time value to the same amount of seconds as I calculate with Pump Rate / Current Volume. Once the timer exceeds that time value, the pump shuts off.

Still working on and testing a few things, but here's the mostly completed script:

Code:
//Script:  "Prepare Water"
//
//This script uses supplied strike and sparge water volumes to fill,
//pump, and heat reverse osmosis water to have ready for the day's 
//brew session.  The RO process is relatively slow, so the intention
//here is to start it the night before and have both strike and sparge
//water ready to go the next morning.
//
//The RO water feed terminates at the HLT where there is a pressure
//transducer to measure volume.  Once there is enough RO water in the
//HLT to meet the needs of the strike water plus transfer and dead 
//space loss, it is pumped to the mash tun using a pre-measured 
//transfer rate of the HLT's pump.  A timer is used to keep the pump 
//running for a calculated number of seconds (pump rate in gal per 
//sec / the HLT's currently measured volume).
//
//After the transfer of the strike water to the mash tun, the PID on 
//the mash tun's RIMS tube is enabled as well as the mash tun pump to 
//circulate and heat the strike water to target.  While that is taking
//place, the RO system is enabled again to start filling up the HLT
//with a predetermined volume of strike water.  The strike water is
//heated in the HLT so that it will be ready to go when the mash has
//completed.



//////////////////////////
// Variable declaration //
//////////////////////////


new value strikeWaterVolume
new value spargeWaterVolume
new value waterLossGallons
new value strikeWaterMaxPumpTime 
new time strikeWaterPumpWaitTime
new value secondsIncrementCounter





/////////////////////
// Initiate values //
/////////////////////

//Update status
"Water Prep Status" value = "Initializing"

//How much water is left behind in transfer from HLT to Mash Tun
waterLossGallons = 1.8  

//Target volume to make for sparge water
spargeWaterVolume = "Sparge Target Volume" Value + waterLossGallons

//Target volume to make for strike water
strikeWaterVolume = "Mash Target Volume" Value + waterLossGallons

//Used to count the number of loops made to increment a max pump time
secondsIncrementCounter = 0

//Used to compare to a Timer to see when the pump has run the proper amount of time
strikeWaterPumpWaitTime = "00:00:00"

//Calculate how long the pump needs to run to move the strike water to the mash tun
strikeWaterMaxPumpTime = strikeWaterVolume / "HLT Pump Rate" value

//Pad the value with 3 extra seconds
strikeWaterMaxPumpTime = strikeWaterMaxPumpTime + 3

//"HLT Ready To Recirculate" is a switch that needs to be toggled to advance the 
//script after the HLT pump's output has been physically moved from the mash tun
//back to the HLT itself.  Having to do this because there are no electric valves
//to direct the flow between the two tanks.
"Recirculate HLT Switch" state = false



//////////////////////////////////////////////////////////
// Prep the reverse osmosis system for the strike water //
//////////////////////////////////////////////////////////


//Update status
"Water Prep Status" value = "Enabling RO System"

"RO Valve" Enabled = true
"RO Pressure Boost Pump"  Enabled = true

//Reset the RO flow meter values
"RO Waste Flow Meter" Enabled = false
"RO Clean Flow Meter" Enabled = false
"RO Waste Flow Meter" Enabled = true
"RO Clean Flow Meter" Enabled = true

//Reset the timer that shows how long the RO system ran
reset "RO Fill Time"




///////////////////////////////////////////////////////////////////////////////
// Fill the HLT with the first 8 gallons of reverse osmosis water for strike //
///////////////////////////////////////////////////////////////////////////////

//Update status
"Water Prep Status" value = "Filling HLT with strike water"

//Start city water flow into the RO system
"RO Valve" State = on

//Pause 3 seconds for the valve to finish opening
sleep 3000

//Turn on the RO pressure booster pump
"RO Pressure Boost Pump" State = on

//Start informational timing for RO fill time
Start "RO Fill Time"


//Fill the HLT to 8 gallons to get it over the HLT temp sensor so that it
//is safe to start pre-heating
wait "HLT Volume" Value >= 8





////////////////////////////////////////////////////////////////////////////////////
// Pre-heat the strike water using the HLT's heating element while the rest fills //
////////////////////////////////////////////////////////////////////////////////////

//There is now enough water in the HLT tank to get above the temperature sensor and 
//start pre-heating while the remainder of the RO strike water is created and added
//to the HLT

//Update status
"Water Prep Status" value = "Heating strike water in HLT"

//Enable the BC switch which toggles the contactor that protects the HLT heating element
"HLT Contactor" Enabled = true

//Enable the BC switch which toggles the HLT heating element
"HLT Element" Enabled = true

//Energize the HLT contactor
"HLT Contactor" State = on

//Enable the PID which controls the temperature of the HLT
"HLT PID" enabled = true

//Define the HLT PID's target temperature
"HLT PID" target = "Strike Water Temp" value





///////////////////////////////////////////////////////////////////
// Continue filling the HLT with the balance of the strike water //
///////////////////////////////////////////////////////////////////


//Update status
"Water Prep Status" value = "Filling HLT with strike water and heating"

//Wait for the volume of the HLT to reach the predetermined strike volume
wait "HLT Volume" Value >= strikeWaterVolume

//Turn off the RO pressure booster pump
"RO Pressure Boost Pump" State = off

//Stop the city water flow into the RO system
"RO Valve" State = off

//Stop informational timing for RO fill time
Stop "RO Fill Time"

//Pause 10 seconds to let the RO system depressurize 
sleep 10000

//Reset the RO flow meter values
"RO Waste Flow Meter" Enabled = false
"RO Clean Flow Meter" Enabled = false
"RO Waste Flow Meter" Enabled = true
"RO Clean Flow Meter" Enabled = true





/////////////////////////
// Disable HLT heating //
/////////////////////////

//The RO water creation has completed.  Disable the HLT heating element and contactor.
//From this point, the strike water temperature will be maintained in the mash tun's 
//RIMS tube once it has been pumped to the mash tun.

//Update status
"Water Prep Status" value = "Disabling HLT heating"

//Enable the PID which controls the temperature of the HLT
"HLT PID" enabled = false

//Enable the BC switch which toggles the HLT heating element
"HLT Element" Enabled = false

//Energize the HLT contactor
"HLT Contactor" State = off

//Enable the BC switch which toggles the contactor that protects the HLT heating element
"HLT Contactor" Enabled = false




//////////////////////////////////////////////////////////////////
// Calculate how long the HLT pump will take to move the strike //
// water over to the mash tun                                   //
//////////////////////////////////////////////////////////////////

//Update status
"Water Prep Status" value = "Calculating pump transfer time"

[CalculatePumpTime]
//Add 1 second to the wait time which is used to compare with the timer
strikeWaterPumpWaitTime += 00:00:01

//Increment the loop counter by 1
secondsIncrementCounter += 1

//If the counter has not exceeded the calculated pump time value keep looping
if secondsIncrementCounter < strikeWaterMaxPumpTime 
goto "CalculatePumpTime"
endif





///////////////////////////////////////////
// Move the strike water to the mash tun //
///////////////////////////////////////////

//Update status
"Water Prep Status" value = "Moving strike water to mash tun"

//Timer element "Pump Timer" is used to track how long the HLT pump has run
restart "Pump Timer"

//Turn on the HLT pump
"HLT Pump" state = on

//Wait until "Pump Timer" has reached strikeWaterPumpWaitTime which was
//built in the [CalculatePumpTime] loop avove
wait "Pump Timer" value > strikeWaterPumpWaitTime

//The pump has run long enough to drain the HLT, so turn it off
"HLT Pump" state = off

//Stop the timer that was controling how long the pump would run
stop "Pump Timer"





//////////////////////////////////////////////////////////
// Heat the strike water using the mash tun's RIMS tube //
//////////////////////////////////////////////////////////


//Update status
"Water Prep Status" value = "Enabling mash tun heating"

//Start the mash tun pump to recirculate the strike water through the RIMS tube
"Mash Tun Pump" state = on

//Allow a generous 10 seconds for the RIMS tube to fill so it doesn't dry fire
sleep 10000 

//Enable the BC switch which toggles the contactor that protects the RIMS heating element
"RIMS Contactor" Enabled = true

//Enable the BC switch which toggles the RIMS heating element
"RIMS Element" Enabled = true

//Energize the RIMS contactor
"RIMS Contactor" State = on

//Enable the PID which controls the temperature of the mash tun
"RIMS PID" enabled = true

//Define the RIMS PID's target temperature
"RIMS PID" target = "Strike Water Temp" value





//////////////////////////////////////////////////////////
// Fill the HLT with reverse osmosis water for sparging //
//////////////////////////////////////////////////////////

//Update status
"Water Prep Status" value = "Filling HLT with sparge water"

//Start city water flow into the RO system
"RO Valve" State = on

//Pause 3 seconds for the valve to finish opening
sleep 3000

//Turn on the RO pressure booster pump
"RO Pressure Boost Pump" State = on

//Start informational timing for RO fill time
Start "RO Fill Time"


//Fill the HLT to 8 gallons to get it over the HLT temp sensor so that it
//is safe to start pre-heating
wait "HLT Volume" Value >= 8





////////////////////////////////////////////////////////////////////////////////////
// Pre-heat the sparge water using the HLT's heating element while the rest fills //
////////////////////////////////////////////////////////////////////////////////////

//There is now enough water in the HLT tank to get above the temperature sensor and 
//start pre-heating while the remainder of the RO sparge water is created and added
//to the HLT

//Update status
"Water Prep Status" value = "Heating sparge water in HLT"

//Enable the BC switch which toggles the contactor that protects the HLT heating element
"HLT Contactor" Enabled = true

//Enable the BC switch which toggles the HLT heating element
"HLT Element" Enabled = true

//Energize the HLT contactor
"HLT Contactor" State = on

//Enable the PID which controls the temperature of the HLT
"HLT PID" enabled = true

//Define the HLT PID's target temperature
"HLT PID" target = "Sparge Water Temp" value





///////////////////////////////////////////////////////////////////
// Continue filling the HLT with the balance of the sparge water //
///////////////////////////////////////////////////////////////////



//Update status
"Water Prep Status" value = "Filling HLT with sparge water and heating"

//Wait for the volume of the HLT to reach the predetermined sparge volume
wait "HLT Volume" Value >= spargeWaterVolume

//Turn off the RO pressure booster pump
"RO Pressure Boost Pump" State = off

//Stop the city water flow into the RO system
"RO Valve" State = off

//Stop informational timing for RO fill time
Stop "RO Fill Time"





/////////////////////////////////////////////////////////
// Done with the RO system, so disable the RO switches //
/////////////////////////////////////////////////////////

//Update status
"Water Prep Status" value = "Disabling RO System"

"RO Valve" Enabled = false
"RO Pressure Boost Pump"  Enabled = false





///////////////////////////////////////////////////////////
// Heat the sparge water using the HLT's heating element //
///////////////////////////////////////////////////////////

//This script is intended for an overnight run the night prior to brewing.  At the moment
//I don't have any electric valves in place to redirect the HLT pump's output from the 
//mash tun back to the HLT itself, so the initial heating will be done without recirculating
//the sparge water in the HLT.  This will get it close enough to where I can manually 
//move the hose in the morning back to the HLT and advance the script to enable the HLT 
//pump to recirculate the HLT water to smooth out any temperature differences within the 
//HLT tank.

//Update status
"Water Prep Status" value = "Heating sparge water in HLT"

//Enable the BC switch which toggles the contactor that protects the HLT heating element
"HLT Contactor" Enabled = true

//Enable the BC switch which toggles the HLT heating element
"HLT Element" Enabled = true

//Energize the HLT contactor
"HLT Contactor" State = on

//Enable the PID which controls the temperature of the HLT
"HLT PID" enabled = true

//Define the HLT PID's target temperature
"HLT PID" target = "Sparge Water Temp" value





/////////////////////////////////////////////
// Recirculate the sparge water in the HLT //
/////////////////////////////////////////////

//After the HLT pump's hose has been disconnected from the mash tun and attached to the
//HLT itself, the "Recirculate HLT Switch" switch is toggled on in BC which this section
//watches for.  When found to have been switched, it toggles the HLT pump on and off
//periodically to smooth out the temperature within the HLT tank.  It will continue doing
//this through the mash process so that the sparge water is ready to go when needed later
//in the brew day.


//Update status
"Water Prep Status" value = "Awaiting HLT pump recirculation"

[RecirculateSpargeWaterInHLT]

//See what the state of the "HLT Ready To Recirculate" switch is
if "Recirculate HLT Switch" state == true

//The hose has (hopefully) been moved and the switch toggled on, so run a brief 
//recirculation cycle in the HLT

//Update status
"Water Prep Status" value = "Heating and recirculating sparge water"

//Turn on the HLT pump
"HLT Pump" state = on

//Run it for 1 minute
sleep 60000

//Turn off the HLT pump
"HLT Pump" state = off

//Pause the scipt for 3 minutes before running the pump again (if the switch is still on)
sleep 180000

else
//The switch is off, so simply pause one second before restarting the loop

//Update status
"Water Prep Status" value = "Awaiting HLT pump recirculation"

sleep 1000

endif

//Loop through this process indefinitely as it is the last step for preparing the water
goto RecirculateSpargeWaterInHLT




stop "Prepare Water"
 
Last edited:
I was curious if anyone found a way of somewhat accurately measuring volume with a pressure sensor at a given temperature? I think I am seeing the effects of thermal expansion and not sure if there is a way to measure volume at higher temps.
 
For a DC pump, the MOSFET module which works like the DC speed control in that picture.
Can you link me the MOSFET module your referencing? I assume this is a component I mount in between Mega and the pump circuitry?
 
I was curious if anyone found a way of somewhat accurately measuring volume with a pressure sensor at a given temperature? I think I am seeing the effects of thermal expansion and not sure if there is a way to measure volume at higher temps.

What sensor are you using? Mounting, vessel, etc? I have some experience.
 
If Mega was malfunctioning would I still get a connection to Ethernet shield? Maybe the better question here is can I test Ethernet shield stand alone without hooking up to Arduino or screw shield?
 
No and no.

I would remove that assembly completely from the enclosure. Connect and power it somewhere else, with a very short ethernet cable. As much work as it is, you have to work backwards to see what changes illicit the problem.
 
No and no.

I would remove that assembly completely from the enclosure. Connect and power it somewhere else, with a very short ethernet cable. As much work as it is, you have to work backwards to see what changes illicit the problem.
By assembly you mean mega with Ethernet shield attached?

If so I've already done this to no resolution. I'm moving in to replacing either the mega or Ethernet shield.
 
Try connecting to the MEGA with a serial (USB) cable without the Ethernet connected. If the MEGA is communicating, it’s probably ok. You can replace it if you want, it won’t break the bank.
I could not get a serial connection with ethernet disconnected with termite. I tried another software and got a connection but couldn't get a response. I'll replace Mega and report back
 
FWIW, I have several Elegoo clone Megas in my brew system and they have all worked flawlessly with BruControl. For $16/ea., I have a couple of spares on hand ready to swap out and save a brew day should it come to that at some point.

Elegoo Arduino Mega clones


I could not get a serial connection with ethernet disconnected with termite. I tried another software and got a connection but couldn't get a response. I'll replace Mega and report back
 
Can the User Control property of an element (and global element) be enable and disabled with a script command? If so, what is the script command and syntax?
 
That’s a good one. 22AWG is a good blend of current carrying (if needed), durability, size, and connectivity to screw terminals. Twisted and/or shielded should be used. The drain or shield is ideally grounded but not current carrying.

I like stranded better than solid. Some use ethernet cable which is not considered industrial suited but it’s probably ok.
 
I received the new Mega today and hooked it up. Still no connection with Termite via serial (USB). Are there certain settings or a driver I'm supposed to be using? I'm sure I'm on the right port as I've confirmed with device manager. Not sure about any of the other settings. I've tried with the Ethernet shield both connected and disconnected.

Termite says COM7, 9600bps, 8N1, no handshake

For diagnosing purposes, I dont have a single wire to the assembly but the usb cord.

Untitled.png
 
Last edited:
A couple basic questions about scripts:
  • Is it possible to have BC start up with no scripts running, then use a device element (i.e. a button on the workspace) to start a brewing script?
  • Can BC be configured to open with the script window always closed by default and the workspace locked by default? Right now BC opens unlocked and in the same configuration that it was last closed (i.e. if I leave the script window open when I close the app, the next time it starts up, the script window is open).
 
Back
Top