This module (HCMODU0120) is a breakout board for the PCF8574 8-bit input/output (I/O) expander IC. Using this module you can expand the available digital I/O pins of your microcontroller via its serial I2C interface. The device features an 8-bit quasi-bidirectional I/O port (P0–P7), including latched outputs with high current drive capability for directly driving LEDs. Each quasi-bidirectional I/O can be used as an input or output without the use of a data-direction control signal.
3 On-board jumpers allow selection of up to 8x I2C addresses meaning that up to 8 modules (64 I/O pins) can be connected to same I2C interface. The module also features convenient input and output headers at each end so that additional modules can simply be daisy-chained without the need for additional wires etc.
If you intend to use this module with a standard Arduino board please don't forget to download our exclusive HCPCF8574 library and example sketches which are fully compatible with this module. The library can be downloaded from the software section of our support forum here:
Note: Modules are shipped with either PCF8574T or PCF8574AT part fitted. These parts have identical operation but have a different I2C address range:
PCF8574T = 0x20 to 0x27
PCF8574AT = 0x38 to 0x3F
Product code: HCMODU0120
2.5V to 6V VCC operation
Low Standby-Current Consumption of 10 μA Max
I2C to 8-bit Parallel-Port Expander
Open-Drain Interrupt Output
Compatible With Most Microcontrollers
Latched Outputs With High-Current Drive Capability for Directly Driving LEDs
Latch-Up Performance Exceeds 100 mA Per JESD 78, Class II
1....VCC: 3.3V or 5V power supply
2....GND: Power ground
3....SDA: I2C Data
4....SCL: I2C Clock
Code: Select all
/* FILE: HCPCF8574_Blink_Example.cpp
DATE: 24/05/17
VERSION: 0.1
AUTHOR: Andrew Davies
24/05/17 version 0.1: Original version
This example sketch uses the HCPCF8574 library to toggle one of the PCF8574's digital pins
emulating the standard Arduino 'blink' sketch. This sketch has been written specifically for
the Hobby Components PCF8574 I2C to 8-bit digital port expander (HCMODU0120). To use the
sketch change the I2C_ADD to match the address of your device (default is 0x38 for HCMODU0120)
and connect and LED (via a current limiting resistor) to the PCF8574's digital pin 0 (marked
D0 on HCMODU0120). You can connect your Arduino to the module as follows:
UNO/NANO........HCMODU0120
VCC.............5V
GND.............GND
A4..............SDA
A5..............SCL
More information about the library can be found in the software section of our support
forum here:
[url]https://forum.hobbycomponents.com/software[/url]
You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used directly for the purpose of selling products that
directly compete with Hobby Components Ltd's own range of products.
THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/
#include "HCPCF8574.h" //Include the HCPCF8574 library
#define I2C_ADD 0x38 //I2C address of the PCF8574. Note parts marked PCF8574T start at address 0x20, parts marked with PCF8574AT start at 0x3F.
HCPCF8574 Port(I2C_ADD); //Create an instance of the library
void setup()
{
Port.init(); //Initiliase the PCF8574 (all pins are set to high)
Port.pinMode(0, OUTPUT); //Set digital pin 0 to an ouput
}
void loop()
{
Port.pinWrite(0, HIGH); //Set digital pin 0 high
delay(1000); //Wait 1 second
Port.pinWrite(0, LOW); //Set digital pin 0 low
delay(1000); //Wait another second
}
HCPCF8574 Arduino library for the above sketch is available for download from the software section of our support forum here:
viewtopic.php?f=58&t=2190
Diagrams, libraries, and example code are provided as an additional free service by Hobby Components and are not sold as part of this product. We do not provide any guarantees or warranties as to their accuracy or fitness for purpose.
Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.