Maybe sometimes we want to share the workload of one Arduino with another. Or maybe we want more digital or analog pins. Inter-Integrated Circuit or I2C (pronounced I squared C) is the best solution.
I2C is an interesting protocol. It's usually used to communicate between components on motherboards in cameras and in any embedded electronic system.
Here, we will make an I2C bus using two Arduinos. We will program one master Arduino to command the other slave Arduino to blink its built-in LED once or twice depending on the received value.
In order to build this we need the following "ingredients":
- 2 Arduinos
- Jumper cables
This instructable and many more can be found in my Arduino Development Cookbook available here. :D
Step 1: How to connect them
Follow these steps to connect two Arduino UNOs using I2C:
- Connect pins A4 and A5 on one Arduino to the same pins on the other one.
The GND line has to be common for both Arduinos. Connect it with a jumper.
We also have a schematic and a "breadboard" implementation, both easy to follow. Luckily, it's a simple implementation.
Remember never to connect 5 V and 3.3 V Arduinos together. It won't
hurt the 5V Arduino, but it will certainly annoy its 3.3 V brother!