[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.
okay so i followed day tripprs advice from above cause I wasnt sure if you were talking to me or the other guy but heres the output of that

pi@raspberrypi:~ $ sudo /etc/init.d/flowmon stop
[ ok ] Stopping flowmon (via systemctl): flowmon.service.
pi@raspberrypi:~ $ sudo /var/www/python/flow_monitor.py
Traceback (most recent call last):
File "/var/www/python/flow_monitor.py", line 13, in <module>
arduino = serial.Serial(port,9600,timeout=2)
File "/usr/local/lib/python2.7/dist-packages/serial/serialutil.py", line 236, in __init__
self.open()
File "/usr/local/lib/python2.7/dist-packages/serial/serialposix.py", line 268, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyS0: [Errno 2] No such file or directory: '/dev/ttyS0'
 
So I re-checked the permissions and the path as stated, and they seemed correct. As I looked at the other code for flow_monitor.py (and I am MOST DEFINATELY not a coder) I found this on lines 45-46

Code:
#The following 2 lines passes the PIN and PULSE COUNT t$
path = '/var/www/includes/pours.php'

I don't know if it was the correct thing to do, but I changed it to this

Code:
#The following 2 lines passes the PIN and PULSE COUNT t$
path = '/var/www/html/includes/pours.php'

and it seems to be working. Did I screw anything obvious up?



Edit: Something still not right that my poor little mind cannot grasp, but I am working on it.

The success did not persist through a reboot. It does work, if after I reboot I stop flowmon and directly run flow_monitor.py in a terminal window.
 
So I re-checked the permissions and the path as stated, and they seemed correct. As I looked at the other code for flow_monitor.py (and I am MOST DEFINATELY not a coder) I found this on lines 45-46

Code:
#The following 2 lines passes the PIN and PULSE COUNT t$
path = '/var/www/includes/pours.php'

I don't know if it was the correct thing to do, but I changed it to this

Code:
#The following 2 lines passes the PIN and PULSE COUNT t$
path = '/var/www/html/includes/pours.php'

and it seems to be working. Did I screw anything obvious up?



Edit: Something still not right that my poor little mind cannot grasp, but I am working on it.

The success did not persist through a reboot. It does work, if after I reboot I stop flowmon and directly run flow_monitor.py in a terminal window.

Did you miss this step:

Code:
sudo update-rc.d flowmon defaults

(makes flowmon start after reboot)
 
okay so i followed day tripprs advice from above cause I wasnt sure if you were talking to me or the other guy but heres the output of that

pi@raspberrypi:~ $ sudo /etc/init.d/flowmon stop
[ ok ] Stopping flowmon (via systemctl): flowmon.service.
pi@raspberrypi:~ $ sudo /var/www/python/flow_monitor.py
Traceback (most recent call last):
File "/var/www/python/flow_monitor.py", line 13, in
arduino = serial.Serial(port,9600,timeout=2)
File "/usr/local/lib/python2.7/dist-packages/serial/serialutil.py", line 236, in __init__
self.open()
File "/usr/local/lib/python2.7/dist-packages/serial/serialposix.py", line 268, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyS0: [Errno 2] No such file or directory: '/dev/ttyS0'

Right - that's the stream of cruft I referred to :)

This indicates the Arduino is sending pour messages that the RPi can "hear".
Next is to make sure the path that flow_monitor.py is using to pours.php is valid.
It uses /var/www by default, so if your RPints install is rooted at /var/www/html, the python script needs to be changed.
Beyond that is ensuring RPints is configured to use flow monitoring and has correctly assigned kegs to Arduino pins...

Cheers!
 
so those error messages that serial isnt working is not a problem? I installed my raspberry pints in /var/www not it /var/www/html so I dont think that is my problem but nothing updates when i blow through the sensor
 
so those error messages that serial isnt working is not a problem? I installed my raspberry pints in /var/www not it /var/www/html so I dont think that is my problem but nothing updates when i blow through the sensor

If you got that message while running flow_monitor.py in a terminal window and blowing through the meter, the pour message had to have gotten through the port.

That said, make sure you've done this:

- Disable Serial Port messaging:

Edit /boot/config.txt
Change enable_uart=0

And be sure to review everything that's been posted in the last couple of days.
I've lost track who is who here ;)

Cheers!

[edit] Did you do your original installation "With Flow Meters" or "Without"?
And what are you using for an Arduino - an AlaMode, or an Uno, or ?
 
I just started posting today. A couple of months ago I started over and did an original installation with flow meters although i didn't yet have the meters. I put them on order and they took a bit to get here and then I've been busy but I got around to playing around with it again today. I was hoping after all that setup I did a while ago that the sensors would be plug and play but of course that cant be the case ;) for my adriuno im using an arduberry because at the time I ordered they wanted like 60 bucks for an alamode vs 15 for an arduberry. Seems the sketch had no problem loading onto the arduberry. Should I go in and change this setting in boot config with my particular setup?
 
It can't hurt :)

I am curious about the "no TTYS0" message though - I don't recall that being in the blast of text I'd see the last time I tried running flow_monitor.py in a window.

Did you load the sketch using the IDE running on your RPi?
That'd give a solid indication that the Pi and Arduino are communicating at some level.

I don't know anything about an Arduberry yet. Gonna Google that right now...

Cheers!
 
I just looked i dont see the enable_uart line anywhere in the config file? I may have forgot to mention Im on a pi3 model B running raspbian jessie with pixel
 
Yeah adriuno IDE is on the pi and the arduberry sits on top I was able to succesfully directly program the arduberry with the pi
 
Ok, the Arduberry is essentially a stripped down Alamode.
Should work just as well.
And it should show up as dev/ttys0 - do you remember when you used the IDE selecting Serial Port 0?

Yes, try adding that line and rebooting...

Cheers!
 
i might be wrong but i think it says that it is located at /dev/ttyAMA0? is there anyway to verfiy this?
 
Ok then, the easiest thing is to go into flow_monitor.py and change it to use tty/ama0.

Find these lines:

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

Change ttyS0 to ttyAMA0, start the flowmon service, and see what happens...

Cheers!
 
now I get this?
sudo /var/www/python/flow_monitor.py
File "/var/www/python/flow_monitor.py", line 9
port = '/dev/ttyAMA0
^
SyntaxError: EOL while scanning string literal
 
oh dohhh lol k i fixed that and now this line jsut sits blank but doensnt go back to command line or output anything?
sudo /var/www/python/flow_monitor.py
 
blowing through a meter accomplished nothing is it possibly wiring then? the swissflow meters had one flat grey cable with one black. I assumed the black was ground and the other outside cable was 5v and the middle was data
 
Run this command in a terminal window:
Code:
ls -l /dev | grep serial

You should see something like this:
Code:
lrwxrwxrwx 1 root root           7 Aug  2 20:18 serial0 -> ttyAMA0

Then try this:
Code:
ls -l /dev | grep ttyS0

and see if you get this:

Code:
lrwxrwxrwx 1 root root           7 Aug  2 20:31 ttyS0 -> ttyAMA0

If you do see this, go back into the Arduino IDE and see which Serial Port device shows up.
Hopefully it's actually ttyS0 but as I don't have an RPi3B that's just a SWAG...

Cheers!
 
actually the first looks the same except it says serial1

pi@raspberrypi:~ $ ls -l /dev | grep serial
lrwxrwxrwx 1 root root 7 Sep 4 05:09 serial1 -> ttyAMA0
pi@raspberrypi:~ $ ls -l /dev | grep ttyS0
pi@raspberrypi:~ $
 
$ ls -l /dev | grep ttyAMA0
lrwxrwxrwx 1 root root 7 Sep 4 22:17 serial1 -> ttyAMA0
crw-rw---- 1 root dialout 204, 64 Sep 4 22:17 ttyAMA0
 
So I reinstalled from the beginning and followed the instructions and additions from the rollup post. I decided to keep the install dir as /var/www and changed the Apache2 config file. I get all the way to Step 9.

I copied flowmon to /etc/init.d and modified the permissions as stated. Then when I tried to start the service with

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

I get this

Code:
[....] Starting flowmon (via systemctl): flowmon.serviceFailed to start flowmon.service: Unit flowmon.service failed to load: No such file or directory.

Any ideas this time around? I double checked that the file was copied and the permissions were changed.
 
$ ls -l /dev | grep ttyAMA0
lrwxrwxrwx 1 root root 7 Sep 4 22:17 serial1 -> ttyAMA0
crw-rw---- 1 root dialout 204, 64 Sep 4 22:17 ttyAMA0

Is there a ttys1?
Code:
ls -l /dev | grep ttyS1

Let's go back to the Arduino IDE running on the RPi.
What serial ports actually appear available when you pick a valid board type?
Also, did you ever install the support for the AlaMode board?
 
Nothing appears with ttyS1. I did install the arduberry setup and adriuno ide as per their instructions. The only serial port that appears when under adriuno IDE is the ttyAMA0 one and when I select it and flash raspberrypints.ino I get a successful flash message.
 
Ok then, it seems all device references should be to ttyama0.
Looking back you've already modified flow_monitor.py to use that device, but haven't gotten any response when blowing through a connected meter while running flow_monitor.py in a terminal.

So...back to your meter question: I believe you have the meter leads correctly identified.
sf800_-_hook_up.jpg

Do you have the required pull-up resistor in place?

Cheers!
 
So I reinstalled from the beginning and followed the instructions and additions from the rollup post. I decided to keep the install dir as /var/www and changed the Apache2 config file. I get all the way to Step 9.

I copied flowmon to /etc/init.d and modified the permissions as stated. Then when I tried to start the service with

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

I get this

Code:
[....] Starting flowmon (via systemctl): flowmon.serviceFailed to start flowmon.service: Unit flowmon.service failed to load: No such file or directory.

Any ideas this time around? I double checked that the file was copied and the permissions were changed.



Trying not to get too excited here, but I think it's all working! Seems the problem was I needed to "Relax and drink a home brew," while I was working on it...and maybe a reboot, or,something. More testing, then installation and calibration to come!

:mug:
 
I did not put the resistor as it seemed references on here were saying that it wasn't required? Perhaps I read wrong but I was thinking the adriuno must have been taking care of that.. I dont have any 2200 ohm resistors on hand but I can order some. The only size pull up resistors I have are some 4.7k ones kicking around from dsb820 temp sensors from making some brewpis. Is there any other references to that serial port that need to be changed? I also didn't change that boot.txt yet since it seemed doing one thing at a time and that we were getting somewhere. I'll change that now too.
 
You definitely need the pull-up. It's the series resistor that isn't really necessary when VDD = 5VDC or lower. This could easily be your last bug to fix :)

wrt to that config.txt change, here are a few lines from my notes:

Code:
August 02, 2016

FINALLY!

Edit /boot/config.txt

Change enable_uart=0

FER ****S SAKE!

pi@cpints:~ $ ls -l /dev | grep serial
lrwxrwxrwx 1 root root           7 Aug  2 20:18 serial0 -> ttyAMA0
pi@cpints:~ $

Now the serial port option shows up in the Arduino IDE - as ttyS0(?)
Was able to successfully upload the same sketch used on the rest of the fleet.

pi@cpints:~ $ ls -l /dev | grep serial
lrwxrwxrwx 1 root root           7 Aug  2 20:31 serial0 -> ttyAMA0
pi@cpints:~ $ ls -l /dev | grep ttyS0
lrwxrwxrwx 1 root root           7 Aug  2 20:31 ttyS0 -> ttyAMA0
pi@cpints:~ $

Interesting. Looks like ttyAMA0 is synonymous with ttyS0.

Wired up a flow meter and LED to UNO pins D2 and D13, respectively (LED cathode to GND pin)
	- LED lights at end of pour!

Next: turn on flow monitor

Copy /var/www/python/flowmon to /etc/init.d
Set privs: 

$ sudo chmod a+x /etc/init.d/flowmon

Install to run at startup:

$ sudo update-rc.d flowmon defaults

Rebooted

WORKS! YAY!

So, it hella mattered for my first Jessie installation ;)

Cheers!

[edit] fwiw, the reference to hooking up an LED is to my modified arduino code that turns on IO13 for a few seconds if the sketch detects a pour.
Helpful for bring-up. Available upon request...
 
ah dude thanks for attempting that on jessie for me! All my stuff is running jessie so that helps. I have faith that it will work after i get the resistors. I just threw a ten pack in my amazon cart. Ill keep you all posted thanks for the help!
 
Check the date - that was a year ago :)

But it appears from my own system schematics that I misspoke wrt using a pull-up on the flow meter signal wire. I'm not seeing them in my schematics, and one of my test mules sitting right next to me has a meter port without any sign of a pull-up.

So my memory glitched and they aren't needed after all. Sorry about that.
 
okay not too late to cancel the order, maybe haha, I will change that boot.txt and try that hopefully that is the last bug!
 
okay edited the boot config file and still nothing when I blow through a sensor. when I exit with ctrl+c the folowing is outputted not sure if it helps at all..

^CExiting
Traceback (most recent call last):
File "/var/www/python/flow_monitor.py", line 23, in <module>
msg = arduino.readline()
File "/usr/local/lib/python2.7/dist-packages/serial/serialposix.py", line 472, in read
ready, _, _ = select.select([self.fd, self.pipe_abort_read_r], [], [], timeout.time_left())
KeyboardInterrupt
 
I've been tinkering today and I'm thinking my problem is serial related but I cant even dream of where to fix it.. To preface this I tried two different approaches.
1) With my current jessie pixel install and raspberry pints with all the arduberry stuff installed I tried seeing the serial traffic with a program called minicom and it sees nothing happening when I blow through a meter. Weird thing is it doesn't bring up AMA0 when i type sudo minicom AMA0 it brings up port Port /dev/tty8. So when I was doubting the serial communication I was doubting a successful flash of the INO. However the adriuno program flashes over gpio with no problem I tried uploading the blink sketch to the arduberry and it succesfully worked I tested with a loadmeter hooked between pin 13 and ground and it was blinking once a second. So my board is programming successfully but not communicating via serial after that?! Web searches were bringing up problems of bluetooth and serial sharing same port names or something on a pi3 but ultimately confused me?
2) second thing I tried is installing raspberry pints onto the arduberry image file they have of everything supposedly working its called jessie for robots. Problem with that is apt-get upgrade breaks it and without it the dependnecies almost all of them fail to installl. So im feeling stuck... as I cant get pints on their image. I know this should work and is probably just a stupid PI setting of some kind so I hate to give up and buy an alamode or uno just yet.. any other ideas?
 
Okay I feel like Im getting closer... I followed the advice here...https://www.abelectronics.co.uk/kb/article/1035/raspberry-pi-3-serial-port-usage

Now when I blow in my sensors Im getting something in flow_monitor.py

a couple of times I got something that looked sensible like some letters and numbers but most times i get something like this with unknown messages and then an eventual crash

sudo /var/www/python/flow_monitor.py
Unknown message: 344

Unknown message:

Unknown message:

Exiting
Traceback (most recent call last):
File "/var/www/python/flow_monitor.py", line 23, in <module>
msg = arduino.readline()
File "/usr/local/lib/python2.7/dist-packages/serial/serialposix.py", line 490, in read
'device reports readiness to read but returned no data '
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
 
well I know I've posted may times in a row here but I am hoping my continual digging will be helpful and trigger someone to know what the problem is..

I was able to get minicom to display my serial output after blowing in the sensor a couple of times

sudo minicom -b 9600 -D /dev/ttyAMA0

Welcome to minicom 2.7

OPTIONS: I18n
Compiled on Jan 12 2014, 05:42:53.
Port /dev/ttyAMA0, 01:37:44

Press CTRL-A Z for help on special keys

;0;10;342
K;010
;0;10;677
K;010

more gental blows came without the K perhaps a kicked code?
 
Back
Top