create new tag
view all tags
Start Presentation

The Raspberry Pi

CSC321: Embedded Systems

First Semester 2018/2019


There are several versions of Raspberry Pis available on the market:

  • The first generation (Raspberry Pi 1 Model B) was released in February 2012

  • There is also a simpler and cheaper model A

  • Raspberry Pi 1 Model B+ was released in 2014.

  • Raspberry 2 with more memory was released in 2015

  • Raspberry Pi zero a stripped down version for 5 US$

  • Raspberry Pi zero W same as zero but with WiFi and Bluetooth for 10 US$

  • Raspberry Pi 3 fully equipped model that we will be using was released in 2016

  • Raspberry PI 3 model B+, improved version of B released in 2018

  • Raspberry Pi 4 Model B, Completely upgraded, re-engineered, Faster, more powerful released in 2019

For more information look up the Wikipedia page

Raspberry Pi 3 vs Pi 4 Specifications

Component Pi 3 Pi 4
Instruction Set ARMv8-A (64/32-bit) ARMv8-A 64-bit
System on Chip(SoC) Broadcom BCM2837 Broadcom BCM2711B0
CPU 4◊ Cortex-A53 1.2 GHz quad-core A72 1.5GHz
GPU Broadcom VideoCore IV Broadcom VideoCore VI
RAM 1GB LPDDR2 (900MHz)--shared with GPU 1GB, 2GB, or 4GB LPDDR4 SDRAM
Networking 10/100 Mbit/s Ethernet, 2.4GHz 802.11n wireless 2.4 GHz and 5 GHz 802.11b/g/n/ac wireless LAN
Bluetooth Bluetooth 4.1 Classic, Bluetooth Low Energy Bluetooth 5.0, Bluetooth Low Energy (BLE)
Storage microSD microSD
GPIO 40-pin header, populated 40-pin header, populated
Ports HDMI, 3.5mm analogue audio-video jack,
4◊ USB 2.0, Ethernet,
Camera Serial Interface (CSI),
Display Serial Interface (DSI)
2 ◊ micro-HDMI 2.0, 3.5 mm analogue audio-
video jack, 2 ◊ USB 2.0, 2 ◊ USB 3.0,
Gigabit Ethernet, Camera Serial Interface (CSI),
Display Serial Interface (DSI)

rpi3.png rpi4.png

Operating Systems on the Pi

Raspberry Pi 3 is a full blown computer with the following specifications

  • 64 bit quad core processor

  • 1 Gbyte of RAM

  • 32 Gbyte of SD card (Our Lab Version)

This allows a great deal of flexibility when it comes to operating systems to be installed on the machine


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

  • 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.,

  • Raspbian provides more than a pure OS:
    it comes with over 35,000 packages,
    pre-compiled software bundled in a nice format for easy installation on your Raspberry Pi.

  • Current version is Raspbian Buster(26-09-2019)

  • Raspbian comes pre-installed with plenty of software for education,
    programming and general use. It has Python, Scratch, Sonic Pi, Java, Mathematica and more.

Other OS

  • Ubuntu Mate is an 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 you, then search the WEB for more.

Third Party Operating System



  • The CPU has got an ARM processor core with 4 64 bit CPUs

  • The operating system and the Linux kernel are still 32 bit versions

  • Around the CPU there are plenty of interfaces

  • To know the details (the interfaces only!) have a look

  • at the data sheet explaining them (205 pages!)

BCM2835 Peripherals

Here are some of the Raspberry Pi peripherals:

  • UART

  • SPI

  • BSC (serial controller)

  • DMA controller

  • External mass media controller

  • PCM / I2S Audio

  • Pulse Width Modulation

  • Timer

  • USB

  • I2C

  • GPIO

Raspberry Pi and the real world

You can easily connect

  • 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)

Connection to bread board: The cobbler



Other RPI Connections

I2C is a serial bus often used in computer systems of for

short distance interfacing. Many devices having a I2C port

are available and we will program a few:

  • ADC

  • DAC

  • Real time clock


  • BPM180 barometric pressure sensor

  • 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

Bringing the 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 will get you a zip file, normally downloaded to your

$HOME/Downloads directory.

Writing an image to the SD card

balenaEtcher is a graphical SD card writing tool that works on
Mac OS, Linux and Windows, and is the easiest option for most users.

  • Install balenaEtcher ( Command Line).

  • Connect an SD card reader with the SD card inside.

  • Open balenaEtcher and select from your hard drive the Raspberry Pi .img or .zip file you wish to write to the SD card.

  • Select the SD card you wish to write your image to.

  • Review your selections and click 'Flash!' to begin writing data to the SD card.


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 the 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


First login

Raspbian has a default user name

  • pi

  • with password raspberry (which must be changed
    immediately for security reasons!)

Create your own user and add him to the sudo group:

adduser rpi01 and follow the instructions on the screen

usermod -a -G sudo rpi01

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

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 exist on PC Ubuntu)


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

Accessing the RPI remotely

Of course we can use the interfaces on the Raspberry Pi

to connect a screen, keyboard and mouse and use it in stand-alone mode

but we can also make use of the PC resources and access it remotely

There are several ways to access the RPI remotely:

  • Using the VNC server on the Pi you can access it
    with a remote desktop from the PC

  • The secure shell (ssh) allows you to get a remote terminal in the Pi

  • With scp you can copy files back and forth between the Pi and the PC

  • With nfs you can mount part of the Pi file system into the
    PC file system tree and access the PI SD card as if it was a local PC disk.

The remote Desktop


Remote Desktop (2)

When running the remote desktop you are working on the Raspberry Pi

with the screen, keyboard and mouse replaced by the devices on the PC.

You have the same functionality as if the screen was connected

to the Piís HDMI port and keyboard and mouse were connected

to the USB ports on the Pi.

nfs the network file system

With nfs you can mount part of the Piís file system tree

onto your PC file system.

This allows you access to the Piís files as if you were

using a local disk. You cannot run any Rasberry Pi

programs this way however.

It is interesting if you cross-compile Pi programs on your PC,

which will be immediately visible on the Pi.

ssh the secure shell

In the case of ssh you have a single terminal window

that is connected to a shell on the Pi.

The command is:

ssh userOnPi@piIPaddress

Where piIPaddress can be the Piís IP address of host name.

If you specify the -X option you can run X-11 based programs

where the X protocol is run over the ssh connection.

ssh session example

Here you see a screen dump from the PC with a remote terminal

that started an emacs session on the Pi.


To copy a file from the PC to the Pi this would be the command:

scp myfile.c rpi01@rpi-10:exercises/solutions/exercise_2

This will copy the file ďmyfile.cĒ into the sub-directory

exercises/solutions/exercise_2 on user rpi01's home directory on the Pi.

Of course user rpi01 must exist on raspberry10.

Instead of specifying the machine name: rpi-10

you can also give its IP address.

Compiling C programs for the Raspberry Pi

Just like Linux on the PC, Linux on the Raspberry Pi uses the GNU C compiler gcc.

The front end:

  • Lexical Analyzer

  • and the parser for the grammar

are the same.

However, the code generator is different since now

we compile for the ARM processor and not the

Intel processor used on the PC

Cross-Compilation for the Pi

As explained in a previous lecture we can also compile

C programs for the Raspberry Pi on the

PC Linux system using a cross-compiler.

The cross compiler we will use is named


and it is part of the tools package for the Pi.

It exists also as an Ubuntu package to be installed with apt.

-- Isaac Armah-Mensah - 2018-10-10


Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng 3party.png r1 manage 178.0 K 2019-10-02 - 12:21 IsaacArmahMensah  
PNGpng balena.png r1 manage 54.9 K 2019-10-02 - 14:11 IsaacArmahMensah  
PNGpng desktop.png r1 manage 378.8 K 2018-10-10 - 16:01 IsaacArmahMensah  
PNGpng etcher.png r1 manage 22.3 K 2018-10-10 - 15:55 IsaacArmahMensah  
PNGpng pi.png r1 manage 1159.1 K 2018-10-10 - 04:26 IsaacArmahMensah  
PNGpng raspi-config.png r1 manage 50.8 K 2018-10-10 - 15:56 IsaacArmahMensah  
PNGpng rpi3.png r1 manage 950.0 K 2019-10-02 - 11:25 IsaacArmahMensah  
PNGpng rpi4.png r1 manage 838.7 K 2019-10-02 - 11:21 IsaacArmahMensah  
JPEGjpeg tcobbler.jpeg r1 manage 36.4 K 2018-10-10 - 04:26 IsaacArmahMensah  
PNGpng versions.png r1 manage 124.8 K 2018-10-10 - 04:20 IsaacArmahMensah  
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2019-10-02 - IsaacArmahMensah
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback