Thursday 13 August 2015

Getting the Raspberry Pi up and running

I received the Raspberry Pi 2 and a 8GB uSD card, along with the WiFi dongle I ordered. The dongle is Edimax EW-7811Un. Let's get this thing up an running.

Step 1 - Image the SD card

I needed to image the SD card with the Raspbian Linux distro. I followed the official instructions. Get the latest distro image from raspberrypi.org/downloads and use the simple Win32DiskImager tool to write it to the SD volume.

Step 2 - Booting

I hooked up the Rasperry Pi to a HDMI monitor and a USB KVM-switch to get mouse/keyboard input, inserted the SD card and USB WiFi dongle, then powered on using the provided 5V AC/DC micro USB adaptor.

The Pi quickly boots and you end up on the raspi-config console UI. You may want to:
  1. Change the default password for the Pi user.
  2. Enable SSH from the advanced menu (will use that to remotely log in the Pi)
  3. Enable I2C from the advanced menu (will need that when we start playing with I2C ICs)
  4. Exit, reboot and login as Pi user
Step 3 - Configure WiFi

First thing first, we need network access. Let's make sure that the OS sees the EDIMAX dongle.
dmesg | more
Somewhere in the output you should see a line that says "802.11n WLAN Adapter".
Then edit the network settings:
sudo nano /etc/network/interfaces
Modify the file to look like this:
auto lo
iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0

iface wlan0 inet dhcp
   wpa-ssid "Your Network SSID"
   wpa-psk "Your Password"
Reload the network configuration
sudo service networking reload
Check the status of the WiFi connection and make sure you have a valid IP address
ifconfig
I then reserved the IP address of the Pi in the router configuration so that it never changes after reboots.

Step 4 - Configuring SSH

In order to remotely work on the Pi, you need to start the SSH service and have it run on boot.
sudo /etc/init.d/ssh start
sudo update-rc.d ssh defaults
sudo reboot
Going forward I'll use SSH to work directly from my workstation and remotely log in the Pi. If you're on Windows, you can download Putty as your SSH client.


Step 5 - Updates

Finally, let's update the packages and the firmware:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get clean

sudo rpi-update
sudo ldconfig
sudo reboot

Resources

No comments: