Thursday, June 20, 2013

Initial Setup

For this post, I am assuming that you have a device to read and write from the SD card. I happen to have an onboard multi card reader in my Windows7 desktop. If you do not, you might need to buy a USB peripheral, or ask someone for help to make it happen.

The steps to get the Raspberry Pi running are:

1. Format the SD card (at least 4GB)
2. Write an operating system image to the card (I chose RaspBMC)
3. Boot the Raspberry Pi to test the loading of the OS
4. Start to install other hardware and software to your liking
5. Enjoy...

1. Format the SD card
I am on windows 7, so I used SDFormatter to format my card. If you do not already have a card that you can use, you can check the list to see what you should get.

2. Write an OS to the card
There are many articles out there on the googlewebs that compare and contrast the different OS options available to be run on the Raspberry Pi. Openelec, Raspbian with XMBC, RaspBMC and others. I am setting up my little machine to run in a van to replace a DVD player, so I went with RaspBMC.

Note that there are instructions on the Raspberry Pi site that point you to a new setup installer. I did not go this way, mostly because I was having power issues at the time and thought they were related to the OS setup. They were not, but by the time I figured that out, I had already installed RaspBMC. Caveat Emptor.

To write to the card, you need to:
Download an OS image. Choose the network image.
Download a tool to format the card and go ahead and format it.
Download a tool to write to the card and write the image to it.

At this point, you should have your SD card set up for an inital boot of the Raspberry Pi into RaspBMC.

3. Boot the Raspberry Pi
It was at this point that I had lots of issues arise. I booted the machine by plugging it in - there is no "on" switch anywhere. I was using the original NOOBs installer, but had also plugged in a wifi chip and a wireless keyboard. On top of that, I had a power supply that powered the lights, but pooped out when the other items came online.

Make sure that when you boot for the first time, you are hardwired to your network. The OS will attempt to download updates via the network connection. Do not try to do this with your wifi card as it needs to be configured before it can work - and SSH'ing into the Raspberry Pi will not work if it is not on the network.

Note: If your Raspberry Pi boots RaspBMC correctly you should get a nice logo screen soon after the power comes on. If not, you might see a "rainbow" test pattern, followed by some scrolling text, then a loss of signal. Then you would see the same thing again and again, in a loop. This was my power issue. Swapping out the power cable solved that issue for me - though lots of people point to a bad write of the OS, reformatting the SD card etc. Try the power first. I used a normal USB cable connected to an iPhone wall wart. Worked like a charm.

4. Start to Install other hardware and software to your liking
Once I had a stable boot sequence, I started to plug in more of the peripherals. I have a USB EDIMax Wifi card, and a FAVI mini keyboard. Both take up a single USB slot on the Raspberry Pi. I started with the mini keyboard. This seemed to work right out of the box. Since I had my power sorted, I was able to plug in the USB, restart the machine and everything worked.

Wifi was somewhat trickier. With the wired connection still in place, I SSH'd into the Raspberry Pi and installed the driver for the card. I used the following commands:

$ sudo bash
$ apt-get update && apt-get install firmware-realtek

To get the software for the card down to the Raspberry Pi. The first command opens a new bash session with root priveleges (or maybe its just admin priveleges, remember I am not a linux guy). Once you are working in a session that has those credentials, you can do the install.

After I installed the driver, I used the RaspBMC UI to pull down the Network Manager add-on program. Once network manager was down, I shut down the machine, swapped the cable for the wifi nic and restarted. I had to use the onboard keyboard to set up the wifi profile, but everything worked well at that point and I was on the network.

Time to load the machine with videos for the van.

Monday, June 17, 2013

What to Buy?

After deciding to augment my van's onboard DVD player with some sort of solid state electronics, I went through a couple of iterations.

I knew that the RPi ran Linux and booted from an SD card. I also knew that it had 2 USB ports (plus an extra for power) as well as an HDMI port and a stereo headphone out. There are other, cool connections available to play with (GPIO jumps to mind) but I am not a hardware hacker at that level. With all that in mind, I started to think about my initial hardware purchase. I decided on a bare-ish bones setup, running directly from the SD boot card for media in the car. I happened to have a 32GB class 10 SD card lying around, so that was the beginning of the build.

I also knew that my 2006 Honda Odyssey EX-L had some aux ports in the way back, by the third row of seats. Specifically RCA inputs for video and left and right audio. It also had a 12V car power socket.

After consulting with some buddies, doing some research online - specifically about power issues and Raspberry Pi in general - I came up with the following list (on amazon.com):

Raspberry Pi Model B Revision 2.0 (512MB) - $42.90

PowerGen Dual USB 3.1A 15w High Output Car Charger - $9.99

FAVI Entertainment Wireless Keyboard (Built-in TouchPad/Laser Pointer) - $18.99

Edimax EW-7811Un 150 Mbps Wireless 11n Nano Size USB Adapter - $10.98

Multicomp Clear Raspberry Pi Enclosure (MC-RP001-CLR) - $10.99

C2G / Cables to Go 40645 3.5mm Stereo Male To 2X RCA Female Adapter - $1.97

I happen to have Amazon Prime, so I did not incur any shipping charges for all of this stuff. 2 days after I ordered it, the hardware showed up. More on the initial boot in the next post.

An Auspicious Beginning

This all started as a way to stop using physical media (DVDs), while travelling with my kids in our 2006 Honda Odyssey EX-L. The DVDs are always scratched and skipping, the kids are always whining about it and changing discs while driving (at night, in a thunderstorm) can be dangerous!

After one such trip, I came into work the next morning and was complaining about the harrowing journey and the DVDs. I said to my co-workers "...is there a hard drive that you can plug into your car to play movies from?" one of them replied "Raspberry Pi and RaspBMC..." that started the odyssey I am about to chronicle for you here.

This blog is somewhat after the fact, but I will try and write the steps down in the order that I took them and enumerate the approaches I took while trying to hack my way through the various hardware and Linux commands I came into contact with along the way.

Fair warning: I am not a Linux guy. There were many stumbles along the way and I read many forum postings with scathing remarks about how the "Linux people" did not know how to describe something for non Linux folks. That is the reason I am making this blog, to let you know how a schlub like me got something this cool up and running.