forum.hobbycomponents.com
http://forum.hobbycomponents.com/

PCF8574 I2C to 8-bit digital port expander (HCMODU0120)
http://forum.hobbycomponents.com/viewtopic.php?f=113&t=2189
Page 1 of 1

Author:  admin [ Mon Jun 05, 2017 11:17 am ]
Post subject:  PCF8574 I2C to 8-bit digital port expander (HCMODU0120)

Image




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


http://forum.hobbycomponents.co/software


Image Image



Image


Image


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




Image

1....VCC: 3.3V or 5V power supply
2....GND: Power ground
3....SDA: I2C Data
4....SCL: I2C Clock




Image


Code:
/* 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:

http://forum.hobbycomponents.com/software


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
}




Image

HCPCF8574 Arduino library for the above sketch is available for download from the software section of our support forum here:

http://forum.hobbycomponents.com/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.

Author:  Peter1956 [ Wed Oct 11, 2017 1:20 pm ]
Post subject:  Re: PCF8574 I2C to 8-bit digital port expander (HCMODU0120)

I received 3 of these and tested them, there Hex Address start at 0x20 for the current devices which are PCF8574T.
if the chip is PCF8574A the start Address is 0x38
the Sketch will need to be altered accordingly.

I.E #define I2C_ADD 0x20

Author:  andrew [ Wed Oct 11, 2017 2:52 pm ]
Post subject:  Re: PCF8574 I2C to 8-bit digital port expander (HCMODU0120)

Thanks for pointing this out. I've just checked and our current stock has indeed been shipped with the PCF8574 and not the PCF8574A (I believe the T just indicates the package type, i.e. SO16 so can be ignored). The only difference between the PCF8574 and the PCF8574A is as you have pointed out, their I2C address range:

PCF8574(T) = 0x20 to 0x27
PCF8574A(T) = 0x38 to 0x3F

I'll get the first post updated with this information. Sorry for any confusion caused.

Author:  Paul van de Veen [ Tue Oct 31, 2017 6:12 pm ]
Post subject:  Re: PCF8574 I2C to 8-bit digital port expander (HCMODU0120)

Peter1956 wrote:
I received 3 of these and tested them, there Hex Address start at 0x20 for the current devices which are PCF8574T.
if the chip is PCF8574A the start Address is 0x38
the Sketch will need to be altered accordingly.

I.E #define I2C_ADD 0x20


I can't find the library. Could you post a working link please?

Thanks in advance!

Author:  andrew [ Tue Oct 31, 2017 7:30 pm ]
Post subject:  Re: PCF8574 I2C to 8-bit digital port expander (HCMODU0120)

I've fixed this link, it now points to the appropriate thread in the software section of the forum.

Author:  Paul van de Veen [ Wed Nov 01, 2017 12:12 pm ]
Post subject:  Re: PCF8574 I2C to 8-bit digital port expander (HCMODU0120)

Many thanks. I got it!

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/