Sunday, April 05, 2015

Raspberry Pi - Can you hear what I hear?

The first project I wanted to use the Pi for was a media centre.

I wanted to:
1/ Stream music from my NAS drive via wifi
2/ Listen to inernet radio via wifi connection
3/ Connect output to my TV so that I could play through my DVD player/Surround Sound system

In the end, 3/ was replaced by "Connect directly to Surround Sound using 3.5mm audio jack".

I choose Volumio as the system as it seemed to do what i needed it to do.

Download and install Volumio...

Download Volumio for Raspberry Pi from here.

Burn ISO file to SD card using Win32DiskImager.

Put SD card in Raspberry Pi, add LAN and power up from PC's UB port (just initially).

Set up wifi...

On the basis of other reviews, I ordered a Edimax EW-7811UN Nano USB Adapter.


Based on the following threads:

Boot the Raspberry Pi without the WiFi adapter plugged in.

Open a Terminal session by clicking on the LXTerminal icon, and enter the following command into it:

$sudo nano /etc/network/interfaces

This opens an editor screen of the wifi configuration file you need to change.
Edit the file to include at the end:

allow-hotplug wlan0
auto wlan0
 
 
iface wlan0 inet dhcp
    wpa-ssid "ssid"
    wpa-psk "password"

..where ssid and password are replaced with mine…

When you have finished press [ctrl]x. This will ask if you want to save the modified files.

Shut down the Raspberry Pi
sudo shutdown -h now

Remove the LAN cable
Plug the WiFi adapter in
Power up...

The Raspberry Pi should connect using the WiFi adapter as it boots up.

Conneting the NAS drive...

I had some problems with getting the Raspberry Pi to find the NAS drive on start up.  I could add it through the Volumio GUI, but it wouldn't mount the drive on start up.  It took some playing around to get a solution that worked, especially some of the fstab file tags were giving errors....still, the following worked in the end.


sudo apt-get install cifs-utils
sudo mkdir /mts/NAS/SOME_NAME


sudo nano /etc/fstab

Add the following line to the end of the file:
//IPADDRESS_OF_NAS_DRIVE/NAS_FOLDERNAME /mnt/NAS/SOME_NAME cifs username=*****,password=*****,ro,users,auto,user_xattr 0 0

...where ***** is replaced by the Pi's username and password for the NAS drive.

Save, exit.

Confirm using
sudo mount -a

Reboot.

Audio output...

Finally, I realised that there was no need to run the connection via the HDMI cable to the TV, then output via optical cable to the surround sound system...as the Raspberry Pi has an 3.5mm audio out jack, and the surround sound has an input for this...


To setup Output to Audio Jack instead of HDMI, I ran the command:
amixer cset numid=3 1

The last digit is the key one; 1= analogue (audio jack); 2= HDMI and 0=automatic(maybe I could have used this?)

Anyway, it works :)



No comments:

Post a Comment