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.
I have this alarm script monitoring fermenter temps which I have set to email. My issue is that when I have a temp issue I receive way too many emails. Can someone assist with a good way to quiet this? Maybe with a wait command?



Code:
[Alarm-Setup]
new value alarm_low
new value alarm_high
new value alarm_counter
new value alarm_threshold
new string FV-1_alarm_status

"FV-1" target = "FV-1 PT100" value
alarm_low = "FV-1" target - 3
alarm_high = "FV-1" target + 3
alarm_threshold = 6                     // Timespan multiplier for sleep command
alarm_counter precision = 0

    [Alarm-Check]
if "FV-1 PT100" value <= "FV-1" target
    if "FV-1 PT100" value > alarm_low
    FV-1_alarm_status = "SYSTEM OK"
    "FV-1 TEMP ALARM" active = false
    sleep 500
    goto "Alarm-Check"
    endif
endif

if "FV-1 PT100" value >= "FV-1" target
    if "FV-1 PT100" value < alarm_high
    FV-1_alarm_status = "SYSTEM OK"
    sleep 500
    goto "Alarm-Check"
    endif
endif

    [Alarm-Count]
if "FV-1 PT100" value <= alarm_low
    if alarm_counter < alarm_threshold
    alarm_counter += 1
    print alarm_counter
    "FV-1 TEMP ALARM" active = false
    FV-1_alarm_status = "ALARM DELAY"
    sleep 10000                    // Defines alarm_threshold timespan
    goto "Alarm-Count"
    endif
endif

if "FV-1 PT100" value >= alarm_high
    if alarm_counter < alarm_threshold
    alarm_counter += 1
    print alarm_counter
    "FV-1 TEMP ALARM" active = false
    FV-1_alarm_status = "ALARM DELAY"
    sleep 10000                    // Defines alarm_threshold timespan
    goto "Alarm-Count"
    endif
endif

    [Alarm-Fault]
if "FV-1 PT100" value <= alarm_low
    "FV-1 TEMP ALARM" active = true
    FV-1_alarm_status = "LOW FV TEMP"
    sleep 10000
    goto "Alarm-Count"
endif

if "FV-1 PT100" value >= alarm_high
    "FV-1 TEMP ALARM" active = true
    FV-1_alarm_status = "HIGH FV TEMP"
    sleep 10000
    goto "Alarm-Count"
else
    alarm_counter = 0
    goto "Alarm-Check"
endif

The reason is because the alarm will repeatedly get triggered when the temp is below your alarm threshold. There is no check to trigger the alarm one time only (ie, when the threshold is first crossed). To fix this, add a boolean variable (e.g. "trigger"). Check for trigger being true after checking the temperature is out of range. If trigger is false, then make it true and activate the alarm. If it is true, then skip activating the alarm. For example, for your last block (this assumes you declared trigger as a boolean up top):

Code:
if "FV-1 PT100" value >= alarm_high
    if trigger = false
        "FV-1 TEMP ALARM" active = true
        trigger = true
        FV-1_alarm_status = "HIGH FV TEMP"
    endif
    sleep 10000
    goto "Alarm-Count"
else
    alarm_counter = 0
    trigger = false
    goto "Alarm-Check"
endif
 
Just realized our manual had script examples with quotation marks instead of double apostrophe's. Oops!! Corrected!

Lesson here: If your script is erroring even though you think the Element name is referenced properly, check to make sure you have double apostrophe quote style instead of open/close quotation marks that most word editors employ.
 
Hello All,

Brand new at scripting here (started yesterday), and I am flabbergasted by the endless possibilities brought upon by Brucontrol.

I have the following question:

- how can I implement a "electric element dry fire" protection with a float valve on the below script (taken from Brucontrol User Manual examples);

[boil_ramp] //this is the name of the section
"Boil Kettle Duty" enabled = true //enable the boil duty cycle
"Boil Kettle Duty" value = 100 //set the boil duty cycle element to 100%
wait "Boil Temp" value >= 81 //wait for the boil temp to reach 210
"Boil Kettle Duty" value = 35 //set the boil duty cycle element to 35%
restart "Boil Timer" //reset and run the boil timer (60 mins)
wait "Boil Timer" value < 01:25:00 //wait for the timer for 5 mins
reset "Boil Timer" //reset the boil timer (90 mins)
"Boil Kettle Duty" value = 50 //set the boil duty cycle element to 50%
wait "Boil Timer" value <= 00:00:00 //wait for the timer down to zero

'Been scratching my head over how to script this with no joy so far.

Cheers and thanks to Pete for the amazing leap forward called Brucontrol!!
 
...called my element "float switch" and I essentially want to enable "Boil Kettle Duty" only if "float switch" is "ON"...
 
After scratching my head a bit this week trying to calibrate sensors, I found out the adc on the grand central is 12 bit, not 10 bit as described on Adafruit. What's up with that? Not that I am complaining, just a bit surprised.
 
...called my element "float switch" and I essentially want to enable "Boil Kettle Duty" only if "float switch" is "ON"...
I would use a looping "if" statement to check if "Float switch" is off. I would also use a global (you could use a variable) to see of you are in the [Boil Ramp] section so you can exit the loop when you are out of the section. You could do this in a separate script.


[LoopBoilKettle]
sleep 50// so you can exit
if "Float switch" state == false
"Boil Kettle Duty" enabled = false //disable the boil duty cycle
"Boil Kettle Off Alarm" active = true // set an alarm so you know the Brew Kettle is off here
else
"Boil Kettle Duty" enabled = true //enable the boil duty cycle
"Boil Kettle Off Alarm" active = false
goto LoopBoilKettle
endif
 
[LoopBoilKettle]
sleep 50// so you can exit
if "Float switch" state == false
"Boil Kettle Duty" enabled = false //disable the boil duty cycle
"Boil Kettle Off Alarm" active = true // set an alarm so you know the Brew Kettle is off here
else
"Boil Kettle Duty" enabled = true //enable the boil duty cycle
"Boil Kettle Off Alarm" active = false
goto LoopBoilKettle
endif
Hi Oakbarn,

Thanks for the suggestion. Here's what I'm getting;
02:17:07.172 [ERROR Line 3: No property found with name 'state']
02:17:07.187 [Started]

I'm at a loss; any idea is more than welcomed!!

1650734373505.png
 
Try “Value”???

If you check the manual (hehe, that pesky thing), you'll see the properties for a Digital Input. They don't include 'state', so that is why your script line fails. Per @swimIan, using 'Value' is the correct property.

There are several ways to skin this cat. You could run a separate script to keep an eye on the float level, or just keep checking for it along the way, but you can't use a wait statement then, because script execution pauses there. Write out exactly what you are looking to do and we can draft it up together here.
 
Going to be my suggestion as well. Some Elements have “value” and some have “state”. Some what interchangeable in my mind but not with scripting. If it has a “value”. It does not have a state. I always have to look it up depending on what type of element I am controlling. Then you can throw in the pwm ones and they have enable = true. Or false
 
Going to be my suggestion as well. Some Elements have “value” and some have “state”. Some what interchangeable in my mind but not with scripting. If it has a “value”. It does not have a state. I always have to look it up depending on what type of element I am controlling. Then you can throw in the pwm ones and they have enable = true. Or false
Making headway here gents; I now have my Boil Kettle Duty subjected to the Float Switch via Oakbarn's script and swinlan's 'value' tip. This is cool very much!

I will be playing with this so more in the next few days; all of your explanations are making this scripting learning so much faster. Cheers!
 
Quick feature request regarding graphs. It'd be great if the 2 Y axis scales were either A) automatically labelled with the variable they're scaling, or B) had their text color change to represent the color of the line selected for the given variable. Even boxes in the appearance settings tab to manually add titles would be helpful.

Perhaps a bit larger request too. How about flexibility to simultaneously graph 3 or 4 variables in a single graph instead of just 2? For example, being able to get Mash Ph, DO, and temp all on the same graph would be excellent.
 
I had a bit of a setback and need some help troubleshooting. One of my rtd's was not working, so I was troubleshooting by swapping 2 of the cs wires. Power was off. This was fine, so I powered off again, put them back where they started and then my interface would not connect. I removed the wifi board, I checked all of the pins for excessive voltage and shorts to ground and everything seems fine. Two random outputs were on and I had 2.5v on all of the rtd cs pins. Analog inputs were all less than 2v. Other than that all pins were 0v. Cs was 24v and vr was 8v. I connected the grand central via USB and it connects to a com port, but I can't get it to talk to termite using %1&14; or %0&15; I then removed the grand central from the unishield and still nothing. I have another grand central, but am reluctant to swap it until I know what the problem is in case I fried the first board. Any ideas.
 
Hi Everyone, I have just taken the plunge and purchased the Advance version of BC to operate a Mega 2560 to control my 2 x 1BBL fermenting vessels, and the first part of my project is to sketch out a schematic for my panel, and I would welcome some guidance on which is best to use either Coil Relays of SSR’s to control the cooling values and heating , especially with the fact that the length of time the normally closed cooling valves is energised for which can be circa 5 to 8 hours continuous when I crash cool in warm weather from a temperature of 68 to 38 degrees? Also, is there any particular precautions I need to take to protect the Mega to operate a signal to the control device for this period of time?

Thanks in advance for your input.
 
I had a bit of a setback and need some help troubleshooting. One of my rtd's was not working, so I was troubleshooting by swapping 2 of the cs wires. Power was off. This was fine, so I powered off again, put them back where they started and then my interface would not connect. I removed the wifi board, I checked all of the pins for excessive voltage and shorts to ground and everything seems fine. Two random outputs were on and I had 2.5v on all of the rtd cs pins. Analog inputs were all less than 2v. Other than that all pins were 0v. Cs was 24v and vr was 8v. I connected the grand central via USB and it connects to a com port, but I can't get it to talk to termite using %1&14; or %0&15; I then removed the grand central from the unishield and still nothing. I have another grand central, but am reluctant to swap it until I know what the problem is in case I fried the first board. Any ideas.
Quick update. I reinstalled the interface firmware. That was successful, but it still will not respond in termite. I am not sure what to do next. Any ideas?
 
Quick update. I reinstalled the interface firmware. That was successful, but it still will not respond in termite. I am not sure what to do next. Any ideas?
It's nearly impossible to determine what went wrong just by a wiring description. This caught my eye: Cs was 24v and vr was 8v. Did you mean Vs was 24V? Vr should be 5V, not 8V. If that 8V was fed into the GC, it will probably overload the 3.3V regulator on the GC, as it's max is 6V. We ship UniShields with VR set to 5V.
 
Hi Everyone, I have just taken the plunge and purchased the Advance version of BC to operate a Mega 2560 to control my 2 x 1BBL fermenting vessels, and the first part of my project is to sketch out a schematic for my panel, and I would welcome some guidance on which is best to use either Coil Relays of SSR’s to control the cooling values and heating , especially with the fact that the length of time the normally closed cooling valves is energised for which can be circa 5 to 8 hours continuous when I crash cool in warm weather from a temperature of 68 to 38 degrees? Also, is there any particular precautions I need to take to protect the Mega to operate a signal to the control device for this period of time?

Thanks in advance for your input.
Are the valves AC or DC? The relays to switch your valves will have 100% duty cycle rating, meaning they can be on 100% of the time. BUT, your valves may not - you need to select valves that can. Many solenoid valves do not allow 100% duty because they overheat. Start with the valves, then you can figure out how to switch them (likely electromechanical relays are fine).
 
It's nearly impossible to determine what went wrong just by a wiring description. This caught my eye: Cs was 24v and vr was 8v. Did you mean Vs was 24V? Vr should be 5V, not 8V. If that 8V was fed into the GC, it will probably overload the 3.3V regulator on the GC, as it's max is 6V. We ship UniShields with VR set to 5V.
Should have said Vs, not Cs. Per the unishield manual, I have the power switch set to VR-->Vin and set the DDPS to 8V (manual states 7-9V. I have been running this for a couple of weeks with no issues.
 
Ok, that's fine. We ship with VR --> 5V, so that was my concern.

Outside of that, I'm not sure what went wrong. The GC alone will take a firmware upload but then will not communicate with your computer via Termite? That is odd. I'm going to email you an output tester. This will turn all the outputs on and off and report the updates over the serial port.
 
Are the valves AC or DC? The relays to switch your valves will have 100% duty cycle rating, meaning they can be on 100% of the time. BUT, your valves may not - you need to select valves that can. Many solenoid valves do not allow 100% duty because they overheat. Start with the valves, then you can figure out how to switch them (likely electromechanical relays are fine).

Currently the valves are AC, but happy to change to DC if that is more reliable option. Also as more background these a currently triggered by an STC-1000 and so far work ok. However, my aim is to have a more stable and manageable system controlling the FVs using BC? Thanks.
 
If you already have the valves and they are plumbed in and working, then it probably doesn't make sense to change them. You can use either an SSR board, or an electromechanical relay board. Both should have transistorized "front ends" to accept the low power input from the MEGA directly. Just need to make sure these relays can handle the current and voltage required of the valves. I'd recommend a snubber in parallel with the valves to reduce the noise they will induce when powering off.
 
RTD issue: I have 7 out of 8 RTD's working. The other one is reading -413. 2 of the 8 are inline sensors and one of these is not working. I have it isolated to the sensor itself because there are disconnects at the sensor and if I swap these 2, the output swaps in BruControl (sensor 1 goes from reading -412 to 64F and sensor 2 goes from 64F to -412). I think this means there is a short, but not sure. What I don't understand is the resistance measures good: 107ohms between the common and the sense wire and 0.6ohms between the common wires. The common wires also seem to be connected to the metal connector, but both sensors are like that. What would cause the sensor resistance to read correct, but the sensor not to work?
On a related note, @BrunDog are all the common wires tied together on the RTD board?
 
I recently acquired an ESP 32. My router, from X Finity, does not allow static IP address. From a Google search it looks like I can reserve an IP address. Will they reserved IP address be good enough for an ESPN3 to connected via Wi-Fi to my PC?
 
I recently acquired an ESP 32. My router, from X Finity, does not allow static IP address. From a Google search it looks like I can reserve an IP address. Will they reserved IP address be good enough for an ESPN3 to connected via Wi-Fi to my PC?
Sounds like you are setting up a full multi-media experience with Brucontrol and ESPN3 :)
 
I found the issue. The was a pin inside the sensor that was touching the housing causing a short.
Just a rambling on the use of connectors for RTDs... one of the risks of using connectors is that they can add incremental (or worse, variable) amounts of resistance to the circuit. RTD loops are REALLY REALLY sensitive to small resistance variations, and ideally are wired directly back to their amplifiers/controllers. But, it really makes a system hard to build and work on when the sensor wire needs to be hard-wired all the way. So if you are going to use connectors, make sure to use quality ones (legit gold plated, etc.) from reputable brands like TE, Amp, Molex, etc. Skip the Amazon/Ebay/Ali-whoever choices for these.
 
I need to put a hole in my mashtun to install one of brucontrols volume sensors. I have seen some posts regarding side mount vs bottom mount. One thing I was wondering about is under the false bottom or above it? I could imagine that this could be very useful to predicting a stuck mash if installed under the false bottom. At the same time, there may be a pressure difference under the false bottom that makes the volume measurement very inaccurate for making sure the sparge addition is stable. Does anyone have one of these sensors on their MT, and if so what is your experience?
 
I like it under the false bottom, on the bottom of the vessel, along with the bottom drains. This can be tricky because the table needs to have a hole in it to accommodate the sensor, and your vessel cannot be a tri-clad design. There are very few who aren’t tri-clad.

I used a solder-on flange from @Bobby_M, and it works great because it is low profile and has no interior lip. Downside is you need to know how to silver solder this, and the heat will warp thin-walled vessels. You could use his threaded flange too, which requires no soldering but will have a lip for the nut and threaded section.
 
How do I (or can I) use the same interface in two different configurations? When I tried it, it connected on one of them, but not the other.
 
One more question on heating element setup. From the user manual I think I am drawing these conclusions:
For a HLT with and a RIMS using heating elements and SSR, set up as Deadband device to control temperature.
For the BK since we want control boil rate, not temperature and eliminate boil-over, set up as Duty Cycle device and control it through scripting.
For a proportional valve, set up as a Deadband device with PWM output based on flowmeter input.
Does this seem reasonable?
 
One more question on heating element setup. From the user manual I think I am drawing these conclusions:
For a HLT with and a RIMS using heating elements and SSR, set up as Deadband device to control temperature.
For the BK since we want control boil rate, not temperature and eliminate boil-over, set up as Duty Cycle device and control it through scripting.
For a proportional valve, set up as a Deadband device with PWM output based on flowmeter input.
Does this seem reasonable?

To be totally honest, not a lot of people have used Deadband, thought it was created for the types of operations you noted. So feel free to give it a try. The good thing about heating water is there is no true overshoot. As soon as you stop heating, the temp stops climbing (assuming rapid mixing is happening effectively), so you can get away with a PID or even simple hysteresis.

For the proportional valve, you may want to control it in a loop via a script, depending on what type of control you are looking to dial in if the deadband doesn't cut it for you.
 
Back
Top