Thursday, February 21, 2013

The Pi Series: 1. Settiing Up our Raspberry Pi

What is a Raspberry Pi?
Raspberry Pi (Raspi or just Pi) is a mini computer thats small enough to fit in the palm of your hand. It is essentially a small motherboard. Pi is powered by an ARM Processor and 512 MB Ram with HDMI and Analog Video Output. It also has two USB 2.0 ports and one micro USB port for power. It has a SD Card slot. For connectivity it has an Ethernet Port. 

Getting the Pi in India
In India its available online and costs around Rs 3000 plus taxes (Gross price approx Rs 3400)

Setting Up the PI
Although its a capable computer on its own, one needs some essential things to set it up and make it work. To setup our Pi, we had to rely on several online resources in Lifehacker and Raspi Wicki pages. Here is how we did it:

Requirements
    1. Your own Pi.
    2. A Laptop or Desktop running Ubuntu 12.10 (We used Linux because its much more flexible than the standard Windows system)
    3. An HDMI Cable or AV Cable (the one we use to connect DVD Players or Cable STBs to the TV). You may have already figured out that HDMI gives better video output than the analog AV. However, we didnt had a HDMI cable and so had to rely on AV Cable.
    4. SD Card - Minimum 2GB. Recommended is a 4GB Card. We used a 2GB Card for setting up our Pi. Please be noted that, during the process, the card will be formatted. So backup any data in the card beforehand. You will also need a SD Card reader if you dont have a Linux machine to setup the SD card. Since we are not big fans of the Big Brother, we used a Linux machine to setup (So this guide is not applicable for those running Windows. Sorry all Windows FanBoys, You have to google it out. And did anyone say MAC? Seriously?)
    5. USB Keyboard and Mouse. This will make things much easier. But we didnt had these two and so had to rely on a more complex procedure. But it was more fun than plugging in a Keyboard and Mouse :)
    6. A standard Ethernet Cable (Yup, the cable we use in our office to plugin the computer to LAN)
    7. Micro USB Cable. i.e. USB Cables of most of the phones will do.
    8. Audio Cable (Optional. Since we didnt want to test the audio, we didnt use audio cable), AND
    9. Finally the RASPI OS. We used Raspbian for our setup. Download it from here.
Step 1: Setting UP SD Card and Installing the RASPI OS
  1. Download the lastest version of Raspbian and unzip the .img file inside. (It's almost 500MB so it may take a little while to download.) Put the '.img' file in your home folder for ease of access. Lets rename it to "RaspiOS.img"
  2. Open up your Linux terminal in Ubuntu.
  3. Type this command "df -h". This is the command to list mounted devices.
  4. Insert the SD card in the slot in your Laptop (Note: Not a SD Card Reader)
  5. Repeat Step 3.
  6. Compare the results of Step 3 and 5. The device that wasn't there last time is your SD card. The left column gives the device name of your SD card. Note it down (e.g. /dev/mmcblk0p1). The last part ("p1" or "1") is the partition number, but you want to write to the whole SD card, not just one partition, so you need to remove that part from the name (getting for example "/dev/mmcblk0") as the device for the whole SD card.
  7. Unmount the SD Card so that files can't be read or written to the SD card while you are copying over the SD image. Command to unmount the device is "umount DEVICE_PATH" (e.g. umount /dev/mmcblk0p1)
  8. In the command line, you're going to need to type a single line to copy the contents of the Raspbian .img file to your SD card. It'll look like this:

    sudo dd bs=4M if=PATH_TO_IMG_FILE of=PATH_TO_SD_CARD_MOUNT_POINT

  9. You'll need to replace PATH_TO_IMG_FILE with the path to the .img file and PATH_TO_SD_CARD_MOUNT_POINT with the path to the SD card mount point. When you're done, the command should look something like this:

    sudo dd bs=4M if=~/RaspiOS.img of=/dev/mmcblk0

    It's very important that you do not get this information wrong or you could end up writing Raspbian to the wrong disk and cause serious data loss. Be careful! When you're sure you've got everything right, press enter.

  10. You will be prompted for the root password. Type it and press enter.
  11. It'll take some time for the dd command to copy everything over to your SD card. While that happens, it'll probably look like the Terminal froze up. Don't worry, it's still working and will likely take longer than an average 2GB copy to an SD card (so be patient). In our case, it took approx. 5 minutes to complete the process. Be Patient and get a cup of coffee in the meantime. When it finishes, the command prompt will return and your SD card will be ready. Eject it safely and stick it in your Raspberry Pi.

    Now You have a bootable SD Card and can plugin the Pi to a monitor. We used our standard LCD TV as the monitor.
Step 2: Connecting the Pi to Monitor and First Boot
  1. Since we did not had HDMI Cable, we used the normal AV cable to connect the Video output of Pi to the TV.
  2. We used the LAN Cable to connect the Pi to the Wireless Modem.
  3. Plugin the USB Keyboard and Mouse (If you have)
  4. Our TV had a USB Port. So we used a micro USB cable to connect the Pi to the TV via this USB port. This powers up the Pi. (If your TV doesnot have a Micro USB Cable, use the Laptop as power source)
Now you should see the Pi booting up on the TV Screen (basically a lot of text will flash through.


 (First Boot Screen)

Since you have already seen Ubuntu booting up, you may be familiar with what you see on the screen). Once your Raspberry Pi boots for the first time you'll  see a Raspi-config window with a pretty big list of settings.




(Config Screen)
 
If you have plugged in the Keyboard and Mouse, your trip ends here. But we didn't had these. So we were forced to take a longer route to access the Pi. So those interested in some hardcore Linux Shell adventure, follow us!!

(Contd..)

No comments:

Post a Comment