I have a few useful I2C components, such as a 16-bit port expander (MCP23017), which I'd like to use in various projects.
What do I need to do to make these work with Arduino? Will it work with any Arduino, or do I need a specific board or shield?
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It only takes a minute to sign up.
Sign up to join this communityArduino have the Wire Library that communicate with I2C.
This library allows you to communicate with I2C / TWI devices. On the Arduino boards with the R3 layout (1.0 pinout), the SDA (data line) and SCL (clock line) are on the pin headers close to the AREF pin. The Arduino Due has two I2C / TWI interfaces SDA1 and SCL1 are near to the AREF pin and the additional one is on pins 20 and 21. As a reference the table below shows where TWI pins are located on various Arduino boards.
Board I2C / TWI pins
You can take a look at , this examples.
Like @TheDoctor said:
The I2C data lines both need resistors to 3.3V. This keeps them from drifting if they are disabled. Andy resistor value should work, but it is recommended to use one between 10k ohm and 47k ohm.
Additional shields are not needed.
You only need the Wire library and a couple of wires to connect the device to SDA and SCL.
The position of these pins is different on the various Arduinos, please have a look here.