SX1509 or MCP23017 for controlling two 8 Channel Relays

Hi all,

sorry for newbie question, but I'm quite new to Arduino and I'd like to know bit more before I order parts.

Basically I need 16 relays controlled via I2C.

I've read a bit over the internet and found ready product ( but it costs 144$ :o

Because I need this for hobby project I want to make something bit cheaper.

I found two 8 Channel Relay boards

They work on 5V so they are perfect for my usage.

The hard part for me is choosing I2C Expander.

I found couple of options:
-SX1509 16 channels

-PCF8574 8 channels

-MCP23017 16 channels

I'm thinking about SX1509 or MCP23017.
Both work on 5V.

I have some questions about wiring before I decide and order items:

  1. Which one I should choose. As I said I'm new to this, but I want to try building it.

  2. Can I connect directly I2C from Arduino to SX1509 or MCP23017 and then to those two relays?
    I've connected single relay boards before but never 16 of them.
    16 Channel Relay Board has external power supply, should I connect external power supply for those relays? How should I calculate current? Can I count 100mA for single relay? So for 16 relays I'll need 1.6A 5V?

  3. SX1509 works on 5V, but do I need extra connectors for it?

I'll be grateful for generale hints on this.
I'm planning to use this with MQTT server.
I'm C# developer, but I thing I can handle programming, but I need guidance on wiring.

Sorry for asking so much questions, but I think it's better to ask twice that to burn even single device.

Hello Sir,

You should def use the SX1509 for this project, you can directly connect your Arduino to your SX1509 PCB. Do yourself a big favor and read the tutorial about the SX1509 Tutorial XS1509
One thing do, you claim the XS1509 works on 5V, but i only see a 3.3V Connection pin?
You can def use the relay board you mentioned, and yes it needs an external power source. I've pulled the datasheet on the relays and calculated that the power consumption per relay will be around 75mA. You claim you have worked with single board relay's, working with a relay board with 16 relay's is just the same, just stay focused, number everything and you should be ok. You only need to connect your 5V output pins to your relay board, connect a 5V power supply and your basically set. It's a very nice thing that the board comes with incorporated opto-couplers for this very reasonable price (I have payed more then that for an 8 relay board).
Here is the link to the relay data sheet datasheet relay
I'm not really sure you can connect the SX1509 to your relay board, because I believe the SX1509 works on 3.3V, but your sure it works on 5V. I hope your right, should you find out your wrong, then use a few of these to interface between the 3.3V and 5V Logic Level Controller

Good luck with your project.
Should I have forgotten to answer one of your questions, or should another question arise then feel free to ask again.

With Regards,


Beware. 16-channel relay boards are very different from 8-channel relay boards.

16-channel relay boards have an onboard 12volt > 5volt buck converter that is hardwired to the relay inputs.
That means a board full of opto couplers, but NO opto isolation. A serious desigh flaw.
Avoid 16-channel boards if you're going to use the board to control mains power devices.


Have you checked the Ebay link? This is a 5V powered relay shield, there is no 12V anywhere on the board, and the inputs are directed to the opto-couplers and totally separated from the relay coils.

What's this thing on the 16 channel relay board, can't make out the numbers, looks like a V regulator, what V is supposed to be applied to DC+ & DC-?


According to the description of the seller 5V. But I know, with Ebay sellers you never know, but you must agree that you do see the 8 opto-coupler chips. I think we can only know for sure if we had the board, or maybe ask the seller? On the relay's you also see they work on 5V. And if you would draw 1.2A from the presumed voltage regulator would't it need a cooling element. That being said, I can't think of what that chip could be if it isn't a voltage regulator. We have a dilemma here.

You can find the datasheet of this 16-channel relay board on the Sainsmart website.

And yes, that is an LM2576 buck converter.
The relays are 5volt, but relay supply must be >7volt (12volt is common for this board).

There have been many posts about the non-existing opto isolation of this board.
You CAN'T separate opto LED VCC from the opto transistor without some serious hacking.
(I wrote a post about that a long time ago).

8-channel relay boards have a JD-VCC jumper that can be removed for opto isolation.
This board does not have one.
The noob who designed this board should be thrown off a cliff.

Thank You all for answers.

I'm planning to use two 8 Relay Boards.
The one I've linked are just for reference, I plan to order more expensive ones, from more trusted source (I'll look at sparkfun)

I've created sketch in fritzing to clarify my questions regarding connection:

Is the schema correct?

I plan to add 5V 2A power supply to this, will it be enough?
I'm not sure about how should I power SX1509.
It requires 3.3V to work, but Relays work on 5V.

SX1509 can work on voltage up to 5.5V (please see features tab), but I don't know should I safely connect it.

I found this post, but I'm not sure how I should connect my power supply. Should I connect 5V to VC1 and VC2 on SX1509 or should I connect 5V to 3.3V input on SX1509?

I'll be grateful for clarifications before I order parts.

Might as well use a 16-channel relay board if you're going to connect it that way.

For opto isolation (safer mains power use), you must remove the JD-VCC jumper, and connect relay supply to JD-VCC(+) and relay ground(-). NOT to relay VCC...

Connect relay VCC to Arduino 5volt.
DO NOT connect relay ground to anything else.
Connecting relay ground to Arduino ground (or expander ground) defeats opto isolation.
You don't need relay ground, because the opto LEDs are connected between relay VCC and relay input.

The Arduino needs ofcourse it's own power supply.
Using the same supply for Arduino and relay board would also defeat opto isolation.
The Arduino supply could be a 5volt cellphone charger, connected to the USB socket.

A 5volt/2A supply is ok for two relay boards. The relays use about 75mA each when active.
The opto LEDs (controlled by Arduino/expander) use 2mA per active relay.

@Leo thank You for reply.
Today I found some instructions in other thread about how to connect 8 Relay Board to Arduino.

I always through that every component must have same common gnd. I was wrong.
As I mentioned I'm a beginner when it comes to electronics and I'm not native English speaker, but I managed to fix my schema with Your suggestions.
Here is corrected version:

I will connect separate power supply to JD-VCC and GND (pink and black wire on my schema), this wey this will be separated from electronics.

I'm not sure about 3.3V going to SZ1509. I found this thread on Stackexchange and on bottom of that answer there is note:

Input drives are active low and need to be 5V. 3V3 almost certainly won't work well or at all.

Should I connect 5V from Arduino to 3.3V input on SX1509? Will it work fine? Or should I leave 3.3V from arduino and relays will work?
That's the last thing missing (for now :wink: )

In final project I plan to add 8 DS18B20 thermometers and maybe a single display.

Diagram looks ok now.
Relay module should be fine with 3.3volt logic from the I2C module.
Logic LOW from the module will activate the relay, and logic HIGH is 1.7volt (5-3.3) across the "opto LED + indicator LED + 1k resistor". That shouldn't be able to activate the relay.

Not sure about shoving 5volt I2C logic of an Uno into a 3.3volt expander.
I see Sparkfun does that. Need to read up about that. Datasheet states 5volt tolerant I/Os.

Thank You Leo for checking my schema.
I'm going to order parts right away and after I put them together I'll share the results.
Hopefully I won't burn anything :slight_smile: