In this illustration we will going to wire 2 or more Arduino board using i2c. Arduino board share information with each other on 2 wires CLS, and SCL.  below are the example how to used them and programmed to communicate with one another in a master writer/slave receiver configuration via i2c (Inter-Integrated Circuit) Synchronous Serial Protocol. If you don’t know how i2c works please refer to this link. Several functions of Arduino are using Wire Library used to communication 2 or more Arduino Board. 1 is the Master and 2 or more are slave this master and slave can be program to send 6 byte of data every half second to a uniquely addressed slave. Once that message is received, it can be viewer in the slave board serial monitor window where you can find the serial monitor by selecting a defined port which is the board is connected.

The i2c (Inter-Integrated Circuit) protocol involves using two lines to send and receive data, a serial clock pin or (SCL) that the Arduino Master pulse at regular interval, and a serial data pin (SDA) over which data is sent between the two devices. As the clock line changes from LOW or HIGH, a single bit of information that will form the address of a specific device and a command or data is transferred from the board to the i2C device over the SDA (Serial Data Line). When this information sent bit after bit the device executes the request and transmit its data back if required to the board over the same line using the clock signal and still generated by the master on SCL as timings. The initial 8bit or an 8 clock pulse from the master to slave contain the address of the device.

Each slave device has its unique address and both master and slave devices need to take turns communication over the same data line. In this method it’s possible for the Arduino board to communicate with many device or other boards using just two pins of the microcontroller using each device unique i2c address.

Required components

  • 2 or more Arduino Board or (i2c Enabled Expansion device)
  • Solderless Bread Board (Optional)
  • Jumper Wires / DuPont Wire

Wiring Diagram for 2 Boards




2-Arduino-Board-WIring-I2c-Communication-Bus

Wiring Diagram for 2 or More Boards

i2c_Multiple-Arduino-Connection-I2c

Connect the pin A5 (SCL Pin) Serial Clock and Pin A4 Data (SDA) on the master to their counterparts on the slave 1 board. Make it sure both boards share common ground GND. In order to enable the serial communication. The slave board must be connected to your computer to test the serial communication data transfer. Powering the boards independently is an issue connect the 5v output of the master to the VIN Pin on the slave board.

Sketch Code for Master Write to Slave



Sketch Code for Slave Receive

 

Wiring 2 or More I2C devices as Writer/Slave Receiver
Facebooktwitterredditpinterestmail
Tagged on:     

JLCPCBPCBgogoPCBway4pcb

Leave a Reply

Your email address will not be published. Required fields are marked *