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.
..... A few things I haven't sorted out yet, such as what is a Global and String. I think I get the difference between an Element and a Variable in a script - Elements need to be enabled and Variables are to be declared as new in a script, but I'll leave that for now.

?
Some general information:


  1. This is always a WORK In Progress
  2. Both Global Elements and a BruControl Variables are a type of variable.
  3. A Variable is like a place holder or container of some snippets of data. In a lot of cases, you use a variable because you are going to use it more than once.

Dictionary:

variable

noun
1: a quantity that may assume any one of a set of values
a symbol representing a variable
2: something that is variable
a factor in a scientific experiment that may be subject to change

In computers, a variable is a place to hold some snippet of data.


From Wikipedia:
What is a Variable?
Variables are used to store information to be referenced and manipulated in a computer program. They also provide a way of labeling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves. It is helpful to think of variables as containers that hold information. Their sole purpose is to label and store data in memory. This data can then be used throughout your program.

  1. Both of the terms are generally used in talking about variables in any computer language and they are similar in meaning to most computer languages. Most computer languages have local Variables and Global ones.
  2. All variables and Global Elements have some common attributes (properties) in BruControl:
    1. Type (Basically what kind of Data can it have)
      1. Boolean = True or False
      2. Value = a number
      3. String = Text (even if you put numbers here they are still text and not values)
      4. Time = a time
      5. DateTime = a Date and Time
    2. Scope: Where can they be used:
      1. Variables are script specific in Scope. It can only be used within the SAME Single Script where it was declared (created).
      2. Global Element is global in Scope. It can be used in any script.

  1. Persistent: Means how long the variable lasts.
Variables in BruControl are script persistent. That means as long as the script is running, the variable will last. You can clear the variable with a script command and kill it. You can also “assign” a value to a Variable so that it is available the next time you want to use it. If you have a Variable where you enter the data from the computer screen within BruControl, the data you entered is gone when the script is no longer running.

Global Elements are persistent and non volatile. They will be there even if you close BruControl and then reopen it the next day or next month.

Persistent refers to the container and not the data. The data can be changed at any time. If you do not change the data in a Global Element, it will still have that value when you open BruControl again.
4. The biggest differences between a Global Element and Variables are:
a. Scope
b. Persistent
c . Global Elements are used for DATA EXCHANGE (requires Professional License).
 
I just received my SM6004 Flow Meters; does this shematic make sense?

1676914891422.png
 

Attachments

  • SM6004.png
    SM6004.png
    62.4 KB · Views: 0
Some general information:


  1. This is always a WORK In Progress
  2. Both Global Elements and a BruControl Variables are a type of variable.
  3. A Variable is like a place holder or container of some snippets of data. In a lot of cases, you use a variable because you are going to use it more than once.

Dictionary:

variable

noun
1: a quantity that may assume any one of a set of values
a symbol representing a variable
2: something that is variable
a factor in a scientific experiment that may be subject to change

In computers, a variable is a place to hold some snippet of data.


From Wikipedia:
What is a Variable?
Variables are used to store information to be referenced and manipulated in a computer program. They also provide a way of labeling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves. It is helpful to think of variables as containers that hold information. Their sole purpose is to label and store data in memory. This data can then be used throughout your program.

  1. Both of the terms are generally used in talking about variables in any computer language and they are similar in meaning to most computer languages. Most computer languages have local Variables and Global ones.
  2. All variables and Global Elements have some common attributes (properties) in BruControl:
    1. Type (Basically what kind of Data can it have)
      1. Boolean = True or False
      2. Value = a number
      3. String = Text (even if you put numbers here they are still text and not values)
      4. Time = a time
      5. DateTime = a Date and Time
    2. Scope: Where can they be used:
      1. Variables are script specific in Scope. It can only be used within the SAME Single Script where it was declared (created).
      2. Global Element is global in Scope. It can be used in any script.

  1. Persistent: Means how long the variable lasts.
Variables in BruControl are script persistent. That means as long as the script is running, the variable will last. You can clear the variable with a script command and kill it. You can also “assign” a value to a Variable so that it is available the next time you want to use it. If you have a Variable where you enter the data from the computer screen within BruControl, the data you entered is gone when the script is no longer running.

Global Elements are persistent and non volatile. They will be there even if you close BruControl and then reopen it the next day or next month.

Persistent refers to the container and not the data. The data can be changed at any time. If you do not change the data in a Global Element, it will still have that value when you open BruControl again.
4. The biggest differences between a Global Element and Variables are:
a. Scope
b. Persistent
c . Global Elements are used for DATA EXCHANGE (requires Professional License).
Thanks for these explanation Oakbarn; I anticipate coming up with a few more queries as I continue with my scripting. I have a few scripts working now (Boil -over Control, HLT Fill and electric elements dry fire protection). After building the control panel and hooking up the various electrical devices, I find the scripting part - which is totally new to me- makes the Brucontrol a WOW software. I can see me sleeping at night with an automated mash infusion happening at the same time so I can save some time during my long brewdays..!!
 
Yes it requires 24VDC to power it and the resistor as mentioned above. If you are going to measure TEMPS above I believe 175F you will want to use a 232 OHM resistor on OUTPUT 1 so you don't burn out the A Input on the board
 
So just a general kind of question - and from an electron's perspective - I am assuming that the 250 ohm resistor would prevent an overcurrent into the Unishield? Anyone care to expand on why a resistive path to ground in parallel to the Unishield pin acheive this?
 
I think I might have an issue with ESP32 firmware v.46F. I installed it on an ESP32 that I have for one fermenter the other day, and it is reading 0.768. My other ESP32 with v46D (I believe) and my Tilt app (calibrated and uncalibrated) show a closer-to-accurate 1.011. The uncalibrated temperature appears correctly. There's no offset, and I even reinstalled the firmware and removed/readded the interface just to clear everything out.

I had installed TiltBridge on that ESP32 just to see what it was like, but I'm sticking with BruControl for Tilt readings for now. I'm sure nothing should remain on the EEPROM that would cause this, but I figure I'd offer that context as well.

Thoughts? I could install v46F on my other ESP32 if it would help, though I need it for the beer in there now, so access to v46D would be good as a backup, hah
 
@BrunDog

Any Plans for a Real Time Clock Element that gets its time from the computer clock?
This already exists, just create a Global as DateTime called Clock, then create a script and use the below code to populate it.

Code:
[clock_run]
new datetime x
x = now
"Clock" Value = x
sleep 1000
goto clock_run

Edit for clarity - more info regarding the 'now' variable on pg. 84 in the 1.2 Manual dated 2/11/2023
 
Last edited:
Thank you for this beautiful schematic. My only concern is that some of the pin numbers/wire colors and their functions do not correspond to the IFM6004 manual. As in the drawing below, pin 1 is brown and UB+, but Pin 2 is white and is the signal for volume, pin 3 is blue and goes to UB- and pin 4 is black and goes to Analogue Temp. It looks like the wiring in your schematic is correct, just the labeling on the pin numbers below it seems to be off. Thanks again for such a beautiful depiction. Here is the manual's drawing:
 

Attachments

  • 6004 Electrical.pdf
    88 KB · Views: 0
Thank you for this beautiful schematic. My only concern is that some of the pin numbers/wire colors and their functions do not correspond to the IFM6004 manual. As in the drawing below, pin 1 is brown and UB+, but Pin 2 is white and is the signal for volume, pin 3 is blue and goes to UB- and pin 4 is black and goes to Analogue Temp. It looks like the wiring in your schematic is correct, just the labeling on the pin numbers below it seems to be off. Thanks again for such a beautiful depiction. Here is the manual's drawing:
You are correct! Here is a corrected one along with the image from your PDF.
Created in MS Paint:
sms.png
 
So just a general kind of question - and from an electron's perspective - I am assuming that the 250 ohm resistor would prevent an overcurrent into the Unishield? Anyone care to expand on why a resistive path to ground in parallel to the Unishield pin acheive this?
...or more specifically, how do we arrive at a 250 ohm value..?
 
Back to the Flow Meter SM6004, which I now have hooked up and have as an Analog Input into Brucontrol; I need a totalizer (for volume), which I assume I can set up in a script. So to obtain volume info, I will need to multiply the minutes X flow (liters/minute).

I'm not sure how to script this, keeping in mind that the flow rate will most likely fluctuate, and where/how this volume info could be displayed?
 
Loop
Volume += Flow * 5
Sleep 5000
Goto loop

Use an inspector or global to display Volume. Maybe this?
I got this from @RiverCityBrewer

[setup]
new value MLTFlow
MLTFlow precision = 6
"MLT Flow Total" value = 0.0 //Global Element
[scan]
if "MLT FlowMeter" value >= 0.04
MLTFlow = "MLT FlowMeter" value / 60
"MLT Flow Total" value = "MLT Flow Total" value + MLTFlow
endif
sleep 1000
goto scan
[end]
stop "MLT Flow Totalizer"

I have not tested it.
 
First, where is the SQL documentation? I look in the 1.1 manual and there is no mention, I remember some sort of migration guide or something, but I last fixed SQL over 2 years ago, and now having a login error so my graphs are lost with every reboot again. I look in the FAQ, Build, and Download sections and find nothing.... I am running 1.1 and this a production machine... edit: I am on 1.1 build22


Code:
15:00:15.337: Loading global settings file 'C:\Users\POS_user\Documents\BruControl\settings.brusettings'...
15:00:15.380: Loading configuration file 'C:\Users\POS_user\Documents\BruControl\1000L_Pot_Run.brucfg'...
15:00:15.530: Opening database: Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\POS_user\Documents\BruControl\Data\Data.mdf;Integrated Security=True
15:00:27.881: Exception while opening database: Cannot open database "C:\USERS\POS_USER\DOCUMENTS\BRUCONTROL\DATA\DATA.MDF" requested by the login. The login failed.
Login failed for user 'DESKTOP-NM60O7L\POS_user'.


<rant>I HATE WINDOWS FOR REASONS LIKE THIS, DAMMIT! </rant>
 
So just a general kind of question - and from an electron's perspective - I am assuming that the 250 ohm resistor would prevent an overcurrent into the Unishield? Anyone care to expand on why a resistive path to ground in parallel to the Unishield pin acheive this?
Many industrial sensors use 4-20mA analog signals because they are not influenced by the length of the wire or connection resistance. If you send 10mA and you have enough voltage to push the electrons through the path, 10mA will come out of the other side whether your wire is 2 ft or 200ft long. Analog inputs on Arduino's and other microcontrollers measure voltage, typically either 0-5V (Arduino Uno/Mega) or 0-3.3V (grand central and other 3.3V microcontrollers). So, you have to convert the current output to voltage for the microcontroller to read the value. For a 0-5V Mega, you would want to have the max output of 20mA from the SM6004 to correspond to max input on the Mega of 5V. As Tartan shows above, this is calculated by ohms law: R= V/I, 5V / 0.02A = 250ohm. On the low end, you will have 4mA x 250 ohms =1V. This will need to be calibrated because the Mega is expecting 0V for 0 flow. In some cases, you want to guard against overvoltage on the microcontroller by adjusting the resistor value. For example, on the SM6004 temperature output, the max temps is ~170F. You can use it at higher temperatures (i.e. boiling), but it will output >20mA which will be converted to >5V which could fry your Analog pin. So you may want to calculate for ~25mA --> 5V/.025 = 200 ohm. Back to your question, the resistor connected to ground will regulate the voltage on the pin. If you had no resistor, your pin will have 0V on it because it would be directly grounded. If you had infinite resistance, your pin will have 24V (assuming that is the SM6004 output voltage). As you decrease the resistance, there will be less voltage on the pin which is a bit counterintuitive, but that is how it works.
 
First, where is the SQL documentation? I look in the 1.1 manual and there is no mention, I remember some sort of migration guide or something, but I last fixed SQL over 2 years ago, and now having a login error so my graphs are lost with every reboot again. I look in the FAQ, Build, and Download sections and find nothing.... I am running 1.1 and this a production machine... edit: I am on 1.1 build22


Code:
15:00:15.337: Loading global settings file 'C:\Users\POS_user\Documents\BruControl\settings.brusettings'...
15:00:15.380: Loading configuration file 'C:\Users\POS_user\Documents\BruControl\1000L_Pot_Run.brucfg'...
15:00:15.530: Opening database: Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\POS_user\Documents\BruControl\Data\Data.mdf;Integrated Security=True
15:00:27.881: Exception while opening database: Cannot open database "C:\USERS\POS_USER\DOCUMENTS\BRUCONTROL\DATA\DATA.MDF" requested by the login. The login failed.
Login failed for user 'DESKTOP-NM60O7L\POS_user'.


<rant>I HATE WINDOWS FOR REASONS LIKE THIS, DAMMIT! </rant>
I got it working. I think the failure was power related crash that caused it, the following steps got it working, but it took me many attempts to get to the final working procedure.:

  • Shut down BruControl
  • CMD prompt:
    • sqllocaldb stop mssqllocaldb
    • sqllocaldb delete mssqllocaldb
    • sqllocaldb start "MSSQLLocalDB"
  • Delete Data.mdf AND Data_log.ldf
  • Restart BruControl
 
Many industrial sensors use 4-20mA analog signals because they are not influenced by the length of the wire or connection resistance. If you send 10mA and you have enough voltage to push the electrons through the path, 10mA will come out of the other side whether your wire is 2 ft or 200ft long. Analog inputs on Arduino's and other microcontrollers measure voltage, typically either 0-5V (Arduino Uno/Mega) or 0-3.3V (grand central and other 3.3V microcontrollers). So, you have to convert the current output to voltage for the microcontroller to read the value. For a 0-5V Mega, you would want to have the max output of 20mA from the SM6004 to correspond to max input on the Mega of 5V. As Tartan shows above, this is calculated by ohms law: R= V/I, 5V / 0.02A = 250ohm. On the low end, you will have 4mA x 250 ohms =1V. This will need to be calibrated because the Mega is expecting 0V for 0 flow. In some cases, you want to guard against overvoltage on the microcontroller by adjusting the resistor value. For example, on the SM6004 temperature output, the max temps is ~170F. You can use it at higher temperatures (i.e. boiling), but it will output >20mA which will be converted to >5V which could fry your Analog pin. So you may want to calculate for ~25mA --> 5V/.025 = 200 ohm. Back to your question, the resistor connected to ground will regulate the voltage on the pin. If you had no resistor, your pin will have 0V on it because it would be directly grounded. If you had infinite resistance, your pin will have 24V (assuming that is the SM6004 output voltage). As you decrease the resistance, there will be less voltage on the pin which is a bit counterintuitive, but that is how it works.
Thanks for this explanation Staffordj; so to use the garden hose analogy, I guess adding that resistor to ground is like pinching the end of the hose creating a back pressure (voltage) on the system.. I think I get it; cool!!
 
@BrunDog
@TxBrew

Any Chance that there could be a whole new Forum Just for BruControl rather than a thread on the Automated Brewing Forum?

That way Threads could be Started under the Forum
Like:

Scripting
Equipment
Suggestions
and others Threads


Some of the threads could be Sticky.


The Old BCS Forum had limited Threads where it was easier. Something like that would be better. I know you have your own forum at brucontrol.com but HomeBrewTalk rocks and more active.

It might be much easier to search for answers rather that the single unending thread. I have ask the same question as others and I see some questions asked and answered multiple times. This is not a complaint against users asking (or even re-asking) a question, as it is hard to do a search.
 
@BrunDog
@TxBrew

Any Chance that there could be a whole new Forum Just for BruControl rather than a thread on the Automated Brewing Forum?

That way Threads could be Started under the Forum
Like:

Scripting
Equipment
Suggestions
and others Threads


Some of the threads could be Sticky.


The Old BCS Forum had limited Threads where it was easier. Something like that would be better. I know you have your own forum at brucontrol.com but HomeBrewTalk rocks and more active.

It might be much easier to search for answers rather that the single unending thread. I have ask the same question as others and I see some questions asked and answered multiple times. This is not a complaint against users asking (or even re-asking) a question, as it is hard to do a search.
Agreed, maybe place it under "Brewing Software" or something like that. Lots of very useful info under the existing thread however as stated it is repetitive at times and is a mix of builds questions/solutions as well as software related questions. Like you, not complaining the content is very much appreciated from contributors, I think it just needs to be organised/streamlined a bit to allow one to find answers through "Search" a bit simpler.
 
Having a problem with Mega connecting via ethernet to server running Brucontrol. Server has a Windows 11 VM installed and has connectivity to everything else in my network and has internet access. I have tried on Windows 10 with same problems. I can ping the interface from command line but it won't stay connected. If I unplug and plug back in it shows connected for a second or 2 then disconnects. I have changed out cables, changed AP in house etc. I suspect its something to do with Virtual Machine on server vs networking issue. I am about to reinstall (for 3rd time) and just put on a dedicated Machine that is not server, but was trying to utilize my server, storage and raid. Server is a Dell 720 with plenty of resources and Proxmox hypervisor. Any help would be appreciated. Been pulling my hair out for couple weeks trying to resolve this.

Brent
 
With power off. Try resetting the Ethernet shield
Well, not sure what kind of magic that is but it worked! At least for longer then it has in the past. What does that do exactly that turning power off doesn't? I still need to take to shop and test there, is it harmful to do that a few times? Either way, thanks a bunch! I still have a few hairs left
 
Well, not sure what kind of magic that is but it worked! At least for longer then it has in the past. What does that do exactly that turning power off doesn't? I still need to take to shop and test there, is it harmful to do that a few times? Either way, thanks a bunch! I still have a few hairs left
Didn't last long, same issue. Disconnected after 30 minutes and only after me starting to add more elements and turn off some of the pumps.
 
Having a problem with Mega connecting via ethernet to server running Brucontrol. Server has a Windows 11 VM installed and has connectivity to everything else in my network and has internet access. I have tried on Windows 10 with same problems. I can ping the interface from command line but it won't stay connected. If I unplug and plug back in it shows connected for a second or 2 then disconnects. I have changed out cables, changed AP in house etc. I suspect its something to do with Virtual Machine on server vs networking issue. I am about to reinstall (for 3rd time) and just put on a dedicated Machine that is not server, but was trying to utilize my server, storage and raid. Server is a Dell 720 with plenty of resources and Proxmox hypervisor. Any help would be appreciated. Been pulling my hair out for couple weeks trying to resolve this.

Brent
What are you using as a power supply and what is the input voltage to the MEGA?
 
Back to the Flow Meter SM6004, which I now have hooked up and have as an Analog Input into Brucontrol; I need a totalizer (for volume), which I assume I can set up in a script. So to obtain volume info, I will need to multiply the minutes X flow (liters/minute).

I'm not sure how to script this, keeping in mind that the flow rate will most likely fluctuate, and where/how this volume info could be displayed?
What are you using the volume for? A little plug for @BrunDog, I ended up buying his volume sensors and they are amazing. You can use them by writing a script to fill your vessels to a specific volume and they are pretty accurate.
 
What are you using as a power supply and what is the input voltage to the MEGA?
I bought a new wall wart for this specific mega, its 9 volt. I have 5v, 12v and 24v in control box so could hard wire if needed but thought the 9v was preferred from what I read somewhere.
 
I had similar problems with disconnects and found it to be due to my power supply overheating the voltage regulator. Some MEGA's (especially the knock-off types) have had issues with the voltage regulator overheating due to overpowering it thru the barrel jack. The voltage regulator takes the eg.. in your case 9VDC and brings it down to 5VDC to power the chips on the board. The 2 MEGA's I had did have this problem, I tried 12VDC, 9VDC. and even 5.2VDC thru the barrel jack. I also tried the 5.2VDC power supply and used the micro usb port instead which bypasses the regulator to power it. Even with using the 5.2VDC thru the USB port for extended periods I found the odd dropout of communications with the board. At this point I can't say if I had damaged the regulator by using the barrel jack bui it was a bit better as far as overheating goes. Eventually I went with RobotDyn MEGA's and used the same 5.2VDC power supply and have never had connection problems. Those boards have the ethernet built in so no piggy backing of boards required. I tried to secure another one of these type boards last year but not sure if it's a chip supply issue or if they are actually not manufacturing them anymore? Hope this solves your problem.
 
Last edited:
Back
Top