Difference between revisions of "I2c bus"
Jump to navigation
Jump to search
(Created page with "https://www.bluedot.space/tutorials/how-many-devices-can-you-connect-on-i2c-bus/ Category:Raspberry") |
|||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | = Wiring - Raspberry = | ||
+ | <pre> | ||
+ | Color i2cbus Raspberry Pi | ||
+ | yellow SCL GPIO 3 / SCL (Pin 5) | ||
+ | orange SDA GPIO 2 / SDA (Pin 3) | ||
+ | Red VCC / V 3,3V (pin 1) | ||
+ | Black GND GND (Pin 6) | ||
+ | </pre> | ||
+ | = Software - Raspberry = | ||
+ | Example with both a {{Link|target=SSD1306}} and {{Link|target=PCA9685}} on the bus | ||
+ | <source lang='bash' highlight='1,3'> | ||
+ | sudo raspi-config | ||
+ | # enable i2c in Interfacing options | ||
+ | sudo i2cdetect -y 1 | ||
+ | 0 1 2 3 4 5 6 7 8 9 a b c d e f | ||
+ | 00: -- -- -- -- -- -- -- -- -- -- -- -- -- | ||
+ | 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | ||
+ | 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | ||
+ | 30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- -- | ||
+ | 40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | ||
+ | 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | ||
+ | 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | ||
+ | 70: 70 -- -- -- -- -- -- -- | ||
+ | </source> | ||
+ | |||
+ | = How many devices on the bus? = | ||
https://www.bluedot.space/tutorials/how-many-devices-can-you-connect-on-i2c-bus/ | https://www.bluedot.space/tutorials/how-many-devices-can-you-connect-on-i2c-bus/ | ||
+ | = Pull up resistor calculation = | ||
+ | It seems recommendations go from 1kΩ (maximize speed) to 10kΩ (minimize power consumption) 4.7 kΩ is a compromise | ||
+ | == Stackoverflow == | ||
+ | * https://electronics.stackexchange.com/questions/1849/is-there-a-correct-resistance-value-for-i2c-pull-up-resistors | ||
+ | Most upvoted answer: | ||
+ | ''I include 4K7 resistors in the kit which seems like a reasonable compromise for most users.'' | ||
+ | |||
+ | == Ti.com == | ||
+ | ''Therefore,we can selectany available resistor value between 966.667Ωand 1.77kΩ. The valueof the pull up resistor can be selected basedon the trade-off for the power consumption and speed.'' | ||
+ | <pdf>http://www.ti.com/lit/an/slva689/slva689.pdf</pdf> | ||
[[Category:Raspberry]] | [[Category:Raspberry]] |
Latest revision as of 10:20, 7 February 2020
Wiring - Raspberry
Color i2cbus Raspberry Pi yellow SCL GPIO 3 / SCL (Pin 5) orange SDA GPIO 2 / SDA (Pin 3) Red VCC / V 3,3V (pin 1) Black GND GND (Pin 6)
Software - Raspberry
Example with both a SSD1306 and PCA9685 on the bus
sudo raspi-config
# enable i2c in Interfacing options
sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: 70 -- -- -- -- -- -- --
How many devices on the bus?
https://www.bluedot.space/tutorials/how-many-devices-can-you-connect-on-i2c-bus/
Pull up resistor calculation
It seems recommendations go from 1kΩ (maximize speed) to 10kΩ (minimize power consumption) 4.7 kΩ is a compromise
Stackoverflow
Most upvoted answer: I include 4K7 resistors in the kit which seems like a reasonable compromise for most users.
Ti.com
Therefore,we can selectany available resistor value between 966.667Ωand 1.77kΩ. The valueof the pull up resistor can be selected basedon the trade-off for the power consumption and speed.