Ncd mpc23008 tcp/ip

Dear All,

I’ve received my first boards with the MPC23008 chip witch i want to control with node-red. In the past i have tested it before directly on the raspberry pi. This worked great.

But now i want to control the board over TCP/IP. Is there an ease way to still use the ncd npm component, but instead of using COM or I2C direct, using tcp?

Any comments are welcome.

Have a nice day.


Unfortunately we do not have libraries capable of that(receiving commands over a TCP socket and then sending those commands over I2C to a local device). However I bet there is a way to do this by integrating 3rd party Node-Red libraries. You just need something to receive commands over a TCP socket and trigger our MCP23008 Node.


Okey, getting this topic back on track. I’m going to use Python to control the relays with API command.
The interface is Node-red dashboard.
I experienced a lot this weekend with Node-Red and the MPC23008 boards. I have it working for a fusion 4 board, because the API commands for controlling relays is different than with the MPC23008 board.

The thing is: i want to control the relays individual and as suggested by Travis over email, my program must always check the status of the relays before opening / closing another relay. " .
the bit assigned for the relay is simple: 1, 2, 4, 8, 16, 32, 64, 128. Placing a Decimal 9 in front for on / off of the relay. Controlling individual relays: for instance 2 and 4 on results in a bit of 10.
This part i understand. To check the status of the relay is send decimal 9 and i get back the counts of relais active: for instance “10” ( 2 and 4 are on ).

But how would this now work in an automated setting in python?

When i would request to switch a relay on / off the first thing the software does need to do is send a relay status command? See witch relays are already ON, and add the bit value requested to get a new bit value for sending? For instance: 2 and 4 are ON: i would get back value 10, i want to power relay 1 also ON, i would send out value 11. If i want to power OFF relay 1, i again check the total relais status (11), substracts 1, resulting in value 10 that i need to send.

Is this the correct way to do it?!
I made an excell file of the different API codes i need to send when using a 8 I2C port hub in between.
Is this correct?


Yes, you’ll want to read the status of the relays, then take that status byte and alter it based on what relays you want to turn on/off. That is the simplest way to accomplish what you want and it’s generally how I approach this in software development.

Thank you.
If i read the status of the relay with Any I2C, it always sends 2 API codes:
W: 170 6 188 50 2 64 9 0 233
R: 85
W: 170 5 188 50 1 65 1 224
R: 32

The first receiving is 85, is this just a control that the connection is okey? How should i interpret this? The 32 value is indeed what relay i have switched on for the moment.


Yes, that 85 is just a command receipt acknowledgment. I would just disregard that response and check the next response. I’m not sure why that firmware sends that response since it seems useless.

Okey, So i just need to send : 170 5 188 50 1 65 1 224, and use the response. So i only send one API code to receive the relay status.

Thank you.

Dear Travis,

Can someone at confirm the following:
This would be the setup: Maximum 16 boards, with four relays, controlled with i2C;
For all these relays, the same API command is needed, right?
API 170 7 188 X 3 64 9 X 0
first X is the I2C port, second is the relay command.

I need to know this so i can start making a python script.

Also: is the command line of the 4 relay module almost the same as the 8 relay.

so opening the first 4 relays,

or the first 4 relays of this 8 relays boards is the same API code, right?

Thank you.


Both the 4 relay board and the 8 relay board use the exact same I2C IC so the commands for controlling the first 4 relays on the 8 channel board will be the same as the command for controlling the 4 relays on the 4 channel board as you stated. The only difference is you will be sending the commands to a different I2C port so that will need to be addressed in your I2C script.

Thank you,
Travis Elliott

Dear Travis,

Great, thanks!

And the I2C board, this has got 8 I2C ports. the address per port:
If i’m not mistaken: the first is port 50, then 51, 52, 53, 54, 55, 56, 57. Right?

I believe you are correct but honestly I do not know for sure.

@ryan1 can you please confirm @Observatory_Gromme’s comment above on addressing ports on the 8 Port I2C board?

The protocol for the newer controller (8-Port) has changed (from the older 5-Port), the port selection you are referring to is in the older format. The newer format is explicit, 1 = Port 1, 3 = Port 3, etc. Newer controller also supports write read commands while directing commands to each port. Please take a close look at the docs for the new 8 port controller and do not try to use the 188 command any longer. The new format is far easier to use. Hope this helps.


Okey. So i should look through these files:

I have on more question:
I also have 1 of these boards:

with this ethernet adapter:

this command set would be the same, only i use port 1, because it is directly with Ethernet adapter controlled?

I guess first i will start learning Alpha station on how to control this so i can understand it myself.

The Ethernet interface you are referring to has been discontinued, we do plan to offer a updated version, but it is not yet ready for our web site. The command set for this adapter does not allow you to explicitly set a I2C port as there is only one port available and there is not enough room in firmware to allow this command even though it cannot be used. The command set is identical otherwise, including bus scanning. If you have a 8-port interface, you can still used your relay board, just plug it into the 8-port interface using this adapter:

Ethernet interface is supported by the 8-port bridge adapter (it’s an option during checkout).
Hope this helps.

Dear Ryan,

Thank you. Unfortunately: the 8 relay board with Ethernet adapter is used 5m away from the I2C port boards. So i’m forced to use the Ethernet adapter right?

Anyway: As i said a few years ago ( then with the fusion boards in mind ), i will be going to proceed with my big order in first step: 10x 4x20A relay boards with I2C interface.
These will be hooked up then to the I2C ports.

Question: this adapter:

this can be used on anything ( Fusion 4, the new 8-port I2C boards, etc )?
I will be buying some of these to change some modules here.


We’ve had great luck with I2C running longer distances, so I would definitely give it a try at 5M and see if you can use it. If not, you can always lower the I2C clock speed of the 8-Channel controller, then it is almost certain to work. The new Ethernet module can only be used with Fusion and the 8-Channel bridge, other boards are being revised (as we speak) to add compatibility with this Ethernet module. Eventually, everything will be migrated to handle the Ethernet module. For now, we are retrofitting older boards with a updated power supply to add compatibility. Let me know if you have more questions.

Okey, great news. Lowering the clock speed would be that the commands are received slower?
that would be no problem, as switching on / off would only be once in an whole night or so.

Good to know, i will give it a try: the cable is a 4 cat5a high quality LAPPKABEL for ethernet, so it can be working. I will let you know.

The fusion and 8 channel bridge are the controllers for the moment that needs to work for me! :smiley:

Have nice evening! This is great response / service!

Yes, lowering the speed means it is technically slower, but you really can’t tell a difference. I have had excellent luck at the default speed of 100KHz, I2C is super resilient to noise, especially when working with a high quality cable as you have planned. The 8-Channel controller is our latest work with I2C protocols, it’s superior in every way to Fusion. If you can avoid using Fusion for I2C, it will make your life so much easier. We deprecated Fusion I2C support because of the limitations of this platform. Have a great evening and let me know if you have more questions.

Thanks. The one fusion board that i still use ( i have a few for sale… ), has to be used because of the dual interface, one with Ethernet, one with key fob witch could come in handy most of the times.

I received all the boards today! Builded a temporary setup :

Now let’s start testing, using, evaluating and scripting ! :smiley: