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.
Hey guys, can anyone suggest the best way to map a PID calculated power level (i.e. 0-100% power) to the required input signal on a Crydom MCPC2450C proportional SSR? Context being to drive a heating element with a PID algorithm in response to temperature (1-wire) for mashing.

Curve is below. I've got a line going from an ESP32 PWM pin into one of Pete's Analogue Amplifier Boards (AA-1), which is set to 0-10V output. Test signals (using a PWM Device in Brucontrol, not a PID Device) are "working" in generating a 0-10V signal into the pSSR which is responding as expected according to the curve below. Note that the control signal is 0-10V, despite the curve below having an upper bound of 11V.

Thanks for any help,

Meddo.

1604642500069.png
 
Hey guys, can anyone suggest the best way to map a PID calculated power level (i.e. 0-100% power) to the required input signal on a Crydom MCPC2450C proportional SSR? Context being to drive a heating element with a PID algorithm in response to temperature (1-wire) for mashing.

Curve is below. I've got a line going from an ESP32 PWM pin into one of Pete's Analogue Amplifier Boards (AA-1), which is set to 0-10V output. Test signals (using a PWM Device in Brucontrol, not a PID Device) are "working" in generating a 0-10V signal into the pSSR which is responding as expected according to the curve below. Note that the control signal is 0-10V, despite the curve below having an upper bound of 11V.

Thanks for any help,

Meddo.

View attachment 705570
Since you have it working in hardware, you just select the “Use PWM” switch on your PID element. The output will be a PWM % rather than a duty cycle %.
 
Since you have it working in hardware, you just select the “Use PWM” switch on your PID element. The output will be a PWM % rather than a duty cycle %.
Thanks for the response Pete, to clarify though I'm trying to calibrate the linear output of the PID (0-255, or 0-100%) to the input axis on the S-curve shaped response curve chart. So for 50% power a 50% PWM signal neatly works, but what about 20% power? By eye it's about a 35% PWM signal.

I can *probably* do it by breaking it into tangent sections between {<2.5%, 2.5-5%, 5-85%, 85-95%, 95-97.5%, >97.5%} in a lookup table, but wondering if there's a better way of approximating that curve (both in terms of an expression defining that curve, and then implementing that expression in Brucontrol).

In effect, from the PID algorithm we know what the required value is on the Y axis of the chart (output voltage percent / element power), how do we determine the matching signal from the X axis to send to the pSSR to achieve that?

Cheers,
 
Making another attempt to get my PID controlled proportional cooling valve working... Today I was running the still decided to give PID another try... I had to move the RTD off of the ESP32 nd onto the mega and only fried one RTD board in the process with 24vdc... oopsie... anyway, got that hooked up and working, and I am having a weird issue with the PID PWM output not matching what the element displays. it just gives a blip of an output...

I verified with a voltmeter, the mega just has a blip of an output.

blue lines are the same thing, the feedback from the valve... the right orange line is the monitored temperature and setpoint is 150. you see when it hits 150, it starts to increase PID output, but then just goes back to zero.. both Ki and Kd are 0 in this case, but it does the same thing if I put in 1, 0.1, 0.01.....

it is not the analog amplifier, it works rock solid in manual mode... I tried looking at the communications, but since the PID is handled completely in the Mega, I can only read the data that supplies the blue line... I can repeat it over and over, I just put it in manual, open the valve to 50-65%, and let the temp cool off, then re-enable the PID, and it closes the valve because it is below the setpoint, then when the setpoint is reached, just a blip... again this is verified with a DMM on the Mega output pin...
1604872221584.png
 
1.1 build 4, no clue what firmware is on Mega, probably been a year since I upgraded it... forget how to check firmware over ethernet, but %1 from comm window in BC does not show anything..

blues are the same thing.. the left orange is the PID output value, the right is the PID Input value temp... you see that when the right orange line crosses 150F, the PID output *says* it goes to 100%, but in reality, the arduino mega only outputs a little bump, and goes back to zero... the PID output that BC says is happening is NOT happening on the actual interface, but the interface works fin when the manual PWM is used on the same output, so it is NOT hardware...
 
Hey guys, I've finally gotten an ESP32 based box built, knocked up a step mash interface and process script, and gave it a wet-test last night. The portable box is built to be adaptable to a number of different single-vessel recirculating systems that I've built or bought and customised. Loving the bulk of it so far but I've got a few questions at this point - I've read every page of this thread over the last 9-12 months but don't remember the answers and haven't been able to find them in a search, but apologies if I'm repeating any.

For context, the notable components are:

Control Box:
  • Brucontrol v1.1.4
  • HUZZAH32 feather (ESP32) plus breakout board
  • 5V, 12V, and 24V DC power supplies
  • 2 x Crydom proportional SSRs to drive 240V AC elements, requiring 0-10VDC control signals
  • Brucontrol TF3 thermistor filter board
  • Brucontrol AA-1 analog amplifier board (to generate the 0-10V control signals for the Crydom SSRs)
Vessels:
  • 1 x 65W AC pump
  • 2 x Topsflo 24VDC pumps with PWM speed control
  • 240V AC elements (2400W, 3600W, 4800W)
  • 1-wire and NTC temp probes
So my questions:
  1. The NTC thermistor probes supplied with two of my 1V systems - which I assumed to be 10K - turn out to be 25K and 150K. Is there any way to use these with the AA-1 board, or do I need to source replacement thermistors?
  2. The 1-wire probe in my other vessel seems to be reading about 1 degree C too low (not sure why as it doesn't in my old ardbir or craftbeerpi systems, that I've noticed anyway - but that's a separate issue) - I've put a calibration on the 1-wire Device in Brucontrol but it looks like the PID Device (generating a PWM signal for the proportional SSRs) seems to be responding to the raw value rather than calibrated - is this expected behaviour? And if so, is there any way to vary this behaviour to align to calibrated values?
  3. Disabling the PID devices in Brucontrol via a script doesn't seem to actually stop them generating the PWM signal, is this behaviour expected? I.e., I hit a "stop" button in my interface which sends the command to the device "enabled = false", should this stop the PWM signal? If not, how should it be done instead? The PID Device is actually disabling in Brucontrol, so my syntax etc. is correct, but the elements are still staying on at full noise (chasing the PID target). I can hack it by setting the target temperature to say -100 degrees C, but that seems messy.
  4. Is there any way in a script to tell another script to resume at a particular section heading? Intent being a script listening for a "next" button press, tell the mashing script to resume at "mash step 2" for example?
  5. Perhaps relevant to the question above, is there any way in the script to "wait" for two conditions to be met, either in AND or OR combination? I.e., in psuedo-code for a mash rest: wait "timer" value <= 0 OR "buttonNext" state == true
  6. What's the current recommended Brucontrol version? Has the v1.2 beta been stress-tested enough to be confidently used in production, or is any other post-v1.1.4 production release imminent? I remember reading about device aliases, absolute addresses for 1-wire, and a few other goodies over the last few months - I'm keen to get access to them if they're ready to go.
  7. Since, from @BrunDog's response yesterday, there doesn't seem to be a way to calibrate the output of a PID Device to match the proportional SSR curve, is there an alternative way to implement a PID algorithm in Brucontrol that can be calibrated in such a manner, with the output then sent to a PWM Device rather than calculating directly on the PID Device onboard the interface?
Thanks for any help anyone can give,

Meddo
 
Making another attempt to get my PID controlled proportional cooling valve working... Today I was running the still decided to give PID another try... I had to move the RTD off of the ESP32 nd onto the mega and only fried one RTD board in the process with 24vdc... oopsie... anyway, got that hooked up and working, and I am having a weird issue with the PID PWM output not matching what the element displays. it just gives a blip of an output...

I verified with a voltmeter, the mega just has a blip of an output.

blue lines are the same thing, the feedback from the valve... the right orange line is the monitored temperature and setpoint is 150. you see when it hits 150, it starts to increase PID output, but then just goes back to zero.. both Ki and Kd are 0 in this case, but it does the same thing if I put in 1, 0.1, 0.01.....

it is not the analog amplifier, it works rock solid in manual mode... I tried looking at the communications, but since the PID is handled completely in the Mega, I can only read the data that supplies the blue line... I can repeat it over and over, I just put it in manual, open the valve to 50-65%, and let the temp cool off, then re-enable the PID, and it closes the valve because it is below the setpoint, then when the setpoint is reached, just a blip... again this is verified with a DMM on the Mega output pin...
View attachment 705859


I had a similar issue last year with PID on my mega. I hooked up the serial port and enabled the debug level that shows the internal PID information. The input temperature element was showing proper temperature value as well as the input to the PID on the workspace, but when you look at the PID input in the debug console you see an invalid value. Eventually it went away during multiple attempts to reprogram FW and power cycling/rebooting PC/mega/network router/eth switches.

The below example was with a thermistor input reading 45F and the PID output set to 30F. Not working you see input of -3166 and the output pegged at 100%.
test_PID_45F_30set_2.PNG


Working you see the raw ADC value for the input of 388 and calculating the proper output of 0%.

45H_working_2.PNG
 
I had a similar issue last year with PID on my mega. I hooked up the serial port and enabled the debug level that shows the internal PID information. The input temperature element was showing proper temperature value as well as the input to the PID on the workspace, but when you look at the PID input in the debug console you see an invalid value. Eventually it went away during multiple attempts to reprogram FW and power cycling/rebooting PC/mega/network router/eth switches.

That is what I expect to see when I hook it up to serial and turn on the PID debug, but right now it is powered from the USB inside the panel, and dragging a laptop over is a royal pain... looking at the automation direct PLC's , but looks like they have same 256k limit as mega???
 
Sorry... not following you. I see two graphs. Which is which?
1.1 build 4, no clue what firmware is on Mega, probably been a year since I upgraded it... forget how to check firmware over ethernet, but %1 from comm window in BC does not show anything..

blues are the same thing.. the left orange is the PID output value, the right is the PID Input value temp... you see that when the right orange line crosses 150F, the PID output *says* it goes to 100%, but in reality, the arduino mega only outputs a little bump, and goes back to zero... the PID output that BC says is happening is NOT happening on the actual interface, but the interface works fin when the manual PWM is used on the same output, so it is NOT hardware...

In the version you have, you need to have the PID on a PWM capable pin in order for it to use PWM for the output. In the newer versions, we added a switch to give you the flexibility to decide. If you don't mind, let's get the versions to the latest... Please upgrade to 1.1 Build 9 (1.2 Beta). I know it says beta but its stable. Please follow the upgrade instructions. Also update the FW to the latest for the interface. Then let's try again.
 
OK, will flash one of my megas with the new Firmware and find some time to do the upgrade to 1.1.9, I thought you pulled it a while back due to a major issue... currently I have a PWM output device and a PID on the same pin, pin 3, and when I enable one it disables the other(manual PWM has worked fine for years...
 
Hey guys, I've finally gotten an ESP32 based box built, knocked up a step mash interface and process script, and gave it a wet-test last night. The portable box is built to be adaptable to a number of different single-vessel recirculating systems that I've built or bought and customised. Loving the bulk of it so far but I've got a few questions at this point - I've read every page of this thread over the last 9-12 months but don't remember the answers and haven't been able to find them in a search, but apologies if I'm repeating any.

For context, the notable components are:

Control Box:
  • Brucontrol v1.1.4
  • HUZZAH32 feather (ESP32) plus breakout board
  • 5V, 12V, and 24V DC power supplies
  • 2 x Crydom proportional SSRs to drive 240V AC elements, requiring 0-10VDC control signals
  • Brucontrol TF3 thermistor filter board
  • Brucontrol AA-1 analog amplifier board (to generate the 0-10V control signals for the Crydom SSRs)
Vessels:
  • 1 x 65W AC pump
  • 2 x Topsflo 24VDC pumps with PWM speed control
  • 240V AC elements (2400W, 3600W, 4800W)
  • 1-wire and NTC temp probes
So my questions:
  1. The NTC thermistor probes supplied with two of my 1V systems - which I assumed to be 10K - turn out to be 25K and 150K. Is there any way to use these with the AA-1 board, or do I need to source replacement thermistors?
  2. The 1-wire probe in my other vessel seems to be reading about 1 degree C too low (not sure why as it doesn't in my old ardbir or craftbeerpi systems, that I've noticed anyway - but that's a separate issue) - I've put a calibration on the 1-wire Device in Brucontrol but it looks like the PID Device (generating a PWM signal for the proportional SSRs) seems to be responding to the raw value rather than calibrated - is this expected behaviour? And if so, is there any way to vary this behaviour to align to calibrated values?
  3. Disabling the PID devices in Brucontrol via a script doesn't seem to actually stop them generating the PWM signal, is this behaviour expected? I.e., I hit a "stop" button in my interface which sends the command to the device "enabled = false", should this stop the PWM signal? If not, how should it be done instead? The PID Device is actually disabling in Brucontrol, so my syntax etc. is correct, but the elements are still staying on at full noise (chasing the PID target). I can hack it by setting the target temperature to say -100 degrees C, but that seems messy.
  4. Is there any way in a script to tell another script to resume at a particular section heading? Intent being a script listening for a "next" button press, tell the mashing script to resume at "mash step 2" for example?
  5. Perhaps relevant to the question above, is there any way in the script to "wait" for two conditions to be met, either in AND or OR combination? I.e., in psuedo-code for a mash rest: wait "timer" value <= 0 OR "buttonNext" state == true
  6. What's the current recommended Brucontrol version? Has the v1.2 beta been stress-tested enough to be confidently used in production, or is any other post-v1.1.4 production release imminent? I remember reading about device aliases, absolute addresses for 1-wire, and a few other goodies over the last few months - I'm keen to get access to them if they're ready to go.
  7. Since, from @BrunDog's response yesterday, there doesn't seem to be a way to calibrate the output of a PID Device to match the proportional SSR curve, is there an alternative way to implement a PID algorithm in Brucontrol that can be calibrated in such a manner, with the output then sent to a PWM Device rather than calculating directly on the PID Device onboard the interface?
Thanks for any help anyone can give,

Meddo

First off... I was wrong... PID can have a calibration. But I need to do some tests to see if we can shift the outputs based on floor/ceilings or a lookup table - give me some time on that.

Regarding the rest:

1. I'd recommend getting the correct 10k thermistor. You *could* change the pad resistors on the thermistor filter, but I think it easier to replace the thermistors. If you have wiring / soldering skills, you could replace just the thermistor sensors, assuming the ones you have can be disassembled.

2. Correct. There is no calibration for 1-wires, though we have plans to add an offset.

3. Yes, this is an issue with the ESP32 older firmware. Please update to the version 45N. I also suggest you upgrade to the v1.1 Build 9 version.

4. No, sorry. You can do this inside of a single script though.

5. Not yet. We have plans to add this.

6. Per above... ok to do it. Please follow the update notes.

7. Technically, you could script the PID, but it will take some effort. Until I can recommend a direction, I suggest you just run with it. The curves aren't off enough to make that much of a difference IMO. I think you will be OK for mashing.
 
...looking at the automation direct PLC's , but looks like they have same 256k limit as mega???

Yes, same 256kB flash memory as all M0 based boards do (same as the MEGA). But it has 32kB of RAM, as compared to the 8 of the MEGA - this is the much more importanter issue. We won't max out the M0 soon.
 
Thanks @BrunDog, that's great clearing those things up for me. Only one is that for point 3 - the ESP32 firmware - I believe I have already updated to the latest firmware from the v45 release currently linked on your website. Is there an OTA method to check the current firmware version on the interface, to make sure I'm not telling porkies?

Cheers,
 
@BrunDog, while you're here, do you have any ETA on absolute addressing for 1-wire? My use-case might be a bit different to most but I've built a general-purpose box which can control a few different rigs with different 1-wire probes and counts so can't rely on sensor indexes remaining constant, so pretty keen on this one whenever it becomes available.

Thanks for the quick responses on the other questions!

Cheers,
 
And one more actually (sorry for spamming the thread) - in scripts is there a "not" function equivalent to the following psuedo-code available?

"Generic Switch Device" state = not("Generic Switch Device" state)

or

new bool CurrentState
CurrrentState = "Generic Switch Device" state
"Generic Switch Device" state = not(CurrentState)


Cheers,
 
Hi @BrunDog, sorry for another message today but Digital Output Devices seems to be broken on 45O on my ESP32. I've got v1.1.9 running, and two ESP32s connected, one on 45O and one on 45N. I've added a new device to BruControl port 4 on each to test, state changes work fine on the 45N interface but don't stick on the 45O interface. Setting the device to the LED indicator, red for OFF and green for ON, the "LED" graphic stays grey on 45O. No signal is received by the relay board (it has an indicator light on the board) on the other end of Port 27 on the 45O interface, which was working fine last night on 45N.

Cheers,

Edit: another data point - I've flashed that ESP32 back to 45N and the digital output devices are responding correctly again.
 
Last edited:
And one more actually (sorry for spamming the thread) - in scripts is there a "not" function equivalent to the following psuedo-code available?

"Generic Switch Device" state = not("Generic Switch Device" state)

or

new bool CurrentState
CurrrentState = "Generic Switch Device" state
"Generic Switch Device" state = not(CurrentState)


Cheers,

If I'm following you correctly and you want to test for a "not true" state, then use the not-equal-to operator !=
 
Thanks for the clarification. I don't think there is any way currently to simply assign the opposite state without performing multiple tests to first determine the state.
 
In the version you have, you need to have the PID on a PWM capable pin in order for it to use PWM for the output. In the newer versions, we added a switch to give you the flexibility to decide. If you don't mind, let's get the versions to the latest... Please upgrade to 1.1 Build 9 (1.2 Beta). I know it says beta but its stable. Please follow the upgrade instructions. Also update the FW to the latest for the interface. Then let's try again.
OK, I am remote, so I carefully did the migration to 1.1.9 via VNC, using SQL2012

I get an error in the log:

12:05:08.477: Opening database: DataSource=(LocalDB)\v11.0;AttachDbFilename=C:\Users\POS_User\Documents\BruControl\Data\Data.mdf;IntegratedSecurity=True
12:05:08.550: Exception while opening database: Keyword not supported: 'datasource'.

the 2012 SQL .msi appeared to install correctly...


I am reading the 1.2 product note that shows this:
Code:
<DBConnection>Data
Source=(LocalDB)\v11.0;AttachDbFilename={0};Integrated
Security=True</DBConnection>
1605028812342.png



That formatting looked a bit weird, so I also tried editing it to show like this, and it still fails.
Code:
<DBConnection>DataSource=(LocalDB)\v11.0;AttachDbFilename={0};IntegratedSecurity=True</DBConnection>
1605028638604.png





on the good side, the PID is acting totally different in a good way!
 
There should be a space between the two words, "Data Source" and "Integrated Security"

thank you, that got me one more step:
1605031640979.png



13:07:09.725: Opening database: Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\POS_User\Documents\BruControl\Data\Data.mdf;Integrated Security=True
13:07:26.608: Exception while opening database: The database 'C:\USERS\POS_USER\DOCUMENTS\BRUCONTROL\DATA\DATA.MDF' cannot be opened because it is version 852. This server supports version 706 and earlier. A downgrade path is not supported.
Could not open new database 'C:\USERS\POS_USER\DOCUMENTS\BRUCONTROL\DATA\DATA.MDF'. CREATE DATABASE is aborted.
An attempt to attach an auto-named database for file C:\Users\POS_User\Documents\BruControl\Data\Data.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

I did initially copy the data.mdf file over, but with this new error, I tried deleting and replacing the Documents\BruControl\Data\data.mdf file with the one in the 1.1.9 zip file, and I tried deleting it altogether.... same response each time...
 
OK, I renamed Data.mdf to data.mdf.old, restarted the computer, and looked in the directory, just the Data.mdf.old with a timestamp of 1:14PM existed... I started BC1.1.9, and watched the folder... within seconds, a new Data,.mdf appeared, but not with a current timestamp of something like 1:37, it still had the 1:14 timestamp.. it appears that it is re-loading the old data.mdf file from somewhere else...
 
thank you, that got me one more step:
View attachment 706069


13:07:09.725: Opening database: Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\POS_User\Documents\BruControl\Data\Data.mdf;Integrated Security=True
13:07:26.608: Exception while opening database: The database 'C:\USERS\POS_USER\DOCUMENTS\BRUCONTROL\DATA\DATA.MDF' cannot be opened because it is version 852. This server supports version 706 and earlier. A downgrade path is not supported.
Could not open new database 'C:\USERS\POS_USER\DOCUMENTS\BRUCONTROL\DATA\DATA.MDF'. CREATE DATABASE is aborted.
An attempt to attach an auto-named database for file C:\Users\POS_User\Documents\BruControl\Data\Data.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

I did initially copy the data.mdf file over, but with this new error, I tried deleting and replacing the Documents\BruControl\Data\data.mdf file with the one in the 1.1.9 zip file, and I tried deleting it altogether.... same response each time...

Looks like it keeps trying to connect to the 2019 DB. You don't want the MDF from the 1.1.9 zip, you want the MDF from the SQLServer2012.zip
 
@clearwaterbrewer - Did we get you right? You can operate without the DB working... just can't generate graph data.

yes, it was operating, but graphs were 'temporary', any change wiped them out... I am all good now, but I have not updated firmware yet, will do that tomorrow.

The great news is that the PID is acting MUCH more like a PID than it was before the BC upgrade will try to test on the weekend...
 
winter is slowly coming in... and I have no clue if I will ever have 4 beers in parallel.
Home made, like beer, the best :) PCB v4.0 is significant improvement.

1605104030047.png
 
Like clearwater I have been holding out on upgrading. I was going to wait for 1.2 to come out, but it was recalled immediately. I thought it would be fixed and available by now. Is there a timeframe for when 1.2 will be re-released or is 1.1.9 here to stay for a while?
 
To be clear... the 1.1 Build 10 beta version was pulled, not the final. Working on the final... my partner tying to navigate enough time to wrap it up. I have Build 12 in my possession. It has the start of the Profile element but it's not handling Time Elements yet, which is a fairly critical step. Once it does, we'll post it.

I am comfortable is recommending 1.1 Build 9. I haven't hyped it because the releases often require FW updates, and I recognize that FW changes can be a pain.
 
OK, here is my LOLIN D32 Pro V2.0.0 , with the 2.4" TFT that I got on ali for $22.35 delivered.

I burned 'BruControl.45N.ESP32.W.bin' firmware to it and it stayed at all white screen. I then burned the 'BruControl.45M.M5STACK.ESP32.W.bin' firmware to it and got this screen. I know it is low priority, but it could be a really cool affordable platform.

*edit - here is a link to what libraries others used, Lolin32 and 2.4 TFT LCD Touch Screen shield example

#include &lt;Adafruit_GFX.h&gt;
#include &lt;Adafruit_ILI9341.h&gt;
#include &lt;XPT2046_Touchscreen.h&gt;


1605307758813.png
 
Last edited:
Back
Top