Differences

This shows you the differences between two versions of the page.

doc:hardware:port.i2c [2013/03/23 14:45]
joky
doc:hardware:port.i2c [2014/01/17 21:04] (current)
valentt additional info for initializing i2c
Line 11: Line 11:
You need 2 GPIO ports to add a 3.3V I2C interface to your router. Check if your router has some spare GPIOs available. The [[toh/tp-link/tl-mr3020|TP-Link MR3020]] has 2 unused GPIO ports at R15 and R17. Otherwise you can use GPIOs used for LEDs. To avoid any influence from the old components disconnect the LEDs from those GPIOs (by removing the resistors. You need 2 GPIO ports to add a 3.3V I2C interface to your router. Check if your router has some spare GPIOs available. The [[toh/tp-link/tl-mr3020|TP-Link MR3020]] has 2 unused GPIO ports at R15 and R17. Otherwise you can use GPIOs used for LEDs. To avoid any influence from the old components disconnect the LEDs from those GPIOs (by removing the resistors.
 +
 +Add a 10k pull-up resistor between GPIO ports and 3.3V. On the MR3020 GPIO 7 would be SDA and the GPIO 29 would be SCL.
Install and load the kernel module: Install and load the kernel module:
Line 16: Line 18:
<code> <code>
# opkg update # opkg update
-# opkg install kmod-i2c-gpio-custom+# opkg install kmod-i2c-gpio-custom kmod-i2c-coreĀ 
 +# insmod i2c-dev
# insmod i2c-gpio-custom bus0=0,7,29 # insmod i2c-gpio-custom bus0=0,7,29
# dmesg | grep gpio # dmesg | grep gpio
Line 28: Line 31:
=== I2C with 3.3V and 5V devices === === I2C with 3.3V and 5V devices ===
-If some of your devices need 5V I2C bus you can use a [[http://www.hobbytronics.co.uk/mosfet-voltage-level-converter|simple level shifter]] with 2 n-channel MOSFETs like the 2N7000. You may have to use 3K3 pull-up resistors on both sides.+If some of your devices need 5V I2C bus you can use a [[http://www.hobbytronics.co.uk/mosfet-voltage-level-converter|simple level shifter]] with 2 n-channel MOSFETs like the 2N7000. Connect the source-pins of the MOSFET to the 3.3V line, the gate pin to 3.3V and the drain pin to the 5V line. You also need the 10k-pull ups on the 5V-line.
==== Old Wiki ==== ==== Old Wiki ====

Back to top

doc/hardware/port.i2c.1364046329.txt.bz2 · Last modified: 2013/03/23 14:45 by joky