CMPE 246 (3) Computer Engineering
Design Studio
Dr. Ling Bai
[email protected]
IEEE Member, ACM Member
Faculty of Applied Science | School of Engineering
The University of British Columbia, Okanagan Campus
1137 Alumni Avenue, Kelowna BC, V1V 1V7 Canada
Instructor Name: Ling Bai
Office Hours: By appointment
Please click on the link to book a 15-minutes
appointment during office hours ( EME 3280,
Friday, 2:30pm-4:30pm). You may book multiple
time slots if needed. If none of the available
times work for you, please feel free to email me.
[email protected] Appointment booking link:
https://lingbai.youcanbook.me
2
Lecture 16
3
1-Start
Earn your stars in Lecture 16! (Only in person)
iclicker classpoint
In Week 12’s Team session, Redeem your stars for the order of your presentation. 4
1-Start
5
2- Serial Communication Interfaces
Data transfer can be done in two ways.
They are serial communication and parallel communication.
Serial communication is a technique for transmitting data bit by bit using a
two-wire, that is, transmitter (transmitter) and receiver.
6
2- Serial Communication Interfaces
Serial communication require less I/O (input-output) lines.
7
2- Serial Communication Interfaces
The main advantage of serial communication is that the cost of the entire
embedded system becomes cheap and the information can be transmitted
over long distances.
8
2- Serial Communication Interfaces
9
2- Serial Communication Interfaces
In parallel communication, one block of data (8, 16 or 32 bits) is transmitted
at a time. Therefore, each data bit requires a separate physical I/O line.
10
2- Serial Communication Interfaces
The advantage of parallel communication is that it has fast speed but the
disadvantage is that it uses more I/O (input-output) lines.
If your integrated circuit or processor supports a small number of
input/output pins, you’d better choose serial communication.
11
2- Serial Communication Interfaces
12
2- Serial Communication Interfaces
Simplex refers to one-way communication technology. There is only one
client (the sender or receiver is active at the same time). If the sender sends
it, the receiver can only accept it. Television communication is a simplex
13
mode, the television station sends and the television receives.
2- Serial Communication Interfaces
In half-duplex mode, both the
sender and the receiver are
active, but not active at the
same time. The Internet is a
good example. If the laptop
sends a request for a web
page, the web server will
process the application and
send back the information. 14
2- Serial Communication Interfaces
Full-duplex mode is widely used in the world for communication. Both the
sender and the receiver can send and receive at the same time. An
example is your smart phone.
15
2- Serial Communication Interfaces
Clock Synchronization
In order to work efficiently with serial devices, the clock is the primary
source.
The clock signal for each serial device is different and it is categorized as
synchronous transmission and asynchronous transmission.
16
2- Serial Communication Interfaces
Synchronous communication
In Synchronous Transmission, data is sent in form of blocks or frames.
17
2- Serial Communication Interfaces
Asynchronous communication
In asynchronous communication, the groups of bits will be treated as an
independent unit, and these data bits will be sent at any point in time.
18
2- Serial Communication Interfaces
The world of the IoT is filled with a wide array of sensors. To transfer data
between computing resources, devices need an agreed-upon
communication standard, or protocol, for proper communication.
The Raspberry Pi provides us with three main communication interfaces.
These interfaces enable devices such as sensors, display modules,
other computers, and scientific instruments to communicate and
exchange data with the Raspberry Pi.
19
2- Serial Communication Interfaces
Label Header
• Power 3.3V (on 2 pins)
• Power 5V (on 2 pins)
• Ground (on 8 pins)
• General purpose input and output
• PCM(Pulse-code Modulation)
• PWM (Pulse width Modulation)
• I2C
• SPI
• UART
20
2- Serial Communication Interfaces
Here are the communication interfaces (protocols) in order from slowest
to fastest:
UART I2C SPI
21
2- Serial Communication Interfaces
UART: Universal Asynchronous Receiver / Transmitter
UART uses two wires known as TX (transmit) and RX (Receive) for both
devices to communicate.
22
2- Serial Communication Interfaces
I2C: Inter-Integrated Circuit
I2C is synchronous serial protocol.
The two pins in an I2C protocol are the SDA (Serial Data Line) which
transmits and receives data, and the SCL (Serial Clock Line) pin, which
functions as a clock.
23
2- Serial Communication Interfaces
SPI: Serial Peripheral Interface
SPI is a synchronous protocol.
It uses a total of four wires, namely MISO (Master In Slave Out), MOSI (Master Out
Slave In), SCLK (Serial Clock Line), and SS/CS (Chip Select). Unlike UART, SPI uses a
master-to-slave format to control multiple slave devices with only one master.
All abbreviations
are not strict; 24
may use freely.
2- Serial Communication Interfaces
25
2- Serial Communication Interfaces
Adapter
26
2- Serial Communication Interfaces
Adapter
https://youtu.be/-kGc2H35tRs
27
2- Serial Communication Interfaces
Temperature Humidity Pressure Sensor
Read the sensor’s datasheet. Read the pins
meaning.
It can use either SPI or I2C. You can wiring with
different pins.
All abbreviations are not strict; different sensors 28
may use freely.
2- Serial Communication Interfaces
Temperature Humidity Pressure Sensor
29
2- Serial Communication Interfaces
LCD sensors
30
2- Serial Communication Interfaces
There are many peripherals that can be added to a microprocessor over the
I2C and SPI serial interfaces. These include atmospheric sensors and
several types of display.
Raspberry Pi SPI and I2C Tutorial:
https://learn.sparkfun.com/tutorials/raspberry-pi-spi-and-i2c-tutorial/all
31
2- Serial Communication Interfaces
The SPI peripheral is not turned on by default. There are two methods to
adjust the settings. 1. You can use the Desktop GUI by heading to the Pi
Start Menu > Preferences > Raspberry Pi Configuration.
32
2- Serial Communication Interfaces
2. If you are using a terminal, you will need to:
Run sudo raspi-config
https://learn.sparkfun.c
om/tutorials/raspberry-
pi-spi-and-i2c-tutorial/a 33
ll
2- Serial Communication Interfaces
34
2- Serial Communication Interfaces https://pinout.xyz/
35
2- Serial Communication Interfaces https://youtu.be/KciKq
GX8g94
36
3- Networking protocols
7 OSI Layer (Open System
Interconnection) is a standard developed
by the International Organization for
Standardization (ISO) to provide a
structured and logical framework for how
data is communicated over a network.
(Optional knowledge in this course)
37
3- Networking protocols
TCP/IP stands for Transmission Control Protocol/Internet Protocol and is
a suite of communication protocols used to interconnect network devices
on the internet.
Internet Protocol Version 4 (IPv4) is the primary version used on the
internet today. However, due to a limited number of addresses, a newer
protocol known as IPv6 was developed.
38
3- Networking protocols
TCP Connection Establishment – The Three-Way Handshake:
1. Client sends a SYN (synchronize) packet to initiate a connection.
2. Server responds with a SYN-ACK (synchronize-acknowledge) packet.
3. Client sends an ACK (acknowledge) packet to finalize the connection.
Use Cases of TCP:
• Web Browsing (HTTP/HTTPS)
• Email (SMTP, IMAP, POP3)
• Secure Shell (SSH)
• File Transfers (FTP, SFTP) 39
3- Networking protocols
User Datagram Protocol (UDP): Fast and Lightweight Communication
UDP is a connectionless protocol that prioritizes speed over reliability.
Unlike TCP, UDP does not establish a formal connection or verify data
delivery.
Sender transmits data packets directly to the recipient.
Recipient receives packets but does not acknowledge them.
40
3- Networking protocols
41
3- Networking protocols
42
3- Networking protocols
43
3- Networking protocols
44
3- Network Performance Metrics
• Bandwidth usage: Bandwidth refers to the maximum data transmission rate on a network at a
particular time.
• Packet Loss: Packet loss refers to the number of data packets lost during transmission from one
destination to another.
• Retransmission: The data packets lost or dropped need to be retransmitted to complete data request.
• Throughput: Throughput is a metric allowing you to measure the actual data transmission rate through
different areas of your network.
• Latency: Latency or network delay is a network performance metric measuring the amount of time it
takes to transfer data from one destination to another.
• Network Availability: Network availability is one of the key metrics you must determine to track your
network's uptime over a specific time interval.
• Connectivity: It’s important to check the connection between devices and nodes on your network.
• Jitter: Jitter can be defined as the time delay or time difference between sending of each data packet
45
over the network.
4- Remote Raspberry Pi
Sometimes you need to access a Raspberry Pi without connecting it to a monitor,
keyboard, and mouse. Perhaps the Raspberry Pi is embedded in a robot or mounted in
an inconvenient location. Or maybe you don’t have a spare monitor.
To remotely control your Raspberry Pi from another device on your local network, use
one of the following services:
• SSH
• VNC
• Raspberry Pi Connect
46
4- Remote Raspberry Pi
• SSH (Secure SHell) provides secure access to a terminal session on your Raspberry
Pi.
• VNC (Virtual Network Computing) provides secure access to a desktop screen share
on your Raspberry Pi. All you need is another computer, a local network, and the
local IP address of your Raspberry Pi.
• Raspberry Pi Connect shares your Raspberry Pi’s screen securely with no need to
determine your local IP address.
Readings:
https://www.raspberrypi.com/documentation/computers/remote-access.html#introduction-to-remot
e-access
47
https://www.raspberrypi.com/documentation/services/connect.html#introduction
4- Remote Raspberry Pi
https://www.raspberryp
i.com/documentation/c
omputers/getting-starte
d.html#setting-up-your-
raspberry-pi
48
Next
49
Dr. Ling Bai
(email: [email protected])