Advertisement
dkiesow

RadioBDC for Raspi

Aug 29th, 2013
501
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.39 KB | None | 0 0
  1. Hardware:
  2.  
  3. Raspberry Pi: http://www.amazon.com/Raspberry-Pi-Model-Revision-512MB/dp/B009SQQF9C/ref=sr_1_1?ie=UTF8&qid=1377009198&sr=8-1&keywords=raspberry+pi
  4.  
  5. WiFi Dongle: https://www.modmypi.com/wireless-usb-1n-nano-adaptor-802.11N-wifi-dongle (Ralink 5370 Chipset)
  6.  
  7. MicroSD Card Adapter: https://www.modmypi.com/sd-cards-and-adaptors/raspberry-pi-micro-sd-card-adaptor-mmp
  8.  
  9. MicroSD Card: http://www.amazon.com/SanDisk-microSDHC-Memory-Adapter-SDSDQUA-016G-U46A/dp/B007XZL7PC/ref=sr_1_6?s=electronics&ie=UTF8&qid=1377009618&sr=1-6&keywords=sandisk+ultra+micro+sd
  10.  
  11. Case: http://www.amazon.com/Raspberry-Pi-Case-Enclosure-Black/dp/B00AZL16S4/ref=sr_1_sc_2?s=electronics&ie=UTF8&qid=1377009744&sr=1-2-spell&keywords=raspberypi+case
  12.  
  13. Power supply (5v 2 a): http://www.amazon.com/EasyAcc-Universal-Travel-Charger-Adapter/dp/B00A9PO5AM/ref=sr_1_3?ie=UTF8&qid=1377010161&sr=8-3&keywords=raspberry+pi+power+supply
  14.  
  15. Ethernet cable
  16. HDMI cable
  17. HDMI/DVI Converter (if necessary)
  18. USB Keyboard
  19.  
  20. Suggested Software:
  21.  
  22. SD Card formatting tools
  23. Mac: https://www.sdcard.org/downloads/formatter_4/eula_mac/
  24. PC: https://www.sdcard.org/downloads/formatter_4/eula_windows/
  25.  
  26. SSH Client (PuTTY for PC, Terminal for Mac or etc)
  27.  
  28. Raspbian “Wheezy” - Debian-based Linux OS
  29. http://www.raspberrypi.org/downloads
  30.  
  31. Creating an OS image on your SD card:
  32.  
  33. Download the latest version of Raspbian ‘Wheezy’ here: http://www.raspberrypi.org/downloads
  34. Unzip and drop the file in your ‘downloads’ folder
  35. Place your micro SD card in the adapter
  36. Place the adapter in a card reader attached to your computer
  37. Open the Mac or PC SD card formatting tool
  38. MAC: Select “Overwrite Format” PC: Set "FORMAT SIZE ADJUSTMENT" to "ON" in the "Options" menu
  39. Select your SD card, not any other internal or external HD.
  40. Click format
  41. Creating a bootable disk for Raspbian Wheezy is easy to do from the command line.
  42.  
  43.  
  44. Open Terminal (or use Disc Utility on Mac)
  45. Get the disk name:
  46. $ df –h
  47.  
  48. Unmount the disk.
  49. $ umount /dev/sdb1  # sdb1 is the example disk name
  50.  
  51. Write the ‘Wheezy’ image to the SD card
  52. $ dd bs=1M if=~/Downloads/2012-08-16-wheezy-raspbian.img of=/dev/sdb  # make sure to change the path and file name
  53.  
  54. Clear the write cache
  55. $ sudo sync
  56.   5. Safely eject the SD card
  57.  
  58. The easiest set-up process at this point is to plug the Pi into an Ethernet connection, an external monitor and a USB keyboard. To try this headless (no monitor/keyboard) try this:http://n00blab.com/how-to-set-up-raspberry-pi-without-monitor/
  59.  
  60. Place the SD card in the Pi (or the micro-SD adapter, then the Pi as appropriate)
  61. Connect the Ethernet, keyboard and external monitor
  62.  
  63. If you are local or SSH the set-up is the basically the same.
  64.  
  65. When prompted the defaults are:
  66. Username: pi
  67. Password: raspberry
  68. Launch the config program (if it is not already)
  69. $ sudo raspi-config
  70.  
  71. Expand the file system
  72. Set Hostname to RadioBDCPi (or etc)
  73. Change the password
  74. Go to Advanced options
  75. Enable SSH
  76. Update Tool
  77. Exit
  78.  
  79. Update the RaspberryPi OS
  80.  
  81. $ sudo apt-get -y update
  82. $ sudo apt-get -y upgrade
  83.  
  84. Install rpi-update (Firmware)
  85.  
  86. $ sudo apt-get install -y git-core
  87. $ sudo wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update -O /usr/bin/rpi-update
  88. $ sudo chmod +x /usr/bin/rpi-update
  89.  
  90. Backup current firmware:
  91.  
  92. $ sudo cp /boot/start.elf /boot/start.elf.works
  93.  
  94. Install the  new firmware and restart
  95.  
  96. $ sudo rpi-update
  97. $ sudo shutdown -r now
  98.  
  99. Install the MP3 encoder
  100. $ sudo apt-get -y install alsa-utils mpg321 lame
  101. $ sudo modprobe snd-bcm2835
  102.  
  103. # Set the audio output to analog (the last number in the below line would be: 0=auto, 1=analog, 2=HDMI)
  104. $ sudo amixer cset numid=3 1
  105.  
  106. # Connect speakers and test the audio
  107. $ aplay /usr/share/sounds/alsa/Front_Center.wav #Plays an audio clip
  108. $ speaker-test -t sine -f 440 -c 2 -s 1 #plays a sine wave
  109.  
  110. Install MPD and MPC
  111. $ sudo apt-get install -y mpd mpc
  112. $ sudo service mpd stop
  113. $ sudo chmod -R g+w /var/lib/mpd
  114. $ sudo chmod -R g+w /var/run/mpd
  115.  
  116. Remove bind to address
  117. $ sudo nano /etc/mpd.conf
  118. Comment out the line: bind_to_address “localhost” or remove the entire line
  119. ctrl-o #to save
  120. ctrl-x #to exit
  121. Y
  122. Enter
  123. Reboot:
  124. $ sudo shutdown -r now
  125.  
  126. Set up the RadioBDC playlist
  127. $ sudo nano ./bdcplaylist
  128.  
  129. Copy and paste this text:
  130. !/bin/bash
  131. rm RADIO_BDC.pls*
  132. wget http://playerservices.streamtheworld.com/pls/RADIO_BDC.pls
  133. grep "File1=" RADIO_BDC.pls > streamaddr
  134. mpc clear
  135. mpc add $(sed "s/File1=//g" streamaddr)
  136. mpc play
  137. rm RADIO_BDC.pls*
  138. ctrl-o #to save
  139. ctrl-x #to exit
  140. Y
  141. Enter
  142. Set the playlist to be executable
  143. $ sudo chmod +x ./bdclist
  144. Set the Pi to check the playlist and play when it boots up:
  145.  
  146. $ sudo nano /etc/rc.local
  147.  
  148. At the bottom enter:
  149. ./bdcplaylist
  150.  
  151. ctrl-o #to save
  152. ctrl-x #to exit
  153. Y
  154. Enter
  155.  
  156. Set up a cron job to refresh the playlist
  157.  
  158. Check for a current crontab:
  159.  
  160. $ crontab -l
  161.  
  162. Most likely this will be returned:
  163. no crontab for pi
  164.  
  165. Create a new crontab
  166.  
  167. $ crontab –e
  168. Add this line:
  169. * */3 * * * ./bdclist  # every three hours
  170.  
  171. ctrl-o #to save
  172. ctrl-x #to exit
  173. Y
  174. Enter
  175. Set up Bonjour
  176.  
  177. $ sudo apt-get update
  178. $ sudo apt-get install libnss-mdns
  179.  
  180. On a PC – install Bonjour if necessary:
  181. http://support.apple.com/kb/DL999
  182. Make sure UDP port 5353 is not blocked
  183.  
  184. Check to see that the hostname is set correctly – or edit it (bottom line alongside 127.0.1.1)
  185. $ sudo nano /etc/hosts
  186.  
  187. Check to see the Pi is broadcasting on Bonjour
  188.  
  189. dns-sd -B _workstation._tcp.
  190.  
  191.  
  192. Test if MPD is running:
  193. $ sudo netstat -apn|grep mpd
  194.  
  195.  
  196. Reference Links:
  197. Raspberry Pi quick start:
  198. http://www.raspberrypi.org/wp-content/uploads/2012/04/quick-start-guide-v2_1.pdf
  199.  
  200. Formatting an SD card:
  201. http://elinux.org/RPi_Easy_SD_Card_Setup#Using_the_Win32DiskImager_program
  202.  
  203. Installing the OS image via command line:
  204. http://n00blab.com/how-to-create-raspberry-pi-sd-card/
  205.  
  206. Using cron on Raspberry Pi
  207. http://blog.davidsingleton.org/raspberry-pi-webcam-a-gentle-intro-to-crontab/
  208.  
  209. Setting up Bonjour
  210. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=66&t=18207
  211. http://www.howtogeek.com/167190/how-and-why-to-assign-the-.local-domain-to-your-raspberry-pi/
  212.  
  213. Changing hostnames
  214. http://www.howtogeek.com/167195/how-to-change-your-raspberry-pi-or-other-linux-devices-hostname/
  215.  
  216. How to troubleshoot MPD
  217. http://mpd.wikia.com/wiki/Music_Player_Daemon_HOWTO_Troubleshoot
  218.  
  219. Setting up Node.js
  220. http://blog.rueedlinger.ch/2013/03/raspberry-pi-and-nodejs-basic-setup/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement