0% found this document useful (0 votes)
11 views8 pages

Copy of Robotic Process Automation (RPA) Project Proposal

The document provides an overview of the I2C (Inter-Integrated Circuit) protocol, highlighting its purpose, basic communication structure, and applications in robotics. It details how the ATmega 16/32 microcontrollers support I2C communication through their TWI module, including key registers and data transmission steps. Additionally, it discusses the advantages and limitations of I2C, along with its common uses in interfacing sensors, data storage, and display communication in robotic systems.

Uploaded by

sainiguharoy25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views8 pages

Copy of Robotic Process Automation (RPA) Project Proposal

The document provides an overview of the I2C (Inter-Integrated Circuit) protocol, highlighting its purpose, basic communication structure, and applications in robotics. It details how the ATmega 16/32 microcontrollers support I2C communication through their TWI module, including key registers and data transmission steps. Additionally, it discusses the advantages and limitations of I2C, along with its common uses in interfacing sensors, data storage, and display communication in robotic systems.

Uploaded by

sainiguharoy25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

I2C PROTOCOL

IN ATMEGA
16/32

Name: SAINI GUHA ROY


Roll No: 13031122003
Department: Computer Science and Business Systems
Semester: 6th
Subject Name: Robotics and Embedded Systems
Subject Code: PEC-CSBS602 C
Introduction & Basics of
I2C isProtocol
What I2C?
•I2C (Inter-Integrated Circuit) is a synchronous serial communication protocol that enables
multiple devices to communicate using just two wires.
•Purpose: It is designed for short-distance, low-speed communication between
microcontrollers and peripherals.
•Who invented it? Developed by Philips (now NXP Semiconductors) in the 1980s.
•Common Applications:
• Sensors (Temperature, Accelerometers, Gyroscopes)
• EEPROMs (Non-volatile memory storage) I2C Protocol Basics
•Communication Type: Half-Duplex (Only one device transmits at a time).
•Number of Wires Required:
• SDA (Serial Data Line) – Transfers data between devices.
• SCL (Serial Clock Line) – Synchronizes data transfer.
•Master-Slave Concept:
• Master: Initiates communication, generates the clock signal, and selects slaves.
• Slaves: Respond to master’s requests based on assigned addresses.
• Multiple slave devices can be connected to a single I2C bus, each with a unique address.
•Speed Modes:
• Standard Mode: 100 kHz
• Fast Mode: 400 kHz
• High-Speed Mode: 3.4 MHz (for advanced applications)
• Ultra-Fast Mode: 5 MHz (rarely used)
I2C Communication in ATmega
I2C in ATmega 16/32
16/32
• ATmega 16/32 supports I2C communication through its TWI (Two-Wire Interface) module.
• This allows the microcontroller to function as a Master or Slave in an I2C network.
• TWI in ATmega follows the standard I2C protocol, ensuring compatibility with various peripherals
like sensors, EEPROMs, and displays.

I2C Addressing in ATmega 16/32


Key Registers for I2C in ATmega 16/32 •7-bit Addressing:
Register Name Description
• Standard addressing mode.
TWBR Bit Rate Register
Sets the speed of the I2C clock (SCL • Supports up to 128 (2⁷) devices
frequency).
on a single I2C bus.
Stores the current status of I2C •10-bit Addressing:
TWSR Status Register operations (Start, Address Sent, • Extended mode for larger
Data Sent, etc.).
networks.
Controls operations like Start, Stop, • Supports up to 1024 devices but
TWCR Control Register
Acknowledge, and Enable. is less commonly used.
Holds the data byte to be
TWDR Data Register
transmitted or received.

Sets the slave address when the


TWAR Address Register microcontroller is operating as a
slave.

Enables address masking for


TWAMR Address Mask Register
selective slave responses.
I2C Data Transmission Steps
Start Condition (S) Send Address (Slave
Acknowledge (ACK)
•The Master pulls the SDA line Address + R/W bit)
•The Master sends the 7-bit slave
from Slave
LOW while SCL remains HIGH. •The addressed Slave responds
•This signals the beginning of a address followed by the Read/Write
(R/W) bit: with an Acknowledge (ACK) by
new data transfer.
• 0 (Write): Master wants to pulling SDA LOW after
•All connected slave devices
send data to the Slave. receiving the address.
recognize this condition.
• 1 (Read): Master wants to
receive data from the Slave.

Send/Receive Data Stop Condition (P)


(Byte-by-Byte) •The Master releases the
•Data is transmitted one byte SDA line HIGH while SCL is
(8 bits) at a time. HIGH.
•After each byte, the receiving •This signals the end of
device sends an ACK to communication, and the
confirm successful reception. bus becomes free for other
•The process repeats for operations.
multiple bytes if necessary.
Programming in ATmega 16/32
I2C communication in ATmega 16/32 is implemented using TWI (Two-Wire Interface). Below are the essential code snippets for initializing I2C and sending data.

I2C Initialization Generating the START Condition

Explanation: Explanation:
•TWBR (Bit Rate Register): Sets the SCL frequency for I2C •TWCR (Control Register):
communication. •TWSTA: Setsthe START condition.
•TWSR (Status Register): Prescaler bits are set to 00 for •TWEN: Enables I2C operation.
standard speed operation. •TWINT: Clears the interrupt flag to start a new operation.
•This function must be called before using I2C •while (!(TWCR & (1<<TWINT)));
communication. •Waits for the START condition to complete before
proceeding.
Advantages &
Limitations
Advantages of I2C
✔️Uses Only Two Wires: Reduces hardware complexity.
✔️Supports Multiple Devices: Allows multiple masters and
slaves on the same bus.
✔️Efficient for Short-Distance Communication: Ideal for
embedded systems and robotics.
✔️Built-in Acknowledgment Mechanism: Ensures reliable
data transmission.

Limitations
✖️Slower than SPI: Maximum speed of 3.4 MHz, while SPI
can reach tens of MHz.
✖️More Complex than UART: Requires addressing and
acknowledgment, making it less straightforward.
✖️Limited Device Address Space: 7-bit addressing
supports only 128 devices (without address conflicts).
✖️Requires Pull-Up Resistors: External resistors are
needed for SDA and SCL lines.
Applications of I2C in
Robotics
I2C is widely used in robotics for integrating various peripherals with microcontrollers.
Key Applications:

🤖 Interfacing Sensors:
•Accelerometers, Gyroscopes, Temperature Sensors, Proximity Sensors use I2C for real-time data
collection.

💾 Data Storage in EEPROM:


•Robots use EEPROMs for non-volatile data storage, such as calibration settings and past
operations.

OLED & LCD Display Communication:


•I2C enables text and graphical displays in robotic user interfaces.

⏳ RTC (Real-Time Clock) Synchronization:


•Robots use RTC modules for time-based task execution, such as scheduled operations.
Conclusion and
references
Summary
🔹 I2C simplifies communication in embedded systems by reducing wiring.
🔹 ATmega 16/32 provides robust I2C support, enabling easy integration of peripherals.
🔹 Widely used in robotics for sensor interfacing, display control, and data storage.

References
📚 Datasheets & Technical Documents:
•ATmega16/32 Datasheet – Microchip Technology
•I2C Protocol Specification – NXP Semiconductors
📖 Books & Online Resources:
•"Embedded Systems with AVR Microcontrollers" – Raj Kamal
•Arduino & AVR Forums – https://www.avrfreaks.net

You might also like