Blog
Sunday, 27 January 2013 14:38

My First Raspberry Pi

This is my first Raspberry Pi and here is my hand on experience. Before this, let me show you the specification of my Raspberry Pi. Here I login to Raspberry Pi and list the hardware information:
 
 
Hardware : BCM2708
Revision : 000e
Serial : 0000000084eb15c5
My Raspberry Pi is a Model B 512MB RAM, details as follow:
  • SoC Broadcom BCM2835 (CPU, GPU, DSP, and SDRAM)
  • CPU: 700 MHz ARM1176JZF-S core (ARM11 family)
  • GPU: Broadcom VideoCore IV, OpenGL ES 2.0, 1080p30 h.264/MPEG-4 AVC high-profile decoder
  • Memory (SDRAM): 512 Megabytes (MiB)
  • Video outputs: Composite RCA, HDMI
  • Audio outputs: 3.5 mm jack, HDMI
  • Onboard storage: SD, MMC, SDIO card slot
  • 10/100 Ethernet RJ45 onboard network
  • Storage via SD/ MMC/ SDIO card slot

Preparing the image file
Raspberry Pi must boot from SD card which the bootloader is installed. I'm download the Raspbian “wheezy” (Debian-based Linux distro) image file from official homepage which is recommended by Raspbian Pi.
 
To write the image file to SD card I'm using Image Writer for Windows (Win32DiskImager)


Writing image file to SD card
  • Insert a SD card (I'm using 8GB SD) to the computer.
  • Download the Raspbian image file and save it to any location of computer
  • Extract the zip file (2012-12-16-wheezy-raspbian.zip 495,214KB) which include the 2012-12-16-wheezy-raspbian.img file to any location
  • Download Win32DiskImager and extract it to any location
  • Run Win32DiskImager by double click Win32DiskImager.exe
  • Select the correct drive from Device and choose the 2012-12-16-wheezy-raspbian.img as shown in
  • figure below
Win32 Disk Imager 
  • Click on Write button to start writing image file to SD card
  • Remove the SD card from computer once writing completed.

Connecting the Raspberry Pi
According to the Raspberry Pi datasheet, it should not connect the power to the USB port of computer since it draw about 700ma while computer USB port can only provide 500ma max. So I use my own Samsung handphone charger as the supply for Raspberry Pi.
 
I'm using an AV cable (RCA) to connect the Raspberry Pi video output to my Samsung TV (AV1 input) which does not have HDMI input.
 
Finally insert the SD card to the slot and a USB keyboard is used to connect to the USB port of Raspberry Pi.
 

Booting and Launching desktop GUI
  • Turn on the power, wait about 40 seconds to let the Raspberry Pi booting up
  • A configuration menu shoud appear and you should make your own selection

Raspberry Pi Configuration

 

  • You should enable SSH from the menu (SSH is enabled by default, you don't have to change this). In the future, you still able to enable SSH from terminal command line with the following code.
sudo apt-get install ssh #this line may not require
sudo /etc/init.d/ssh start
sudo update-rc.d ssh defaults
  • Select Finish after making all the selections
  • Raspberry Pi should launch the terminal command line
  • Enter startx to launch the LXDE desktop GUI (Graphical User Interface), it takes about 10 seconds to show the following screen.
Raspberry Pi Graphical User Interface
 
 

Determine the IP address
Raspberry Pi (Raspbian) does not have an static IP address, it is set to DHCP by default, you should get your Raspberry Pi IP address before you continue the rest of steps. 
 
There are any many ways to determine the IP address of Raspberry Pi. You can login to Raspberry Pi and enter ifconfig to the terminal command line. It should look like this:
[email protected] ~ $ ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:eb:15:c5
inet addr:192.168.0.223 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:244 errors:0 dropped:0 overruns:0 frame:0
TX packets:244 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:18766 (18.3 KiB) TX bytes:29921 (29.2 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
 
I personally like to use net scanner to get IP address without sitting infront of the device.
  • Download and run SoftPert Network Scanner
  • Select Options>IP address>Detect Local IP Range from menu as shown in figure below
Network Scanner Detect Local IP Range
 
  • Select your network's IP ranage. I'm select 192.168.0.138 for my IP as shown in figure below
Network Scanner Select Network IP address
 
  • Click on Start Scanning icon to start the scanner
  • Figure below shows the detected IP address from my local area network, the IP address of Raspberry Pi is detected as 192.168.0.223
SoftPerfect Network Scanner
 
 
SSH to Raspberry Pi
Once you had enable SSH, you can access your Raspberry Pi from other computer over network.
  • Turn of the Raspberry Pi
  • Remove keyboard and AV cable from Raspberry Pi
  • Connect a network cable to Raspberry Pi
  • Turn on Raspberry Pi
  • Waiting Raspberry Pi to booting up
  • Download and install PuTTY
  • Login Raspberry Pi using PuTTY as shown in figure below (remember to use your own Raspberry Pi IP address)

PuTTY

  • Enter pi for login user
  • Enter raspberry for password and it should look like this

login as: pi
This email address is being protected from spambots. You need JavaScript enabled to view it.'">This email address is being protected from spambots. You need JavaScript enabled to view it.';s password:
Linux raspberrypi 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Jan 27 06:18:46 2013 from toshiba.lan 

  • You are logged in to Raspberry Pi
 
Enable and Disable root password
You may want to login as root, but I would not encourage
sudo passwd root
 
You may want to remove root password if you had enabled login as root
sudo passwd -l root


Installing TightVNC
If you want to take full control of your Raspberry Pi with GUI over network, TightVNC is a good software.
SSH to Raspberry Pi and enter command below to start installing TightVNC
sudo apt-get update
sudo apt-get install tightvncserver
 
Create a file /etc/init.d/tightvncserver with the following content. I borrowed this code from http://www.penguintutor.com/linux/tightvnc

#!/bin/sh
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop tightvncserver
### END INIT INFO

### Customize this entry

# Set the USER variable to the name of the user to start tightvncserver under
export USER='pi'
### End customization required

eval cd ~$USER

case "$1" in
start)
su $USER -c '/usr/bin/tightvncserver :1'
echo "Starting TightVNC server for $USER "
;;
stop)
pkill Xtightvnc
echo "Tightvncserver stopped"
;;
*)
echo "Usage: /etc/init.d/tightvncserver {start|stop}"
exit 1
;;
esac
exit 0

 
You may not access to /etc/init.d without login as root, hence you have to use method below to transfer file from /tmp folder to /etc/init.d folder.
  • Save the above file (tightvncserver) to /tmp folder of Raspberry Pi, I'm using WinSCP
  • Using command below to move tightvncserver file from /tmp folder to /etc/init.d folder
sudo mv /tmp/tightvncserver /etc/init.d/tightvncserver
You should have tightvncserver in /etc/init.d as shown in figure below
WinSCP

The file /etc/init.d/tightvncserver must owned by root
sudo chown root:root /etc/init.d/tightvncserver
 
Make the file executable
sudo chmod 755 /etc/init.d/tightvncserver
 
Run the file on every reboot
sudo update-rc.d tightvncserver defaults
 
To start TightVNCserver manually
sudo /etc/init.d/tightvncserver start
 
To stop TightVNCserver manually
sudo /etc/init.d/tightvncserver stop
 

Dwonload/Installing and Running TightVNC viewer
  • Dwonload TightVNC from http://www.tightvnc.com/
  • Install TightVNC Viewer (Tightvnc server is not necessary)
  • Launch TightVNC Viewer, picture below shows the TightVNC connection screen
 TightVNC Connection
 
Read 9798 times Last modified on Tuesday, 10 June 2014 23:48

Leave a comment