Home  Product Technical Articles   How to wire an MCP23008 I2C interface with an Arduino?[FAQ]

How to wire an MCP23008 I2C interface with an Arduino?[FAQ]

Author: Irene
Date: 26 Feb 2022
 3728
Packages

8-Bit I2C  I/O  Expander with Serial Interface 

MCP23008 provides an 8-bit parallel input/output expansion for I2C bus and SPI applications. This microcontroller has 8-bit configuration registers for input, output, and polarity changing.

Catalog

Description

CAD Model

Pinout

Pinout Diagram

Product Attributes

Product Features

Packages

How to wire an MCP23008 I2C interface with an Arduino?

Components

Details Explained

MCP23008 Datasheet

FAQ

 

Description

Add another 8 pins to your microcontroller using an MCP23008  port expander. The MCP23008 uses two i2c pins  (these can be shared with other i2c devices), and in exchange gives you 8 general purpose pins. You can set each of 8 pins to be input, output, or input with a pullup. There's even the ability to get an interrupt via an external pin when any of the inputs change so you don't have to keep polling the chip.

Use this chip from 2.7-5.5V (good for any 3.3V or 5V setup), and you can sink/source up to 20mA from any of the  I/O pins so this will work for LEDs and such. Team it up with a high-power MOSFET  if you need more juice. DIP package means it will plug into any breadboard or perfboard.

You can set the i2c address by tying the ADDR0-2 pins to power or ground, for up to 8 unique addresses. That means 8 chips can share a single i2c bus - that's 64 I/O pins!

 

MCP23008

MCP23008

 

 

 

CAD Model

symbol and footprint

Pinout

 

There is the main 18 pinout of MCP23008, which are described below with a detailed description.

 

MCP23008-Pinout

MCP23008 Pinout

 

 

Pinout Diagram

Pin# Type   Parameters
Pin#1 SCL/SCK It is a Serial clock input.
Pin#2 SDA/SI It is a Serial data I/O (MCP23008)/Serial data input (MCP23S08) pin.
Pin#3 A2/SO It is a hardware address input (MCP23008)/Serial data output (MCP23S08). It (A2) must be biased externally.
Pin#4 A1 It is a Hardware address input. It Must be biased externally.
Pin#5 A0 It is a Hardware address input. It Must be biased externally.
Pin#6 RESET This is an external reset input.
Pin#7 NC/CS No connect (MCP23008)/External chip select input (MCP23S08).
Pin#8 INT It is an Interrupt output. It Can be configured for active-high, active-low or open-drain.
Pin#9 VSS It is used for Ground.
Pin#10 GP0 It is a Bidirectional I/O pin. It can be enabled for interrupt-on-change and/or internal weak pull-up resistor.
Pin#11 GP1 It is a Bidirectional I/O pin. It can be enabled for interrupt-on-change and/or internal weak pull-up resistor.
Pin#12 GP2 It is a Bidirectional I/O pin. It can be enabled for interrupt-on-change and/or internal weak pull-up resistor.
Pin#13 GP3 It is a Bidirectional I/O pin. It can be enabled for interrupt-on-change and/or internal weak pull-up resistor.
Pin#14 GP4 It is a Bidirectional I/O pin. It can be enabled for interrupt-on-change and/or internal weak pull-up resistor.
Pin#15 GP5 It is a Bidirectional I/O pin. It can be enabled for interrupt-on-change and/or internal weak pull-up resistor.
Pin#16 GP6 It is a Bidirectional I/O pin. It can be enabled for interrupt-on-change and/or internal weak pull-up resistor.
Pin#17 GP7 It is a Bidirectional I/O pin. It can be enabled for interrupt-on-change and/or internal weak pull-up resistor.
Pin#18 VDD Power pin.
Pin#19 N/C N/C

 

Product Attributes

TYPE DESCRIPTION
Category Integrated Circuits (ICs)
  Interface - I/O Expanders
Mfr Microchip Technology
Series -
Package Tube
Part Status Active
Number of I/O 8
Interface I虏C
Interrupt Output Yes
Features POR
Output Type Push-Pull
Current - Output Source/Sink 25mA
Clock Frequency 1.7 MHz
Voltage - Supply 1.8V ~ 5.5V
Operating Temperature -40C ~ 125C 
Mounting Type Through Hole
Package / Case 18-DIP (0.300", 7.62mm)
Supplier Device Package 18-PDIP
Base Product Number MCP23008
Report an Error  
View Similar  

 

Product Features

  • 8-bit port expander with interrupt output
  • 3 address inputs for up to 8 devices on one bus
  • 25mA sink/source capability per I/O
  • Supports 100kHz, 400kHz, and 1.7MHz I2C  ™Compatible modes
  • Internal power-on-reset (POR)

 

Packages

  • 18-pin  PDIP  (300 mil)
  • 18-pin SOIC (300 mil)
  • 20-pin SSOP
  • 20-pin QFN

 MCP23008 Package type

 

 MCP23008 Package type

 

How to wire an MCP23008 I2C interface with an Arduino?

  • We will demonstrate how to connect an MCP23008  I/O port expander chip to an Arduino microcontroller in this project. If we need more I/O ports for a microcontroller, this is a very useful thing to do.
  • Input/output ports are referred to as I/O ports. If we need more inputs or outputs to a microcontroller, we can use an I/O port expander chip to increase the number of I/O ports.
  • The MCP23008  chip will provide us with an additional 8 I/O ports by utilizing only two pins on the microcontroller.
  • The I2C  bus and protocol are used by the MCP23008  chip. As a result, only two digital pins on the Arduino are required. As a result, it uses a very small number of I/O pins for communication.
  • It uses two pins for the clock line and one for the data line.
  • The I/O ports are all bidirectional. As a result, the device connected to one of the ports can both receive and send data to the microcontroller. Each port can sink up to 25mA of current, which is sufficient to power devices such as the LEDs used in this circuit. If you need more current, you can always use a transistor, but for this circuit, the IC can drive LEDs.
  • We can drive 8 LEDs with an  MCP23008  because it has 8 outputs.

 

Components

  • MCP23008 I/O Port Expander
  • A few 220Ω resistors
  • A few LEDs
  • Arduino microcontroller   

It is an ideal addition to a microcontroller that requires more I/O ports. The  MCP23008 I/O port expander costs slightly more than $2. It is a chip with 18 pins.

18 pins

18 pins

 

The MCP23008 is powered by +5V. As a result, we can connect  VDD  to the Arduino's 5V terminal. VSS is connected to the ground. This completes the powering requirements for the MCP23008,  The 8 I/O ports are labeled GP0-GP7. Because NC is not connected, we leave that pin unconnected (or floating). SCL stands for serial clock line. It connects to the analog clock pin on the Arduino.  analog pin 5. The serial data line is abbreviated as SDA. It connects to the analog data line on the Arduino's analog pin 4. The interrupt pin for the outputs is  INT. We leave this pin unconnected because we are not going to use interrupts here. The address pins are A0, A1, and A2. If you're using multiple MCP23008 chips, you only need to be concerned about these pins. These pins are externally biased, which means you can supply voltages to them to generate different addresses. Because there are three pins, you can generate a total of eight different addresses (23=8). This is only required if you are connecting multiple ICs so that we can tell them apart. MCP23008 I/O Port Expander Circuit with an Arduino  Microcontroller. The MCP23008 I/O port expander circuit we will build with an Arduino microcontroller is shown below.

 

 

MCP23008 Arduino Circuit

MCP23008 Arduino Circuit

 

Details Explained

Let us now go over our projects in detail. In this circuit, we connect a 220 resistor and an LED to each input and output pin. We connected +5V to Vdd and Vss to  GND  for input power.

Now, connect SCL pin 1 of the MCP23008 to analog pin 5 of the Arduino,  This synchronizes the clocks of the  Arduino and the I/O port expander chip.

Following that, we connected to pin 2 of the MCP23008.  which is SDA, to analog pin 4 of the  Arduino,  Data can be transferred between the  Arduino and the I/O port expander chip via this connection. Because interrupts aren't used in this project, leave the  INT pin unconnected. We don't use the RESET pin; instead, we connect it to +5V. To use it, simply connect it to a digital pin on the Arduino,  If you want to reset all outputs, connect this pin to the ground in cade.

Following that, we'll connect address pins A0, A1, and A2 to the ground. It changes the address of these three pins to 000. This is MCP23008 Arduino Interfacing.

 

MCP23008 Datasheet

MCP23008 Datasheet

 

 

FAQ

What is MCP23008?

MCP23008 – I2C interface; three address pins. • MCP23S08 – SPI interface; two address pins. The MCP23X08 consists of multiple 8-bit configuration registers for input, output and polarity selection. The system master can enable the I/Os as either inputs or outputs by writing the I/O configuration bits.

 

What are I O expanders?

NXP's general-purpose input/output (GPIO) expanders are a simple, cost-effective way to monitor and control several peripheral signals. They make it easy for designers to add extra I/O to their design and thereby free up the microprocessor's GPIO for other, more important functions.

 

What is I2C port?

I2C is a packet-switched serial communication protocol that allows multiple master devices to connect to multiple slave devices using only 2 wires per connection. It is intended for attaching lower-speed peripheral ICs to processors and microcontrollers in short-distance, intra-board communication.

 

What does MCP23008 have for input?

8-bit configuration registers

 

What does the MCP23008 port expander use?

MOSFET

Related Articles

74HC14 IC: Pinout, Equivalent, Feature [Video]

Iggy 21 Feb 2022 24528

74HC14 is Hex Inverting Schmitt Trigger IC. 74HC14 is a member of the 74XXXX Integrated Circuit Series, consisting of logic gates. This module is also referred to as the hexadecimal Schmitt trig...

Continue reading »

MT25QL128ABA1ESE-0SIT: CAD Models, Datasheet, Features

Candy 13 Sep 2022 588

CatalogMT25QL128ABA1ESE-0SIT Product OverviewMT25QL128ABA1ESE-0SIT CAD ModelsMT25QL128ABA1ESE-0SIT Pin ConfigurationMT25QL128ABA1ESE-0SIT Block DiagramMT25QL128ABA1ESE-0SIT FeaturesMT25QL128ABA1ESE-0S...

Continue reading »

Introduction to L7812CV Voltage Regulator [FAQ]

Mia 21 Jan 2022 16849

The L7812CV is a three-terminal positive voltage regulator. This regulator can provide local on-card regulation, eliminating the distribution problems associated with single point regulation...

Continue reading »

BQ32000DR: CAD Models, Datasheet, Features [Video]

Candy 28 Oct 2022 441

CatalogBQ32000DR Product OverviewBQ32000DR Related Video IntroductionBQ32000DR CAD ModelsBQ32000DR Pin ConfigurationBQ32000DR Block DiagramBQ32000DR Simplified SchematicBQ32000DR Typical ApplicationBQ...

Continue reading »

LM317: Switched Mode Power Supply

Irene 1 Mar 2022 8384

IntroductionA switched-mode power supply (SMPS) is an electronic power supply that incorporates a switching regulator to convert electrical power efficiently. Switched-mode power supplies have re...

Continue reading »

0 comment

Leave a Reply

Your email address will not be published.

 
 
   
 
Rating:

# 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z