

This creates I2C message with address and data. To start sending message from the master we need to begin the transmission, write the data and then end the transmission. The master can send information to slave device, request information from slave device. #define SLAVE_ADDRESS 0x08 Master Communication Where we define the SLAVE_ADDRESS as follows: If the Arduino is to made a slave then we write the following statement in the setup() function. If the Arduino is to made master then we declare it as I2C master device using the following statement in the setup() function. This needs to be imported when working with Arduino. To use the I2C serial communication with Arduino there is a standard library called Wire.h. All the slave devices are connected to master device on these SDA and SCL wires as illustrated below. The information exchange between Master and Slave happens with two communication wires called SDA(Serial Data) and SCL(Serial Clock) and a common ground wire. The master sends commands and information request to Slave address and the Slave replies with information required and keeps quit until another information is requested by the Master. I2C is a serial communication standard which uses Master Slave system.

Arduino USART can only communicate with one device, SPI(Serial Peripheral Interface) can be used to communicate upto 3 devices but I2C can be used to communicate hundreds of devices. Example of such I2C capable system are LCD, EEPROM, different types of sensors such as temperature sensor, pressure sensors, accelerometers and others. I2C serial communication is designed to connect number of integrated circuit which is cable of I2C communication. If two devices of different system like two Arduino are used for I2C communication another wire which is the ground wire is required. It is also called Two Wire Interface (shortened to TWI) because it uses two wire when the two I2C devices are within the same system. I2C is acronym for Inter-Integrated Circuit which is a serial communication standard developed by Philips Semiconductor in 1982. One Arduino is configured as a master and the other is configured as slave. Hence it is useful if I/O capability is to be increased or if more processing is required. This is useful if we want to transfer data from one Arduino to another or control sensors or actuator connected to one Arduino with another Arduino. In this tutorial we will show how two Arduino can be communicated using I2C communication protocol.
