Owl Circuits Logo

OwlCircuits

Personal Weather Station

A weather station based on the Raspberry Pi

2. Setting up the Raspberry PI

In this section we will look at the basics of getting the Raspberry PI up and running fresh out of the box. It is surprisingly easy to get the |Raspberry PI up and running and serving a web page on a home network. There are ample resources out on the internet if you run into problems. Chances are if something does not work for you, Google it and most likely someone else has fixed a similar problem.

In this phase of the project we want to perform the following with the Raspberry PI:

2.1 Create a SD card with the OS image

The first step is to create a SD card that contains an OS image from the Raspberry PI website. The Raspberry PI boots from the SD card and stores data on the SD card. It has no attached hard drive. I selected an 8G byte SD card to provide enough storage to log data from the weather station.

You will want to download an image from the Raspberry PI downloads page located here

Raspberry PI downloads page

I selected the "Raspbian Debian Wheezy" install. You can't just put the file on the SD card, it won't work. You need to image the file onto the SD card using an image writing program. To properly image the OS onto the SD card you need to follow the instructions here:

Installing Raspberry PI OS image onto SD card

The instructions are dependent on the operating system you have on your host machine. If you are using windows, you will need to download win32diskimager, you can find that here:

Win32diskimager

2.2 Power up and boot the Raspberry PI

Now comes the fun part. We need to power up and boot the Raspberry PI. About the only things that can go wrong here are having something connected incorrectly, or not imaging the SD card properly.

You will want to connect the following to the appropriate ports on the Raspberry PI.

  1. USB Keyboard and mouse to the two USB ports
  2. Insert the SD card into the SD slot
  3. Connect a monitor to the HDMI output for the display
  4. Plug Ethernet from your router into the Ethernet jack

Once you have verified your connections, plug power in using the micro USB jack. Power is supplied through this micro USB jack. You can use any micro USB power supply, like a phone charger etc. Make sure that the power supply can supply at least 1 amp. The Raspberry PI uses about 700ma (0.7A).

If all goes well, you should see a bunch of messages on your monitor as the Raspberry PI boots. If it does not boot, check your connections and make sure that you properly imaged your SD card with a valid OS image.

2.3 Login to the Raspberry PI

If all goes well, you should get a prompt like this:

raspberrypi login:

Login with the user name pi and the password raspberry Note that the password is not echoed to the screen

2.4 Update the OS to the latest patches

Now that you have logged in successfully, you will want to update the Raspberry PI to the latest patch level. To do this type the following commands at the prompt

sudo apt-get update
sudo apt-get upgrade

If it asks you for a password, use the same default password raspberry .

2.5 Set a DHCP reservation on your network

Next you want to set your home router to assign the same IP address each time it finds the Raspberry PI on your network. If you don't do this, your Raspberry PI may get a different IP each time, making it difficult to find reliably on your home network.

Login to your home router and look for a setting called DHCP reservation. Select the Raspberry PI from the list of computers on your network and enable a DHCP reservation for it. Pick an IP address in your routers range that is easy to remember. For example 192.168.0.101. Make note of this IP address, you will use it later to remotely login to it.

Reboot the Raspberry PI so that it can get the new IP address. To do this type:

sudo reboot

2.6 Login remotely

Next you will want to be able to login remotely to the Raspberry PI. The easiest way to do this is to download PuTTY for Windows:

PuTTY for Windows

After you have downloaded it, run PuTTY and put the IP address that you set in the DHCP reservation for the Raspberry PI in the host name field. Select SSH as the connection type and click open. The user name and password are the same as before: user name pi , password raspberry .

You should now have a terminal just like the one you had with the monitor and keyboard. Now you don't need the monitor and keyboard attached to the Raspberry PI anymore, you can access it from your laptop or other computer instead.

2.7 Update the timezone

The Raspberry PI reads the time from the internet using a time server. However, by default the timezone is set to UTC time. So if you type date, you will get the current time where the minutes may be correct but the hour is off. To fix this you need to set your default timezone. To do this type:

sudo dpkg-reconfigure tzdata

Follow the on-screen instructions to select your region and nearest city. After this is done, type date and you should see the correct time.

2.8 Install Apache

In order to serve a web page, you will need to install Apache on the Raspberry PI. To do this, simply type:

sudo apt-get install apache2 php5 libapache2-mod-php5

2.9 Change the default web page

By default, Apache installs a default web page that says Hello World. To test that everything is working, we want to change this. Edit the file:

vi /var/www/index.html

Change Hello World to Hello your_name and save the file.

2.10 Test the web page

At this point, if everything is working you should be able to open a web browser on your laptop and go to the IP address you assigned your Raspberry PI and see your web page with your name displayed.

© Copyright 2013-2018 OwlCircuits.com
Page last updated: March 3,2015.

Home | Contact | Privacy Policy