Group assignment
Individual Assignment
I2C Communication ProtocolI2C (Inter-Integrated Circuit) is a serial communication bus protocol commonly used for short-distance data exchange between integrated circuits. It is also known as the Two-Wire Interface (TWI).
I2C uses only two bi-directional, open-drain lines:
SDA (Serial Data) – carries the actual data
SCL (Serial Clock) – carries the clock signal
Both SDA and SCL lines are normally pulled high using pull-up resistors. All devices on the bus are active low, meaning they can pull the lines low but not drive them high.
I2C supports two operating roles:
- Master mode
- Slave mode
Every bit of data sent on the SDA line is synchronized with the clock on the SCL line. According to the I2C specification:
The data line (SDA) must remain stable while the clock line (SCL) is high.
SDA is only allowed to change state when SCL is low.
Data Format Data is transmitted in packets, typically consisting of 9 bits:
Start Condition – 1 bit
Slave Address – 8 bits
Acknowledge (ACK) – 1 bit
Start and Stop Conditions
Start and stop conditions are generated by changing SDA while SCL is kept high:
Start Condition: SDA goes from high to low while SCL is high.
Stop Condition: SDA goes from low to high while SCL is high.
Read/Write Bit
A single Read/Write (R/W) bit indicates the direction of data transfer:
A high R/W bit means the master is sending data to the slave (write).
A low R/W bit means the master is receiving data from the slave (read).
Overall, this simple two-wire design, combined with addressing and start/stop conditions, allows multiple devices to share the same bus efficiently.
Designing the Board
For the Master board , I'll be using the board developed during the output week. It is a Xiao esp32s3 board, having a motor and speaker along with the I2C pins.
For the Student board , I'll be using the board developed during the input week, which has an ATtiny3216 microcontroller,This board features a magnetic encoder and touch pads, along with
the necessary I2C pins required for communication.
Programming the boards
For programming i referred a couple of documentations from the past academy graduates, Angelina Yang , Arduino's example.Initially i had trouble programming the board and found out it was because i had not soldered my SDA pin properly.
Following is how my initial test worked out:
click here for test code
Conclusion
Final Files
PCB FilesCode File