 I2C is incredibly powerful and using just two wires, we can connect up to 1,008 devices within one I2C loop. I2C is a communication protocol that's used to transmit information between electronics. I2C was developed by Philips in 1982 to assist with the communication between the CPU and the different peripherals within its audio and visual appliances. Since then, it's been periodically updated and now can support transfer speeds of up to 3.2Mbps. Before we continue, we must understand that there are two main devices within an I2C loop. There's a master and the slave. The master is transmitting information, the slave is receiving information. Masters are typically your microcontrollers or your brains and slaves are usually your peripherals such as an external sensor or a display device etc. Like I mentioned before, there are two different wires where information in the I2C loop is carried out through. There's the SDA and the SCL which is the serial data and the serial clock. Now the actual information within an I2C loop is sent using something called a message. Now each message is broken down into different frames. Each frame is responsible for a different job. Firstly we have the start condition. The start condition basically signals that a message is going to be sent and get ready for it. Next we have the address frame. The address frame is basically responsible for identifying which device or which slave is the master trying to communicate to. This is also followed by a read or write bit that means is the master requesting information or is the master sending information to the slave. Next we have the acknowledge bit. So once this information reaches the appropriate device, the device will acknowledge, okay yes, this address is for me and it's like sending a post to someone, right? Once the post reaches your home, you will acknowledge it by signing perhaps, okay, I have received this post in the mail. After this acknowledge bit is received by the master, the master will actually send the actual data that means the information that it's trying to transmit. This is also followed by a few acknowledge bits just to make sure that the data transmission is going smoothly. Lastly, we have the finish condition. Just like the start condition, this basically signals the end of the message. Let's use a real-life example to understand how I square C works. Here we have a boss that's saying, listen up, this is like a start condition. Next we have the boss calling out who he needs to talk to. This is like an address. Next we have Kevin replying with an acknowledge bit. Now there's actual data transmitted when the boss says finish that report. That's the instruction. Now Kevin again replies with an acknowledge bit. Now lastly, the boss ends the conversation with the end condition. In this I square C demo, the boss is the master and Kevin is the slave. Now that we've understood how I square C works, it's actually talking about some of the alternatives to I square C. Firstly we have serial communication. Now serial communication also uses two wires, but it's biggest drawback is that you can only use it to communicate between two devices. You cannot add more like I square C. Next we have SPI. Now SPI is similar to I square C in the sense that you can control multiple devices within one communication loop. But SPI uses three to four wires as a minimum and every additional device that you connect to your master will have an additional wire which can make it very messy for bigger projects. Next, let's talk about some of the downsides of I square C. The actual software and the implementation of I square C is actually quite complicated. However, most of this work is done by the manufacturers and by using open source libraries, I square C implementation for hobbyists like you and I is very simple. Next I square C is significantly slower than SPI, but it can still be faster than serial. Now let's talk about some of the positives of I square C. Firstly it doesn't need a dedicated control line for each device such as SPI, I square C only uses two wires no matter how many devices you have connected. Next we can have multiple masters or transmitters within one communication loop. Again, this is not possible by SPI. And lastly the acknowledged frame within each message is a good way to ensure that your message is being properly received and nothing is wrong. Lastly let's talk about how you can implement I square C in your Raspberry Pi or Arduino powered project. For the Raspberry Pi, you actually have two I square C compatible pin pairs. The first is pins 3 and 5 and then pins 27 and 28. To enable these pins, you actually have to go into Raspberry config, go into interfacing options and then enable I square C. Next to actually use it in your project, you do need to have RPI or GPIO package installed within your Python code. The Arduino implementation of I square C is actually a little easier. You also have to check which pins on your board are compatible with I square C. For example on the Arduino Uno, those pins are pins A4 and pins A5. Next to actually use it in your code, you have to go into libraries and import the wire.h library. That's it for this quick tutorial. Now I'll be making dedicated videos for both SPI and serial communication. If you have any questions, comments, you can leave them down in the comment section below. And if you want to subscribe for more future videos or tutorials like these, please feel free to subscribe. Thanks for watching.