Monday, July 07, 2014

Raspberry Pi Media Center for Your Car

The Raspberry Pi got me super excited to try to figure out how to make my own media center form my car that could be controlled by my cellphone.  Below are the steps I followed to set mine up.

Equipment list and estimated cost (total ~$160):
I know DVD players with two screens are cheaper and probably have better video resolution.  The advantages here are that we don't have to be reaching back and load new DVDs throughout the trip, we don't have to bring a binder of DVDs with us, and most of all it was a fun project.

After I got Xbian installed on the Pi, I had to figure out how to get the phone to control it.  I didn't want to have to bring a wireless router with me and create a mini-network.  I came across a post that explains how to make the Edimax nano usb adapter an access point (Xbian recognizes the device automatically).  Then, you just have to have your phone connect to the access point to control it.

Essentially, run the following commands:
  1. apt-get install bridge-utils hostapd
  2. wget http://www.daveconroy.com/wp3/wp-content/uploads/2013/07/hostapd.zip
  3. unzip hostapd.zip
  4. sudo mv /usr/sbin/hostapd /usr/sbin/hostapd.bak
  5. sudo mv hostapd /usr/sbin/hostapd.edimax
  6. sudo ln -sf /usr/sbin/hostapd.edimax /usr/sbin/hostapd
  7. sudo chown root.root /usr/sbin/hostapd
  8. sudo chmod 755 /usr/sbin/hostapd
Place the following in /etc/hostapd/hostapd.conf:
interface=wlan0
driver=rtl871xdrv
ssid=<SSID HERE>
channel=1
wmm_enabled=0
wpa=1
wpa_passphrase=<PASSPHRASE>
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0
Reboot and uncomment the following line in the /etc/default/hostapd file:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
I didn't want to bridge the wireless and wired network interfaces (which is what the above-linked tutorial shows), I just wanted a wireless access point, so the following was all I needed in the /etc/network/interfaces file:

auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.20.1
netmask 255.255.255.0


The Yatse remote ended up working best for me.

Adding the HDD so I could browse the movies on it from my phone was a little tricky.  On the Pi, under Videos > Files, the HDD likely shows up there and you can select movies from the file structure, but that won't display the files on your phone. If you want to control it from the front passenger seat, you'll need to select "Add Videos" instead of your HDD, and then select the folder containing the Movies. Then in Yatse, that Folder should show up under Files/Playlists in the Left slide-out menu.