Kegberry/Kegbot New Installation


#1

Hello everyone,

I’m in the process of installing a bar in my basement including a built-in Kegerator. I also really want to run some sort of tap monitoring solution and stumbled on the Kegbot project. I also really liked the Kegberry version of the project, so I started the process of installing Kegberry on a new Raspberry Pi 3 (Model B). Like many of you who have attempted this recently, the installation did not go smooth! So I decided to dive in and try to get a working installation of Kegberry on the new Pi3, and I was successful! I’ll share the process and links to my updated files below. It’s not the cleanest project and I’ll hopefully try to generate a one-command install, but for now here’s the process to follow if you want to get Kegberry running on a Raspberry Pi 3.

NOTE: It helps if you have some Linux/Pi experience but hopefully the steps below are easy enough to follow. I’ll try to help out as needed as well.

  1. Download a copy of Raspbian Jessie 2017-07-05-raspbian-jessie.zip. (http://downloads.raspberrypi.org/raspbian/images/raspbian-2017-07-05/).
  2. Unzip the file and you should be left with a single file with a .IMG extension
  3. Flash the image to a fresh MicroSD Card formatted as FAT32 using an Image Writing program. My personal favorite is Etcher (etcher .io)
  4. Insert the MicroSD card into the Pi and power up. You should have it connected to a TV/Monitor with a Keyboard and Mouse connected. You may be able to do this remotely through SSH but that’s outside the scope of these instructions.
  5. After expanding the file system and rebooting, you should be looking at the Raspbian Desktop.
  6. Make sure you are connected to the internet, either wired or wireless.

OPTIONAL BUT RECOMMENDED
7. Update your Keyboard Layout to your country, the default is English (UK). Example here is for USA.

  • Open a terminal window and type sudo raspi-config
  • Choose: Option 4 - Localization Options
  • Choose: Change Keyboard Layout
  • Keep the default 105-Keyboard selected
  • Choose: Other
  • Choose: English (US)
  • Scroll to the top of the list and select English (US) again
  • Press ENTER several times to accept the defaults and you will be taken back to the home config screen
  • Select

  1. Open the Chromium browser and download my_kegbot_packages.zip from Google Drive at: https://drive.google.com/open?id=1MzTjk_JJkv1lpjg1D3E2i0H0vcJN2VXE. This should place the download in your home Downloads directory. If you choose another location you may have to modify the following instructions. This package does not contain any feature/functionality updates, it just uses the latest versions of all of the packages and solves the issue you’ll run into with step 11.
  2. In a terminal window, type sudo unzip ~/Downloads/my_kegbot_packages.zip
  3. Next, type sudo mv /home/pi/Downloads/mypkgs /home/pi/
  4. Run the command bash -c ~/mypkgs/install.sh . This will take awhile AND IT WILL FAIL! You should see an error message from urllib2 about SSL being required.
  5. Run the command bash -c ~/mypkgs/install_part2.sh
  6. Run the same command from step 11 bash -c ~/mypkgs/install.sh . This command should now succeed, and you’ll have the Kegbot Server running at your local IP or localhost .

I hope this gets folks up and running on their Raspberry Pi 3. I have yet to integrate the Flow Meters/Temperature sensors but I’ll update this post with my progress and any issues/troubleshooting that I have to work through in order to get a working configuration. If I can get a sample size of larger than just myself, I can hopefully put this into a single script that can be run in one command from the terminal.

If you have any questions/issues with the steps above please let me know.


#2

Thanks! Have been able to connect the flow meter to the Arduino and that to the pi 3?


After Raspberry Pi 3 setup
#3

Hey, yes I was able to get that working, although to be honest I went out and got an Android tablet so I’m running things the “traditional” way with an Arduino setup connected to the tablet and talking to the Kegbot Server running on the pi3.

However, prior to getting the tablet, I was able to get the Arduino with flow meters talking directly to the PI.


#4

Hello everyone,

I wanted to follow-up my previous post now that I have everything working in a semi-production fashion with a full write-up on my Kegberry setup. I’ll try to break this into a few sections with regards to setting up the software and hardware, as well as a parts list for the things that I’ve used to get up and running. There’s still some modifications and clean-up to do with my setup as well as some additional features that I would like to implement, but so far I’m really pleased with how things are performing.

Component List
Let me start by listing everything I’m currently using to put this system together, with some links if I still have them to where you can get some of the components.

  • Raspberry Pi 3 Model B – I got mine from a local MicroCenter but available on Amazon
  • Raspberry Power Supply – The PI takes a lot of current, so I recommend getting a dedicated power supply, or at least use one that can output 2.5A. Link: https://www.amazon.com/Raspberry-Power-Supply-Adapter-Charger/dp/B0719SX3GC
  • Arduino Nano – I purchased mine from Amazon and specifically looked for one that used an FTDI chip for USB vs. cheaper clones that use a CH340 chip. The CH340 devices do seem to work but I had some reliability issues. The one I got also had pre-soldered pins for connection to a breadboard. Link: https://www.amazon.com/gp/product/B00761NDHI
  • Small Breadboard – 30-row breadboard for holding the Arduino. Link: https://www.amazon.com/dp/B01EV640I6
  • RJ45 Breakout Board – I used a pair of these to connect an Ethernet cable from the inside of the kegerator to my Arduino. Link: https://www.amazon.com/gp/product/B0156JXSF8
  • 14’ Flat Cat-6 Cable: This cable doesn’t need to be flat, but since this cable is between the top of my kegerator and the underside of my countertop I needed it to be very low-profile. Link: https://www.amazon.com/Belkin-Network-Cable-Ethernet-Black/dp/B077BPJ3ZM
  • Adafruit Flow Meter: I’m currently using 2 of the very inexpensive Adafruit flow meters for my installation. Link: https://www.adafruit.com/product/828
  • ½” female to ¼” barb 316 Stainless Steel Fittings: These are used to connect the flow meters to my beer lines. Link: https://www.amazon.com/gp/product/B0197ZRIEO
  • Plumbing Thread-Tape: used to help seal the threads between the SS fittings and plastic flow meters. Available at any hardware store.
  • Hose Clamps: Hold the beer lines onto the fittings. They already fit tight but these are cheap insurance. Available at any hardware store.
  • DS18b20 Temperature Sensor: I use this to report temperature back to Kegberry to display my kegerator temperature. Link: https://www.amazon.com/gp/product/B00QGN0LKY
  • 4.7k Resistor: Required by the DS18B20 temperature sensor for proper operation. I had one of these on-hand but should be available for pennies at an electronics retailer or online.

Raspberry Pi OS and Kegberry Installation
To get the software setup on my device, I followed the steps in my previous post exactly. Prior to running any installation scripts you should run the following terminal commands which I missed in my previous post:

  • Sudo apt-get update
  • Sudo apt-get upgrade

This will refresh the list of packages and then upgrade the existing packages on the pi to the latest available for the Raspian distribution. I’m not sure if this is 100% required, but I have always run these prior to installing Kegbot.

The rest of the instructions should still work well for getting things up and running from a fresh installation of Raspian Jessie available in the link in the original post.

Some other things I have done on the OS side are to enable SSH connectivity through the sudo raspi-config command > Interfacing Options. I also changed the default password for the “pi” login account by running the passwd command and following the prompts.

Finally, in order to easily access my server, I set a static IP address on the wireless interface of the Raspberry Pi by editing the file /etc/dhcpcd.conf and adding the following lines at the bottom. This information will be unique to your local network.

Interface wlan0
static ip_address=10.1.1.10/24
static routers=10.1.1.1
static domain_name_servers=10.1.1.1

You will need to at least connect your pi to your wireless network, preferably using the desktop GUI. If you are using a wired connection, just replace “wlan0” with “eth0” to set a static IP on the wired interface.

Kegbot Server Setup
Kegberry is just Kegbot Server designed for the Raspberry Pi that also includes some utilities for monitoring taps and temperature. Therefore the setup is almost exactly the same as the documentation for Kegbot Server, but a lot of the legwork has already been done for you. Once the installation is completed, simply navigate to the IP address of your Raspberry Pi or “localhost” and you should be prompted to go through the configuration wizard. There are only 2 other things you may want to do to complete the setup outside of the Wizard.

  1. Setup E-mail Notifications
    Configuration settings for Kegbot Server are located in /home/kegbot/.kegbot/local_settings.py. In order to configure e-mail, add the following lines.

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend’
EMAIL_HOST = 'smtp.gmail.com
EMAIL_PORT = 587
EMAIL_HOST_USER = '[your email]@gmail.com
EMAIL_HOST_PASSWORD = '[your gmail password]'
EMAIL_USE_SSL = False
EMAIL_USE_TLS = True
EMAIL_FROM_ADDRESS = ‘whatever@you_want.com’

This configuration is if you are using GMAIL, you will have to replace some of the values if using another email service.

  1. Fix broken image links
    For some reason after configuring email, my images disappeared from the Fullscreen view and other areas of the website. To resolve this, I added the following to /home/kegbot/.kegbot/local_settings.py:

KEGBOT_BASE_URL = ‘http://[ip address of pi]/’

NOTE: After all changes, you will need to reboot the Pi for the changes to take effect.

Arduino-based Kegboard Setup

You will first need to download the Arduino IDE as well as download the github repository from github.com/Kegbot/kegboard . After unzipping the kegboard-master.zip archive to a kegboard-master folder, you will need to move the folder to the Sketchbook Location directory of the Arduino IDE specified under File > Preferences. Once you’ve moved the entire folder into that directory, you should see the sketch available to open by clicking File > Sketchbook. You should be able to expand to locate the kegboard sketch under the Arduino folder.

In order to successfully flash the kegboard firmware, you will need to select the appropriate COM port and device type of your Arduino board. Also, check the file kegboard_config.h. This is where all of the pin definitions are setup, so ensure that the pins you are going to use for the Flow Meters and other sensors are setup appropriately. The Flow Meters are required to be on pins that support interrupts. The creators of Kegbot did a great job pre-configuring the pin assignments for most boards, but keep that in mind if you plan on changing where things are connected. My Arduino Nano only has 2 interrupt pins (2 and 3) so my flow meters are connected to those 2 ports.

If you are using a temperature sensor, you will have to connect a 4.7k resistor between the 5V line and the signal line of the sensor. A good diagram of how this looks can be found here: https://create.arduino.cc/projecthub/TheGadgetBoy/ds18b20-digital-temperature-sensor-and-arduino-9cc806

For my setup, I just decided which wires in my Cat-6 cable would carry 5V, Ground, and the Flow0, Flow1, and temperature signals. Once I decided that, I was able to connect the appropriate pins on one RJ45 breakout board to the appropriate Arduino inputs, and wire the sensors to the correct pins on the opposite RJ45 breakout.

Once you’re happy with the settings in the Arduino IDE (you really shouldn’t have to touch anything), flash the firmware to your Arduino. Once completed, open the Arduino Serial Monitor (Tools > Serial Monitor) and set the baud rate to 115200. You should see “Hello” packets every few seconds from the board with some gibberish characters after each line. If you have a temperature sensor installed, you should also see “thermo-“ messages displayed every few seconds. Finally, if you have a flow meter connected, you should be able to blow into the sensor and observe the rapid “flow0” or “flow1” messages being generated.

Flow Meter Hardware Setup
Installing the flow-meters is pretty straight-forward. Using the thread-tape, I wrapped it around the flow meter 3 times, and then screwed on the stainless steel fitting as tight as I could get it with an adjustable wrench without going to the point where I thought I might crack the plastic. I cut the line about 18 inches above the keg coupler and inserted the flow meters, being sure to observe the correct flow direction arrow on the side of the meter.

My beer lines are about 6ft long with inner diameter of 3/16”, so the ¼” barb fittings were very tight. I solved the issue by using a heat-gun to warm up the end of the tube so that it would easily slip onto the fitting creating a tight seal. You can also use a hair-dryer or dip the end of the tube in boiling water for 15-20 seconds to soften it. I then installed metal hose clamps on all of the connections.

Cleaning
I installed all of the flow meter hardware in between changing kegs, so once everything was installed I used my preferred beer line cleaner to flush, clean, and sanitize the lines including the flow meter and fittings. This also served to check for leaks which I was relieved to see there are none.

Testing it out
After getting everything connected, I booted up the Raspberry Pi without the Arduino connected and logged into the Admin console and pulled up the “Controllers” screen. I then connected the Arduino to the Raspberry Pi via one of the USB ports. I refreshed the “Controllers” screen several times over the course of about 30 seconds, and finally the page displayed that there was one kegboard connected with 2 flow meters. (NOTE: at one point in testing I was never able to get the kegboard to show up. I completely started from scratch and re-flashed the OS and re-installed Kegberry and it then worked fine. Not sure what happened but keep this in mind if for some reason the controller does not show up).

I was also able to go to the configuration page of one of the taps and see that the system had discovered a temperature sensor and that it had reported a value a few seconds ago.
I then finally tapped a fresh keg, and thankfully the system successfully recorded the activity!

Calibration
After getting everything installed, I used a Pyrex measuring glass to pour a beer and compare the number of ounces actually poured to what was recorded. With a couple of calibration pours, I actually settled on a value of exactly 1.0 on the “ticks per mL” value. I know Adafruit specs say that the meter should be 450 ticks per L (0.45 ticks per mL), but I guess with the small diameter fittings the reading changes. It seems to be very accurate and consistent now though with that setting but your settings may vary.

Software Modifications

  1. Full Screen Display of ABV/IBU information.
    One of the pieces of information I wanted to make visible on the Full Screen (aka taplist) view was the ABV and IBU values of the current beer. These values can be recorded on the Beer Styles pages, but aren’t displayed. I solved this by adding a few lines to the HTML file for the Full Screen page. The file is here: /home/kegbot/kegbot-server.venv/lib/python2.7/site-packages/pykeg/web/kegweb/templates/kegweb/fullscreen.html. And I added the following lines directly above the line that says {% if beverage.description %} with some HTML tags for formatting.

ABV: {{ beverage.abv_percent }}%     IBU: {{ beverage.ibu }}

  1. Resolving Phantom Pours
    After the installation, I was regularly seeing “phantom” pours on my system at all hours which I believe was caused by beer moving in the lines or EMI from the compressor kicking on/off. These pours were almost always about 0.5oz, and very rarely just under 1oz. I was able to find a setting in the configuration files that sets a minimum volume to actually trigger a pour, and it was set to 10mL (about 0.33oz). I edited the value to be 35mL (about 1.18oz) and that has completely eliminated any phantom pours.
    You can find the setting in the file /home/kegbot/kegbot-pycore.venv/lib/python2.7/site-packages/kegbot/pycore/common_defs.py under MIN_VOLUME_TO_RECORD.

FAQ & Other Info

  1. Why Kegberry instead of Android + Kegbot Server
    My main issue with this installation was that with my under counter kegerator installation I don’t have a good way to setup a permanent Android tablet on the countertop without a lot of exposed wires which I didn’t want. I’m sure I could engineer some solution, but it was easier and cleaner to route everything in the bottom cabinets and just use a web browser or the Kegbot App to display the tap list and pour stats, while just having Kegberry do the actual monitoring.

  2. Beer Foam
    When I first connected the flow meters to a fresh keg my pours came out as almost all foam. I was extremely disappointed and close to just scrapping everything. However, after talking with a few other Kegbot users it was suggested to lower my CO2 pressure. Previously I was running about 12psi on my 2-tap system. I dropped that to about 6-8psi and saw a HUGE improvement. Also, my initial installation used a different collection of fittings to adapt the hose to the ½” NPT fittings of the flow meters. Installing the ¼” stainless barb fittings simplified the connections and also made a huge reduction in foam. Things are pretty much perfect now with 6-8psi and a kegerator temperature of about 38 F.

  3. More than 2 Flow Meters
    I have not set this up or tested this as I only have 2 taps on my setup, but this is certainly possible and there are multiple ways to accomplish this. First, the easiest way would probably be to use an Arduino Mega board (https://www.amazon.com/Elegoo-EL-CB-003-ATmega2560-ATMEGA16U2-Arduino/dp/B01H4ZLZLQ). These boards have 6 interrupt pins so you can connect up to 6 flow meters directly and feed them in via the single connection to the Raspberry Pi. The Arduino Code already supports these boards and correctly sets up the pin assignments. I have not done this or tested it, but it should work well.
    The other option is to connect multiple Arduino Nano boards (or similar Arduino Uno) that support 2 flow meters each. I believe you can edit the definition for the Kegboard name in the kegboard_config.h file to uniquely identify each board. The RPi 3 has 4 USB ports so you should be able to connect 4 Arduino boards (8 flow meters) and even more if you use some type of USB Hub. Again, I have not tried this or tested this but it should work just fine.

  4. Future Enhancements
    One thing I’m going to try to setup in the future is an easy tablet-friendly way of re-assigning or claiming pours from the Full Screen display of Kegbot Server. I’m happy to have Kegberry just recording pours and keg volumes behind the scenes when I’m just drinking by myself, but for parties or gatherings I would love to setup the attractive tap list view with the additional ability for known users manually log pours within the Kegberry system.

  5. I’m having problem [insert problem here] with Kegberry
    If you’re having issues getting setup, feel free to reach out and I’ll try to help as best I can! The most common issue I’ve seen is people trying to use one of the later versions of the Raspbian operating system. The latest version that Kegberry supports is the “Jessie” version, so follow the instructions in the first post to get the correct image and get things going.

I will of course try to help any respond to any issues you may have or questions, but hopefully this write-up helps some people get the system up and running! Here’s a few mediocre pictures of my setup.


The Bar


Flow Meter connected inline with Stainless Steel fittings & Hose Clamps


RJ45 Breakout Board soldered with connections for Flow Meter 0 (Green), Flow Meter 1 (Red - not connected), and Temperature Sensor (Blue)


Arduino (Green LED) board connected to RPi via USB. Cat-6 Cable runs through the cabinet and up and into the Kegerator through the cutout for the tower.


#5

Great write up man, this should help new kegbot enthusiasts!