Question about usage of 4-Channel PCA9536

Hi Everyone,

I’m a new user to NCD products. I bought two products from NCD, the 4-Channel I2C PCA9536 Optical Isolated Digital Input with I2C Interface and the Analog Devices AD5254 Digital Potentiometer 4-Channel 256-Position I2C Mini Module. I got the DigiPot setup in Arduino and running perfect in 30 minutes. Then I came to the Optical Isolated GPIO and I’m banging my head against the wall. I’ll explain what I’m trying to do because I’m think I might be misunderstanding what the GPIO board can do.

I am trying to emulate 4 button presses with my Arduino and for this discussion we only need to pretend I’m controlling 1 button. Before I bought the NCD board, I bought a PC817 Optocoupler and used a breadboard to test out my “button pressing”. My button has 3V going through it. So I was able to send 5V to my optocoupler (through Pin 1 & 2 on PC817) and this closed the circuit on my 3V button (through Pin 3 & 4).

This led me to buy the 4 Channel GPIO as it seemed exactly what I needed to. In fairness I am quite new to electronics, as this is a hobby for me and my son. I am C++ developer and I can say I am humbled every time I tackle a new electronics project because I realize there is so much I don’t know.

Question 1: Is this GPIO board the correct device for having the Arduino activating the optocouplers in this board, so I can emulate my button presses?

Question 2: If so, are there any code examples in Arduino to activate each channel? I have searched google and found libraries for controlling the PCA9536. I have used straight code using <wire.h>, just as I use the DigiPot. Nothing I do in the code activates/deactivates the channels on the GPIO board. I have my 3V button line on “IN1” on the board and I have my volt meter across the terminals. I always read 3V (I expect when I set LOW, it should break the circuit and I should read 0V). I downloaded and tried the <SparkFun_PCA9536_Arduino_Library.h> and nothing.

Thanks for any help!
Anthony

Hi Anthony,
This is how the button needs to connect.

Button’s one end to IO1 screw terminal “+”
Button’s other end to 3.3V
IO1’s other screw terminal “-” to ground

here is a sample code you can use

Let me know if you run into any issues.

Thanks

Hi Bashkar,

I figured out the Arduino code to set the states to HIGH and LOW.
However, I did not notice a change in the output.

When I reread you comment, I thought I might have confused you with talk of the button.
I made a little schematic of what I actually have.
There is “no button” on my device, just a 3.5mm plug with ground and 3V.
When I touch the two contacts together, my device registers a “button push”. (Technically it registers button push when you disconnect the two contacts).
Basically I need a switch and I know I could have used an electromagnetic relay, but this is low voltage and very low current.
So I assumed clicking electromagnetic relay would be slow and overkill for this.

I am attaching a picture of my schematic and a real picture of the plug connected to the board.


Hi Anthony,
The board is an Input board. It will not be able to set outputs high and low.

if you just want to set high and low i will recommend a general purpose IO board. like this one

it has 4 relays and 4 io. You can use either one.

Thanks

Thanks!
I had a feeling this might have been an “input only board”, but I was bit confused by the name of “GPIO”.
This is my in experience with electronics :slight_smile: