#define SCREEN_WIDTH 128 // OLED display width, in pixels Stop: After the completion of all data, at first, the SCL line changes from Low to High and then the SDA line will change from High to Low.
Pay attention that at the end of each data transition, the receiver must put the ACK bit in Low level to indicate full proper transition. Date: Once the ACK Bit sent from the slave is received by the master, the first byte of data is prepared to be sent.If the receiver properly receives the data, it’s called the “Acknowledge” state and a bit with Low level will be sent through the SDA line. ACK/NACK Bit: Once each 8-bit data is received by the Master or Slave, this bit specifies whether the data has been properly received.If this bit is in High level, the master is the receiver, and vice versa. R/W Bit: This bit, which is sent alongside the 7-bit address (it’s the LSB) determines whether the master is the transmitter or the receiver.After the address is sent, each slave compares it to its own address and in case it matches, the module will send a single bit (ACK Bit) in Low level to the master. These 7 bits (the address) is always sent from the master toward the slaves. Address: Including 7 bits (10 bit in some cases) is the I2C address of the module that the master intends to communicate with.Then, the same thing goes for the SCL line, too. Start: At first, the SDA line voltage drops from High to Low level.The data being transmitted between 2 devices on the SDA line consists of the following parts: In a nutshell, we are going to add the TCA9548A I2C Multiplexer to the project and expand the I2C addresses of the modules with the same I2C address. In this tutorial, we are going to present a hardware solution for this problem.
Generally speaking, this problem can be solved in both software and hardware. If you’re having the same problem, this tutorial can be helpful for you.
This problem is a serious one which we all have definitely come across with at least once.
But, if 2 or more of the modules had the same I2C address, we would face some apparently unsolvable problems in using them all. If they all have different I2C addresses, we could easily interface them, facing no serious trouble.
Sometimes, we have interfaced some I2C modules with a microcontroller in our projects. In a lot of projects, we have used different modules and sensors that support I2C communication protocol. Have you ever wanted to use 2 sensors with the same I2C address at the same time, not knowing what to do? Faced some serious challenges in doing that?