HTML5: Best viewed in Mozilla Firefox.

This page will be moved to a new location: DCIUX

Header image

RPIsPLC.

Simple Raspberry Pi PLC.

How to configure Raspberry Pi.

How to configure raspberry Pi.

Last modified: De Coninck Ivo

You need the following parts.
- Raspberry Pi Version 2.
- Micro USB Power Cable (+700mA). A micro USB cable or phone charger.
- Network cable/connection to the Internet.
- SDcard with Wheezy. We'll be installing the Raspbian "wheezy" Debian Linux distribution for Raspberry Pi.

First run.

Last modified:

We'll be using the Debian Raspbian "wheezy" Linux distribution.
The default username and password:
Username: pi
Password: raspberry
Make sure the SD card is inserted and the Pi is connected to the network.
Now connect the power.
Open a terminal window from a Ubuntu PC (ctrl-alt-t).

First displays the status of the currently active interfaces.
xxx@aspireI7:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:26:22:56:df:ea
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::226:22ff:fe56:dfea/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:48397 errors:0 dropped:0 overruns:0 frame:0
TX packets:40626 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:49765386 (49.7 MB) TX bytes:6254215 (6.2 MB)
Interrupt:16

Discover IP address of all devices on LAN network:
xxx@aspireI7:~$ sudo nmap -PR -sP 192.168.1.0/24
Starting Nmap 5.21 ( http://nmap.org ) at 2014-02-18 15:39 CET
Nmap scan report for 192.168.1.1
Host is up (0.00038s latency).
MAC Address: 98:FC:11:9C:FB:23 (Unknown)
Nmap scan report for 192.168.1.100
Host is up (0.00049s latency).
MAC Address: 3C:4A:92:17:FF:72 (Unknown)
Nmap scan report for 192.168.1.101
Host is up.
Nmap scan report for docsite (192.168.1.102)
Host is up (0.00081s latency).
MAC Address: B8:27:EB:A1:D7:AE (Unknown)
Nmap done: 256 IP addresses (4 hosts up) scanned in 4.49 seconds

Address 192.168.1.102 unknown to me, think this is the Raspberry Pi.
Using SSH to Connect to Raspberry Pi (standard user: pi):
sudo ssh pi@192.168.1.102

rpi.first.login.png
Fig1. - First login from ubuntu desktop.

Top

Updating and Upgrading.

Last modified:

The software on this Raspberry Pi has not been fully configured, run 'sudo raspi-config'.
pi@raspberrypi ~ $
Start 'sudo raspi-config'
pi@raspberrypi ~ $ sudo raspi-config
Click the option: Expanding the File System.

raspi-config.png
Fig2. - Raspberry Pi Configuration Tool.

Updating and Upgrading Debian Raspbian "wheezy".
Make sure you have an internet connection and run the following command. It may take a few minutes.
pi@raspberrypi ~ $ sudo apt-get update
Followed by:
pi@raspberrypi ~ $ sudo apt-get upgrade

Top

Configure Network Settings on Raspberry Pi Hardware.

Last modified:

Set new hostname (your own choice):
pi@raspberrypi ~ $ sudo hostname mypi

Check new hostname:
pi@raspberrypi ~ $ hostname
raspberrypi

Giving the Raspberry Pi a Static IP Address.
Example: 192.168.1.222 (easy to remember).

Change text in /etc/network/interfaces
iface lo inet loopback
iface eth0 inet dhcp
To:
iface lo inet loopback
iface eth0 inet static
address 192.168.1.222
netmask 255.255.255.0
gateway 192.168.1.1
Type in the Ubuntu terminal window:
pi@raspberrypi ~ $ sudo nano /etc/network/interfaces

This will bring up the network interface configuration file in the nano text editor.
sudo allows a permitted user to execute a command as the superuser or another user.
You see the following text:
auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Change this to IP details you got from ifconfig:

terminal.nano.static.ip.png
Fig3. - Nano text editor and /etc/network/interfaces.

Use Ctrl X to exit. Hit Y when prompted to save.
Now check your modifications!
Else you can not login to the Raspberry Pi from the Ubuntu machine via an ssh connection.
pi@raspberrypi ~ $ cat /etc/network/interfaces

terminal.cat.netwerk.interfaces.png
Fig3. - View /etc/netwerk/interfaces.

Now reboot the Raspberry Pi.

terminal.first.reboot.png
Fig4. - Raspberry Pi terminal first reboot.

SSH connection to Ubuntu terminal is lost.
Connect again to the RPi via ssh:
ivo@aspireI7:~$ ssh pi@192.168.1.222

terminal.login.png
Fig5. - Raspberry Pi second login.

Now your Raspberry Pi will always have the same IP address.

< Previous - - - Next >

Top

Leave a Message.