Keg Cop: Keg Monitoring and Control

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
3,903
Reaction score
1,694
Location
Rural Kansas
My temps started fluctuating crazy again. The keg temp going from 108F to 31F in one fell swoop. Then changing by 2-3 F up from 31 a few times. Then from 36 to 43 in one single change. Then back to 30F in a single change. Wasn't there a buffer range that it averaged the temps over each X number of seconds?
Well, you certainly seem to be finding things we’ve not seen before.

A guess: Somewhere the logic to ignore invalid readings + a bad connection are skewing things.

Yes there is a buffer that averages things. It takes a reading every 10 seconds and keeps six. If it’s one bad reading that is throwing things off, I’d expect it to correct itself in 60 seconds. Watching it for 60 secs would be interesting.

I did just notice the calibration doesn’t actually clear the buffer like I thought it did - I added that logic without calling it. Pretty smooth! No big deal for regular operation but I was going to have you leverage that functionality to soft-clear the buffer.

I’m on an RV trip without even the ability to find a temp sensor. What I could do is enable some debug that would be pretty spammy but would show you the buffer values. Is it always the same sensor that goes off?
 

rkhanso

Well-Known Member
Joined
Jan 24, 2017
Messages
691
Reaction score
163
Location
Plymouth, MN - terrible tap water for brewing
It hasn't fluctuated like that since I re-flashed the firmware and rebooted Days: 0, Hours: 13, Minutes: 12, Seconds: 14
If I remember correctly, all 3 of the sensors were fluctuating. But I was noticing the one having larger fluctuations.
I'll keep an eye on it and report back if it starts up again.
 

rkhanso

Well-Known Member
Joined
Jan 24, 2017
Messages
691
Reaction score
163
Location
Plymouth, MN - terrible tap water for brewing
The ESP/Keg Cop crashed again.
I left a Brave tab up the last few days. I went back to the same tab just now and clicked refresh. It didn't respond at first. Eventually, it crashed/rebooted and came back with all the settings gone and uptime under 1 minute. It was working good for over a day. It seems to me like the web server is the weak point. The other crashes/reboots had to do when I was actively using the web/GUI. It did the same about 3x in a row before I could get the settings set and finally close out the tab.

Now the only way I'll know it's crashed is if the beer gets warm.
 
Last edited:
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
3,903
Reaction score
1,694
Location
Rural Kansas
there’s no reason I can think of that the settings would get wiped out on a crash. I would love to see the serial log if you can figure out how to get that for me. Provided you’re not on the Settings page, there is nothing that is going to wipe out those settings.

I am back home now, I’ll think about how we might be able to diagnose just a little bit better. Is there anyway to connect a USB cable to the controller while it’s running?
 

rkhanso

Well-Known Member
Joined
Jan 24, 2017
Messages
691
Reaction score
163
Location
Plymouth, MN - terrible tap water for brewing
It didn't take long to get a crash log. See the attached files.
I wasn't on the settings page when it crashed (well, I don't think I was). But the temp offset, what temp probes were enabled, brewery name, beer name all were lost each time.
 

Attachments

  • kegcopcrashlog.txt
    22.3 KB · Views: 0
  • kegcopcrashlog - second example.txt
    16.4 KB · Views: 0
Last edited:

rkhanso

Well-Known Member
Joined
Jan 24, 2017
Messages
691
Reaction score
163
Location
Plymouth, MN - terrible tap water for brewing
That looks a lot like the SPIFFS partition failed. Do you have a legit Lolin or is it another? Have you tried a different controller?
I only have the one ESP32. I'm not sure if it's a real Lolin. I bought it from the Ali Express link on your website.

Sometimes it'll run for a couple days. It seems like when I click links or refresh the webpage is when it crashes.

I just got the necessary settings to stick (what temp sensors used, offsets, temp control) and closed the tab. I think it'll run this way for some time as long as I don't access the web server on the ESP. Not why I started this project, but at least the beer will stay cold.
 
Last edited:

Thorrak

Supporting Member
HBT Supporter
Joined
Feb 7, 2016
Messages
3,351
Reaction score
2,196
Location
New York, NY
I only have the one ESP32. I'm not sure if it's a real Lolin. I bought it from the Ali Express link on your website.

Sometimes it'll run for a couple days. It seems like when I click links or refresh the webpage is when it crashes.

I just got the necessary settings to stick (what temp sensors used, offsets, temp control) and closed the tab. I think it'll run this way for some time as long as I don't access the web server on the ESP. Not why I started this project, but at least the beer will stay cold.
Unfortunately (fortunately?) that is indeed the manufacturer themselves.

That said, if you get a chance, try the "trythis" firmware I just posted. This version moves the SPIFFS partition to where the "app1" partition used to be - meaning that you lose the ability to do OTA firmware updates but the SPIFFS data will reside somewhere else. If this is stable, it points to there possibly being some kind of hardware issue at play with this specific board.
 

rkhanso

Well-Known Member
Joined
Jan 24, 2017
Messages
691
Reaction score
163
Location
Plymouth, MN - terrible tap water for brewing
I tried the "try this" firmware in post 276. If it's the same "try this" firmware....
I started getting excessive temp fluctuations. It also didn't have the tower temp control feature.
But I will try it again tomorrow and see if it's more stable long-term, if the wild temp fluctuations come back and won't worry about the tower temp control.
Will follow up after that.
 

Thorrak

Supporting Member
HBT Supporter
Joined
Feb 7, 2016
Messages
3,351
Reaction score
2,196
Location
New York, NY
I tried the "try this" firmware in post 276. If it's the same "try this" firmware....
I started getting excessive temp fluctuations. It also didn't have the tower temp control feature.
But I will try it again tomorrow and see if it's more stable long-term, if the wild temp fluctuations come back and won't worry about the tower temp control.
Will follow up after that.
This is a new one, I’m just being lazy and reusing the entry in BrewFlasher.

This version is based on the slightly older codebase that I’ve been using, but I can take a stab at pulling in Lee’s changes and making the same shift to where in flash things are stored. I’ll post once that’s done.
 
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
3,903
Reaction score
1,694
Location
Rural Kansas
Not why I started this project, but at least the beer will stay cold.
You start this or any other Open Source project for the same reasons you brew your own beer. When it's done you will have something you built.

I have a D32 about to be delivered from China, I'll send that to you to try out and see if that fixes things. It would be amusing/not amusing if all the crashing this whole time was a bad controller.
 

rkhanso

Well-Known Member
Joined
Jan 24, 2017
Messages
691
Reaction score
163
Location
Plymouth, MN - terrible tap water for brewing
This is a new one, I’m just being lazy and reusing the entry in BrewFlasher.

This version is based on the slightly older codebase that I’ve been using, but I can take a stab at pulling in Lee’s changes and making the same shift to where in flash things are stored. I’ll post once that’s done.
At 9:15am Central time today, I installed your "Try This" version of firmware. Install and changing the config settings went well. No reboots/crashes. This version had the tower temp control feature included.

The previous install crashed and the chamber/beer temps were up in the 60s. Waiting for it to cool back down.
 
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
3,903
Reaction score
1,694
Location
Rural Kansas
Here’s hoping that is the issue. Will get you going one way or the other. I finished the tower controller feature, I’ll get that merged later today I hope. If it is a bad controller, that will remove the mystery between John and I releasing the same code.
 
Last edited:
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
3,903
Reaction score
1,694
Location
Rural Kansas
So @rkhanso another thought .... Earlier when you posted the uptime.csv I pointed out that the reboots I saw were "power on." Something to consider is whether your power supply has enough amperage to keep that running. There have been reports of consumption up to 790mA from just the controller. The relays are another ~20mA each (assuming SainSmart or similar) and nother 1mA each for the temp sensors. So you need to plan for 832mA peak. I'd round that up to an even 1A, and then padding for Chinese power supplies, your power supply should be capable of 2A or 10W.

The reason this is interesting is if you brown out or power cycle the ESP device at precisely the wrong time, it could corrupt the SPIFFS partition. I've gone to some lengths to ensure that "wrong time" is very short, and this very uncommon shortcoming is appliccable to all applications writing SPIFFS (BrewPiLess, BrewPi ESP8266, Brew Bubbles, iSpindel, etc.)
 

rkhanso

Well-Known Member
Joined
Jan 24, 2017
Messages
691
Reaction score
163
Location
Plymouth, MN - terrible tap water for brewing
The power supply is a 12v, 1A wall wart. It's probably not the highest quality supply in the world.
I have a 5v step-down regulator powering the ESP32 directly through the homemade PCB.
I do have a 2-channel relay module - one running the Kegerator compressor, the other the tower fan (a Desktop PC squirrel-cage type fan). I could disable the tower fan to reduce the load on the power supply if needed. The 12V side runs the squirrel-cage fan to cool the tower and also a very tiny (5cm x 5cm?) 12v van to circulate air inside the Kegerator. That circulation fan is running ALL the time to circulate air in the Kegerator.

But it's been working this way for a few hours after putting the new "Try This" firmware on it. The tower fan ran a long time at first when the temps were in the 60s inside the Kegerator.
Days: 0, Hours: 3, Minutes: 39, Seconds: 14

EDIT - Days: 0, Hours: 5, Minutes: 42, Seconds: 35 and still going strong. I'm closing out the browser tab to the ESP in-between times, but checking occasionally.

EDIT - Days: 0, Hours: 10, Minutes: 27, Seconds: 55 - still working OK.

EDIT - Days: 0, Hours: 22, Minutes: 56, Seconds: 24 - still going strong.
 
Last edited:

rkhanso

Well-Known Member
Joined
Jan 24, 2017
Messages
691
Reaction score
163
Location
Plymouth, MN - terrible tap water for brewing
Uh-Oh - looks like I had another reboot.
But at least I didn't lose my settings this time. I didn't have the serial monitor connected.

  • Uptime:Days: 0, Hours: 4, Minutes: 0, Seconds: 20
  • Reset Reason:Reason: ESP_RST_SW, Description: Software reset via esp_restart
  • Heap Information:Free Heap: 177520, Max: 45044, Frags: 75
 
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
3,903
Reaction score
1,694
Location
Rural Kansas
Keg Cop will do a (controlled) reboot automatically at 24 hours - "Software reset via esp_restart" means it was programmatic. At the time I put that in to deal with weird mDNS things. I believe John may have discovered the reason for those issues in a core bug.

So it sounds like your problems are a hardware issue. That makes me feel better but likely does nothing for your attitude. I'll shoot you a PM to get your address and send you this controller I have showing up here in a day or so.

In theory you should be fine till you get the new controller, but you will not be able to upgrade to the release version till you have it replaced.
 

Thorrak

Supporting Member
HBT Supporter
Joined
Feb 7, 2016
Messages
3,351
Reaction score
2,196
Location
New York, NY
Keg Cop will do a (controlled) reboot automatically at 24 hours - "Software reset via esp_restart" means it was programmatic. At the time I put that in to deal with weird mDNS things. I believe John may have discovered the reason for those issues in a core bug.

So it sounds like your problems are a hardware issue. That makes me feel better but likely does nothing for your attitude. I'll shoot you a PM to get your address and send you this controller I have showing up here in a day or so.

In theory you should be fine till you get the new controller, but you will not be able to upgrade to the release version till you have it replaced.

Yeah - the mDNS stuff is incredibly frustrating, as it seems to be some kind of issue with the wifi stack (which is closed source). I'm hoping to run that down further once we're back in NYC -- but at least the work so far has been productive (at least insofar as opening issues counts...)
 
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
3,903
Reaction score
1,694
Location
Rural Kansas
Seems like we have the culprit then. The good news in all of this is that I spent some quality time in a few sections of code to make them easier to maintain.

I’ll be releasing 1.2 here soon with the new Tower fan control among other things. I also want to look at some additional support for a new-ish project @Thorrak is working on, and maybe a couple other things.
 

rkhanso

Well-Known Member
Joined
Jan 24, 2017
Messages
691
Reaction score
163
Location
Plymouth, MN - terrible tap water for brewing
One thing I've been noticing - it's still crashing/rebooting - Reason: ESP_RST_PANIC, Description: Software reset due to exception/panic
I notice it happening when I bring up a browser tab and access the web GUI. It could be happening at other times, but obviously - if I don't check the web GUI, I don't know if it is or not. When I do check the temps via the web interface, I immediately check the About page, and shows only 10 or so seconds of uptime. This happens every time I check via the web browser.
Also - The temp sensor and control settings are saved during this, but the Tap settings are always lost when this happens.
 
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
3,903
Reaction score
1,694
Location
Rural Kansas
What does the serial monitor say?

I’m 99.99% sure it’s just a bad controller. It’s not doing that here. Not sure what else to say. I should be dropping a package later today so we can see what’s up.
 
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
3,903
Reaction score
1,694
Location
Rural Kansas
Okay, in between harvesting honey, working my day job, and moving cattle around, I came up with a little teaser for you all:
1661950700945.png
 
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
3,903
Reaction score
1,694
Location
Rural Kansas
As a Mets fan,
And that, dear reader, tells you all you need to know about him.

The right shade of orange and everything.
Ironically, that was apparently the default Bootstrap colors. I selected a Bootswatch theme that was not available in 4.x and that's what I got.

Okay; as long as we're here - one more teaser:

1661962608996.png


Why is that a picture of a screen rather than a screenshot? Well, that's not a computer. That's all I'll say about that right now. ;)
 

tomakana

Well-Known Member
Joined
Jun 20, 2017
Messages
69
Reaction score
19
Location
Southeastern PA
Hi, all - been lurking for a while and collecting the materials to get KegCop up and running. At this point just waiting for the delivery from Mouser to get here. I built a BrewPi remix setup for myself over the pandemic, and short of the LCD screen never quite working right, it's been a god-send for my fermentation control. Can't wait to start digging into this one!

For now, I have a couple of assembly questions before I jump in and get too far down a path to back up.

First - My SwissFlow meters came with a connector on the end of the wires (see the pic with the included wiring diagram below). Am I correct in interpreting the diagram as the red wire is the ground (connects to the "G" on the breakout board), the center wire is the pulse (connects to the "D") and the top wire is the power (connects to the "V")?

IMG_5944.jpg

If that's correct, the next thing I'm planning to do is extend the wires so the flowmeters can be further away from the boards than 15cm. Can anyone tell me what type of connector that is? I'd prefer to just put a connector on the end of the wires that run to the flow sensor board. The SwissFlow website just says "3-wire flat cable sealed in housing (jack-plug or molex connector on request)" - I didn't really know enough to pay attention to that. If a connector doesn't seem reasonable, best to simply strip and splice the wires?

Last thing, for now - I've dug around all the diagrams and pictures I can find, but I can't find one that shows exactly how the D32 connects to the PCB. I can see where it goes and the orientation, but the actual mechanics of it are escaping me for some reason. If anyone has a picture of the main board assembled with the D32 or can explain how it mounts, that would be a big help. I'm assuming it mounts above the resistors and capacitors, but can't quite identify the way to create the right spacing, if that makes sense.

Thanks in advance - @LBussy and everyone were incredibly helpful on the last project, and even though I understand the bare minimum of these threads, it's fun to try to follow everything!

Tom
 

Thorrak

Supporting Member
HBT Supporter
Joined
Feb 7, 2016
Messages
3,351
Reaction score
2,196
Location
New York, NY
I had the exact same question @tomakana so I designed the following board:

IMG_4568 Large.jpeg

Eagle files are attached.

The problem with this board is that I designed it with this specific Molex connector in mind which seems to be tagged as obsolete. DigiKey claims that this connector is a potential replacement -- I don't own it to compare and thus can't say either way, but it might be worth a shot if you want to take the risk!
 

Attachments

  • Keg Cop - Daisy Chain Molex.zip
    26.6 KB · Views: 0

danb35

Well-Known Member
Joined
May 26, 2012
Messages
148
Reaction score
28
Location
Hartsville
That looks like a JST-XH connector on the cable, and that's what my 6-way breakout board is designed to use--but it looks like I may have the pins in the incorrect order to just plug it in and have it work.

As to mounting the D32, maybe this will help--I've pulled it up out of the socket a little bit so it's more clear what's soldered to where:
1662200534654.png
 
OP
OP
LBussy

LBussy

A Cunning Linguist
HBT Supporter
Joined
Jan 19, 2013
Messages
3,903
Reaction score
1,694
Location
Rural Kansas
Am I correct in interpreting the diagram as the red wire is the ground (connects to the "G" on the breakout board), the center wire is the pulse (connects to the "D") and the top wire is the power (connects to the "V")?
Yep.

I'm assuming it mounts above the resistors and capacitors, but can't quite identify the way to create the right spacing, if that makes sense.
If you purchased the BOM from Mouser, you will receive those 16-pin headers to mount on the board as shown by @danb35 .

it looks like I may have the pins in the incorrect order to just plug it in and have it work.
Not too late for a PR to fix it. I believe that will be GA when I release the next feature release.
 

tomakana

Well-Known Member
Joined
Jun 20, 2017
Messages
69
Reaction score
19
Location
Southeastern PA
That looks like a JST-XH connector on the cable, and that's what my 6-way breakout board is designed to use--but it looks like I may have the pins in the incorrect order to just plug it in and have it work.

As to mounting the D32, maybe this will help--I've pulled it up out of the socket a little bit so it's more clear what's soldered to where:
View attachment 779808
Thanks - this is a huge help!
If you purchased the BOM from Mouser, you will receive those 16-pin headers to mount on the board as shown by @danb35 .
OK - that's what I was thinking - it probably would have made complete sense once I saw everything on the table.

Thanks!
 

Thorrak

Supporting Member
HBT Supporter
Joined
Feb 7, 2016
Messages
3,351
Reaction score
2,196
Location
New York, NY
That looks like a JST-XH connector on the cable, and that's what my 6-way breakout board is designed to use--but it looks like I may have the pins in the incorrect order to just plug it in and have it work.

It might be, as they offer both. This is what mine looks like:
 

Attachments

  • DB7FC860-DED2-41E3-ABD8-2CB317D40BFE.jpeg
    DB7FC860-DED2-41E3-ABD8-2CB317D40BFE.jpeg
    1.5 MB · Views: 0
Top