background preloader

I2C/IIC/TWI

Facebook Twitter

I2C between Arduino's. Wire Arduino Library, connecting I2C (TWI) devices to Teensy. The Wire library allows you to communicate with I2C devices, often also called "2 wire" or "TWI" (Two Wire Interface).

Wire Arduino Library, connecting I2C (TWI) devices to Teensy

Download: Wire is included with Arduino Brian "nox771" has written an improved I2C library for Teensy 3.0. Hardware Requirements I2C devices communicate with 2 signals, called SDA and SCL. Normally a 4.7K pullup resistor is connected between each signal and power (+3.3V on Teensy 3.0, +5V on Teensy 2.0). Easily manage I/O on a remote Arduino using two wires and the ExtraCore library. I’m always running out of the good pins in my Arduino projects.

Easily manage I/O on a remote Arduino using two wires and the ExtraCore library

PWM pins are in particularly scarce supply and I sometimes even find myself short on analog inputs. Tricks like using shift registers or software PWM help, but they have limitations that aren’t always easy to work around. TWI. The TinkerKit!

TWI

LCD also supports TWI connections. TWI stands for “Two-Wire Interface” and it’s another way to call the I2C bus technology. Basically it allows to connect multiple devices in series. This means that you can hook a large number of LCD screens, connecting them “in-line” using the two TWI ports, one for input and one for output. One of them must be the master (or you can use a TInkerKit! First of all let’s connect two modules, then we move to the code. Between the examples of the TKLCD library, there is one that is called TwiFirmware. Now we have to declare our LCDs. Then in the setup we initialize them normally After this we can use them in the loop as a normal TKLCD, let’s try to write somthing on them: Ok, that was rather easy, but the cool thing about TWI is that you can connect as much modules as you want. If we have more than one TWI, in order to understand which one we are controlling we need to define a different address for each.

Arduino and the I2C bus - Part Two. Part two of our Arduino and I2C bus tutorial.

Arduino and the I2C bus - Part Two

[Updated 10/01/2013] Today we are going to continue learning about the I2C bus and how it can work for us. If you have not already, please read and understand the first I2C article before continuing. First of all, there are some limitations of I2C to take into account when designing your projects. One of these is the physical length of the SDA and SCL lines. Several applications come to mind with an extended I2C bus, for example remote temperature monitoring using the the ST Microelectronics CN75 temperature sensor from part one; or controlling several I/O ports using an I2C expander without the expense or worry of using a wireless system. A very useful and inexpensive part is the PCF8574 I/O expander (data sheet.pdf). There should not be any surprises for you there. So if we set pins A0 to A2 to GND, our device address in binary will be 0100000, or 0×20 in hexadecimal.

The reason is that the PCF8574 is a current sink. Here is the schematic: Arduino and the I2C bus - Part One. This is part one of several tutorials on how to use the I2C bus with Arduino, and chapter twenty of a series originally titled “Getting Started/Moving Forward with Arduino!”

Arduino and the I2C bus - Part One

By John Boxall – A tutorial on the Arduino universe. The first chapter is here, the complete series is detailed here. [Updated 28/11/2014] In this first of several tutorials we are going to investigate the I2C data bus, and how we can control devices using it with our Arduino systems. The I2C bus can be a complex interface to master, so I will do my best to simplify it for you. But first of all, what is it? I2C is an acronym for “Inter-Integrated Circuit”. Why would we want to use I2C devices? As there are literally thousands of components that use the I2C interface! From a hardware perspective, the wiring is very easy. If you are using an Arduino Mega, SDA is pin 20 and SCL is 21, so note that shields with I2C need to be specifically for the Mega. ChipKIT Tutorial 6: Inter-Integrated Circuit (I2C) communication. I2C or IIC (Inter-Integrated Circuit) is a simple bidirectional serial interface, which requires only 2 signal lines for data transfer.

chipKIT Tutorial 6: Inter-Integrated Circuit (I2C) communication

It was originally developed by Philips in 1980′s to provide easy on-board communications between a CPU and various peripheral chips in a TV set. Today, it is widely used in varieties of embedded systems to connect many low speed peripherals, such as external EEPROMs, sensors, LCD drivers, port expanders, real-time clocks, etc, to the host microcontroller. In this tutorial, we will explore the chipKIT Wire Library for establishing an I2C communication link between the chipKIT Uno32 board and two I2C sensors.

The Uno32 board receives the sensor outputs through the I2C link and displays the results on the serial monitor window on the computer screen.

TWI

I2C/IIC.