Hello all,
I need some advice if you have a minute. I am two weeks into teaching myself brucontrol and ardunio scripting
and my basic language skills from 30 years ago are not enough. I am presently controlling my new build
"Ferminator 3" a fermentor/kegger/freezer all in one quite well, but now I need to add in logic in the scripting
that is more sophisticated that I understand.
I need to add in two important sub-routines.
Let me set the stage. I am controlling 4 zones, 1- freezer, 2- lager chamber, 3-ale chamber & 4-kegger chamber.
I have a air distribution box that has 1 main fan and 3 electric air valves driven based on the temp in each chamber.
Controlling each with a PID is straight forward, but what I ultimately need is to allow each temp sensor to drive the
valve(s) open and close for each chamber and also turn on the main fan. So each chamber individually has valves but all are
serviced from the same fan. So individually I can turn on the valve and fan, but I am having trouble with the logic to make sure that when all three chambers are "off", I have also switched the main fan off. I cant figure out how "NOT" to disable the main fan once temp is hit for chamber 1 if chamber 2 is also on, or not at temp yet. I don't want to disable the fan while it is needed enabled by the other chamber(s) control.
Secondly, I want to replace the manual defrost circuit for the freezer. Right now it goes on for 15 minutes every 12 hours.
I cant seem to get the logic right and debug fails with the following code (below). When the defrost is on, I need to turn off
all devices. I don't want to run the cooling system while I am heating the evaporator to 50+ degrees. Right now I have a manual defrost control that just switches power off to all devices and on to the heater circuit. Everything is being told by BC to do this and that, but there is no 110v to those devices for them to actually carry out their orders. I could easily leave this as is, but seems silly to have all this control and leave in an $11 plastic analog timer.
The code is below, I know its not efficient, but I am learning. This code does not work but it has the framework of what I am trying to do. I have code that does work (when not adding in the fan control and heating circuit) and other than that it has
been running for the last week quite well. I am not asking anyone to write it for me, I need to learn, but this is getting
out of my wheelhouse and after 4 hours of trying and debugging (and a few brews) I need to reach out for help.
Your advise is much appreciated. I have included a raw drawing to explain the physical design (not to scale, the air control is 5" x 12" and the chambers hold 6.5 gal conical's).
View attachment 605145 View attachment 605145
script
[fermenting_prep]
"FERMHEAT" State = off
"MAINFAN" State = off
"FERMVALVE" State = OFF
"FERMHEAT" Enabled = true
"MAINFAN" Enabled = true
"FERMTOPSEN" Enabled = true
"FERMVALVE" ENABLED = TRUE
[fermenting_loop]
if "FERMTOPSEN" Value < 64 //this temp probe is 3 degrees hotter at top then in center
"FERMHEAT" State = on
else
if "FERMTOPSEN" Value > 66
"FERMHEAT" State = off
endif
endif
if "FERMTOPSEN" Value > 67 // cool down the chamber
"MAINFAN" State = on
"FERMVALVE" State = on
else
if "FERMTOPSEN" Value < 65 // turn off valve and fan
"MAINFAN" State = off
"FERMVALVE" State = off
endif
endif
[keg_loop]
if "BOTTOMKEG" Value > 55 // keep keg chamber at some temp change later to 38
"MAINFAN" State = on
"KEGVALVE" State = on
else
if "bottomkeg" Value < 53 //turn off cold
"kegvalve" State = off
[heater loop] // this is the defrost circuit for the freeze evaporator, heat 15 minutes every 12 hours
reset "HEATER TIMER" // reset the timer (to its default of 0:00:00)
start "HEATER TIMER" // start the timer running
[loop]
wait "HEATER TIMER" Value >= 11:59:59 // wait for 12 HOURS elapse
"FREZHEAT" state = off
"FERMHEAT" State = off
"MAINFAN" State = off
"FERMVALVE" State = off
"FREEZER" State = off
"FREZHEAT" State = on //turns on freezer defrost heater for 15 minutes
wait "HEATER TIMER" Value >= 12:15:00
"FREZHEAT" State = on
reset "HEATER TIMER" // reset the timer (to default of 0:00:00)
endif
sleep 2000
goto fermenting_loop
Happy new year to all!
KDAZ