Trouble with node-red node ncd MCP23008


As stated in the heading, I’m having trouble with the nod-red ncd MCP23008. The node-red node is not connecting to the physical device. It displays “disconnected”. For the record, I have been able to confirm that AnyI2C v1.2.0 connects to the device and that I can activate all relays on the I2CIO4R4_MCP23008 board.

I’ve inserted a couple of log outputs to a couple of your files and it looks to me like maybe the issue is with the payload sent during initialization. Following is the information pertaining to the inserted log output content:

  1. Output1:
    Filename: <<C:\Users\rts01.node-red\node_modules\ncd-red-comm\lib\NcdSerialI2C.js>>
    Function: writeBytes()

writeBytes(addr, reg, …bytes){
if(bytes.constructor != Array) bytes = [bytes];
if(this.version == 3){
var payload = [190, addr, reg];
payload.push.apply(payload, bytes);
//console.log(‘v3 - write bytes’, payload);
return this.send(payload);
var payload = [addr*2, reg];
payload.push.apply(payload, bytes);
if(this.version == 1) payload.push(0);
// Rod’s code start************************
console.log(“Payload check:”,payload);
// Rod’s code end***************************
return this.send(payload);

  1. Output2:
    Filename: <<C:\Users\rts01.node-red\node_modules\ncd-red-mcp23008\index.js>>
    Function: init()

this.comm.writeBytes(this.addr, 0x00, this.iodir),
this.comm.writeBytes(this.addr, 0x06, this.iodir),
]).then((r ) => {
this.initialized = true;
}).catch((e) => {
// Rod’s code start************************
console.log(“got node.sensor.initialized error_init”);
// Rod’s code end***************************
this.initialized = false;

  1. Node-red output data (node-red debug mode):
    Following is a screenshot of my setup for the node

    Following is my comm log in AnyI2C

    Thanks in advance to any help that anyone can offer up. It will certainly be greatly appreciated.


Hi Rod,

One thing to keep in mind is only one software application is allowed to connect to a COM port at a time. This means you must make sure Any I2C is closed prior to attempting a connection to the board from Node-Red. You might check that.

Hey Travis,

Thanks for the reply. I’ve managed to figure out the problem. It has nothing to do with the COM port. After 40+ total hours troubleshooting this issue I’ve managed to discover that my version of the NcdSerialI2C.js driver doesn’t appear to support I2C Firmware version set 6. After inserting version 6 checks to the respective functions, i.e.,

if(this.version == 3 || this.version == 6)

The node-red node started connecting. As such, all I/O capabilities of the device seen to now be working properly. Can y’all please double check the operation of your ncd MCP23008 node-red node against an actual I2CIO4R4_MCP23008 board and update the ncd-red-comm module so that I don’t have to use my own hacked version of the driver?



I’ve published an update to the ncd-red-comm library that should solve the issue. You can run an npm update on it to use version 1.6.9.