Electronics

Expansion I/O Module MCP23017 I2C 16bit

AED 40.95

Low stock
1

Description

An Expansion I/O Module MCP23017 I2C 16-bit is a module that expands the input/output (I/O) capabilities of a device using the MCP23017 chip and the I2C (Inter-Integrated Circuit) communication protocol. It provides 16 general-purpose I/O pins that can be configured as either inputs or outputs. These pins can be used to connect and control various devices and peripherals, such as sensors, switches, LEDs, and actuators. Take your project to the next level with our 16 Way IO Extension Module, equipped with the powerful MCP23017 chip. Unlock new possibilities, streamline your IO management, and enjoy reliable operation every step of the way. Elevate your project's performance and efficiency with this exceptional module today.

 

Package Includes:

  • 1x Expansion I/O Module MCP23017 I2C 16-bit

 

Features:

  1. MCP23017 Chip: The module utilizes the MCP23017 integrated circuit, manufactured by Microchip, which provides 16 general-purpose I/O pins.
  2. I2C Communication: The module uses the I2C (Inter-Integrated Circuit) protocol for communication, allowing for easy integration and control with devices supporting I2C.
  3. 16-Bit I/O Expansion: The module offers 16 individual I/O pins, which can be configured as either inputs or outputs, providing expanded I/O capabilities for connecting and controlling external components.
  4. Configurable I/O Settings: Each I/O pin can be independently configured as an input or output based on the specific requirements of your project. This flexibility allows for customization and adaptation to different applications.
  5. Pull-Up Resistors: The module supports the option to enable pull-up resistors on the I/O pins. Pull-up resistors ensure stable and reliable input readings by providing a default logic level when the pins are not actively driven.
  6. Interrupt Functionality: The MCP23017 chip integrated into the module includes interrupt capability for the I/O pins configured as inputs. This feature allows for efficient monitoring and immediate response to specific events or changes in the input signals.
  7. High-Speed I2C Interface: The module supports various I2C frequencies, including 100KHz, 400KHz, and 1.7MHz, enabling fast and efficient data transfer between devices.
  8. Multiple Address Configurations: The MCP23017 chip has three address pins, allowing for eight different address configurations. This feature enables the connection of up to eight modules to a single I2C bus, expanding the total number of available I/O pins and achieving scalability.
  9. Strong Driving Capacity: The module's I/O interface provides a strong driving capacity, allowing for the control and connection of devices with higher current and power requirements. It can handle currents up to 25mA.
  10. Parallel Connection Capability: The module's design facilitates parallel connections, enabling multiple modules to be connected and controlled through a single I2C bus. This feature provides extended I/O expansion possibilities, with the potential for connecting up to 128 I/O extensions.

 

Description:

The Expansion I/O Module MCP23017 I2C 16-bit is a powerful and versatile solution designed to expand the input/output (I/O) capabilities of your device. Equipped with the highly regarded MCP23017 chip from Microchip, this module provides a wide range of features and functionalities that enhance its performance and flexibility.

With 16 individual I/O pins, this module allows you to significantly increase the number of available I/O channels. Each of these pins can be independently configured as either an input or an output, giving you the freedom to adapt the module to the specific requirements of your project. Whether you need to connect sensors, switches, LEDs, or other peripherals, the module offers ample flexibility to accommodate a variety of components.

To ensure accurate and reliable input readings, the module includes the option to enable pull-up resistors on the I/O pins. These resistors provide a default logic level when the pins are not actively driven, helping to stabilize the signals and prevent erroneous readings. The MCP23017 chip integrated into the module also supports interrupt functionality. This feature allows you to configure specific I/O pins as inputs and set up interrupt triggers. When an interrupt event occurs, such as a change in input state, the module can quickly respond and initiate the necessary actions, streamlining your data processing and enhancing overall system efficiency. The module communicates with your device using the I2C (Inter-Integrated Circuit) protocol, a widely adopted serial communication protocol known for its simplicity and versatility. The I2C interface offers high-speed data transfer capabilities, with selectable frequencies of 100KHz, 400KHz, and 1.7MHz, ensuring fast and efficient communication between devices. To accommodate larger projects or multiple modules, the MCP23017 chip provides three address pins, allowing for eight different address configurations. This means that you can connect up to eight modules to a single I2C bus, expanding your I/O capabilities even further. With the potential for parallel connections, you can achieve an impressive total of 128 I/O extensions, enabling extensive scalability for your projects. The module's I/O interface features a robust driving capacity, capable of handling currents up to 25mA. This enables you to connect and control devices with higher power requirements without the need for additional circuitry or external drivers. Whether you're working on automation systems, robotics, IoT applications, or any project that demands increased I/O capabilities, the Expansion I/O Module MCP23017 I2C 16-bit offers a feature-packed solution. Its comprehensive functionality, configuration flexibility, and strong driving ability make it an ideal choice for expanding the I/O capabilities of your device. Unlock new possibilities and take your projects to the next level with this powerful module.

 

Principle of Work:

The MCP23017 chip consists of two 8-bit ports (Port A and Port B) that can be configured as inputs or outputs. Each port is divided into eight individual I/O pins, resulting in a total of 16 pins available for I/O operations on the module. The module communicates with the host device, such as a microcontroller or a computer, via the I2C bus. The I2C bus utilizes two communication lines: SDA (Serial Data) and SCL (Serial Clock).

These lines facilitate bidirectional data transfer between the module and the host device. To interact with the MCP23017 chip, the host device sends commands and data over the I2C bus, addressing the specific MCP23017 chip on the module. The module contains address configuration options, typically set using hardware address pins, which allow multiple modules to coexist on the same I2C bus. By selecting different addresses, the host device can communicate with individual MCP23017 chips on different modules. Through the I2C interface, the host device can configure each I/O pin on the MCP23017 chip as either an input or an output. This configuration can be done individually for each pin or in a group, depending on the specific requirements of the project. The module provides software libraries or APIs that facilitate the configuration process, simplifying the integration of the module into various applications. For pins configured as inputs, the MCP23017 chip provides interrupt functionality. This allows the host device to specify certain conditions that trigger an interrupt event, such as a change in input state, and respond accordingly. When an interrupt event occurs, the MCP23017 chip generates an interrupt signal that the host device can capture, enabling it to execute the necessary actions promptly.

In addition to the I/O configuration and interrupt functionality, the MCP23017 chip also supports other features, such as configuring pull-up resistors for individual pins. Enabling pull-up resistors ensures stable input readings by providing a default logic level when the pins are not actively driven.

 

 

Pinout of the Sensor:

  1. I/O Configuration: Each individual pin on the MCP23017 chip can be configured as either an input or an output. This flexibility allows users to adapt the module to their specific project requirements. For example, the pins can be connected to sensors, switches, LEDs, or other peripheral devices.
  2. Pull-up Resistors: The MCP23017 chip includes built-in pull-up resistors that can be optionally enabled on the input pins. These resistors help stabilize the input signals by providing a default logic level when the pins are not actively driven.
  3. Interrupt Functionality: The chip supports interrupt functionality for the input pins. Users can configure specific pins as inputs and enable interrupt triggers based on their desired conditions. When an interrupt event occurs, such as a change in input state, the MCP23017 chip can generate an interrupt signal to the connected microcontroller or host device, allowing for the prompt response and efficient event handling.
  4. I2C Interface: The MCP23017 chip communicates with the microcontroller or host device through the I2C (Inter-Integrated Circuit) protocol. It provides a convenient serial communication interface, using the SDA (Serial Data) and SCL (Serial Clock) lines for bidirectional data transfer. This allows for efficient and reliable communication between the module and the controlling device.

These are the pinout of the module:

No. Pin Function Description
1 VCC Power Source Input Accepts power input in the range of 3.0V-5.5V
2 GND Power Negative Electrode Connected to the ground (0V)
3 SCL I2C Clock Line Connects to the SCL pin of the single-chip or MCU's I2C interface for clock synchronization
4 SDA I2C Data Line Connects to the SDA pin of the single-chip or MCU's I2C interface for data transfer
5 RST Chip Reset Low-level signal for chip reset. Connect to an MCU's IO pin or leave it unconnected if not used
6 ITA GPIOA Port Interrupt Output Connects to an MCU's IO pin to receive interrupt signals from the GPIOA port
7 ITB GPIOB Port Interrupt Output Connects to an MCU's IO pin to receive interrupt signals from the GPIOB port

 and the side pins:

Pin Name Description
VCC Power supply for the module - 5V
GND Ground connection
Port B Pins 8 pins available for I/O operations (PB0-7)
VCC Power supply for the module - 5V
Port A Pins 8 pins available for I/O operations (PA0-7)

 

Applications:

  1. Home Automation: The module can be used to connect and control various smart home devices, such as sensors, actuators, and switches, enabling users to automate and manage their home environment efficiently.
  2. Robotics: In robotics projects, the module can be utilized to interface with multiple sensors, motors, and other peripherals, facilitating the control and monitoring of the robot's movements and behaviors.
  3. Internet of Things (IoT): The module can be integrated into IoT projects to expand the I/O capabilities of IoT devices, enabling them to interact with the physical world and respond to sensor data.
  4. Industrial Automation: The module finds applications in industrial automation systems where it can connect to sensors, actuators, and other industrial equipment, providing enhanced control and monitoring capabilities.
  5. Environmental Monitoring: The module can be used in environmental monitoring systems to interface with various sensors measuring parameters like temperature, humidity, air quality, etc.
  6. Home Security Systems: By connecting the module to various security sensors, cameras, and alarms, it can serve as a fundamental component in home security setups.
  7. Data Logging: The module can be employed to log data from multiple sensors, allowing for the collection and analysis of information over time.
  8. Display Control: It can be used to control and drive various display panels or screens, enabling the creation of interactive display systems.
  9. Custom Control Panels: The module can be utilized to create custom control panels for specific applications, such as DIY projects or hobbyist setups.
  10. Educational Projects: The module is an excellent learning tool for students and electronics enthusiasts to understand I2C communication, I/O expansion, and interfacing with microcontrollers.

 

Circuit:

 

Library:

We need to install the Adafruit_MCP23017 library:

  1. Make sure you have the Arduino IDE installed on your computer. If you don't have it, you can download it from the official Arduino website (https://www.arduino.cc/en/software) and install it.
  2. Open the Arduino IDE.
  3. Go to the "Sketch" menu, select "Include Library," and then click on "Manage Libraries."
  4. The Library Manager window will open. In the search bar, type "Adafruit_MCP23017" and press Enter.
  5. The Adafruit_MCP23017 library should appear in the search results. Click on it.
  6. On the right side of the library entry, you'll see an "Install" button. Click on it.
  7. Wait for the installation process to complete. Once finished, you will see a "Installed" status next to the library.
  8. Close the Library Manager window.
  9. You can now use the Adafruit_MCP23017 library in your Arduino sketches. To include the library, go to the "Sketch" menu, select "Include Library," and you should see "Adafruit_MCP23017" listed. Click on it to include the library in your sketch.

 

Code:

This is a sample code that demonstrates how to use the Adafruit_MCP23017 library to control the I/O pins on the MCP23017 module, it initializes the MCP23017 module using the Adafruit_MCP23017 library and sets pin 0 as an output and pin 1 as an input. In the loop function, it continuously reads the state of pin 1 and turns on an LED connected to pin 0 if pin 1 is in a HIGH state.:

#include "Wire.h"
#include "Adafruit_MCP23017.h"

Adafruit_MCP23017 mcp;

void setup() {
  mcp.begin();  // Initialize MCP23017
  mcp.pinMode(0, OUTPUT);  // Set pin 0 as output
  mcp.pinMode(1, INPUT);   // Set pin 1 as input
}

void loop() {
  // Read the state of pin 1
  int inputState = mcp.digitalRead(1);
  
  // If pin 1 is HIGH, turn on the LED connected to pin 0
  if (inputState == HIGH) {
    mcp.digitalWrite(0, HIGH);
  } else {
    mcp.digitalWrite(0, LOW);
  }
}

 

  • The code includes the necessary libraries: Wire.h for I2C communication and Adafruit_MCP23017.h for interacting with the MCP23017 chip.
  • An instance of the Adafruit_MCP23017 class named mcp is created.
  • The setup() function is called once during the initialization phase. Inside the setup() function:
    • The mcp.begin() function is called to initialize communication with the MCP23017 chip.
    • pinMode() is used to set pin 0 as an output and pin 1 as an input.
    • The loop() function is repeatedly executed after the setup() function. Inside the loop() function:

    • The mcp.digitalRead(1) function reads the state of pin 1 and assigns it to the inputState variable.
    • An if statement checks if inputState is equal to HIGH, indicating that pin 1 is in a HIGH state.
    • If pin 1 is HIGH, the mcp.digitalWrite(0, HIGH) function is called to turn on the LED connected to pin 0.
    • If pin 1 is not HIGH, the mcp.digitalWrite(0, LOW) function is called to turn off the LED connected to pin 0.
  • By default, the MCP23017 chip has three address pins (A0, A1, and A2) that can be used to set the device address. The address pins can be either grounded (GND) or pulled up to VCC (3.3V or 5V) to set their respective binary values (0 or 1).
  • If you have not modified the address pins on your MCP23017 module, the default address is 0x20 (hexadecimal). However, if you have changed the address by grounding or pulling up the address pins, you will need to update the address in the code accordingly.
  • To change the address in the code, you can use the mcp.begin(address) function in the setup() function. Replace address with the correct address value you have configured. For example, if you have set the address to 0x21, the line would be mcp.begin(0x21).

 

Technical Details:

  • Chip: MCP23017 by Microchip Technology Inc.
  • Interface: I2C (Inter-Integrated Circuit)
  • Supply Voltage: 3.0V to 5.5V
  • I2C Frequency Support: 100kHz, 400kHz, and 1.7MHz
  • Number of I/O Pins: 16 (8 GPIOA pins and 8 GPIOB pins)
  • I/O Configuration: Each I/O can be individually configured as input or output.
  • Interrupt Function: Each input pin can be configured to generate an interrupt signal.
  • Pull-Up Resistors: Pull-up resistors can be enabled on each input pin.
  • I/O Driving Capacity: Strong driving capacity with a maximum current of 25mA per pin.
  • Address Configuration: Three address pins (A0, A1, and A2) allow for up to 8 different addresses, enabling the connection of multiple modules.

 

Resources:

 

Comparisons:

We will compare the MCP23017 I2C 16-bit IO expansion module with the PCF8574 I/O I2C module, we will consider various aspects such as features, capabilities, and specifications:

  1. Number of I/O Pins:

    • MCP23017: 16 I/O pins (8 pins each for Port A and Port B).
    • PCF8574: 8 I/O pins.
  2. Chip Manufacturer:

    • MCP23017: Microchip Technology Inc.
    • PCF8574: Texas Instruments (TI)
  3. Driving Capacity:

    • MCP23017: Strong driving capacity with a current of up to 25mA per pin.
    • PCF8574: Moderate driving capacity with a current of up to 20mA per pin.
  4. Interrupt Function:

    • MCP23017: Supports interrupt functionality on each input pin.
    • PCF8574: Does not have built-in interrupt support.
  5. Address Configuration:

    • MCP23017: Three address pins (A0, A1, and A2) for up to 8 different addresses, allowing multiple modules to be cascaded.
    • PCF8574: Only one address is available, making it less suitable for cascading multiple modules.
  6. I2C Frequency Support:

    • MCP23017: Supports I2C frequencies of 100kHz, 400kHz, and 1.7MHz.
    • PCF8574: Typically supports standard I2C frequency (100kHz).
  7. Voltage Levels:

    • Both modules generally support a power supply voltage range of 3.0V to 5.5V.
  8. Compatibility:

    • Both modules are compatible with various microcontrollers and microprocessors that support the I2C communication protocol.
  9. Application:

    • Both modules are widely used for expanding the number of available I/O pins on microcontrollers or for interfacing with various sensors and peripherals.

We can say that the MCP23017 I2C 16-bit IO expansion module offers more I/O pins, higher driving capacity, interrupt support, and cascading capability compared to the PCF8574 I/O I2C module. The PCF8574 module may be suitable for simpler projects with fewer I/O requirements, while the MCP23017 module provides enhanced capabilities and versatility for more complex projects that need a larger number of I/O pins and advanced features.