0% found this document useful (0 votes)
29 views13 pages

Chapter 2 I2C & I2S

The document discusses I2C and I2S communication protocols. It explains the basics of each protocol including wiring, timing diagrams, and applications. Challenges and solutions for each protocol are also covered.

Uploaded by

Keabetswe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views13 pages

Chapter 2 I2C & I2S

The document discusses I2C and I2S communication protocols. It explains the basics of each protocol including wiring, timing diagrams, and applications. Challenges and solutions for each protocol are also covered.

Uploaded by

Keabetswe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

DIGITAL SYSTEMS IV

S1 2024

Chapter 2
ESP32 I2C & I2S

www.vut.ac.za

1
CONTENTS

1. I2C Communication
2. I2S Communication

The contents of this presentation is confidential. ©VUT

2
I2C Communication

What really is I2C?

• I2C (Inter-Integrated Circuit) is a widely used serial communication protocol for


connecting low-speed devices.
• It uses only two wires: Serial Data (SDA) and Serial Clock (SCL).
• One master device controls the bus and communicates with multiple slave
devices.
• The master device initiates communication and addresses a specific slave
device for data exchange.

3
I2C Communication

Understanding I2C?

 Imagine a bus: Think of it like a two-lane highway for data.


• Serial Data (SDA): This lane carries the actual data being
exchanged between devices.
• Serial Clock (SCL): This lane synchronizes the data
transfer, ensuring everything is sent and received at the
right time.
 Master and Slaves: In an I2C network, a single master
device acts as the traffic controller, initiating communication
and addressing specific slave devices for data exchange.
Each slave device has a unique 7-bit address that allows
the master to target the desired device for communication.

4
I2C Communication

Connecting I2C Sensors to ESP32

 Specific ESP32 GPIO pins can be configured as SDA and SCL lines to
connect to I2C sensors.
 The sensor's datasheet provides its unique 7-bit address, which you'll use
to communicate with it.

5
I2C Protocol

I2C Sensor Interfacing

I2C is a popular choice for sensor communication.


You can find a wide range of I2C sensors for temperature,
pressure, light, and more.
The sensor's datasheet will specify its unique I2C address,
which you'll use to communicate with it.
 Libraries like Wire in Arduino can often handle the low-
level communication details, allowing you to focus on
reading sensor data.

The image illustrates An ESP32


board connected to an I2C sensor

6
I2C Protocol

I2C Wiring in a Nutshell

There are two main wiring approaches:


1.Individual Wires
• Suitable for breakout modules with individual wires for VCC
(power), GND (ground), SDA, and SCL as discussed in the
previous slides.
Bare I2C Wiring on UNO R4 WiFi
• Connect each wire to the corresponding pin on your
microcontroller (e.g., ESP32).
2.Standardized Connectors
• Some ecosystems like Qwiic and STEMMA QT use a 4-pin
JST SH connector for I2C devices.
• This simplifies connection and ensures compatibility with
specific Arduino boards (e.g., UNO R4 WiFi) as illustrated by I2C on a Qwiic/STEMMA QT connector with UNO R4 WiFi

the diagram .
• These connectors often bundle power, ground, SDA, and SCL
wires into a single cable.
7
I2C Protocol

I2C Challenges and solutions


As you would imagine , I2C has its own drawbacks, below are the challenges and
proposed solutions:
1. Power Supply Problems: Ensure both the ESP32 and the I2C sensors are receiving
adequate and stable power. Insufficient voltage can lead to erratic communication.
2. Bus Length: I2C is designed for short-distance communication. Extending the I2C bus
excessively can introduce signal integrity issues. Consider using I2C bus repeaters if
longer distances are unavoidable.
3. Noise: Electrical noise on the I2C lines can disrupt communication. Use shielded cables
and proper grounding techniques to minimize noise interference.
4. Software Bugs: Double-check your code for errors related to I2C communication
protocols, addressing, and data handling. Utilize debugging tools and print statements to
isolate potential issues.
5. Wiring Issues: Double-check your connections! Ensure the SDA and SCL lines are wired
correctly to the ESP32 and the I2C sensor.
6. Address Conflicts: If multiple I2C devices share the same address, they'll cause
communication problems. Consult the datasheets to verify unique addresses or consider
changing the address of a sensor if possible 8
I2S Communication

I2S (Inter-IC Sound), is an electrical serial bus interface standard used for connecting digital
audio devices together. It is used to communicate PCM( Pulse Code Modulation) audio data
between integrated circuits in an electronic device. It was originally developed by Philips
Semiconductor (now NXP Semiconductors) for transporting digital audio data between integrated
.
circuits
Key Components of I2S
 Serial Clock (SCK): This clock is used to synchronize the data transmission.
 Word Select (WS): Also known as Left-Right Clock (LRCLK), this signal indicates whether the data is for
the left or right channel.
 Serial Data (SD): This line carries the audio data.
How it works
1. Master-Slave Relationship: Master device generates clock and word select signals; slave devices
receive and decode data.
2. Data Transmission: Data is transmitted using a two's complement format; WS line indicates which
channel (left or right) is currently active.
I2S Communication
Timing Diagram

Serial Clock (SCK):


The SCK line is the main clock for the I2S interface, pulsing at a consistent rate throughout the data transmission process. Each
pulse on the SCK line represents a single bit of data being transmitted.
Word Select (WS):
The WS signal, also known as the Left-Right Clock (LRCLK), indicates which channel (left or right) the data is for. When WS is
high, it typically indicates the left channel; when low, the right channel. It changes state at the beginning of each word, which
typically represents a sample from one of the audio channels.
Serial Data (SD):
The SD line carries the actual audio data. The data on SD changes state on the edges of the SCK clock signal. For instance, on
the rising edge of SCK, a new data bit is presented on the SD line. This ensures that each bit of the audio sample is read in sync
with the clock.
I2S Communication

Sequence and Timing

Serial Clock (SCK):


The SCK line is the main clock for the I2S interface, pulsing at a consistent rate throughout the data
transmission process. Each pulse on the SCK line represents a single bit of data being transmitted.
Word Select (WS):
The WS signal, also known as the Left-Right Clock (LRCLK), indicates which channel (left or right) the data is
for. When WS is high, it typically indicates the left channel; when low, the right channel. It changes state at
the beginning of each word, which typically represents a sample from one of the audio channels.
Serial Data (SD):
The SD line carries the actual audio data. The data on SD changes state on the edges of the SCK clock
signal. For instance, on the rising edge of SCK, a new data bit is presented on the SD line. This ensures that
each bit of the audio sample is read in sync with the clock.
Applications of I2S

Digital Audio Conversion: Common in devices that convert digital audio data to analog form (DACs) and
vice versa (ADCs).
Consumer Electronics: Highlight usage in smartphones, televisions, and sound systems where quality
audio is essential.
Professional Audio: Usage in audio interfaces, mixing consoles, and studio equipment for pristine audio
quality.
I2S Communication

Advantages of I2S
High-Fidelity Audio: Ensures high-quality audio transmission with minimal jitter and
synchronization issues.
Simplicity and Efficiency: Minimal wiring and straightforward protocol reduce complexity and
cost.
Flexibility: Supports various audio data formats and sample rates, adaptable to different needs.

Challenges and Limitations


Distance Limitations: I2S is optimal for short-distance applications due to its high susceptibility to
signal degradation over long cables.
Compatibility Issues: Standardization issues can arise with non-standard implementations affecting
interoperability.
THANKYOU

Andries Potgieter Blvd. Vanderbijlpark, 1900 , South Africa | T 098 008 8900 | E enquiries@ vut. ac. za www.vut.ac.za
13

You might also like