Comimark LY438

Download PDF
Contents

Comimark PCF8574/PCF8574T I2C 8-Bit IO GPIO Expander Module User Manual

Model: LY438

1. Introduction

This manual provides comprehensive instructions for the installation, operation, and maintenance of the Comimark PCF8574/PCF8574T I2C 8-Bit IO GPIO Expander Module. Designed for use with microcontrollers such as Arduino and Raspberry Pi, this module allows for the expansion of available General Purpose Input/Output (GPIO) pins via the I2C communication protocol. Please read this manual thoroughly before use to ensure proper functionality and to maximize the utility of your module.

2. Product Overview

The Comimark PCF8574/PCF8574T is an 8-bit I/O expander for the I2C-bus. It provides 8 quasi-bidirectional I/O pins and operates from 2.5V to 6V. The device features a low current consumption and is suitable for various applications requiring additional digital I/O. Its I2C interface simplifies connection to microcontrollers, requiring only two data lines (SDA, SCL) in addition to power (VCC, GND).

Three Comimark PCF8574T I2C 8-Bit IO GPIO Expander Modules

Figure 2.1: Three Comimark PCF8574T I2C 8-Bit IO GPIO Expander Modules. Each module is blue with a black IC chip labeled PCF8574T, yellow pin headers for I/O, and address selection jumpers (A0, A1, A2).

3. Features

  • Compatible with Arduino and Raspberry Pi platforms.
  • Provides 8 additional General Purpose Input/Output (GPIO) pins.
  • Utilizes the I2C communication interface for simplified wiring.
  • Low power consumption.
  • Address selection pins (A0, A1, A2) allow for multiple modules on a single I2C bus.

4. Package Contents

The package typically includes:

  • 3 x Comimark PCF8574/PCF8574T I2C 8-Bit IO GPIO Expander Modules

Note: Contents may vary slightly depending on the specific vendor or kit.

5. Specifications

Model NumberLY438
BrandComimark
ChipsetPCF8574 / PCF8574T
I/O Pins8 (quasi-bidirectional)
InterfaceI2C (Two-Wire Interface)
Operating Voltage2.5V to 6V
Default I2C Address (Arduino)0x20 (configurable via A0, A1, A2)
DimensionsApproximately 5.75 x 3.78 x 0.94 inches (package dimensions)
WeightApproximately 0.634 ounces

6. Setup

Follow these steps to connect and prepare your PCF8574/PCF8574T module for use:

  1. Identify Pins: Locate the VCC, GND, SDA, SCL, and I/O (P0-P7) pins on the module. Also, identify the address selection pins A0, A1, A2.
    Top view of a single Comimark PCF8574T module showing pin labels

    Figure 6.1: Top view of a single PCF8574T module, highlighting the VCC, GND, SDA, SCL pins on one side, and the P0-P7 I/O pins, INT pin, and A0, A1, A2 address selection jumpers on the other side.

  2. Power Connection:
    • Connect the VCC pin on the module to the 3.3V or 5V power supply of your microcontroller (e.g., Arduino 5V, Raspberry Pi 3.3V/5V).
    • Connect the GND pin on the module to the ground of your microcontroller.
  3. I2C Connection:
    • Connect the SDA pin on the module to the SDA (data line) pin of your microcontroller.
    • Connect the SCL pin on the module to the SCL (clock line) pin of your microcontroller.

    Typical Arduino Uno/Nano: SDA is A4, SCL is A5. Typical Arduino Mega: SDA is 20, SCL is 21. Raspberry Pi: SDA is GPIO2, SCL is GPIO3.

  4. Address Configuration (A0, A1, A2): The PCF8574/PCF8574T uses three address pins (A0, A1, A2) to set its I2C address. These pins can be connected to VCC (HIGH) or GND (LOW) using the onboard jumpers or external wiring.
    • By default, all A0, A1, A2 pins are typically pulled LOW (connected to GND) via the jumpers, resulting in an I2C address of 0x20 for Arduino libraries.
    • To change the address, move the corresponding jumper from its default position (GND) to VCC. For example, connecting A0 to VCC will change the address to 0x21.
    • Up to 8 modules can be connected to a single I2C bus by assigning each a unique address (0x20 to 0x27).
    Angled view of a single Comimark PCF8574T module showing address jumpers

    Figure 6.2: Angled view of a single PCF8574T module, showing the yellow jumpers for A0, A1, A2 address selection. These jumpers determine the I2C address of the module.

  5. I/O Pin Connection: Connect your sensors, LEDs, or other peripherals to the P0-P7 pins as required by your project. Remember that these are quasi-bidirectional pins.

7. Operating Instructions

To operate the PCF8574/PCF8574T module, you will typically use an I2C library compatible with your microcontroller platform.

7.1. Arduino Example

  1. Install Library: Install an appropriate PCF8574 library via the Arduino IDE's Library Manager (e.g., "PCF8574" by Rob Tillaart or "LiquidCrystal_I2C" for LCDs).
  2. Include Library: In your Arduino sketch, include the library: #include <Wire.h> and #include <PCF8574.h> (or similar).
  3. Initialize: Create an instance of the PCF8574 object, specifying the I2C address. For example, PCF8574 pcf8574(0x20); if A0, A1, A2 are all LOW.
  4. Begin Communication: In your setup() function, call Wire.begin(); and pcf8574.begin();.
  5. Read/Write Pins:
    • To set a pin as output and write a value: pcf8574.pinMode(P0, OUTPUT); pcf8574.digitalWrite(P0, HIGH);
    • To read a pin: pcf8574.pinMode(P1, INPUT); int value = pcf8574.digitalRead(P1);

    Note: The PCF8574's pins are quasi-bidirectional. When configured as input, they have a weak pull-up. To read a low signal, the external device must be able to sink current. When configured as output, they can sink more current than they can source.

7.2. Raspberry Pi Example

  1. Enable I2C: Ensure I2C is enabled on your Raspberry Pi (sudo raspi-config -> Interface Options -> I2C).
  2. Install Libraries: Install python3-smbus and i2c-tools: sudo apt-get install python3-smbus i2c-tools.
  3. Detect Address: Use i2cdetect -y 1 (for Raspberry Pi 2/3/4) to find the module's I2C address.
  4. Python Script Example:
    import smbus
    import time
    
    bus = smbus.SMBus(1) # 0 for older Pi boards, 1 for newer ones
    address = 0x20       # PCF8574 default I2C address
    
    def write_pcf8574(value):
        bus.write_byte(address, value)
    
    def read_pcf8574():
        return bus.read_byte(address)
    
    # Example: Turn on P0, turn off P1
    # To set P0 high, write 0x01 (binary 00000001)
    # To set P1 low, write 0x00 (binary 00000000)
    # Note: PCF8574 pins are inverted for output (write 0 to turn on LED, 1 to turn off)
    # For input, write 0xFF to set all pins as input with weak pull-ups
    
    # Set all pins high (off for LEDs)
    write_pcf8574(0xFF)
    print("All pins set high (default state)")
    time.sleep(1)
    
    # Turn on P0 (write 0 to P0, others high)
    write_pcf8574(0xFE) # 11111110
    print("P0 turned on")
    time.sleep(1)
    
    # Turn on P1 (write 0 to P1, others high)
    write_pcf8574(0xFD) # 11111101
    print("P1 turned on")
    time.sleep(1)
    
    # Read input from P7 (assuming P7 is connected to a switch)
    # First, set all pins to input (write 0xFF)
    write_pcf8574(0xFF)
    input_value = read_pcf8574()
    print(f"Current input value: {bin(input_value)}")
    # To check P7, mask the bit: (input_value & 0x80) == 0
    

8. Maintenance

The Comimark PCF8574/PCF8574T module is a robust electronic component that requires minimal maintenance. Adhere to the following guidelines:

  • Storage: Store the modules in a dry, anti-static environment when not in use.
  • Cleaning: If necessary, gently clean the module with a soft, dry brush or compressed air to remove dust. Avoid using liquids or abrasive materials.
  • Handling: Handle the module by its edges to avoid touching the electronic components, especially the IC chip, to prevent electrostatic discharge (ESD) damage.
  • Power Supply: Ensure the operating voltage (2.5V to 6V) is strictly adhered to. Over-voltage can permanently damage the module.

9. Troubleshooting

If you encounter issues with your PCF8574/PCF8574T module, consider the following troubleshooting steps:

  • Module Not Detected on I2C Bus:
    • Check Wiring: Verify that VCC, GND, SDA, and SCL connections are correct and secure.
    • Verify I2C Address: The default I2C address for many Arduino libraries is 0x20, not 0x40 as sometimes documented in datasheets (which may count the R/W bit). Use an I2C scanner sketch (available online) to confirm the actual address of your module.
    • Address Jumpers: Ensure the A0, A1, A2 jumpers are set correctly. If you've moved them, the address will change.
    • Power Supply: Confirm the module is receiving adequate power within its operating voltage range.
    • Pull-up Resistors: Most microcontrollers have internal pull-up resistors for I2C, but external 4.7kΩ pull-up resistors on SDA and SCL lines (to VCC) might be necessary for longer wires or specific setups.
  • Output Pins Not Driving Devices Correctly:
    • Current Limitations: The PCF8574/PCF8574T pins are quasi-bidirectional and have limited current sourcing capabilities (weak pull-up). They are better at sinking current (driving a pin LOW). If you need to drive components that require significant current (e.g., some relays, brighter LEDs), you may need external transistors or a different I/O expander (e.g., MCP23017).
    • Inverted Logic: For output, writing a '0' (LOW) to a pin typically turns on an LED connected to VCC, while writing a '1' (HIGH) turns it off. Verify your logic.
  • Input Pins Not Reading Correctly:
    • Weak Pull-up: When configured as input, the pins have a weak internal pull-up. An external switch or sensor must be able to pull the pin LOW effectively.
    • External Pull-down: For some sensors, an external pull-down resistor might be needed if the sensor provides a high-impedance output.
  • Multiple Modules on I2C Bus: Ensure each module has a unique I2C address set via its A0, A1, A2 jumpers. Duplicate addresses will cause conflicts.

10. Warranty and Support

Specific warranty details for the Comimark PCF8574/PCF8574T I2C 8-Bit IO GPIO Expander Module are not provided in this manual. For warranty claims, technical support, or further assistance, please refer to the retailer or manufacturer's official website where the product was purchased. Keep your proof of purchase for any warranty-related inquiries.

© 2023 Comimark. All rights reserved.

This manual is for informational purposes only. Comimark is not responsible for any damages or losses resulting from the use of this information.

Documents and downloads

Ask a question about this manual

Ask about setup, troubleshooting, compatibility, parts, safety, or missing instructions. Manuals+ will review the question and use this page’s manual context to help answer it.

After a successful submission, we securely hash the supplied account or form email before sending it to Microsoft Advertising for conversion attribution. Privacy details.