Total Views

Friday, May 3, 2013

Raspberry Pi - First Steps

After I started my first projects on my Pi I have decided to post a quick tutorial on how to set up initially your device.


Step One: Prepare Your SD Card

First things first, we need to prepare your SD card for the Raspberry Pi. This involves formatting it properly and putting Raspbian, the standard Raspberry Pi operating system, on it. The steps vary depending on whether or not you're on a Mac, Linux, or Windows PC, so just follow the instructions for your operating system below.

Windows
  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.)
  2. Download Win32DiskImager and unzip the application (.exe file) inside.
  3. Insert your SD card into your Windows PC using a card reader.
  4. Open Win32DiskImager.exe, the application you just downloaded, by double-clicking on it. If you're running Windows 7 or 8, right click on it and choose "Run as Administrator" instead.
  5. If your SD card isn't automatically detected by the application, click on the drop-down menu at the top right (labeled "Device") and choose it from the list.
  6. In the image file section of the application, click the little folder icon and choose the Raspbian .img file you just downloaded.
  7. Click the Write button and wait for Win32DiskImager to do its thing. When it finishes, you can safely eject your SD card and insert it into your Raspberry Pi.
OS X
  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.)
  2. Download RPi-sd card builder (be sure to pick the appropriate version for your installed version of OS X) and unzip the application.
  3. Insert your SD card into your Mac using a card reader.
  4. Open RPi-sd card builder. You'll immediately be asked to choose a Raspbian image. Choose the .img file you downloaded earlier.
  5. You'll be asked if your SD card is connected. Since we inserted it earlier, it is, so go ahead and click Continue. You'll be presented with SD card options. If you only have one inserted, you won't see anything else in the list and it'll be checked. If not, just check only the card you want to use and click OK.
  6. Enter your administrator password and click OK.
  7. You'll be asked if the SD card was ejected. This is supposed to happen, as the application needs to unmount it so it can perform a direct copy. Double-check that your SD card is no longer available in the Finder. DO NOT remove it from your USB port. When you're sure, click Continue.
  8. RPi-sd card builder finishes prepping your SD card, safely eject it and insert it into your Raspberry Pi unit.
RPi-sd card builder isn't an app so much as it's an Automator action that acts like one. Some people have reported issues using it, so if you run into problems just open up the Terminal app (Your Hard Drive → Applications → Utilities → Terminal) and follow the instructions for Linux.
Linux
  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.)
  2. Open up your Linux terminal emulator of choice.
  3. Insert your SD card. If it mounts automatically, unmount it but make note of its location (e.g. /dev/disk2s1). Even though the card is unmounted, do not remove it from the reader
  4. 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 if=PATH_TO_IMG_FILE of=PATH_TO_SD_CARD_MOUNT_POINT bs=1m

    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. (The bs=1m just specifies the byte size and you don't need to mess with it.) When you're done, the command should look something like this:

    sudo dd if=/Users/adachis/Downloads/2012-12-16-wheezy-raspbian.img of=/dev/disk2s1 bs=1m

    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.
  5. You will be prompted for the root password (or your administrator password for those of you on OS X who are using this method). Type it and press enter.
  6. 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). 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.

Step Two: Hook Up Your Raspberry Pi


Connecting everything to your Raspberry Pi is pretty easy. Start by connecting the HDMI cable from the unit to your television (or monitor). If you're using the analog composite video connection instead, connect it to your television (or monitor) and plug in a set of speakers to the 3.5mm audio jack. If you want your Raspberry Pi to connect to your network and/or the internet, use an Ethernet cable to connect it to your router. If you've set up a computer before, this should all seem familiar.
Finally, you need to connect your Raspberry Pi with a micro USB power adapter. As mentioned earlier, you need an adapter that can provide at least 700mA at 5V. Fortunately, you probably already have one. Many smartphone and tablet chargers utilize micro USB and provide 700mA at 5V (or more). You can find out by reading the small text on the plug and looking for the output section. (Note: it may say 0.7A (or higher) instead of 700mA.) When you have a compatible power adapter on hand, connect it to a micro USB cable and then connect that cable to the micro USB port on your Raspberry Pi unit. It'll turn on all by itself and you should see it boot for the first time.



Step Three: Configure Your Raspberry Pi



Once your Raspberry Pi boots for the first time you'll need to configure a few things. You'll know it's ready for you when you see a Raspi-config window with a pretty big list of settings. You can mess with the others if you feel so inclined, but the only thing you really need to do is expand the file system so you can use up all the space on your SD card. To do so, follow these steps:
  1. Select expand_rootfs (the second option) and press enter.
  2. Confirm that you want to expand the file system and let Raspbian do its thing.
  3. When you're returned to the configuration list, go all the way to the bottom and select the Finish option.
  4. It'll ask you if you want to reboot. Choose yes.
Your Raspberry Pi will reboot and take a little longer this time because it needs to expand the file system. After a about a minute you'll be asked to log in. You'll need to use the default username and password:
Username: pi
Password: raspberry

Once you've logged in, you've got yourself a working Raspberry Pi. Congratulations!

The New Toy - Raspberry Pi rev.B

I just received my new toy and can't wait to start playing with it :)

It is Raspberry Pi Model B with very interesting wooden case (both purchased from Amazon)




It is already up and running and I am starting my work on it :)
Will keep you posted on my progress with different projects.

Cheers,
Petar