Project 1 - Interfacing a 16*2 LCD with Arduino using I2C protocol
Here we used I2C communication for transferring data from MASTER to SLAVE through theI2C bus
In arduino we used the separate SDA and SCL pins .
SDA (Serial Data) – The line for the master and slave to send and receive data.
SCL (Serial Clock) – The line that carries the clock signal.
Process:
1. The master sends the start condition to every connected slave by switching the SDA line from a high voltage level to a low voltage level before switching the SCL line from high to low
2. The master sends each slave the 7 or 10 bit address of the slave it wants to communicate with, along with the read/write bit
3. Each slave compares the address sent from the master to its own address. If the address matches, the slave returns an ACK bit by pulling the SDA line low for one bit. If the address from the master does not match the slave’s own address, the slave leaves the SDA line high.
4. The master sends or receives the data frame
5.After each data frame has been transferred, the receiving device returns another ACK bit to the sender to acknowledge successful receipt of the frame
6. To stop the data transmission, the master sends a stop condition to the slave by switching SCL high before switching SDA high
ADVANTAGES
- Only uses two wires
- Supports multiple masters and multiple slaves
- ACK/NACK bit gives confirmation that each frame is transferred successfully
- Hardware is less complicated than with UARTs
- Well known and widely used protocol
DISADVANTAGES
- Slower data transfer rate than SPI
- The size of the data frame is limited to 8 bits
- More complicated hardware needed to implement than SPI
https://www.tinkercad.com/things/9nfGecE8fPg-copy-of-project-1-interfacing-a-162-lcd-with-arduino-using-i2c/editel?tenant=circuits