[Version 2 Release] RaspberryPints - Digital Taplist Solution

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.
I actually went pretty in depth on those meters. id suggest you go with the 1/2 inch versions for many reasons. the flow count will be different like day_tripper stated. you'll have to go back a lot farther than 15 pages to find my notes. I had to drill mine out and use like 15 wraps of Teflon to get to where I'm at now so really it's kinda uncharted territory. I got good flow sense but I was never really able to get around pouring beer through my system.

Thanks for the information. I went with the 1/2 ones I found on ebay instead. Hopefully those will do the trick. Ill be sure to go back and see the notes you had
 
When considering various flow meters...

The Arduino merely counts pulses and once it decides a pour is complete is sends the pulse count along with the tap "pin" to the RPi (or whatever host system is being used). The host-side code translates the raw pulse count into volume, associates the pin with a tap, and posts the pour record to the database.

The pour-size math exists in /var/www/includes/pours.php, where the pulse count is translated into pulses per gallon (21120) to generate the fractional gallon pour value that ends up being posted to the database.

If using a meter other than the SF800, you change the following line in pours.php:

$amount = $PULSE_COUNT / 21120;

to

$amount = $PULSE_COUNT / 1500;

or whatever number is determined through testing.

I believe wbarber69 ended up around 3000 with the meter he was trying out...

fwiw, the Swissflow meters put out ~165 pulses per ounce poured.
That's where the 21120 came from...

Cheers!
 
One other thing to remember about those flow meters is that their calibration will be very dependent upon their orientation, unlike the Swissflow meters spec'd in the original build. So make sure when you're calibrating them, you have them in roughly the same position you'll have them in place in your setup. For that reason, you'll want them secured inside of your build so that they remain relatively stable when you change kegs, etc.
 
Thanks guys again for the information. Everything is on order. I'll prob mount the flow meters against the inside of the keezer wall. Is it okay for the Rpi and aduino to be mounted inside the keezer ?
 
If they are in a hermetically sealed case, maybe.
Otherwise there's a huge risk of condensation wreaking havoc.
I wouldn't go that route...

Cheers!
 
I haven't had issues with putting the arduino in there, but I wouldn't put the rpi in there.
 
Wow!! Nice to see this project still going strong...

I'm finally getting back to brewing after a year hiatus... will have to clean up and finish the work I was doing on my rpints with the rfid reader...
 
Lots of small things, but the biggest is adding support to display different containers/glassware for each beer in the gravity/color column. I ended up using SVG images to style on the fly for coloring instead of the overlay. I just realized this renders correctly in epiphany, which may help performance on older hardware like my first-gen B+.

I may try a similar technique on the alcohol scale so the glassware matches.

I also spend considerable time (I suck at web design) modifying the layout to vertical columns per beer.

I updated the sql.schema with my database changes, so It should be simple to package up if anybody wants it, but unless you're comfortable modify the database schema manually, you'd have to delete your existing data.

Would you be willing to share these modifications?
 
Somewhere in the gawdawful mess that is my "lab" is a basic R'Pints rig using an Uno with Bluetooth...
View attachment 371781

Ah, there it is!
View attachment 371782

Note the Uno - and the detached USB cable and the BT radio laying on edge.
Pours are registering perfectly over the BT link.
There's also a PIR and some BrewPi stuff wired up to the RPi2B and working as well.


So, here's the How To Do's

Using an UNO instead of an AlaMode for R'Pints

- You can follow the RaspberryPints "With Flow Meters" installation and completely skip Step 6 where AlaMode-specific stuff is installed. It's not needed.

Perform Steps 7 and 8, then in Step 9, skip the AlaMode assembly and use the instructions on how to configure the Arduino sketch for the number of meters and the meter pin assignments.

You'll configure these lines of the sketch file located at /var/www/arduino/raspberrypints.ino

Code:
//This line is the number of flow sensors connected.
const uint8_t numSensors = 4;
//This line initializes an array with the pins connected to the flow sensors
uint8_t pulsePin[] = {8,9,10,11};

DO NOT SAVE THE SKETCH YET!

- Next, change the baud rate setting in the sketch from 9600 to 57600 as shown:

Code:
void setup() {
  pinMode(13, OUTPUT);
  // initialize serial communications at 57600 bps:
  Serial.begin(57600);

The Uno USB/serial bridge defaults to 57.6K baud and there's no good reason not to use that speed.

NOW save the sketch.

- Next, edit the R'Pints Python listener /var/www/python/flow_monitor.py

Disable the 'port' command line for /dev/ttyS0, enable the 'port' command line that points to /dev/ttyACM0, and change the baud rate to 57600 (I modified the original so the options are listed):

Code:
#The following line is for serial over GPIO
#port = '/dev/ttyS0'
#The following line is for serial over USB
port = '/dev/ttyACM0'

#The next line is for serial over GPIO
#arduino = serial.Serial(port,9600,timeout=2)
#The next line is for serial over USB
arduino = serial.Serial(port,57600,timeout=2)

- Next, plug the Uno into the host RPi via a USB cable and run the Arduino IDE.

o In Tools/Board select Arduino UNO (should be the top of the list)
o In Tools/Serial Port select /dev/ttyACM0
o In File/Open select the sketch at /var/www/arduino/raspberrypints.ino
o Click the Right Arrow button to compile and upload the sketch to the Uno.

- Finally, start the flowmon service:

Code:
$ sudo /etc/init.d/flowmon start

- Check to verify the service is running:

Code:
$ sudo /etc/init.d/flowmon status

pi@cpints:~ $ sudo /etc/init.d/flowmon status
● flowmon.service - LSB: Put a short description of the service here
   Loaded: loaded (/etc/init.d/flowmon)
   Active: active (running) since Wed 2016-09-28 21:10:38 EDT; 46min ago
.
.
.

- Hook up a flow meter and give it a try.

Note that using a USB link instead of the AlaMode shield opens the road to using something other than an Uno.
The sketch is so tiny and uses so few elements I'd be surprised if you couldn't use pretty much any Arduino available with enough digital IO pins to suit the number of taps needed...



Using an Uno with Bluetooth for R'Pints

This section assumes one already has an Uno running with R'Pints (see above :))

Assuming one has built-in BT or a BT USB dongle plugged into their RPi (or other host), and a BT/serial bridge (eg: HC-05, HC-06) plugged into an Uno, I'll show what needs to be done to get them to play together.

Note: the basics of using an HC-05 or HC-06 with an Uno can be found here. You can find the simple connectivity including a highly-recommended resistor level-shifter on the Uno serial TX signal to the HC-0x serial RX input to keep from blowing up the latter.

So, assuming one has an HC-05 or HC-06 properly wired to an Uno TX, RX, 5V and GND pins, here's what needs to be done:

- in a terminal session, find the MAC address of the BT/serial bridge:

Code:
$ hcitool scan
Scanning ...
        00:02:72:32:D8:2C       OBELISK
        98:D3:31:80:25:64       BPSAT_3

OBELISK is my workstation's BT radio, the other entry is an HC-05 BT/serial module.
Note I believe it's included with standard Jessie distros, but if you don't have hcitool installed:

$ sudo apt-get update
$ sudo apt-get install hcitool

- next, on the desktop, go to Menu - Preferences, find the Bluetooth Manager, right-click on it and "Add to desktop".

- now launch the Bluetooth Manager
o click the Search button to scan for BT devices
o click on the entry for the BT bridge (HC-05 or -06)
The correct entry will have the MAC address listed as found above.
o click the plus sign icon to add this device to the "known" list
o click the keg icon to add this device to the "trusted" list.
o click the Setup... button to get into the connection dialog
o you'll need to Pair the device using the key (likely 1234) and then Connect the device.
o once successfully added you can close the dialog pane.

- next, back at the command line, use rfcomm to bind the BT/serial bridge channel 1 to virtual port rfcomm0 (assumes this is the first bridge - if you already have any rfcomm ports, use the first free port number)

Code:
$ sudo rfcomm bind 0 98:D3:31:80:25:64 1

- Then check the status:

Code:
$ rfcomm show rfcomm0
rfcomm0: 98:D3:31:80:25:64 channel 1 clean

- If you get that far, edit /home/pi/.config/lxsession/LXDE-pi/autostart and add the same rfcomm bind command to the end of that file.

- next, change the listener port used by the flow monitor process to rfcomm0 (or whatever port you've created) by editing the Python file /var/www/python/flow_monitor.py.
Note I've added two more lines vs what I showed in the "Use an Uno" section, the better to illustrate all the options now available.

Code:
#The following line is for serial over GPIO
#port = '/dev/ttyS0'
#The following line is for serial over USB
#port = '/dev/ttyACM0'
#The following line is for serial over Bluetooth:
port = '/dev/rfcomm0'

Reboot the system and verify the BT module is connected and pour data is being conveyed successfully...

Cheers!



After awhile searching I found this. Thanks for the guide. I have everything installed, I just need to wire up my flow meters. I think my last question...Hopefully...How do I calibratey flow meter output? How do I know how many pulses it does for a 12oz pour? Thanks again guys
 
The host-side code is tuned for SwissFlow SF800 meters. If you want to use anything else you will have to empirically determine the "ticks per gallon" and use that value in the pours.php code to calibrate to your meter.

I posted what needs to be changed in the last week here...

Cheers!
 
The host-side code is tuned for SwissFlow SF800 meters. If you want to use anything else you will have to empirically determine the "ticks per gallon" and use that value in the pours.php code to calibrate to your meter.

I posted what needs to be changed in the last week here...

Cheers!


I understand that. I'm just not sure how to determine "ticks"
 
The easiest way to figure it out is to pour a measured volume of convenient size, see what R'Pints says you poured, then do the math :)

I'm pretty sure the SF800 meters use a far higher tick-per-volume than anything else you're going to find for less money. So, if you pour a 128 ounce gallon and R'Pint says you only poured an ounce, you'd reduce the tick count to 1/128th of the default, and try again...

Cheers!
 
So I hit of a little snag tonight and I cant figure out what is wrong. Basically my flow meter service wont start. Ive attached a few photos so maybe if there is something wrong someone can point it out. Im using Jessie so i know I have to add "html" to everything instead of the just var/www. Ive changed all the lines to just var/www/html to where i also added var/www/html/RaspberryPints/python (as you see in the photo). Nothing works

IMG_20170222_180658.jpg


IMG_20170222_180719.jpg


IMG_20170222_180748.jpg
 
Just checking, but did you really root the kit at var/www/html/RaspberryPints?
Most folks unpack the saveset to either var/www or var/www/html.
Not that it should make any difference, just making sure there isn't a disconnect here...

Cheers!
 
Just checking, but did you really root the kit at var/www/html/RaspberryPints?
Most folks unpack the saveset to either var/www or var/www/html.
Not that it should make any difference, just making sure there isn't a disconnect here...

Cheers!


I think i unpacked it to the desktop and just copied the folder to var/www/html. I dont see how that would make much difference tho. You can see by my address bar the location of the folder
 
Would you be willing to share these modifications?

Certainly. I was kind of hoping that the original developers were still maintaining it or had passed it along to somebody else that was active.

I'll see about creating my own fork on github and getting it packaged correctly in the next few days.
 
So I got everything installed and the flow meter service started. I wired up my flow meter to the arduino to see if it was going to work and it seems like it didnt. On my raspberrypints "homepage" it still says "0oz poured" I went into the arduino folder and changed the port to only 8 and 1 flow meter hooked up because i didnt know if it didnt make a difference that i was only testing out 1 before I attached all the others. Here is my photo, do I have everything hooked up right? I have Red going to 5v, yellow going to pin 8 and black going to GRN.
Also, when i run
sudo /etc/init.d/flowmon start $ ps aux | grep flow_monitor.py
I get nothing in return??

Here is my code in the Arduino file
//This line is the number of flow sensors connected.
const uint8_t numSensors = 1;
//This line initializes an array with the pins connected to the flow sensors
uint8_t pulsePin[] = {8};
//number of milliseconds to wait after pour before sending message
unsigned int pourMsgDelay = 300;

unsigned int pulseCount[numSensors];
unsigned int kickedCount[numSensors];
unsigned long nowTime;
unsigned long lastPourTime = 0;
unsigned long lastPinStateChangeTime[numSensors];
int lastPinState[numSensors];

unsigned long lastSend = 0;

void setup() {
pinMode(13, OUTPUT);
// initialize serial communications at 57600 bps:
Serial.begin(57600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only

IMG_20170224_135631.jpg
 
Did you configure the web gui to assign pin 8 to a tap?

For debugging you can run flow_monitor.py in a console window.
When the Arduino decides a pour has completed it will send a terse packet to the host side code.

Some service commands you can use:

sudo /etc/init.d/flowmon start
sudo /etc/init.d/flowmon status
sudo /etc/init.d/flowmon stop

[edit] Sorry, got called to dinner.
Anyway, what happens when you start the flowmon service in a console window?
I'm assuming the service doesn't start, so there should be some kind of messages that should provide a hint...

Cheers!
 
Did you configure the web gui to assign pin 8 to a tap?

For debugging you can run flow_monitor.py in a console window.
When the Arduino decides a pour has completed it will send a terse packet to the host side code.

Some service commands you can use:

sudo /etc/init.d/flowmon start
sudo /etc/init.d/flowmon status
sudo /etc/init.d/flowmon stop

[edit] Sorry, got called to dinner.
Anyway, what happens when you start the flowmon service in a console window?
I'm assuming the service doesn't start, so there should be some kind of messages that should provide a hint...

Cheers!


Thanks for the response. I cant open the flowmon serivce, it just flashes and doesnt open. I start and stop the service with no problem.

IMG_20170224_202019.jpg
 
I went to the FAQ of the raspberrypints site and did the command they said if you dont recognize pours and i get this error. Not sure what it means? I installed mysql. Everything else runs perfect, just not recognizing pours

IMG_20170224_203830.jpg
 
I went to the FAQ of the raspberrypints site and did the command they said if you dont recognize pours and i get this error. Not sure what it means? I installed mysql. Everything else runs perfect, just not recognizing pours

If you google the error message "importerror no module named mysqldb" you'll get a bunch of explanations for potential causes of this error. I don't know exactly how your Pi is set up, but you do, so you should be able to see what solutions might be applicable to you.
 
Wait - wasn't there a /RaspberryPints/ in the path to your kit?

Yes there was before. I fixed that today

I just fixed the MySql error. But its still not reading pours. Is there a place in the terminal or anywhere to read realtime pours or just have to wait for the homepage to update? Is that realtime?
 
Went back at it this morning....still not working. I went back to your post 50 or so pages back and ran the command you said to see if it was running right but it says something about name error on port? Could this be my error?

IMG_20170225_143115.jpg
 
That's certainly a show-stopper error.
'port' is defined at runtime by the same Python script (my example below) but if the device isn't actually at the defined port it'd likely fail.

ie: make sure you really have an actual physical device where you're pointing the code and that it's running at the prescribed baud rate.

This is what my flow_monitor.py looks like. The system I just grabbed this from is an RPi2B running Jessie, and as it has an AlaMode the lines that are enabled/uncommented are for serial over GPIO. For an Uno connected via USB you'd enable the "serial over USB" lines instead.

Code:
#The following line is for serial over GPIO
port = '/dev/ttyS0'
#The following line is for serial over USB
#port = '/dev/ttyACM0'
#The following line is for serial over Bluetooth:
#port = '/dev/rfcomm0'
#The following line is for serial over WiFi:
#port = 'socket://192.168.1.230:23'

#The next line is for serial over GPIO
arduino = serial.Serial(port,baudrate=9600,timeout=2)
#The next line is for serial over USB or Bluetooth
#arduino = serial.Serial(port,baudrate=57600,timeout=2)
#The next line is for serial over Wifi
#arduino = serial.serial_for_url(port,baudrate=57600,timeout=5)


# Edit this line to point to where your rpints install is
poursdir = '/var/www'

Cheers!
 
That's certainly a show-stopper error.
'port' is defined at runtime by the same Python script (my example below) but if the device isn't actually at the defined port it'd likely fail.

ie: make sure you really have an actual physical device where you're pointing the code and that it's running at the prescribed baud rate.

This is what my flow_monitor.py looks like. The system I just grabbed this from is an RPi2B running Jessie, and as it has an AlaMode the lines that are enabled/uncommented are for serial over GPIO. For an Uno connected via USB you'd enable the "serial over USB" lines instead.

Code:
#The following line is for serial over GPIO
port = '/dev/ttyS0'
#The following line is for serial over USB
#port = '/dev/ttyACM0'
#The following line is for serial over Bluetooth:
#port = '/dev/rfcomm0'
#The following line is for serial over WiFi:
#port = 'socket://192.168.1.230:23'

#The next line is for serial over GPIO
arduino = serial.Serial(port,baudrate=9600,timeout=2)
#The next line is for serial over USB or Bluetooth
#arduino = serial.Serial(port,baudrate=57600,timeout=2)
#The next line is for serial over Wifi
#arduino = serial.serial_for_url(port,baudrate=57600,timeout=5)


# Edit this line to point to where your rpints install is
poursdir = '/var/www'

Cheers!


It works!
In the end I think i deleted the line of code "#port = '/dev/ttyACM0'" and never put it back.

Once I put that in it worked like a charm. Thanks again for all the help, cant wait to hook up the rest of the lines.
 
Hi! I've just heard about the RaspberryPi Zero W that has built in wifi and Bluetooth, all for $10. Do you think RaspberryPints can be run on it? It appears to have similar specs to the model you recommend. If so, I think I could start this adventure for less than $15!

Thanks!
 
Hi! I've just heard about the RaspberryPi Zero W that has built in wifi and Bluetooth, all for $10. Do you think RaspberryPints can be run on it? It appears to have similar specs to the model you recommend. If so, I think I could start this adventure for less than $15!

Thanks!

I'd expect it to work on a Zero W, but you might have difficulty getting hold of one for a while.
 
I'd expect RPints to be a dog on a Pi Zero. The Zero has less memory and a slower single core processor. Pretty tough to run mysql and Apache on there.

RPints was originally specified to run on a Pi model B. The Pi Zero is basically the same but runs a little faster (1GHz instead of 700MHz).
 
Having run R'Pints, multi-chamber BrewPi and a bunch of other stuff on an RPiB, I agree the single-threaded and memory challenged Zero will most likely be quite slow compared to the 2B and 3B models.

With the B a taplist update could take a couple of seconds to update the screen.
With the 2B it's barely discernible, if at all (you'll definitely miss it if you blink)...

Cheers!
 
Having run R'Pints, multi-chamber BrewPi and a bunch of other stuff on an RPiB, I agree the single-threaded and memory challenged Zero will most likely be quite slow compared to the 2B and 3B models.

With the B a taplist update could take a couple of seconds to update the screen.
With the 2B it's barely discernible, if at all (you'll definitely miss it if you blink)...

Cheers!

So it works, then.
 
If what you need is a small form factor and you can put up with a little bit slower experience, the Zero will work. I've run it myself on the bench and have a few other Zero projects going. If however you are thinking about the Zero out of some misguided attempt to save money, you have the wrong hobby I'm afraid.
 
Certainly. I was kind of hoping that the original developers were still maintaining it or had passed it along to somebody else that was active.

I'll see about creating my own fork on github and getting it packaged correctly in the next few days.

I started trying to get it packaged for distribution, but it turned into more hassle than I expected. I actually ended up writing my own very stripped down version that has just the features I need. For example, I really don't need keg inventory and found it quite cumbersome to have to manage the keg tracking subsystem and enter OG/FG/SRM/IBU, etc. twice just to get things displayed. This is not a criticism, just my own preference.

A couple people expressed interest in the container/glassware rendering code, so I published my new project at github, which contains that, at https://github.com/y0gensha/LitePints

I also zipped my RaspberryPints folder with all my modifications before I nuked it. You can get it at http://yogensha.net/junk/pints_yogensha_bak.tar.gz Use at your own risk!

It's in the img/ folder of both projects and is actually very simple.

If any of the original developers are around, thanks for contributing the project. Also many thanks to day_trippr for the motion sensor stuff. Certainly added joy to my own home brewing!
 
I started trying to get it packaged for distribution, but it turned into more hassle than I expected. I actually ended up writing my own very stripped down version that has just the features I need. For example, I really don't need keg inventory and found it quite cumbersome to have to manage the keg tracking subsystem and enter OG/FG/SRM/IBU, etc. twice just to get things displayed. This is not a criticism, just my own preference.

A couple people expressed interest in the container/glassware rendering code, so I published my new project at github, which contains that, at https://github.com/y0gensha/LitePints

I also zipped my RaspberryPints folder with all my modifications before I nuked it. You can get it at http://yogensha.net/junk/pints_yogensha_bak.tar.gz Use at your own risk!

It's in the img/ folder of both projects and is actually very simple.

If any of the original developers are around, thanks for contributing the project. Also many thanks to day_trippr for the motion sensor stuff. Certainly added joy to my own home brewing!

I'm laughing here because I did the exact same thing and was calling my version "Lite Beer Menu". I didn't care for all the mysql overhead and such, so I redid it completely in html and javascript. A single JSON file is used that lists the beers to be displayed. I hadn't got around to packaging it up, but I can put it into a zip file for anyone that wants it. You can see it at http://www.surfcitybrewing.com/taplist/
 
Back
Top