Problems connecting Raspberry Pi running latest server release with Arduino

Hi gang!

I’ve been chipping away at my build for a few weeks now, trying various Raspberry PI OS versions and various versions/build processes for the kegbot-server software, with various amounts of success.

I’ve finally done a clean install of the Buster-based Raspberry PI OS (64 bit) and successfully installed the v1.3.0 of the software using the Docker compose script provided by the install documentation.

I’ve also got the latest version of the kegboard software running on an Elegoo Mega 2560 R3 with four flow monitors and a temperature sensor attached and writing successfully to the serial monitor.

However, I can’t for the life of me seem to get the Arduino software to communicate with the server software. It seems like the controller name and flow meters need to be very specifically named, which I have done, and yet nothing seems to work.

Has anyone run into a similar issue with flow meter integration? Does anyone have any troubleshooting suggestions? Thanks in advance!

Plug your arduino into a computer and make sure you are getting output from it.

How many taps? If more than 2 you’ll need to run the set serial command on it. I can dig out my notes if you get stuck

Wow, blast from the past! After spending several weeks banging my head against package dependency conflicts, PI OS version issues, and digging through various shell scripts and forked repos, I decided to just go ahead and write my own software in JS (React/Node), bypassing the Arduino entirely and just using the PI’s GPIO pins for my four flow monitors. Definitely cribbed a lot of the logic from kegboard for my own implementation, so thanks for that!

If you’re curious, repo is here: GitHub - jordandalt/kegnode: A full-stack Javascript application for real-time monitoring and reporting of my home bar, The Lorraine Street Garage.

Hi ! It looks like a very clean implementation. Congrats!

Would your project work for accessing flow meter data directly from the Arduino instead of the Pi?

Best regards

I don’t see why not! kegnode-board could probably be ported to Arduino, and then the Arduino could POST to the server just as the current Node script does.

Thanks, Jordan! I have successfully connected the Arduino to a Nodejs server, and so far so good.

I have a question about the flow sensor… I put the sensor between the keg and the beer, but since the line is not always full of beer the sensor will measure gas and not only beer. That happens during the time the line is “empty”. I could be as short as 1/4 of a second, but it will definitely alter the measurements.

What would be a good approach to control this?

thanks in advance!

Now we’re getting into the hairy sensing challenges for any of these applications! In my kegnode-board application, I defined two constants that I used to tweak calibration and to ignore “false positive” flow readings (from foam, gas, or even just physical jostling of the lines): kegnode/kegnode-board/src/constants.js at main · jordandalt/kegnode · GitHub

With those constants, I’m doing a couple of different things:

  1. In the main loop of my sensor application, I’m sleeping 10 ms between IO reads. This is mostly to keep my data volume manageable, but might not actually be necessary for all applications. Adafruit’s documentation of my flow monitors states that pulse rates from the device aren’t consistent, so you’d probably want to use some sort of sleep/setInterval/setTimeout functionality to generate consistent “ticks.”
  2. In each loop, I’m then checking for “active ticks” – changes in the current coming from the flow monitors. I use the TICKS_TO_ML constant to generate measured pour volume by multiplying measured ticks by the constant value. I did a lot of tweaking of this const value on my kegerator, and never quite got a satisfactory result – mostly, I suspect, because it varied based on temperature, foaminess, and other environmental variables.
  3. If my code deems a pour to be “completed”, I then check the measured volume. If it’s less than MINIMUM_VOLUME, I don’t push it to my server. This is my check against “false positive” pours, and I didn’t tweak it much after initial setup. I did some initial testing just by trying to pour a very small amount of beer and checking how much my setup was registering, and 10 mL seemed like a sane threshold.

I have a four-tap kegerator, and my initial installation kinda placed the flow monitors haphazardly in my existing tap lines. I pretty quickly ran into foam and calibration issues, so I pulled all of my lines and replaced them with fresh lines, each with consistent spacing between keg and flow monitor (1 ft of line) and flow monitor and tap (8 ft of line). Moving the monitors closer to the keg and adding extra line between the monitor and tap greatly improved foam issues.

Calibration was a trickier issue – I never really feel like I fully was able to get consistently accurate readings, and my kegs regularly kicked well before my monitoring system said that they should. (So underreporting of volume was my biggest issue.) FWIW, I also have been running my kegerator in a mostly unconditioned garage, so temperature, humidity, and air pressure definitely made calibration a good bit harder. If I had my setup in a conditioned space, things might have been a little bit more consistent.

Ultimately, I ended up removing my setup because of ongoing foam and cleaning challenges. I used these plastic flow monitors from Adafruit, and I just don’t think they were intended for continuous exposure to the sugars and yeasts in beer. After a few months of regular use, I didn’t feel like my regular line cleaning routine was really getting the sensors fully cleaned out, and there’s no easy way to remove or pull them apart to clean out the internals of yeast or bacterial accumulation. If I had several hundred dollars, I’d replace them with higher quality plastic or stainless sensors from a different source.

Thanks a lot for the detailed answer, I can´t wait to have the time and try your code and compare results.
Right now I’m using my own tweaked/copied from StackOverflow), code :sweat_smile:

I will share my findings ASAP, (I’m using a 1cheap 9 USD sensor and also have a 90 USD Swissflow sensor). Will share the results.

Best regards

1 Like