[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 had a couple of hours waiting for a huge simulation to run so I cloned the SD card on my Jessie system then did a huge (110+ packages) update.
Verified the system didn't regress, then started playing with the Bluetooth thing again.

With a known-good BT4LE dongle plugged into the RPi2B and a known-good HC-05 plugged into the Uno shield I used the desktop BT management gui to discover the HC-05.

When I try to pair with the HC-05 I get a pop-up "Pairing Requested" message: "Connection failed - GDBus.Error:eek:rg.bluez.Error.NotAvailable: Operation currently not available. Try to connect manually."

However, the HC-05 believes it is connected, and after dismissing the pop-up message and returning to the main gui page, the BT manager gui thinks the HC-05 is paired and trusted. But no services are assigned to it.

This is exactly as far as I've ever gotten...
 
Persistence rewarded!

After a myriad of things tried I finally dug into sdptool and rfcomm to try to figure out what the actual status was between the RPi host and the HC-05.

I eventually discovered I was really close and just had to manually do the things to set up an rfcomm port and bind the HC-05 to it - stuff that the Bluez/Bluez-Utils/Bluez Manager on Wheezy did automagically and that you simply cannot complete using the BT manager gui on Jessie.

So, I believe this was the magic:

- create /etc/bluetooth/rfcomm.conf, noting the MAC address of the HC-05:

Code:
#
# RFCOMM configuration file.
#

rfcomm0 {
# Automatically bind the device at startup
bind yes;
#
# Bluetooth address of the device
device 98:d3:31:80:25:64;
#
# RFCOMM channel for the connection
channel	1;
#
# Description of the connection
comment "BPSAT_3";
}

Next, execute the following command to connect the HC-05 Channel 1 to rfcomm0:

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

Now you should be able to find the serial port:

Code:
$ ls /dev/rfcomm0 

should return:

/dev/rfcomm0

You can also use rfcomm:

Code:
$ rfcomm show rfcomm0

should return:

rfcomm0: 98:D3:31:80:25:64 channel 1 clean

The rest is SOP: I edited /home/brewpi/brewpi1/settings/config.cfg
to make the Bluetooth port the default and the wired USB connection as the alternate

Code:
scriptPath = /home/brewpi/brewpi1
wwwPath = /var/www/brewpi1
port = /dev/rfcomm0
altport = /dev/brewpi1  (<= this is the wired USB connection as an alternate port)
boardType = uno

Started the BrewPi script, et voila! We're up and running BrewPi over Bluetooth on Jessie!

Cheers!

[edit] After cloning the working card again I noticed after reboot the HC-05 did not auto-connect.
It appears Jessie doesn't run the rfcomm stuff by default (that'll bear further scrutiny) but the expedient solution was dead simple:

Edit /home/pi/.config/lxsession/LXDE-pi/autostart
Add this line:

Code:
sudo rfcomm bind 0 98:D3:31:80:25:64 1
Save, exit, restart, good to go!
 
Now do rpints!

Ok, I'll put it on the list.

I did get 'Pints running on an Uno over USB already, so all I really need to do is take the AVR out of the AlaMode, stick it in the Uno, change the port pointer and it ought to just work.

Might get to that tonight, even...

Cheers!

[edit] Ugh. Thinking about how to pull this off and looking at the spaghetti bowl that is my Jessie system right now.
It needs to be straightened out before I set up this experiment.
Also need to make sure I'm not missing anything that'll make something simple more complicated - like, I need to change the R'Pints sketch to run the Uno side at 57600 instead of 9600 to be compatible with my existing HC-05 configuration (which I'd prefer not to screw with as it can be a pita to change).
And I can't use the BrewPi shield for this, which means gender-swapping some connections (flow meter, etc).

So, not tonight, but I'll get to it...
 
I've not seen or read of similar behavior.
How long have you had R'pints running before this started?
If it has been a while I would suspect an SD card flaking out...

Cheers!
I have had it running for maybe 8 months. I would get a dying card causing the reboots but what I don't understand is how what I had posted on my menu reverts back to what was there a couple of months ago. It is like what I did for last 2 months was displayed, but not saved some how.
 
I get that, but still, when you think about it, what makes more sense than a dying SD card?

If someone can come up with an alternative scenario that holds water I'm all eyes ;)

Cheers!
 
Ok, I'll put it on the list.

I did get 'Pints running on an Uno over USB already, so all I really need to do is take the AVR out of the AlaMode, stick it in the Uno, change the port pointer and it ought to just work.

Might get to that tonight, even...

Cheers!

[edit] Ugh. Thinking about how to pull this off and looking at the spaghetti bowl that is my Jessie system right now.
It needs to be straightened out before I set up this experiment.
Also need to make sure I'm not missing anything that'll make something simple more complicated - like, I need to change the R'Pints sketch to run the Uno side at 57600 instead of 9600 to be compatible with my existing HC-05 configuration (which I'd prefer not to screw with as it can be a pita to change).
And I can't use the BrewPi shield for this, which means gender-swapping some connections (flow meter, etc).

So, not tonight, but I'll get to it...


I've gotten the USB and bleuetooth working for rpints. but I was talking about getting it up and going gin Jesse.
 
I got that. I'm old but haven't lost any perception ;)

I have everything laid out that I need, including a game plan.
I'm basically disemboweling a totally functional R'Pints/BrewPi/All My Added Goodies system for the cause here and would like to get back to that when the experiment is complete.

But the Patriots and the red hot Red Sox are both playing tonight so it'll likely have to keep 'til tomorrow.

Priorities.

Cheers! (otoh, if they're both being blown-out, I'll do it tonight)
 
For some reason my RPi has suddenly rebooted a couple of times recently and it has had a strange side affect. I had 3 beers on tap that all kicked. I registered 2 news beers and put them on tap. Then after the reboots my menu reverts to the original 3 I had on tap. And the beers I added are not only gone from the menu but from the Beers inventory page. Also I had a 4th tap that I took out and even that returns when this occurs.
Anyone ever see anything like this or have a suggestion on where I would start to look for an answer?

I have had it running for maybe 8 months. I would get a dying card causing the reboots but what I don't understand is how what I had posted on my menu reverts back to what was there a couple of months ago. It is like what I did for last 2 months was displayed, but not saved some how.

Sounds like you had happen what happened to me. After a reboot it reverts back to the way it was when it last booted. Its a F$%^ed up card. I have killed two of them recently. The full sized SD card with the same behavior as you are having was in post 2145. Its funny. The card seems to be stuck in that part of time. I am unable to nuke the partitions on it, or do anything to change it. I have put the card in my PC and deleted the files on it. I take it out and remount it and all the files are back. I can "write" a file to it on the PC as well and it is gone next remount. No changes persist. I even tried a fdisk clean and clean all (which took a while on a 16 GB card and even though it said it was successful) it didnt do squat to the existing partitions. Card hosed.

I reinstalled again on a micro sd card with an adapter. It ran fine for a week, then when I had people over and it was working I noticed that the motion sensor was not working anymore. Then I powercycled the monitor and hooked up a mouse. Everything came back up, but pours werent registering. Attempted to reboot gracefully. No dice. Power supply rebooted and got nothing but the rainbow screen. Took the card to my other computer and it doesn't even register.

I killed 2 cards in less than 3 weeks. Then again the cards were a couple years old and well used so I am buying one more card and trying again. Hopefully this one lasts.



One question for everyone else who has more electronics experience than I do. My hookup is kinda sloppy and kludged together. My soldering job was passable, but I am wondering if someone can provide me with a list of the breakout board, connectors, etc that they used to put theirs together in a more... clean installation. I have my flow meters put together in the most redneck rigged fashion (I have wired/soldered some of these together so I could branch out my vin and grounds to work on all of my meters

400-03.jpg


and then have one male to female wire connecting the center pin to the corresponding pin on the andruino.)

Thoughts? Hell, its possibly my shoddy wiring job that caused the card issues.
 
Okay, I could use some help- I found the fixes on page 188 for Jesse, and I am getting file not found errors for alamode setup command and for the half of the flowmon commands. Is this a permission issue? (I can see the files in the directory.)

Also, I am hoping I have these things wired up because the new flow meters look different. Instead of a red wire they have one wire with a stripe. I'm assuming that is ground, middle is the pin#, and the last on is vin?

Thanks for any help- this is tough for rookies when all the software is not backwards compatible.
(For anyone else just starting out- read page 188 before you touch anything.)
 
Yes, the striped (used to be red) lead is ground, middle is signal, last is power.

I had to run dos2unix against all of the files in the alamode-setup folder to get anything to work properly.

Then, run jessie-setup instead of arduino-setup...

Cheers!
 
Thanks. I think I'm closer to the finish line but still not showing pours. Does this look right?
20160926_221510.jpg
 
Hi, I'm sure this has likely been asked before (and I did try to search this thread). But I am about to start this project, and i was wondering if I could order the Model 3 Pi with WiFi built in instead of the Model 2 + USB Wifi? TIA.
 
Hi, I'm sure this has likely been asked before (and I did try to search this thread). But I am about to start this project, and i was wondering if I could order the Model 3 Pi with WiFi built in instead of the Model 2 + USB Wifi? TIA.

Yes, you should be able to get R'Pints running on an RPi3.
I have it running using the latest versions of Jessie and Apache2 - albeit on an RPi2B, but we've never had platform issues with R'Pints, just dealing with OS/software updates that broke stuff...

Cheers!

[edit] Ok, this just came to me.
There is a potential problem on the RPi3 wrt using an AlaMode shield, as the hardware serial port is now dedicated to the on-board Bluetooth radio, leaving only a software serial port available to the AlaMode (and anything else).
The software serial port unfortunately uses the system clock for the baud rate generate - a clock that can vary frequency with workload and temperature - making it less than robust, euphemistically speaking.

I suggest using an Arduino R3 UNO board connected via USB instead of the AlaMode.
I've proven this will work and the change to R'Pints is trivial (one line in one file).
And it'll save some money - a legit UNO R3 with either an 8U2 or 16U2 bridge chip can be found for as little as $6.
Avoid those that use CH340 bridge chips as they can be problematic to get going.
 
fwiw, I've been running Chromium on Jessie since Day 1.
It's a short process (Google that beyotch!) but it works and it will update along with all other installed packages...

Cheers!
 
day trippr, does this also mean serial over wifi would be out for the RPi3?
 
It's the same issue either way, so, yeah, it could be a show-stopper.
The only work-arounds I've seen are either disable the Bluetooth radio so the hardware serial port can be used, or to set the system clock to a fixed frequency so the software serial port baud rate doesn't change.

The RPi3 caused a lot of havoc in the Raspbian world...

Cheers!
 
Serial over wifi is not an issue. Also, the serial port change to accommodate the BT module has been fixed and is no longer an issue.
 
Thanks. I think I'm closer to the finish line but still not showing pours. Does this look right?
View attachment 371624

No, it doesn't. Where you requested the flowmon system service status
the response was "exited" when it should show "active".
I've never seen that before except when I have actually stopped the service (because it autostarts on boot) so I don't know what caused it to exit in your case.

btw, these are the commands (and their respective .bash_aliases entries) I use to control/check the flow monitor service:

alias flowstart='sudo /etc/init.d/flowmon start'
alias flowstat='sudo /etc/init.d/flowmon status'
alias flowstop='sudo /etc/init.d/flowmon stop'

They work through systemctl and may provide more info...

Cheers!
 
Somewhere in the gawdawful mess that is my "lab" is a basic R'Pints rig using an Uno with Bluetooth...
BT_rpints_01.jpg

Ah, there it is!
BT_rpints_02.jpg

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
&#9679; 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!
 
Right. Aside from the last comment at the bottom of that page that claims a kernel update removed the need for the fixed clock (and with no way to confirm that), the rest of the page is almost word-for-word what I said.

Still don't see a reason to believe one doesn't either need to kill the on-board Bluetooth, or staple the system clock, to get serial communications working properly on an RPi3...

Cheers!

[edit] But you are correct about the serial-over-wifi thing. I was thinking that the serial port issues would preclude using an esp8266, but of course that's the wrong end of the link for that ;)
 
Ok, but I followed the instructions in that article and hooked up an external serial device to the GPIO serial pins (pin 8 and pin 10) on a Pi 3 and it worked as expected.

The way to confirm it is to try it.
 
I'm on a roll!
Today I got RaspberryPints running using an UNO connected via Wifi on Jessie and it works great!

As long as I had my Jessie system already wired to use the HC-05 BT/serial bridge and it's so easy to pop that out and stick an esp8266 in its place, there was no better time to prove I could get that to work.

And once one has gotten the Uno working over either USB or Bluetooth, the changes needed for the wifi option are trivial (assuming one already has experience with the esp8266 and has a working one in hand). Literally, just one file needs editing.

btw, for those who've never used an esp8266 there's a pretty good thread on using the esp8266 with BrewPi for remote communication with an Uno here, with my blow-by-blow writeup here.

The terse procedure below assumes an UNO is already being used with RaspberryPints on an RPi running Jessie, and there's an available esp8266 programmed as a wifi/serial bridge. I use esp-link on the esp8266, which can then be operated in pretty near any of its modes. I happen to like "esp-bridge" mode.


RaspberryPints with an UNO over WiFi on Jessie

- Shut down the system and disconnect power
- Remove the USB cable or the Bluetooth/Serial bridge, whichever is in use.
- Connect the esp8266 to power (typically 5V as the module has a down-regulator to 3.3V on board), ground, Uno TX to esp8266 RX (this should be routed through a level-shifter such as the resistor pair I used for the HC-05 connection scheme) and esp8266 TX to Uno RX.

- power up the system, log in, and stop the flow monitor service:

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

- edit the RaspberryPints Python listener at /var/www/python/flow_monitor.py

Note I have added two more pairs of lines so the ever-increasing set of connectivity options is clear.
Add the two new pairs with their respective commands enabled and comment-out all of the other commands.

eg:

#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)

Obviously, the url must use the actual ip address for the esp8266; port 23 is the standard tty port.

Save that file, then start the flow monitor listener service again:

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

It should just plain work!

Cheers!
 
Could one use the same UNO that is running a BrewPi instance for this, or would you need to stuff another UNO into the BrewPi box in order to have it running the 'Pints flow monitoring stuff? I'm sure that's a dumb question, so please forgive it if it is. I'm guessing some of the i/o pins are doing double duty if BrewPi and 'Pints are running on the same UNO.

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
 
Could one use the same UNO that is running a BrewPi instance for this, or would you need to stuff another UNO into the BrewPi box in order to have it running the 'Pints flow monitoring stuff? I'm sure that's a dumb question, so please forgive it if it is. I'm guessing some of the i/o pins are doing double duty if BrewPi and 'Pints are running on the same UNO.

Your guesses are correct - and there would be at least three problems with trying to cram both functions into one Uno:
- BrewPi pretty much eats an entire Uno for breakfast leaving barely a crumb of execution "space" for anything else
- BrewPi comes as a compiled hex image, so you'd have to integrate the R'Pints sketch into BrewPi's pre-compiled code base
- And, yes, there are pin conflicts that get tougher to cope with as the number of faucets increase.

So I don't think that's going to work out...

Cheers!
 
Could one use the same UNO that is running a BrewPi instance for this, or would you need to stuff another UNO into the BrewPi box in order to have it running the 'Pints flow monitoring stuff? I'm sure that's a dumb question, so please forgive it if it is. I'm guessing some of the i/o pins are doing double duty if BrewPi and 'Pints are running on the same UNO.

You could run my Fuscus software on the Pi, which replaces the BrewPi Arduino. You can connect the temperature sensors and relays to the Pi GPIO instead of using an Arduino.

I also think that the flowmeter code on the RPints Arduino could easily be ported to the Pi and use the Pi GPIO too.

There is a discussion of Fuscus here:
https://www.homebrewtalk.com/showthread.php?t=575724
 
Expecting an RPi to reliably count flow meter pulses might be a stretch.
That was the primary reason why the authors went with a state machine to capture the meter data and forward it up to the host.

The other was expandability via a Centipede shield...

Cheers!
 
Not at all. The flow rate is not that great, and the pulses could be serviced by interrupts. In my Fuscus code I have a rotary encoder that is serviced by polling, and it doesn't miss a count (although I haven't measured the speed of pulses).

I also mentioned that DS2423 counters on a 1-wire bus could also be used. They are hard to find now, but there is an emulated version on an ATtiny.
 
Rotary switch on a dedicated port /= 200 pulses per second that could be coming from any of numerous meters.
But, let us know when you have everything ported and not missing a tick :)

Cheers!
 
No. I ported the BrewPi controller because I was interested. I am not interested in making a Raspberry Pints installation with flowmeters, but I am interested in why nobody is improving the project.
 
I occasionally check their Facebook page and there have been signs of life, seeking input for future development, etc. But I expect the balance between enhancing R'Pints functionality and "life" is tilted towards "life" these days.

I added a few linked functions to my system that have been mentioned as integration candidates, and there have been requests for gui changes by a few users, but I have no idea if or when development might get going again.

But if nothing ever happened I'd be fine with it. I'm very happy with my 6-faucet R'Pints installation.
It pretty much drives my whole brewing pipeline, and folks that see it - either first hand or over the web - think it's something out of "The Jetsons" :)

Cheers! :mug:
 
Careful now trip… you're showing your age again. im waiting for the next post to be "what's a jetson?…"
 
Back
Top