I've found a really cool project call MusicBox that has a lot of streaming options for the Raspberry PI and I'm pretty sure that I'm going to toss the Q&D code I wrote in favor of it.
You can check it out here: http://www.woutervanwijk.nl/pimusicbox/
Saturday, March 14, 2015
Sunday, February 8, 2015
Aaaaaannnnndddd.... we're back...
Wow.... what a long time to have left this alone. So much has happened in the last 2 years that I can't even begin to write it all down.
Personal: We got our Black Belts in both Open Hand and Kobudo. Soon to have our 2nd in Open Hand. Have been teaching a lot. Built some shelves for my oldest. Put in new windows and blinds all around. Changed hosts and in the process lost the CNAME for this site... forgot to fix that with the new host and finally figured out how to do it.
Work: They got rid of my group, pushed me onto another, and I finally moved to a third of my own free will. Get to travel to the corp offices soon. My bud started working with me then left for greener pastures. Another bud retired. The company is in the process of being purchased.
All in all a very entertaining 2 years. The future still looks bright with God and my girl and family by my side.
Lets hope I remember to update this some. :)
Personal: We got our Black Belts in both Open Hand and Kobudo. Soon to have our 2nd in Open Hand. Have been teaching a lot. Built some shelves for my oldest. Put in new windows and blinds all around. Changed hosts and in the process lost the CNAME for this site... forgot to fix that with the new host and finally figured out how to do it.
Work: They got rid of my group, pushed me onto another, and I finally moved to a third of my own free will. Get to travel to the corp offices soon. My bud started working with me then left for greener pastures. Another bud retired. The company is in the process of being purchased.
All in all a very entertaining 2 years. The future still looks bright with God and my girl and family by my side.
Lets hope I remember to update this some. :)
Monday, January 21, 2013
Waiting...
Waiting for parts is not at all fun.
Wondering if they will ever get here
Anticipation
Idle projects sitting in the way
Timing is everything
Intense longing
Not remembering where you left off
Getting more and more annoyed as time wears on
Wondering if they will ever get here
Anticipation
Idle projects sitting in the way
Timing is everything
Intense longing
Not remembering where you left off
Getting more and more annoyed as time wears on
Sunday, November 25, 2012
RPi Changes
As promised here are the changes that I made to the RPi to accommodate the physical button that allows changing of the station being played.
1) add another user that will monitor for the button (adduser radiochange)
2) make changes to the sudoers... it should now have the following lines.
radio ALL=(radio)NOPASSWD:/usr/bin/doradio,/usr/bin/mpg123 *,/usr/bin/killall mpg123, /usr/bin/amixer *
www-data ALL=(radio)NOPASSWD:/usr/bin/doradio,/usr/bin/mpg123 *,/usr/bin/killall mpg123, /usr/bin/amixer *
radiochange ALL=(radiochange)NOPASSWD:/usr/bin/radioSwitch,/usr/bin/doradio,/usr/bin/mpg123 *,/usr/bin/killall mpg123, /usr/bin/amixer *
3) Create the switch monitor program (vi /usr/bin/radioSwitch) and put the following code in it:
# python3
# Monitor button on RPI
import RPi.GPIO as GPIO
import time
import subprocess
change_channel = 1
# use BCM GPIO
GPIO.setmode(GPIO.BCM)
# set up GPIO input pins
# (pull_up_down be PUD_OFF, PUD_UP or PUD_DOWN, default PUD_OFF)
GPIO.setup(1, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# GPIO 0 & 1 have hardware pull ups fitted in the Pi so don't enable them
GPIO.setup(0, GPIO.IN, pull_up_down=GPIO.PUD_OFF)
GPIO.setup(change_channel, GPIO.IN, pull_up_down=GPIO.PUD_OFF)
print("RadioPI Monitoring for button press")
delay = range(0,5000)
dum = 0
while True:
while GPIO.input(change_channel) != 0:
time.sleep(0.07)
print("Button Pressed")
output = subprocess.Popen("/usr/bin/radioChange", shell=True)
output.wait()
#finished a run so start again
4) Make the new program executable: chmod 755 /usr/bin/radioSwitch
5) Setup inittab to fire off the radioSwitch program, find the following line and comment it out.
#2:23:respawn:/sbin/getty 38400 tty2
Add the following line
2:2345:respawn:/bin/login -f radiochange tty2 /dev/tty2 2>&1
6) Change the doRadioScript.php... replace the line
$inName = trim($_GET["inName"]);
with
if ($_GET["inName"] > "")
{
$inName = trim($_GET["inName"]);
} else {
$inName = trim($radioList[$nextStation][0]);
}
7) Change the stationCommon.php script to the following:
<?php
{
$radioList[] = $tempArray;
if (trim($tempArray[0]) == $currentStation)
{
$currentURL = trim($tempArray[1]);
$stationPosition = $stationCount;
}
$stationCount++;
}
}
fclose($file);
$nextStation = $stationPosition + 1;
if ($nextStation >= $stationCount) $nextStation = 0;
?>
8) There is also a bug in the current sound drivers so you eed to change the doRadio script... and make it look like the following (you could probably change the 2s to something less but I didn't try it)... and the amixer line just bumps up the volume.
sudo -uradio killall mpg123
sleep 2s
sudo -uradio /usr/bin/amixer set PCM 9
sleep 2s
sudo -uradio /usr/bin/mpg123 -@ `cat /var/www/stationURL` &
I think that's all the changes. If I think of anymore I'll post them.
Tuesday, September 11, 2012
BRPi - Completed
I've got the Bathroom Radio Pi completed now. I decided to add a button onto the case that allows me to change channels without having to go to the webpage. I accomplished this with some modifications to the PHP scripts, creating a python script to monitor for a button press through the GPIO and one more shell script to call the PHP when the button was pressed.
It works pretty slick... it just cycles through the radio stations in the StationList file.
Maybe sometime I'll post the updated and additional scripts :)
Sunday, August 26, 2012
Bathroom RPi Radio
So the RPi has USB issues and I can't get my wireless USB stick to work on it for the bathroom RPi radio, so I guess I'll just have to install a network jack in the bathroom :) Not 100% sure how I'm going to get the wire up that wall but we'll see what I can do.
Wish the power supplies I ordered would hurry up and show up...
Tuesday, July 17, 2012
Radio PI Followup
I ended up tweaking the scripts a little to display 3 columns of stations but other than that the radio is working great.
One other thing I found was that some of the radio stations start having issues with an irregular clicking sound that is not part of the stream. I found that changing the station and then changing it right back fixes the issue for awhile. So I put in a cron job to run the doradio script every 2 hours (0 */2 * * * /usr/bin/doradio). We'll see how that works out.
Subscribe to:
Posts (Atom)