Getting started with Raspberry Pi: Difference between revisions

From ICO wiki
Jump to navigationJump to search
No edit summary
Line 5: Line 5:
Before you continue make sure you're comfortable with basic command-line usage, if that's not the case take a look at  
Before you continue make sure you're comfortable with basic command-line usage, if that's not the case take a look at  
[https://www.codecademy.com/en/courses/learn-the-command-line/ CodeAcademy track for learning command line].
[https://www.codecademy.com/en/courses/learn-the-command-line/ CodeAcademy track for learning command line].


=Preparing SD card=
=Preparing SD card=
Line 35: Line 36:
  minicom -b 115200 -o -D /dev/ttyUSB0
  minicom -b 115200 -o -D /dev/ttyUSB0


For Windows you need to install driver for your USB-UART bridge first
For Windows you need to install [http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=225&pcid=41 driver for your USB-UART bridge] first.
[http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=225&pcid=41].
Then you can use built-in HyperTerminal, [http://www.putty.org/ PuTTY] or [http://www.9bis.net/kitty/ KiTTY] for connecting to the virtual serial port.
Then you can use built-in HyperTerminal, [http://www.putty.org/ PuTTY] or [http://www.9bis.net/kitty/ KiTTY] for connecting to the virtual serial port.


Line 47: Line 47:
The networking configuration is stored in [https://wiki.debian.org/NetworkConfiguration#Setting_up_an_Ethernet_Interface /etc/network/interfaces],
The networking configuration is stored in [https://wiki.debian.org/NetworkConfiguration#Setting_up_an_Ethernet_Interface /etc/network/interfaces],
remember to issue <code>service networking restart</code> after you've tweaked the configuration.
remember to issue <code>service networking restart</code> after you've tweaked the configuration.


=Remote shell=
=Remote shell=
Line 55: Line 56:
  apt-get install openssh-server
  apt-get install openssh-server


While connected via USB-UART bridge add your private key to Raspberry Pi as follows:
Assuming Raspberry Pi sits on an DHCP enabled network you can use following on your Linux laptop to connect to remote shell:
 
ssh pi
 
Otherwise determine the IP address of your Raspberry Pi, for example with <code>ip addr list</code>:
 
ssh 192.168.x.x
 
Make your life easier by setting up public key authentication.
Note that while you are connected via USB-UART bridge you can add your public to Raspberry Pi as follows:


  mkdir -p /root/.ssh
  mkdir -p /root/.ssh
Line 62: Line 72:
  # Press Ctrl-D
  # Press Ctrl-D


Assuming Raspberry Pi sits on an DHCP enabled network you can use following on your Linux laptop to connect to remote shell:


ssh pi
=Beyond installation=


Otherwise determine the IP address of your Raspberry Pi, for example with <code>ip addr list</code>:
Once you are comfortable with Raspberry Pi command line and SSH you can do a lot of cool stuff:


ssh 192.168.x.x
* Set up [https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=11124 PulseAudio network sink] and use Raspberry Pi as wireless speakers.
* Set up [http://www.instructables.com/id/Raspberry-Pi-as-low-cost-HD-surveillance-camera/step7/Installing-the-motion-detection-software/ motion] and use Raspberry Pi with USB webcam as a IP camera.
* Set up [http://lauri.vosandi.com/lan/hostapd.html hostapd] and [http://lauri.vosandi.com/lan/dnsmasq.html] and turn your Raspberry Pi into a wireless hotspot.

Revision as of 08:58, 6 September 2015

Raspberry Pi is a credit-card sized single-board computer which can be used for variety of purposes. The official operating system for Raspberry Pi is Raspbian. Rasbian and Ubuntu both are derived from Debian, providing seamless access to thousands of software package ready to go via Advanced Packaging Tool. Compared to other similar single-board computers Raspberry Pi has vibrant community and plenty of code examples that you can run out of the box. Before you continue make sure you're comfortable with basic command-line usage, if that's not the case take a look at CodeAcademy track for learning command line.


Preparing SD card

Before you continue make sure you have backed up any important data on the SD-card

Download and uncompress Raspbian:

wget https://downloads.raspberrypi.org/raspbian/images/raspbian-2015-05-07/2015-05-05-raspbian-wheezy.zip
unzip 2015-05-05-raspbian-wheezy.zip

For Linux there is no need to fetch extra tools to write the image to a SD card, simply use dd:

 sudo dd bs=4M if=2015-05-05-raspbian-wheezy.img of=/dev/mmcblk0

If you're running on Windows, you can use Win32 Disk Imager to write the image to the SD card.


Powering up

Use USB-UART bridge to power up Raspberry Pi and gain access to the command-line.


Accessing command-line

For Linux there are variety of programs for connecting to serial port:

screen /dev/ttyUSB0 115200
picocom /dev/ttyUSB0 -b 115200
minicom -b 115200 -o -D /dev/ttyUSB0

For Windows you need to install driver for your USB-UART bridge first. Then you can use built-in HyperTerminal, PuTTY or KiTTY for connecting to the virtual serial port.


Setting up network

Raspbian as Debian attempts to request IP address using DHCP on the Ethernet port. This assumes a functioning DHCP server on the network, which is the case most of the time. If you want to connect your laptop directly to the Raspberry Pi you can set up manual IP addresses. The networking configuration is stored in /etc/network/interfaces, remember to issue service networking restart after you've tweaked the configuration.


Remote shell

For more convenient access to command-line SSH is recommended. You can start by installing OpenSSH server on Raspberry Pi:

apt-get install openssh-server

Assuming Raspberry Pi sits on an DHCP enabled network you can use following on your Linux laptop to connect to remote shell:

ssh pi

Otherwise determine the IP address of your Raspberry Pi, for example with ip addr list:

ssh 192.168.x.x

Make your life easier by setting up public key authentication. Note that while you are connected via USB-UART bridge you can add your public to Raspberry Pi as follows:

mkdir -p /root/.ssh
cat - >> /root/.ssh/authorized_keys
# Paste now
# Press Ctrl-D


Beyond installation

Once you are comfortable with Raspberry Pi command line and SSH you can do a lot of cool stuff:

  • Set up PulseAudio network sink and use Raspberry Pi as wireless speakers.
  • Set up motion and use Raspberry Pi with USB webcam as a IP camera.
  • Set up hostapd and [1] and turn your Raspberry Pi into a wireless hotspot.