0% found this document useful (0 votes)
2 views9 pages

Slide Lab 3

The document outlines the implementation of I2C communication using TC74 and MCP23017 devices in an embedded system project. The TC74 sensor measures temperature and communicates with a microcontroller, while the MCP23017 expands the number of input/output pins available for Arduino, allowing for more device control. The document includes details on circuit modifications, source code for both devices, and successful testing results.

Uploaded by

Khairul Aziz
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)
2 views9 pages

Slide Lab 3

The document outlines the implementation of I2C communication using TC74 and MCP23017 devices in an embedded system project. The TC74 sensor measures temperature and communicates with a microcontroller, while the MCP23017 expands the number of input/output pins available for Arduino, allowing for more device control. The document includes details on circuit modifications, source code for both devices, and successful testing results.

Uploaded by

Khairul Aziz
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/ 9

Lab 3 :

I2C Communication
FSB30103
EMBEDDED SYSTEM TECHNOLOGY
NAME ID

Muhammad Arif Bin Zakaria 50222123146

Muhammad Wafiuddin Bin Khairuzzaini 50222123150


Circuit
Modification
 TC74 and MCP23017 are connected to I2C
bus
 I2C are a two-wire system that lets multiple
devices share the same connection
 MCP23017 is utilized to extend numbers of
input and output pins available for Arduino
 Motor connection, left button and right
button are moved to MCP23017 ports
TC74 and MCP23017 Implementation
TC74 sensor
 TC74 measures the temperature and
sends the data to the microcontroller
using the I2C communication protocol
 It provides the temperature readings
in Celsius .
 Address : 0X4D
MCP23017
 MCP23017 adds 16 extra input/output
pins to the Arduino using I2C
 Allow to control more devices like
push buttons and motor without
using the pins on the Arduino
 Address : 0X20

 Both devices are connected via the I2C bus,


sharing the same two wires (SDA for data
and SCL for clock) and can work together
without interfering with each other.
Modified Source Code for TC74
 According to the datasheet , the A5 address  The readTemperatureTC74() function
is equivalent to the 1001 101 in binary, 77 reads the temperature from the TC74
in decimal and 0X4D in hexadecimal. sensor using I2C
 In this context, hexadecimal is used  If successful, it retrieves and returns the
because it is a commonly used format in I2C temperature in Celsius.
communication due to its conciseness and  If there’s an error, vice versa
readability
 Different option address correspond to
different binary values (refer to datasheet)
Modified Source Code for MCP23017
 The base address of the MCP23017 is 0x20 in
hexadecimal (equivalent to 32 in decimal)
because all address pins are grounded
 This base address is determined by the default
configuration of the 3 address pins (A0, A1. A2)
set to GND (0)
 By changing the states of the address pins, the
address can range from 0x20 to 0x27 which
allows up to 8 MCP23017 devices on the same I2C
bus.
Modified Source Code for MCP23017
Void setup ()
 mcp.begin_I2C (…) – initialize between communication
between a microcontroller at address 0x20
 mcp.pinMode (…) – configures the mode (input or
output)

Void loop ()
 mcp.digitalWrite (…) and mcp.digitalRead (…) – sets
and reads the current state of a specific pins on the
MCP23017
Complete Code Implementation
Testing and Simulation

 The motors, left button, right button and TC74 functions properly
 It demonstrates the successful application of the I2C application in code

Right Left
TC74 button button
MCP23017 Overview
 The MCP23017 has three address pins (A0, A1, A2) that allow the user to set the I2C address
of the device
 These pins determine the last three bits of the device’s 7-bit I2C address. By connecting each
pin to either GND (0) or VCC (1), the address can be configured which provides 8 unique
addresess from 0X20 to 0X27
 16 additional digital I/O pins are provided, and it divided into two 8-pin banks (PORTA and
PORTB). The pins can be configured individually as input or output
 It communicates with Arduino via I2C protocol by using only SDA and SCL pins
 It also allows control of more devices such as sensors, buttons or motors which increases
system flexibilty

You might also like