Saturday, March 28, 2015

Setting up the Raspberry Pi 2 for the first time

raspbery-pi-2-malaysia-price-rm-150
Smartphones are all the rage and talk these days but there is another piece of tech which is on the rise in the recent years and that is the Internet of Things. The simple definition for IoT is it connects services or devices together and it's meant to replace the traditional way of executing tasks manually. It is so popular that Microsoft has announced that they'll be creating a dedicated version of Windows 10 for IoT devices.

In terms of the hardware, IoT is all about being small, compact and low power which enable it to run on just anywhere. Well, one of the more well known IoT board is the Raspberry Pi which was initially created to teach students how to code. The low price of the Raspberry Pi and it's expandability contributed to it's overall success in the market.

Well, just a few days ago i picked up the brand new Raspberry Pi 2 for about $40 (including taxes) today i'm going to run you through the setup process (this tutorial also applies to the Raspberry Pi).

Here's some glamour shots of the Raspberry Pi 2, stay tuned for some content in the coming days #RaspberryPi2 #RaspberryPi #Raspbian
Posted by The Technology Of Today International on Saturday, March 28, 2015

TL;DR

  1. Once your microSD card has been formatted, drag all the files in the extracted NOOBS folder and drop them onto the SD card drive.
  2. When this process has finished, safely remove the SD card and insert it into your Raspberry Pi.
  3. Plug in your keyboard, mouse and monitor  cables.
  4. Now plug in the USB power cable to your Pi.
  5. Your Raspberry Pi will boot, and a window will appear with a list of different operating systems that you can install. We recommend that you use Raspbian – tick the box next to Raspbian and click on Install.
  6. Raspbian will then run through its installation process. Note this can take a while.
  7. When the install process has completed, the Raspberry Pi configuration menu (raspi-config) will load. Here you are able to set the time and date for your region and enable a Raspberry Pi camera board, or even create users. You can exit this menu by using Tab on your keyboard to move to Finish.
  8. The default login for Raspbian is username pi with the password raspberry.
sourced from raspberrypi.org

              What you'll need

              raspbery-pi-2-size-comparison-credit-card-quick-start-guide
              The first thing you want to do is get yourself a Raspberry Pi. In this tutorial i will be showing things on the Raspberry Pi 2. You can pick up the Raspberry Pi 2 yourself from element14.com. After you have the Raspberry Pi you'll need a couple of accessories to get things started:
              1. microUSB cable which can output at least 5V of power
              2. microSD card (or SD card for Raspberry Pi model A, A+ and B)
              3. HDMI cable and monitor 
              4. Keyboard and Mouse
              5. Wired (or wireless) internet connection (optional)
              By itself, the Raspberry Pi 2 does not come with either a microUSB cable or a microSD card. You could get the bundle online which comes with the microSD card and the microUSB cable for a little bit more money. But, i would recommend  you to save the money as you'll most likely have a microUSB cable lying around and also installing the software onto the microSD card is fairly simple.

              Speaking of the microSD, if you do choose to install NOOBS by yourself. It is recommended that you get a higher class microSD card, for this tutorial i am using an 8GB Sandisk Ultra class 10 microSD card which is just right for running Raspbian on the Raspberry Pi 2.
              raspbery-pi-2-logitech-wireless-keyboard-and-mouse
              As to powering the device, the 4w CPU on the Raspberry Pi 2 requires a microUSB cable capable of outputting 5V of power and i did try connecting it through a power bank but it just refused to turn on, so it'll probably need to be powered from a wall outlet. The next thing is the display, you can output it through either the HDMI port or through the RCA (audio jack) port for older displays. Also it is possible to convert the HDMI to either DVI or VGA but you'll need to get a separate adapter to do that.

              Then it's the keyboard and mouse, you can use either wired or wireless peripherals and i would recommend a wired one to assure compatibility. But if you do insist on using a wireless keyboard/mouse, Logitech wireless peripherals will work out the box for the Raspberry Pi 2 without the installation of any drivers. Finally, the internet connection will not be needed to install the OS but it is recommended for updating the software.

              Installing NOOBS

              raspbery-pi-2-NOOBS-setup
              After getting all the require hardware, the next step is installing an operating system onto your Raspberry Pi 2. You will need to download a file called NOOBS from here and the file is about 700mb, so it'll take some time to download depending on your internet speed. After downloading the file, all you have to do is to extract all the files in the NOOBS.zip file and then copy it into the microSD card which has already been formatted. 

              Installing an Operating System onto the Raspberry Pi 2

              Once you have transferred all the files in the NOOBS.zip folder, the next step is to plug in the microSD card onto the Raspberry Pi 2 which is located on the underside of the board. While plugging in the microSD card other wires like the microUSB cable and keyboard and mouse should also be plugged in. 
              raspbery-pi-2-NOOBS-setup
              If all goes well, you will see a mutlicolored image pop up on the screen and then you'll automatically redirected to the recovery page (image above). From there you will need to choose at least one operating system to install, you can choose as many as you want. But it is recommended that you at least install Raspbian as that is the official OS for the Raspberry Pi 2. 

              In this tutorial i will be running through the installation process for Raspbian but the installation process for other OSs will be identical. Well, after selecting the desired OS, just click on Install and what you have to do now is to wait for the installation to complete. With my Sandisk Ultra microSD card, it took me about 10 minutes to install Raspbian. You mileage might vary depending on your microSD card. 

              While waiting for Raspbian to install, the window will display some information and tips for using Raspbian. Also, if you notice the bottom of the window there is menus for both language and keyboard. The stock settings are in UK english but if you wish to change to US english or another language, you can do so even during the install process. 
              raspbery-pi-2-Raspbian-setup-screen
              raspbery-pi-2-Raspbian-setup-screen
              raspbery-pi-2-Raspbian-setup-screenraspbery-pi-2-Raspbian-setup-screenraspbery-pi-2-Raspbian-setup-screen
              raspbery-pi-2-Raspbian-setup-screen

              Completing the first boot

              raspbery-pi-2-first-boot
              After the installation is done, the Raspberry Pi 2 will then reboot and 4 Raspberries will soon appear on the top of the screen and a script of code will start unraveling before your eyes. Don't worry, everything is fine and no you won't need to type any code to get through the first boot. 

              After a few minutes, the script of code will stop and a blue screen will appear on screen. That page is called the raspi-config page and from there you can change several settings like the time, locale, etc. After leaving this page you will still be able to access this page from Raspbian by typing in sudo raspi-config on LXTerminal. 

              raspberry-pi-2-raspi-config-bios
              Similarly to a BIOS on a motherboard, the raspi-config page can only be navigate by the arrow keys on the keyboard. Here below i have a couple of recommended things for you to configure. After configuring all of the recommended settings, just navigate to <Finish> and hit enter.

              Changing the password

              The default password for Raspbian is raspberry and i would highly recommend you to change it for security reasons. To change your password, just navigate to Change User Password and click enter. After that a prompt will come up requesting you to type in your password after clicking enter. You will need to enter your password twice and that's it, your password is now changed.

              Boot directly to the desktop

              If you do not turn on this feature, each time you turn on your Raspberry Pi 2 you will be greeted with the script of code and you'll also need to key in your username and password every time. So, navigate to Enable Boot to Desktop/Scratch click enter and navigate to the second option, Desktop Log in as user 'pi' at the graphical desktop and hit enter again.

              Changing the locale and time

              The Raspberry Pi 2 comes all the way from the UK and out of the box the time zone and locale are set to the UK. So, you will need to configure the time and locale so that your Raspberry Pi 2 will display the correct time and date.

              To do that, navigate to Internationalisation Options and hit enter. First navigate to the first option, Change Locale and click enter; You will then be greeted with a long list of locales, for english the locale starts with en and continues on with your region name. Select your desired locale and click enter. You will then be require to choose a default locale, if you choose not to do so navigate to none and click enter. 

              Again, you navigate back to the same page but this time select the second option, Change Timezone and click enter. You will then be show a list of continents and select your continent and the select your desired city/country which the Raspberry Pi 2 will base the time off. 

              Finally, there is a third option on the Internationalisation Options page to change the keyboard locale, but if you remember during the initial setup process, i did mention that you will be able to change the keyboard locale and language even while Raspbian is installing. If you did not do so, you can do it here.

              Overclocking the Raspberry Pi 2

              At stock, the quad core processor on the Raspberry Pi 2 is running at 700MHz. Overclocking basically increases the speed in which your processor runs at and thus improving performance. I would recommend to at least overclock your Raspberry Pi by 100MHz which will not harm your CPU too much.

              Navigate to the Overclock menu and hit enter then you will be prompted at the risks of overclocking the processor, hit enter. After that, select on the second option which is a Modest overclock and only increases the CPU speed by 800MHz. You can try other presets but they might make your Raspberry Pi 2 unstable so do it at your own risk.

              Enabling SSH

              This option however is purely optional if you do not intend to remotely connect to your Raspberry Pi 2. SSH stands for secure shell and with this enabled you will be able to stream/view your Raspberry Pi 2 straight from your PC/Mac through the internet.

              If you choose to do this, navigate to Advanced Options and click enter. Highlight the fourth option, SSH and click enter. A popup will then appear and just highlight on <Enable> and click enter. That's it, SSH is now enabled on your Raspberry Pi 2.

              Booting into Raspbian for the first time

              raspberry-pi-2-login
              After you finish configuring the options on raspi-config, the Raspberry Pi 2 will reboot once again and the script of code will come up again. You might be wondering, didn't we already enable the Raspberry Pi 2 to boot straight into the desktop earlier? Well, for the very first login, you will need to sign in using the username and password.

              The script of code will run much faster this time around and after it stops on the bottom of the screen you will be required to enter the login details. The default login username is pi and the password is raspberry, but if you did change the password earlier, you can disregard the default password and just use your modified password to enter. Also something to note is that, nothing will appear on screen when you type the password, so don't be alarmed by it.

              raspberry-pi-2-pi@raspberry-startx
              Once you enter your login details, you will see a pi@raspberrypi ~ $ command pop up and all you have to do is type startx and hit enter. After that you will see the Raspbian desktop pop up and my first impressions is that it looks a lot like Windows 95, don't you think so too?

              Conclusion

              raspberry-pi-2-raspbian-desktop-malaysia
              That is it, you have successful installed an Operating System onto your Raspberry Pi 2. At this point you should know a little more about your new Raspberry Pi 2. Mind you this is also my first time playing around with the Raspberry Pi and if you do decide to buy it, do keep an open mind to hacking and typing code because this machine is intended to tech the users how to program a computer. In the coming weeks i will release a couple more tutorials as i learn more about this board. Also, i will definitely trying out Windows 10 on the Raspberry Pi 2 when it comes out next month so stay tuned for that. 

              If you have any questions or problems about the installation process you can ask me in the comments section below of tweet me @TTOT9 and i'll try my best to help you with your question.