You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/sensor_bus/i2c_general.md
+20-26Lines changed: 20 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,23 +4,23 @@
4
4
5
5
It is recommended for:
6
6
7
-
* Connecting offboard components that require low bandwidth and low latency communication, e.g. [rangefinders](../sensor/rangefinders.md), [magnetometers](../gps_compass/magnetometer.md), [airspeed sensors](../sensor/airspeed.md) and [tachometers](../sensor/tachometers.md).
7
+
* Connecting offboard components that require low bandwidth and low latency communication, e.g. [rangefinders](../sensor/rangefinders.md), [magnetometers](../gps_compass/magnetometer.md), [airspeed sensors](../sensor/airspeed.md) and [tachometers](../sensor/tachometers.md).
8
8
* Compatibility with peripheral devices that only support I2C.
9
9
* Allowing multiple devices to attach to a single bus, which is useful for conserving ports.
10
10
11
11
I2C allows multiple master devices to connect to multiple slave devices using only 2 wires per connection (SDA, SCL).
12
-
in theory a bus can support 128 devices, each accessed via its unique address.
12
+
in theory, a bus can support 128 devices, each accessed via its unique address.
13
13
14
14
::: info
15
-
UAVCAN would normally be preferred where higher data rates are required, and on larger vehicles where sensors are be mounted further from the flight controller.
15
+
UAVCAN would normally be preferred where higher data rates are required, and on larger vehicles where sensors are mounted further from the flight controller.
16
16
:::
17
17
18
18
19
19
## Wiring
20
20
21
21
I2C uses a pair of wires: SDA (serial data) and SCL (serial clock).
22
22
The bus is of open-drain type, meaning that devices ground the data line.
23
-
It uses a pullup resistor to push it to `log.1` (idle state) - every wire has it usually located on the bus terminating devices.
23
+
It uses a pull-up resistor to push it to `log.1` (idle state) - every wire has it usually located on the bus terminating devices.
24
24
One bus can connect to multiple I2C devices.
25
25
The individual devices are connected without any crossing.
26
26
@@ -52,41 +52,44 @@ If two I2C devices on a bus have the same ID there will be a clash, and neither
52
52
This usually occurs because a user needs to attach two sensors of the same type to the bus, but may also happen if devices use duplicate addresses by default.
53
53
54
54
Particular I2C devices may allow you to select a new address for one of the devices to avoid the clash.
55
-
Some devices do not support this option, or do not have broad options for the addresses that can be used (i.e. cannot be used to avoid a clash).
55
+
Some devices do not support this option or do not have broad options for the addresses that can be used (i.e. cannot be used to avoid a clash).
56
56
57
57
If you can't change the addresses, one option is to use an [I2C Address Translator](#i2c-address-translators).
58
58
59
59
### Insufficient Transfer Capacity
60
60
61
-
The bandwidth available for each individual device generally decreases as more devices are added. The exact decrease depends on the bandwidth used by each individual device. Therefore it is possible to connect many lowbandwidth devices, like [tachometers](../sensor/tachometers.md).
61
+
The bandwidth available for each device generally decreases as more devices are added. The exact decrease depends on the bandwidth used by each individual device. Therefore it is possible to connect many low-bandwidth devices, like [tachometers](../sensor/tachometers.md).
62
62
If too many devices are added, it can cause transmission errors and network unreliability.
63
63
64
64
There are several ways to reduce the problem:
65
-
* Dividing the devices into groups, each with approximately the same number of devices and connecting each group to one autopilot port
65
+
* Dividing the devices into groups, each with approximately the same number of devices, and connecting each group to one autopilot port
66
66
* Increase bus speed limit (usually set to 100kHz for external I2C bus)
67
67
68
68
### Excessive Wiring Capacitance
69
69
70
-
The electrical capacity of bus wiring increases as more devices/wires are added. The exact decrease depends on total length of bus wiring and wiringspecific capacitance.
70
+
The electrical capacity of bus wiring increases as more devices/wires are added. The exact decrease depends on the total length of bus wiring and wiring-specific capacitance.
71
71
The problem can be analyzed using an oscilloscope, where we see that the edges of SDA/SCL signals are no longer sharp.
72
72
73
73
There are several ways to reduce the problem:
74
-
* Dividing the devices into groups, each with approximately the same number of devices and connecting each group to one autopilot port
75
-
* Using the shortest and the highest quality I2C cables possible
76
-
* Separating the devices with a weak open-drain driver to smaller bus with lower capacitance
77
-
*[I2C Bus Accelerators](#i2c-bus-accelerators)
74
+
* Dividing the devices into groups, each with approximately the same number of devices, and connecting each group to one autopilot port
75
+
* Using the shorter and higher quality I2C cables, see the [cable wiring page](../assembly/cable_wiring.md#i2c-cables) for details
76
+
* Separating the devices with a weak open-drain driver to smaller buses with lower capacitance by using [I2C Bus Accelerators](#i2c-bus-accelerators)
78
77
79
78
## I2C Bus Accelerators
80
79
81
-
I2C bus accelerators are separate circuits that can be used to support longer wiring length on an I2C bus.
80
+
I2C bus accelerators are separate circuits that can be used to support longer wiring lengths on an I2C bus.
82
81
They work by physically dividing an I2C network into 2 parts and using their own transistors to amplify I2C signals.

87
86
- This has Dronecode connectors and is hence very easy to add to a Pixhawk I2C setup.
88
87
- The module has no settings (it works out of the box).
89
88
89
+
### I2C Level Converter function
90
+
91
+
Some I2C devices have 5V on the data lines, while the Pixhawk connector standard port expects these lines to be 3.3 V.
92
+
You can use the TFI2CEXT01 as a level converter to connect 5V devices to a Pixhawk I2C port. This feature is possible because the SCL and SDA lines of TFI2CEXT01 are 5V tolerant.
90
93
91
94
## I2C Address Translators
92
95
@@ -96,21 +99,12 @@ The work by listening for I2C communication and transforming the address when a
- This has Dronecode connectors and is very easy to add to a Pixhawk I2C setup.
100
103
101
104
## I2C Bus Splitters
102
105
103
-
I2C Bus Splitters are circuit boards that split the I2C port on your flight controller into multiple ports.
104
-
They are useful if you want to use multiple I2C peripherals on a flight controller that has only one I2C port (or too few), such as an airspeed sensor and a distance sensor.
105
-
106
-
You can find an appropriate board using an internet search.
107
-
108
-
## I2C Level Converter
109
-
110
-
Some I2C devices have 5V on the data lines, while the Pixhawk connector standard port expects these lines to be 3.3 V.
111
-
You can use an I2C level converter to connect 5V devices to a Pixhawk I2C port.
112
-
113
-
You can find an appropriate covnerter using an internet search.
106
+
I2C Bus Splitters are devices that split the I2C port on your flight controller into multiple connectors.
107
+
They are useful if you want to use multiple I2C peripherals on a flight controller that has only one I2C port (or too few), such as an airspeed sensor and a distance sensor. Both devices [I2C Address Translator](../sensor_bus/translator_tfi2cadt.md) and [I2C Bus Accelerators](#i2c-bus-accelerators) could also be used as I2C splitters because they have multiple I2C connectors for connecting additional I2C devices.
[TFI2CADT01](https://github.com/ThunderFly-aerospace/TFI2CADT01) is designed as open-source hardware with GPLv3 license.
17
-
It is commercially available from [ThunderFly](https://www.thunderfly.cz/) company or from [Tindie eshop](https://www.tindie.com/products/thunderfly/tfi2cadt01-i2c-address-translator/).
16
+
It is commercially available from [ThunderFly](https://www.thunderfly.cz/) company or from [Tindie eshop](https://www.tindie.com/products/26353/).
18
17
:::
19
18
20
19
## Address Translation Method
@@ -31,7 +30,7 @@ If you need your own value for address translation, changing the configuration r
31
30
The tachometer sensor [TFRPM01](../sensor/thunderfly_tachometer.md) can be set to two different addresses using a solder jumper.
32
31
If the autopilot has three buses, only 6 sensors can be connected and no bus remains free (2 available addresses * 3 I2C ports).
33
32
In some multicopters or VTOL solutions, there is a need to measure the RPM of 8 or more elements.
34
-
The [TFI2CADT01](https://www.tindie.com/products/thunderfly/tfi2cadt01-i2c-address-translator/) is highly recommended in this case.
33
+
The [TFI2CADT01](https://www.tindie.com/products/26353/) is highly recommended in this case.
TFI2CADT01 does not contain any I2C buffer or accelerator.
61
-
As it adds additional capacitance on the bus, we advise combining it with some bus booster, e.g. [TFI2CEXT01](https://github.com/ThunderFly-aerospace/TFI2CEXT01).
60
+
As it adds additional capacitance on the bus, we advise combining it with some bus booster, e.g. [TFI2CEXT01](https://docs.thunderfly.cz/avionics/TFI2CEXT01/).
0 commit comments