Difference: Lecture6:BringingTheRaspberryPiToLife (2 vs. 3)

Revision 32017-09-19 - uli

Line: 1 to 1
 
META TOPICPARENT name="LectureSlides"

Start Presentation

Slide 1: The Raspberry Pi and how to bring it to life

Line: 40 to 40
 

Currently available OS

Changed:
<
<
  • Raspbian, a Debian variant of Linux tailored to the Raspberry Pi.

  • It contains most of the software packages you also find on Ubuntu

    The Desktop is however stripped down to make it more

    responsive on a processor that cannot cope with the speed of a PC

    This is what we are using!

  • Ubuntu Mate is a Ubuntu variant for the Pi

  • Windows 10 IOT core, a windows variant. I have never tried this but

    Windows gurus may give it a try if they cannot live without Windows on the Pi

  • Android: There are several Android versions for the Pi floating

    around on the WEB. Your success on these may vary

  • Kodi is a multimedia server that will allow you to listen to music,

    look at photos or watch films. Connect your Pi to a TV set

    (through the HDMI connector) and a stereo and off you go!
>
>
  • Raspbian, a Debian variant of Linux tailored to the Raspberry Pi.
  • It contains most of the software packages you also find on Ubuntu
    The Desktop is however stripped down to make it more
    responsive on a processor that cannot cope with the speed of a PC
    This is what we are using!
  • Ubuntu Mate is a Ubuntu variant for the Pi
  • Windows 10 IOT core, a windows variant. I have never tried this but
    Windows gurus may give it a try if they cannot live without Windows on the Pi
  • Android: There are several Android versions for the Pi floating
    around on the WEB. Your success on these may vary
  • Kodi is a multimedia server that will allow you to listen to music,
    look at photos or watch films. Connect your Pi to a TV set
    (through the HDMI connector) and a stereo and off you go!
 If this is not enough for your then search the WEB for more.

Line: 63 to 63
  Around the CPU there are plenty of interfaces
Changed:
<
<
To know the details (the interfaces only!) have a look at the data sheet explaining them (205 pages!)
>
>
To know the details (the interfaces only!) have a look

at the data sheet explaining them (205 pages!)

 

BCM2835 peripherals

Changed:
<
<
Here are some of the Raspberry Pi peripherals:
>
>
Here are some of the Raspberry Pi peripherals:

 
  • UART
  • SPI
  • BSC (serial controller)
Line: 84 to 86
 

Raspberry Pi and the real world

You can easily connect

Changed:
<
<
  • General Purpose Input Output signals

  • These are 3.3 V single pin signals used e.g. to drive a LED,

    a relay or any other device needing a digital signal level

  • You can program it input or output

    • With pull-ups or pull-downs

    • To read switch state

>
>
  • General Purpose Input Output signals
  • These are 3.3 V single pin signals used e.g. to drive a LED,
    a relay or any other device needing a digital signal level
  • You can program it input or output
    • With pull-ups or pull-downs
    • To read switch state
 
    • To drive a 3.3V output level (and light a LED)

Line: 102 to 104
 short distance interfacing. Many devices having a I2C port

are available and we will program a few:

Changed:
<
<
  • ADC

  • DAC

  • Real time clock

  • EEPROM

  • We also have a 2-line LCD display needing some 8 signals

    (+ power and gnd). A serial to parallel interface (shift register)

    with I2C interface eases the connection to the Raspberry Pi

    as only 4 serial signal lines are needed: SDA, SCL,Vcc, gnd
>
>
  • ADC
  • DAC
  • Real time clock
  • EEPROM
  • We also have a 2-line LCD display needing some 8 signals
    (+ power and gnd). A serial to parallel interface (shift register)
    with I2C interface eases the connection to the Raspberry Pi
    as only 4 serial signal lines are needed: SDA, SCL, Vcc, Gnd

More interfaces

There are more interfaces which we will not necessarily use during the course.

Students who think that they do not learn enough during this course

are invited to come forward.

We can easily give you more exercises, e.g to make

  • The camera
  • The touch screen interface
  • The audio system
  • Or the video system work

What you need to bring a RPI to life

This is what you will need to bring a Raspberry Pi to life:

  • The Raspberry Pi board
  • A case (this increases the chances the Pi will survive for more than a week)
  • A 5V, 2.5A power supply with micro USB connector
  • A USB keyboard and USB mouse
  • A screen with HDMI connection of HDMI to VGA adapter
Once the Raspberry Pi is up and running you can replace the screen,

keyboard and mouse with your laptop or other computer

and access the Pi through a remote desktop.

The software

Go to the Raspberry Pi download page and download the

Raspbian image. It comes in 2 versions

  • NOOBS which contains the system itself + an installer
  • Raspbian proper. This version may be slightly more difficult to install
    because it does not have the installer, which you would keep on your
    SD card even though after its first use you don’t need it any more
This will get you a zip file, normally downloaded to your

$HOME/Downloads directory.

Since at Internet speeds that we experience at UCC this takes more than

1 hour to download we will distribute the zip file to all the PCs

How to extract the file system on Ubuntu?

Once downloaded we must first unzip the file:

Create a folder /opt/ucc/micros/raspberry and copy the zip file into it

cd /opt/ucc/micros/raspberry

cp ~/Downloads/2017-09-07-raspbian-stretch.zip .

unzip 2017-09-07-raspbian-stretch.zip which will give you

2017-09-07-raspbian-stretch.img

This is the file system image which will be copied to the SD card

bit by bit using the dd command

Structure of the image file

Can we know what is inside this image?

raspbianImage.png

We see that there are 2 disk partitions:

  • a FAT32 (Windows type) partition. This is the boot partition
  • a Linux (ext4) partition which is the root file system

Looking inside the partitions

This is something only root (the superuser) can do

We loop mount the file system:

loopMount.png

Now we can copy the contents to whatever directory we want

This is the boot partition

Then we can do the same thing for the root partition

The root partition

Once we mount the second partition the same way we see that it contains:

raspbianRoot.png

something we have seen before on our Ubuntu PC

The boot partition we have seen before is mounted on

/boot in this partition

How to get the OS onto the Raspberry Pi?

Now we have the OS on the PC where it does not help us much!

We must put it onto a media that can be read by the Rpi.

Traditionally this was the micro SD card

but you can also use certain types of USB memory sticks

(Be careful, not all sticks will work! I use a SanDisk cruzer)

Copying the OS to the SD card

If your PC has an SD card reader then you put the

micro SD card into a normal SD card holder.

Otherwise there are microSD to USB converters

First check which disks you have on you system:

whichDisks.png

Then you plug in your microSD adapter or your USB adapter

and do the same thing again

You should see 2 additional partitions, in my case probably

/dev/sdc /dev/sdc1 /dev/sdc2

Copy the OS

Now we are ready to copy the operating system to the SD card (or USB stick)

dd.png

Where X is the disk letter (in our case “c”)

This may well take several minutes (the image is some 1.6 Gbytes!)

To see the progress:

ddProgress.png

The moment of truth

Safely remove the SD card from your system (unmount if mounted!)

Put it into the SD card slot of the Pi

Power on th machine

With a little bit of luck, it should boot

For more details of installing Raspbian on the SD card using a Linux system see

https://www.raspberrypi.org/documentation/installation/installing-images/linux.md

First login

Raspbian has a default user named

  • pi
  • with password raspberry (which must be changed
    immediately for security reasons!)
Create your own user and add him to the sudo group:

adduser uli and follow the instructions on the screen

usermod -a -G sudo uli

Then login with this new login name and

upgrade the system to the latest revision of all programs:

sudo apt update

sudo apt upgrade or sudo apt dist-upgrade

 

Added:
>
>

Adding software packages

Once you have come this far you may want to add

additional software packages, emacs being one of them

You will continue adding packages as you use the system

and you will see what is missing.

Configuring the system

We have seen that the system image takes 1.6 Gbytes our SD card

however provides 32 Gbytes. How to use it to its full capacity?

Start raspi-config (which is a program dedicated to the Raspberry

and does not exists und PC Ubuntu)

raspi-config.png

Go through all the options of the program and see if they make sense to you.

  %SLIDESHOWEND%
Line: 120 to 328
 
META FILEATTACHMENT attachment="raspberry.png" attr="" comment="" date="1505378307" name="raspberry.png" path="raspberry.png" size="103409" user="uli" version="1"
META FILEATTACHMENT attachment="cobbler.png" attr="" comment="" date="1505378307" name="cobbler.png" path="cobbler.png" size="61724" user="uli" version="1"
Changed:
<
<
META FILEATTACHMENT attachment="loopMount.png" attr="" comment="" date="1505378308" name="loopMount.png" path="loopMount.png" size="29538" user="uli" version="1"
META FILEATTACHMENT attachment="raspbianImage.png" attr="" comment="" date="1505378308" name="raspbianImage.png" path="raspbianImage.png" size="32423" user="uli" version="1"
>
>
META FILEATTACHMENT attachment="loopMount.png" attr="" comment="" date="1505808893" name="loopMount.png" path="loopMount.png" size="29538" user="uli" version="1"
META FILEATTACHMENT attachment="raspbianImage.png" attr="" comment="" date="1505808894" name="raspbianImage.png" path="raspbianImage.png" size="32423" user="uli" version="1"
 
META FILEATTACHMENT attachment="raspbianRoot.png" attr="" comment="" date="1505378308" name="raspbianRoot.png" path="raspbianRoot.png" size="16644" user="uli" version="1"
Changed:
<
<
META FILEATTACHMENT attachment="raspi-config.png" attr="" comment="" date="1505378308" name="raspi-config.png" path="raspi-config.png" size="76355" user="uli" version="1"
>
>
META FILEATTACHMENT attachment="raspi-config.png" attr="" comment="" date="1505810751" name="raspi-config.png" path="raspi-config.png" size="76355" user="uli" version="1"
 
META FILEATTACHMENT attachment="rpiGPIO.png" attr="" comment="" date="1505378308" name="rpiGPIO.png" path="rpiGPIO.png" size="79322" user="uli" version="1"
META FILEATTACHMENT attachment="rpiSpecs.png" attr="" comment="" date="1505378622" name="rpiSpecs.png" path="rpiSpecs.png" size="30591" user="uli" version="1"
Added:
>
>
META FILEATTACHMENT attachment="whichDisks.png" attr="" comment="" date="1505808933" name="whichDisks.png" path="whichDisks.png" size="7263" user="uli" version="1"
META FILEATTACHMENT attachment="dd.png" attr="" comment="" date="1505810091" name="dd.png" path="dd.png" size="5660" user="uli" version="1"
META FILEATTACHMENT attachment="ddProgress.png" attr="" comment="" date="1505810091" name="ddProgress.png" path="ddProgress.png" size="4503" user="uli" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback