Blog  /  i2c Adapter: A Fun Insight To i2c Adapters And Protocols

i2c Adapter: A Fun Insight To i2c Adapters And Protocols

Understanding the i2c adapter is essential for effective communication between microcontrollers and peripheral devices. OurPCB offers Printed Circuit Board Assembly (PCBA) services that can help bring your i2c-based projects to life. With expert support in component selection and assembly, OurPCB ensures that your designs function smoothly and efficiently.
Quote Form
check whiteFast Turnaround check whiteISO Certified
1 2 3

Generally speaking, everything you see today is part of something. It happens either physically or via a protocol. Consequently, it is part of the global web if it has a screen and can connect to any online connection. But have you ever stopped to ask how and why this is?

This piece will attempt to answer the how part of the question. To do this, we will have a look at the i2c adapter.

What Is i2c?

i2c is an acronym that stands for an integrated controller and is a type of bus. Consequently, this is the physical part of the i2c system.

An i2c adapter is a synchronous multi-target or multi-controller. It was in intra-board communication, connecting lower-speed ICs to processors and microcontrollers.

Generally, most major IC manufacturers use the i2c protocol and the i2c adapter. Furthermore, its master-slave mode communication capabilities make it the go-to for many. Besides this, the i2c is also popular because:

  • It has an overall flexible data transmission rate.
  • Has proven it can provide long-distance communication.
  • There is an increase in the complexity of the low-level hardware or firmware.
  • The i2c easily accommodates multiple master interactions via collision detection and arbitration.

 

Pin Configuration Of i2c Adapter

An i2c module has 20 pins on board. These pins face the sides, the front, and the rear. Sixteen pins face the rear, and for pins, face the front side.

These pins are for communication with the MCU or the MPC. All this happens via the i2c protocol. The table below indicates all the pin names, the type, and the description. It gives a better understanding of the i2c adapter.

 

i2c pin configuration

i2c pin configuration

 

Eight devices can connect to a single bus when addressing the i2c serial interface adapter module. To do this, you will use the available points on the board. You can subsequently change these addresses.

Here is a table highlighting addresses set using points A0, A1, and A2.

 

i2c pin configuration

A0, A1, A2 address points

 

Special Offer: Get $100 off your order!

Enjoy $100 off your order! No hidden fees and no minimum order quantity required.
Email [email protected] to get started!

Features and Specifications of i2c Adapter

  • PCF8574 controls it.
  • On a single bus, it can have eight modules.
  • The i2c has an operational voltage of 5V output in DC.
  • The original i2c address is 0X20, and it runs to 0X27. You can change this using onboard jumper pins.
  • Its data rates range from 100 kbps to 3.4 Mbps.
  • The communication is synchronous, just like SPI.

 

 

How To Connect An i2c Adapter?

To give you a better understanding of the i2c adapter, we will experiment with the i2c adapter. To illustrate this, we will connect an i2c LCD with Arduino UNO.  

Requirements

  • 16x2 I2C LCD
  • Male and female jumper wires
  • An i2c controller

 

The experiment

We will connect a 16x2 I2C LCD with an Arduino Uno for this experiment. We will use the i2c adapter to intermediate the MCU (Arduino) and the LCD.

Before you embark on this experiment, you need to properly understand the i2c serial interface adapter. And its communication and peripheral device address as well.

Once that is out of the way. Dive right in. The 16 output pins on the i2c controller connect to the 16x2 LCD for this experiment. In addition, the two pins out of the four remaining will connect to the SDA and the SCL. The SDA is the serial data pin, and lastly, the SCL is the serial clock pin.

The remaining two pins will connect to the VCC for the power supply. And the GND for the ground connection.

On the i2c module, there is a POT, which controls the contrast of the LCD. To do this, you must rotate the POT. The module's jumper is responsible for the LCD is on or off.

 

Step 1

Step 1 is compulsory for beginners. But if you are not a beginner, you can skip it. For this case, the address table is below. To illustrate connected, we will use one and zero for not connected.

A0, A1, and A2 will disconnect at the start of the experiment. Plus, the address is not 0x27. If this happens, we need to scan the code.

For this reason, we need to write some code. We will use the i2c scan to find the correct peripheral device address. Once you complete this step, upload the code to your Arduino Uno.

 

A table displaying i2c addresses

A table displaying i2c addresses

 

Step 2

The second step also does not apply to everyone. You can skip this step if you already have an i2c LCD adapter module. If you do not, you need to connect your 16x2 LCD and the i2c module.

To begin with, you need to solder the module. Ensure that you have connected the i2c module to the Arduino. To do this, connect analog pin four to SDA in the same way. The analog pin is 5 to SCL, 5V to VCC, and the GND to GND.

Finally, with everything connected, connect your Arduino to the computer. Once complete, your screen should display this:

 

Synching i2c addresses

 

Step 3

We will display text to the i2c LCD adapter module in the third step. Before doing that, make sure to add the Arduino-LiquidCrystal-I2C-library to your IDE.

 

Step 4

Once you install the library, create a sketch. To begin with, including the header, “Wire. h”. As a result, this will create communication with the i2c device. With this in mind, make sure to include the LiquidCrystal_I2C.h.

Creating a sketch

 

Step 5

Next, you are going to set the address. While at it, set the number of columns to 16 and rows to 2 using the function "LiquidCrystal_I2C LCD(). The address for this is 0x27. Once you complete this step, call the display using “LCD.”

Setting up the columns and rows

 

Step 6

For this step, you need to code the setup. To do this, initialize the display using the "LCD. begin()" function.  

Begin function

 

Step 7

Step 7 involves turning on the LCD backlight. Subsequently, use the "LCD.backlight()" function to do this.  

Backlight function

 

Step 8

Next, you need to clear the LCD. Make sure to use "LCD.clear()" for this. Once done, set the cursor to position (4, 0).  

LCD clear function

 

Step 9

LCD Display

 

The last step in this experiment is printing. With the cursor set at the fourth column and the zero row, print any message of your choice. Finally, use the "LCD. print()" function to print your message.  

Print function

 

Finally, with programming complete, upload your sketch to your Arduino. Following this, watch the displayed message on the LCD.  

The Complete code

Complete code showcasing a connection between an i2c LCD with Arduino UNO

Applications

 

Conclusion

Undoubtedly, OLED screens are quickly replacing LCD screens. But until we cannot use them anymore, there are several fun experiments. Overall experiments allow us to understand the connection between two or more electric elements or components.

Lastly, if you found this experiment fun, you have just unlocked level one of the i2c adapters. If you are looking to experiment with this, do not hesitate to contact us

 

 

Special Offer: Get $100 off your order!

Enjoy $100 off your order! No hidden fees and no minimum order quantity required.
Email [email protected] to get started!
Table of Contents

Related Post