2.Accessing the Pi

31
Pi Maker Workshop Powered by: 2.Accessing the Pi http://www.inventrom.com/ http://www.robotechlabs.com/ Mayank Joneja botmayank.wordpress.com [email protected]

description

This is a part of the slide set used at the MakerSpace Noida (India) launch event, Pi Maker Workshop. This slide set is designed to help people get started with the Raspberry Pi and also serves as a collection of innovative projects and some core basic concepts that can aid anybody with their first few steps into the world of DIY electronics or maybe serve as a refresher for the experienced. Feel free to refer and share but please don't alter the watermarks :)

Transcript of 2.Accessing the Pi

Page 1: 2.Accessing the Pi

Pi Maker

Workshop

Powered by:

2.Accessing the Pi

http://www.inventrom.com/http://www.robotechlabs.com/

Mayank Jonejabotmayank.wordpress.com

[email protected]

Page 2: 2.Accessing the Pi

Mayank Joneja

Operating Systems

Many OSs (linux variants)

Most common one is Raspbian “wheezy”

Raspbian is a free operating system based on Debian and optimized for the Raspberry Pi hardware

Other possible OS include: Arch Linux, ARCOs, RiscOS, Bodhi Linux ports etc

Media Center operating Systems based on XBMC include Raspbmc, OpenELEC as well

Android is supported for the Raspberry Pi, however given the limited hardware specs, it works really slowly.

Source code: https://github.com/Razdroid/userland

Wiki: https://razdroid.net/

No Windows support (:P)

Page 3: 2.Accessing the Pi

Mayank Joneja

Popular Variants for the Raspberry Pi

http://www.makeuseof.com/tag/7-operating-

systems-you-can-run-with-raspberry-pi/

Page 4: 2.Accessing the Pi

Mayank Joneja

OS Structure

Hardware does the actual computing

To interact with hardware the instructions need to

be translated to 1’s and 0’s (Punch cards in the

good ol’ days anyone? )

The Kernel converts the High level instructions to

Low level ones i.e assembly level language (eg.

MV AX, BX)

Shell is used to command the kernel to do a

particular task

Page 5: 2.Accessing the Pi

Mayank Joneja

The application layer is available to us in the form of the Graphical User Interface

(GUI)

Sits on the top of the chain

Converts graphical inputs into shell commands

Many times the least important for developers

There is always a shell command for every GUI action but the converse is not true.

Eg.

Ifconfig, ping

Page 6: 2.Accessing the Pi

Mayank Joneja

NOOBS-New Out of the Box Setup

NOOBS is a way to make setting up the RasPi for the first time much easier

You won’t need network access and you won’t need to download any special imaging

software

Just head to the http://www,raspberrypi.org/downloads page, grab a copy of the NOOBS

zip file, and unpack it onto a freshly formatted SD Card

When you boot up for the first time, you’ll see a menu prompting you to install one of the

several operating systems into the free space on the card

The choice means you can boot the Pi with a regular operating system like Raspbian or

with a media centre specific OS like RaspBMC

https://www.youtube.com/watch?v=TyFDaMpdh2c&list

=TLiwsXqzVYEWQk6pVkT9xd8eN0tq10H7ps

Geek Gurl Diaries on

YouTube

Page 7: 2.Accessing the Pi

Mayank Joneja

SSH

Secure Shell (SSH) is a network protocol used for

Secure data communication

Remote command-line login

Remote command execution

It is done via a secure channel over an insecure network

Needs a server and a client (running SSH server and SSH

client programs respectively)

Page 8: 2.Accessing the Pi

Mayank Joneja

PuTTY

One of the most popular SSH clients, also the one that we

use

Free and open source terminal emulator

Serial console and network file transfer application

It supports several network protocols, including SCP, SSH,

Telnet and rlogin

Link to download PuTTY:

http://www.chiark.greenend.org.uk/~sgtatham/putty/downl

oad.html

Sessions

Page 9: 2.Accessing the Pi

Mayank Joneja

Advanced IP Scanner

Install an IP Scanner

Need to know the IP for accessing

the Pi via PuTTY

Enter the correct IP address of the Pi

assigned to your team in PuTTY

Page 10: 2.Accessing the Pi

Mayank Joneja

Login to the Pi

Username: pi

Password: raspberry

Page 11: 2.Accessing the Pi

Mayank Joneja

Command Line Interface

Gives better access over hardware to do all the awesome things you want

Is more prominently used in Linux through Terminal, however Command Line Access is available in almost all devices through some form of a console, even smart TVs

On windows machines, one can access it by going toStart->Run->cmd

Page 12: 2.Accessing the Pi

Mayank Joneja

Popular UNIX commands

sudo date or date : Displays the current date and time

startx : Launches the GUI (X server)

[ctrl+c] : breaks the script

hostname –l : Displays your IP address

free : Shows how much memory space is available

ls : Shows list of files in that directory (or folder in Windows)

cat filename : Shows content of file “filename”

rm filename : Remove or delete the file (Please don’t try this right now :D)

sudo mkdir directoryname : Create a new directory

Page 13: 2.Accessing the Pi

Mayank Joneja

cd directory name : change directory eg. cd /boot ( in UNIX, ‘.’ refers to current

dir, ‘..’ refers to prev dir, therefore, to go one level up, “cd ..”

cd : parent directory

nano filename : Opens file in “nano”, a Linux command line editor that opens up

inside the PuTTY window or the Terminal itself

* : wildcard, eg. ls d*

sudo apt-get update : Downloads the package lists from the repositories and

“updates” them to get information on the newest version of packages and their

dependencies.

sudo apt-get upgrade : Downloads the actual new versions of the packages

based on the lists fetched by the previous command.

Page 14: 2.Accessing the Pi

Mayank Joneja

Yeh Sudo Sudo kya hai?

sudo is an abbreviation of “super user do” and is a Linux command

that allows programs to be executed as a super user (aka root user)

or another user. It's basically the Linux/Mac equivalent of the runas

command in Windows.

It allows you to make changes that affect the complete system and

not just one user

Some programs or commands require root access, or do not work

until they are preceded by “sudo”

It’s the equivalent of Run as Administrator on Windows

Page 15: 2.Accessing the Pi

Mayank Joneja

Easter Eggs!

An Easter egg is an intentional inside joke, hidden message, or feature in a work such as a computer program

Here are a few that are really fun as featured in a post by Inventromhttp://inventrom.wordpress.com/2014/07/11/easter-eggs-in-raspberry-pi/

1. sudo apt-get moo

2. sudo apt-get install slsl

3. sudo apt-get install vimvim:help 42

Page 16: 2.Accessing the Pi

Mayank Joneja

4. sudo apt-get install emacs

emacs

[Esc]+[x]

doctor

tetris

life

5. sudo apt-get install cowsay

cowsay –f stegosaurus “Mooah”

6. sudo apt-get install fortune

fortune | cowsay

fortune | cowsay –f tux

7. sudo apt-get install telnet

Page 17: 2.Accessing the Pi

Mayank Joneja

File access through Samba

Back in the 1990s, Microsoft developed a protocol that allows one Windows machine to

access the files and folders on another Windows machine.

The protocol, which is known as the Common Internet File System (CIFS) – but

was originally called Server Message Block (SMB), has been implemented on other

operating systems including Linux.

The most popular implementation is known as Samba and it allows devices like the

Raspberry Pi to act as a CIFS file server. To put it another way, it allows a Windows PC to

mount a folder on a Raspberry Pi and then copy, delete, read and write files on the it.

Page 18: 2.Accessing the Pi

Mayank Joneja

File access through Samba

sudo apt-get install samba samba-common-bin

sudo nano /etc/samba/smb.conf

Find the line “# security = user” and UNCOMMENT it (remove the hash)

Scroll down to the [Homes] section and change read only = yes to read only = no

[Ctrl+X] to leave the nano editor and then [Y] to confirm that the file should be saved, then press [Enter]

sudo service samba restart

sudo service samba reload

sudo smbpasswd –a pi

Page 19: 2.Accessing the Pi

Mayank Joneja

You can now connect to your Raspberry Pi from a Windows machine. Open the

“Computer” window (on Windows 7 ) or “This PC” (on Windows 8) and click the “Map

Network Drive” button on the toolbar (Windows 7) or click the “Map Network Drive” button

under “Computer” (on Windows 8 ).

In the Map Network Drive dialog, select and unused drive letter from the “Drive:” drop-

down list and enter \\raspberrypi\pi in the “Folder:” field. Check “Connect using different

credentials” and click “Finish”.

Enter pi in the Username field when you are asked to enter the network credentials. Enter

the password you set previously in the password field and click OK.

Page 20: 2.Accessing the Pi

Mayank Joneja

Once connected, you can access

the files on the Pi like any other

directory on your harddisk

http://www.maketecheasier.com/

turn-raspberry-pi-into-file-server/

Page 21: 2.Accessing the Pi

Mayank Joneja

Virtual Network Computing (VNC)

In computing, Virtual Network Computing (VNC) is a graphical

desktop sharing system

Uses the Remote Frame Buffer protocol (RFB) to remotely control

another computer

Transmits the keyboard and mouse events from one computer to

another relaying the graphical screen updates back in the other

direction over a network

Page 22: 2.Accessing the Pi

Mayank Joneja

TightVNC

Tight VNC is a free remote control

software package

sudo apt-get install tightvncserver

tightvncserver (configure password)

vncserver :1 –geometry 1024x768 –

depth 24 (Starts a session on VNC display zero

(:1) with full HD resolution

Page 23: 2.Accessing the Pi

Mayank Joneja

Accessing the VNC Server

On Windows:

Run VNC Viewer

Enter IP Address:session eg. 192.168.1.4:1

Over Android

Download Juice SSH ( similar to PuTTY) for command line access

Download VNC Viewer (by RealVNC Limited) or some similar app

Over iOS

Download VNC Client app

For Chrome

VNC Viewer for Google Chrome extension by RealVNC

Page 24: 2.Accessing the Pi

Mayank Joneja

OMXPlayer

OMXPlayer is a commandline OMX player to play videos and audio for the

Raspberry PI.

It was developed as a testbed for the XBMC Raspberry PI implementation and is

quite handy to use standalone.

http://omxplayer.sconde.net/

sudo apt-get update

sudo apt-get -y install omxplayer

To play a video: omxplayer myvideo.mp4

omxplayer –o hdmi myvideo.mp4 to force the audio over the HDMI interface

Page 25: 2.Accessing the Pi

Mayank Joneja

OMXPlayer Commands

Page 26: 2.Accessing the Pi

Mayank Joneja

Troubleshoot: No sound over HDMI

cd /boot

sudo nano config.txt

hdmi_drive=2 should be uncommented for the sound to run

through the HDMI

Page 27: 2.Accessing the Pi

Mayank Joneja

RasPi Dynamic Bike Headlight

https://www.youtube.com/watch?v=Nfk1-XMASrk

Page 28: 2.Accessing the Pi

Mayank Joneja

Linux Commands List

Page 29: 2.Accessing the Pi

Mayank Joneja

Page 30: 2.Accessing the Pi

Mayank Joneja

Page 31: 2.Accessing the Pi

Mayank Joneja