• Please visit and share your knowledge at our sister communities:
  • If you have not, please join our official Homebrewing Facebook Group!

    Homebrewing Facebook Group

[Initial Release] RaspberryPints - Digital Taplist Solution

Homebrew Talk

Help Support Homebrew Talk:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
For those using my motion sensor script with their R'Pints tap list display who might be interested in having the 'Pi play an audio track when the screen wakes up, it doesn't take much to do.

Basically install/update the sound drivers, install an mp3 player, add a couple of lines to the python script that runs the motion sensor, plug in a speaker and you're done.


First, install the alsa audio drivers and MP3 Player:

$ sudo apt-get install alsa-utils
$ sudo apt-get install mpg321


Reboot the system

Set the system to load the sound drivers on startup, configured for the 3.5mm jack output:

$ sudo modprobe snd_bcm2835
$ sudo amixer cset numid=3 1


Plug a cheap speaker into the audio jack. I dug up a pair of ancient Labtec peecee speakers (with the original wall wart!) and they work just peachy.


Note: for those using an HDMI display with integrated sound, use this amixer setting instead to send sound through the HDMI port:

$ sudo amixer cset numid=3 2


Now you can play an mp3 file using mpg321 to verify the sound is working.

$ mpg321 filename.mp3



To have the motion sensor script play sound when triggered, edit pir_run.py (should be in /home/pi) and add the two bolded lines, noting you want to provide the file name of your intended mp3 file (put it in /home/pi and all you need to change is the 'filename' string).

[And don't try to copy the code in its entirety from this, the formatting is fubar and you'll just get python parsing errors up the wazoo. Do the edits!]


$ sudo nano pir_run.py

#!/usr/bin/env python

import os
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)

cmd = 'xscreensaver-command -deactivate'
playsound = 'mpg321 /home/pi/filename.mp3'

PIR_PIN = 7
GPIO.setup(PIR_PIN, GPIO.IN)

def MOTION(PIR_PIN):
os.system(cmd)
os.system(playsound)

try:
GPIO.add_event_detect(PIR_PIN, GPIO.RISING, callback=MOTION)
while 1:
time.sleep(100)

except KeyboardInterrupt:
GPIO.cleanup()

GPIO.cleanup()


Save the file (ctrl-o ctrl-x) and you should be good to go...

Cheers!
 
Does RPints have it's own forum somewhere? Seems to me that having threads with specific topics that people can refer to would be far better than a single long running thread that covers from initial release to who knows what and everything else in between. Just makes it slightly difficult to have to search a single thread for a specific issue/resolution. :)
 
Does RPints have it's own forum somewhere? Seems to me that having threads with specific topics that people can refer to would be far better than a single long running thread that covers from initial release to who knows what and everything else in between. Just makes it slightly difficult to have to search a single thread for a specific issue/resolution. :)

Each release has its own thread https://www.homebrewtalk.com/f51/version-2-release-raspberrypints-digital-taplist-solution-487694/ is the new thread and has a link on every thread on RaspberryPints. We dont have a forum yet for users but that is a good idea. We will look into it.
 
I just installed a new wireless router and have to change IP address on Pints/Pi, and now I'm trying to get to the desktop on my RaspberryPi and get out of the Chromium so I can open LXTerminal and WIFI setup.

Can anyone tell me how to do this? If I can get out of RaspberryPints, I'll be fine.
 
Yes...I just bought a NEW wireless router and the IP address are .0.XXX and the old one was .1.XXX, so I need to go to my Pi and change the IP addresses.

However, I can't get out of Pints to the desktop. Will try Alt-F11.

Thanks.
 
Alt-F4 is close program, just like in Winders. F-11 usually is the toggle from full screen to windowed mode (works in both as well). Sometimes you have to alt-F11 for it to work. I think alt tab will work to switch programs on the pi as well, and I know that the windows key (most keyboards have that or the apple key) will work to bring up the pi equivalent to the start menu.

Hope this helps.
 
Love my Raspberry Pints setup, however I was wondering if anyone knew how to insert text or a header say after tap #4?
I have 2 keezers and wanted to differentiate them by inserting text that says something like "Garage Keezer" say after tap #4.
Would this be an easy thing to do? I'm pretty comfortable editing html and css, but havn't been able to find the place to make this change.
Thanks!
 
Love my Raspberry Pints setup, however I was wondering if anyone knew how to insert text or a header say after tap #4?
I have 2 keezers and wanted to differentiate them by inserting text that says something like "Garage Keezer" say after tap #4.
Would this be an easy thing to do? I'm pretty comfortable editing html and css, but havn't been able to find the place to make this change.
Thanks!

The only suggestion I have is to set up tap #5's name as "Garage Keezer" instead of Nothing on Tap. Then continue with your other Keezers beers after that.

I've made a copy of my RPints html and have been trying to modify the html look with a html editor. I'm wanting to add in beer labels in front of the beer name and have had minor success.

p.s. I'm just learning html.
 
Love my Raspberry Pints setup, however I was wondering if anyone knew how to insert text or a header say after tap #4?
I have 2 keezers and wanted to differentiate them by inserting text that says something like "Garage Keezer" say after tap #4.
Would this be an easy thing to do? I'm pretty comfortable editing html and css, but havn't been able to find the place to make this change.
Thanks!

You need to edit the index.php file. Currently, the drawing of the tap data is handled by a loop that goes from tap #1 to the total number of taps you have. I modified mine so it was setup in two columns for a landscape view and to give me taps 1-4 in the first column and 5-8 in the second column. A setup similar to this might be good for you if you wanted to give custom headers for each set of taps.

Here's a link to the mods I made: http://www.surfcitybrewing.com/download/rpi-jonw-mods.zip
Note that I use pool ball images for the tap numbers as I have pool ball tap handles, and those images are not included here.

beerboard1.jpg
 
Excellent!!! I'm going to switch my display back to horizontal like you have it Jon. That'll work great to separate my 2 keezers.
Thanks for sharing your code too.
 
I would like to use a separate image for each tap. How tough was it to change the default images?

It's a pretty easy change to make.

The original code line just wrote the tap number:
Code:
     <span class="tapcircle"><?php echo $i; ?></span>

I added extra code as an image tag to use the tap number plus additional characters to make up the file names (e.g. 1-Ball.png, 2-Ball.png, etc):
Code:
<img src="img/<?php echo $i; ?>-Ball.png" alt="">
 
i added extra code as an image tag to use the tap number plus additional characters to make up the file names (e.g. 1-Ball.png, 2-Ball.png, etc):

Code:
<img src="img/<?php echo $i; ?>-Ball.png" alt="">


Thank you for sharing this as well as the rest of your code. Your display looks great.


Sent from my iPad using Home Brew
 
Any thoughts or ideas on how to get wifi back up and running. I get different messages.
One is "Association request to the driver failed".
I have also gotten "could not get status from wpa_supplicant".

Been Googling all night and day.
 
Not sure what was going on there. I ended up taking all of the hardware to work and tried to get things hooked up to the wifi at work on Sunday. I could see it was connected, but it would not load the accept terms and conditions page. When I got back home on Monday and hooked everything back up it magically worked.
 
I have day_trippr's PIR and sound worked in now. The only thing is the sound goes off every time the PIR senses motion. It does not wait for the xscreensaver to have the screen go blank before playing the sound. I have the time set for 15 minutes. Every time the PIR senses motion the mp3 file will play. I tested it at one minute and when the sound was done which was less than a minute it would start playing the sound aginan.

I have the following file in /home/pi. I added the following lines where it says to add them.

pir_run.py

#!/usr/bin/env python

import os
import RPi.GPIO as GPIO
import time

cmd = 'xscreensaver-command -deactivate'
playsound = 'mpg321 /home/pi/my_mp3_file.mp3
GPIO.setmode(GPIO.BCM)
PIR_PIN=7
GPIO.setup(PIR_PIN, GPIO.IN)

def MOTION(PIR_PIN):
os.system(cmd)
os.system(playsound)
time.sleep(1)

time.sleep(2)

try:
GPIO.add_event_detect(PIR_PIN, GPIO.RISING, callback=MOTION)
while 1:
time.sleep(100)

except KeyboardInterrupt:
GPIO.cleanup()
 
Does your PIR have two potentiometers? If it does, one of them sets the duration of a non-interruptable one-shot that prevents the sensor from firing until it expires. I turned that until the sensor wouldn't fire again before the screensaver clicked in.

But you could certainly change that sleep(1) to something much larger and it should do the same thing...

Cheers!
 
Does your PIR have two potentiometers? If it does, one of them sets the duration of a non-interruptable one-shot that prevents the sensor from firing until it expires. I turned that until the sensor wouldn't fire again before the screensaver clicked in.

But you could certainly change that sleep(1) to something much larger and it should do the same thing...

Cheers!

It looks like the one in your picture. I'll adjust both of them. I'll change the sleep to sleep(20) and change the potentiometer too.

Thanks...

p.s. I looked at the PDF file link for the HC SR501 and the time delays are from 0.3 seconds to 5 minutes. I'm going to have to find a shorter mp3 file. The one I have is 36 seconds.
 
It looks like the one in your picture. I'll adjust both of them. I'll change the sleep to sleep(20) and change the potentiometer too.

Thanks...

p.s. I looked at the PDF file link for the HC SR501 and the time delays are from 0.3 seconds to 5 minutes. I'm going to have to find a shorter mp3 file. The one I have is 36 seconds.

Did you ever get this figured out? I am playing with the same thing at the moment, and I was wondering if you ended up adjusting the sleep value.
 
Did you ever get this figured out? I am playing with the same thing at the moment, and I was wondering if you ended up adjusting the sleep value.

With the longest time setting for the PIR being 5 minutes I just set everything at 5 minutes, so the screen will blank at 5 minutes. That way they will both come on at the same time.
 
Back
Top