Skip to content

Commit 11fb355

Browse files
committed
Rework I2C article
1 parent 6e50152 commit 11fb355

File tree

3 files changed

+23
-27
lines changed
  • content

3 files changed

+23
-27
lines changed

content/hardware/02.hero/boards/uno-r4-wifi/tutorials/qwiic/qwiic.md

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,9 @@ You'll learn what Qwiic is, as well as how to set it up and get started making y
2727

2828
## I2C
2929

30-
We'll go over the conceptual level of how I2C works, if you want to skip ahead you can [click here](#qwiic) to jump directly to the Qwiic section
30+
I2C is the communication protocol that is used in Qwiic, it is a protocol that allows you to connect many peripheral devices to a single controller board, using only two pins.
3131

32-
I2C is a communication protocol that lets you connect multiple I2C compatible devices in a line, using only two pins that are referred to as SCL and SDA.
33-
34-
Each device in the I2C line is functionally independent from the controller, but will respond with information when prompted by the controller.
35-
36-
All devices on the line have an address that is represented by 7 bits. With 7 bits you can create 128 unique combinations, and that means that the theoretical limit of the amount of I2C devices a single line can support is 128.
37-
38-
An I2C message on a lower bit-level looks something like this:
39-
40-
![An I2C Message](./assets/I2C.png)
41-
42-
- The controller sends out instructions through the I2C bus on the data pin (SDA), and the instructions are prefaced with the address, so that only the correct device listens.
43-
- Then there is a bit signifying whether the controller wants to read or write.
44-
- Every message needs to be acknowledged, to combat unexpected results, once the receiver has acknowledged the previous information it lets the controller know, so it can move on to the next set of bits.
45-
- 8 bits of data
46-
- Another acknowledgement bit
47-
- 8 bits of data
48-
- Another acknowledgement bit
49-
50-
But how does the controller and peripherals know where the address, messages, and so on starts and ends? That's what the SCL wire is for. It synchronises the clock of the controller with the devices, ensuring that they all move to the next instruction at the same time.
51-
52-
However, you are nearly never going to *actually* need to consider any of this, in the Arduino ecosystem we have the [Wire library](https://www.arduino.cc/reference/en/language/functions/communication/wire/) that handles everything for you.
53-
54-
But what does all of this have to do with Qwiic?
32+
To learn more about I2C and how it functions, check out our [I2C guide](/learn/communication/wire#tutorials).
5533

5634
## Qwiic
5735
Qwiic is an ecosystem of breakout-modules and development boards with a so called Qwiic connector. The Arduino UNO R4 WiFi has one, for example. The Qwiic ecosystem combines the flexibility of I2C with the ease of use of pre-bundled cables making it incredibly easy to create lines of I2C devices, by collecting all the pins to get up and running with a large network of I2C devices in a single cable.

content/hardware/02.hero/boards/uno-r4-wifi/tutorials/qwiic/assets/I2C.png renamed to content/learn/05.communication/01.wire/assets/I2C.png

File renamed without changes.

content/learn/05.communication/01.wire/wire.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,34 @@
22
title: 'A Guide to Arduino & the I2C Protocol (Two Wire)'
33
description: 'Allows the communication between devices or sensors connected via Two Wire Interface Bus.'
44
tags: [I2C, Wire, SDA, SCL]
5-
author: 'Arduino, Nicholas Zambetti'
5+
author: 'Nicholas Zambetti, Karl Söderby, Jacob Hylén'
66
difficulty: 'intermediate'
77
---
88

9-
>This article was revised on 2021/11/18 by Karl Söderby.
9+
The I2C protocol involves using two lines to send and receive data: a serial clock pin **(SCL)** that the Arduino Controller board pulses at a regular interval, and a serial data pin **(SDA)** over which data is sent between the two devices.
1010

11-
The I2C protocol involves using two lines to send and receive data: a serial clock pin **(SCL)** that the Arduino Controller board pulses at a regular interval, and a serial data pin **(SDA)** over which data is sent between the two devices. As the clock line changes from low to high (known as the rising edge of the clock pulse), a single bit of information - that will form in sequence the address of a specific device and a command or data - is transferred from the board to the I2C device over the SDA line. When this information is sent - bit after bit -, the called upon device executes the request and transmits it's data back - if required - to the board over the same line using the clock signal still generated by the Controller on SCL as timing.
11+
As the clock line changes from low to high (known as the rising edge of the clock pulse), a single bit of information is transferred from the board to the I2C device over the SDA line. As the clock line keeps pulsing, more and more bits are sent until a sequence of a 7 or 8 bit address, and a command or data is formed. When this information is sent - bit after bit -, the called upon device executes the request and transmits it's data back - if required - to the board over the same line using the clock signal still generated by the Controller on SCL as timing.
12+
13+
Each device in the I2C bus is functionally independent from the controller, but will respond with information when prompted by the controller.
1214

1315
Because the I2C protocol allows for each enabled device to have it's own unique address, and as both controller and peripheral devices to take turns communicating over a single line, it is possible for your Arduino board to communicate (in turn) with many devices, or other boards, while using just two pins of your microcontroller.
1416

17+
An I2C message on a lower bit-level looks something like this:
18+
19+
![An I2C Message](./assets/I2C.png)
20+
21+
- The controller sends out instructions through the I2C bus on the data pin (SDA), and the instructions are prefaced with the address, so that only the correct device listens.
22+
- Then there is a bit signifying whether the controller wants to read or write.
23+
- Every message needs to be acknowledged, to combat unexpected results, once the receiver has acknowledged the previous information it lets the controller know, so it can move on to the next set of bits.
24+
- 8 bits of data
25+
- Another acknowledgement bit
26+
- 8 bits of data
27+
- Another acknowledgement bit
28+
29+
But how does the controller and peripherals know where the address, messages, and so on starts and ends? That's what the SCL wire is for. It synchronises the clock of the controller with the devices, ensuring that they all move to the next instruction at the same time.
30+
31+
However, you are nearly never going to *actually* need to consider any of this, in the Arduino ecosystem we have the [Wire library](https://www.arduino.cc/reference/en/language/functions/communication/wire/) that handles everything for you.
32+
1533
## Hardware & Software Needed
1634

1735
- Arduino IDE ([online](https://create.arduino.cc/) or [offline](https://www.arduino.cc/en/main/software)).

0 commit comments

Comments
 (0)