New MCP23017 PCF8574 All-In-One node

I installed them all because I tested each one to see if it worked.

I don't have any issues with the function. I can already see the problem in the input status of the respective input nodes.

Installing ALL without uninstalling previous can cause serious problems, because Joe's is based on my nodes. Same ID, same hidden setup, etc.
I do not recommend that at all.

  1. uninstall all 3 from palette manager
  2. delete setup node mcp_pcf_chip
  3. install Joe's or mine. (do not touch that 0.1.1 version!)
  4. re-create setup node.
  5. enable "more Logs" checkbox. (I think it's checked by default...)
  6. fix that function of yours before connecting to a MCP node.
    (Connect first to a Debug node only, enable to show "whole MSG" at debug setup!)

Hi, what is the newer palett? Yours, or joes?
Is it possibel to make a reset by the mcp23017 ?

I have now uninstalled everything, created new setup nodes, and tested them.

But the inputs are not being queried (or only intermittently) after a restart.

And which one did You install back?

  • mine, or Joe's ?

Joe's is newer, but different. He focused to apply new chips, mine is more focused on stability.
So basically it's 2 split version, the date does not matter.

I do not understand this question.

You know that You can force-read an input by placing a trigger before it?
(And set it to do 1 read at startup.)

What kind of "restart" ?

Hello, i installed joes.
By "reset," I mean resetting the MCP23017 chip.
It has happened to me twice that the MCP23017s (I have 3 running) froze. The only thing that helped was powering them off.
By "restart," I mean either rebooting the Raspberry Pi or restarting Node-RED.
I can try the trigger thing. Just an inject that triggers after one second. Does it need to send something specific to the input nodes?

Übersetzt mit DeepL (https://dee.pl/app)

I can not take responsibility for other people's code. Ask him.

There is no such thing in I2C standard. The only safe way to do it: to power it down and up again. (unplug, replug the i2c cable.)
That's why I've dropped the whole project too, and switched to Firmata capable chips.

That will not power down the chip, because a reboot may keep the i2c bus powered during restart too. But maybe helps.

How to do it is an other topic, but here is how I do it with dashboard v1:

[{"id":"683a2b05.736204","type":"ui_button","z":"6d7fecc404563cfc","name":"","group":"c5f1b8aa.45bc08","order":1,"width":0,"height":0,"passthru":false,"label":"Rpi Restart","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"","topicType":"str","x":90,"y":440,"wires":[["1cf31554.2aaa63"]]},{"id":"1cf31554.2aaa63","type":"exec","z":"6d7fecc404563cfc","command":"sudo reboot","addpay":false,"append":"","useSpawn":"","timer":"","name":"Reboot","x":280,"y":440,"wires":[[],[],[]]},{"id":"38e53dbf.ca594a","type":"ui_button","z":"6d7fecc404563cfc","name":"","group":"c5f1b8aa.45bc08","order":2,"width":0,"height":0,"passthru":false,"label":"Rpi Leállít","tooltip":"Megállítja a házvezérlő linux Raspberry-t","color":"","bgcolor":"red","className":"","icon":"","payload":"","payloadType":"str","topic":"","topicType":"str","x":80,"y":500,"wires":[["c409cae5.8e4128"]]},{"id":"c409cae5.8e4128","type":"exec","z":"6d7fecc404563cfc","command":"sudo shutdown","addpay":false,"append":"","useSpawn":"","timer":"","winHide":false,"name":"Shutdown","x":280,"y":500,"wires":[[],[],[]]},{"id":"457add87a6e83405","type":"ui_button","z":"6d7fecc404563cfc","name":"","group":"c5f1b8aa.45bc08","order":3,"width":0,"height":0,"passthru":false,"label":"Node-Red Restart","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":110,"y":560,"wires":[["c711ed8df9a784fc"]]},{"id":"c711ed8df9a784fc","type":"exec","z":"6d7fecc404563cfc","command":"node-red-restart","addpay":false,"append":"","useSpawn":"","timer":"","winHide":false,"name":"NR restart","x":290,"y":560,"wires":[[],[],[]]},{"id":"c5f1b8aa.45bc08","type":"ui_group","name":"Parancsok","tab":"c3173234.2636e","order":6,"disp":true,"width":"4","collapse":false,"className":""},{"id":"c3173234.2636e","type":"ui_tab","name":"RPi Control","icon":"fa-thermometer-half","order":1,"disabled":false,"hidden":false}]

Do not remember. Check node examples!

important questions to determine why:

  • how long is your i2c cable ? ( usually it should not be longer than 30-40cm all together )
  • it is properly terminated at the end?
  • is it near 240V cables, or relays?
  • do you know about i2c stabiliser chip? Like this one.
  • did you try to lower the bus frequency?
    (Usually it is not necessary to run it on default 100kHz, but it depends on how quick responses you need.)

The cabel from the Raspi to the MCP23017 are 40cm.

This ist my test:
[{"id":"5fcabaeba24adbe7","type":"change","z":"ki_io_in_tab_v1","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"step_out","tot":"str"}],"x":660,"y":2060,"wires":[["c956f0fc45bf7105","cef278bbcc01fad3"]]},{"id":"6567de54e77dd90d","type":"change","z":"ki_io_in_tab_v1","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"step_in","tot":"str"}],"x":660,"y":2120,"wires":[["c956f0fc45bf7105","775fcf31b083004b"]]},{"id":"d6f4a9eef7c9ec61","type":"change","z":"ki_io_in_tab_v1","rules":[{"t":"set","p":"topic","to":"hub_top","tot":"str"}],"x":660,"y":2180,"wires":[["c956f0fc45bf7105"]]},{"id":"a29779454d0659c5","type":"change","z":"ki_io_in_tab_v1","rules":[{"t":"set","p":"topic","to":"hub_bottom","tot":"str"}],"x":660,"y":2240,"wires":[["c956f0fc45bf7105"]]},{"id":"822acf86d16325ed","type":"comment","z":"ki_io_in_tab_v1","name":"KI IO IN 0x24 Bewegung / Endlagen Inputs","info":"","x":400,"y":2000,"wires":},{"id":"3499554470b53ae9","type":"mcp pcf in","z":"ki_io_in_tab_v1","name":"24PA0 Treppe rein","chip":"32607a6c53936833","bitNum":"0","invert":false,"pullUp":true,"debounce":20,"onMsg":true,"offMsg":true,"diagnostics":true,"x":290,"y":2120,"wires":[["6567de54e77dd90d"]]},{"id":"8a7f30b2c81506f4","type":"mcp pcf in","z":"ki_io_in_tab_v1","name":"24PA1 Treppe raus","chip":"32607a6c53936833","bitNum":"1","invert":false,"pullUp":true,"debounce":20,"onMsg":true,"offMsg":true,"diagnostics":false,"x":290,"y":2060,"wires":[["5fcabaeba24adbe7"]]},{"id":"355f5529ae7d1fa9","type":"mcp pcf in","z":"ki_io_in_tab_v1","name":"24PA6 Hub unten","chip":"32607a6c53936833","bitNum":"6","invert":true,"pullUp":true,"debounce":20,"onMsg":true,"offMsg":true,"diagnostics":false,"x":290,"y":2240,"wires":[["a29779454d0659c5"]]},{"id":"1dc855aa80093acd","type":"mcp pcf in","z":"ki_io_in_tab_v1","name":"24PA5 Hub oben","chip":"32607a6c53936833","bitNum":"5","invert":true,"pullUp":true,"debounce":20,"onMsg":true,"offMsg":true,"diagnostics":false,"x":290,"y":2180,"wires":[["d6f4a9eef7c9ec61"]]},{"id":"a99d8efd64450161","type":"comment","z":"ki_io_in_tab_v1","name":"Senor aktiv = off","info":"","x":480,"y":2180,"wires":},{"id":"e21570d7b66091eb","type":"comment","z":"ki_io_in_tab_v1","name":"Senor aktiv = off","info":"","x":480,"y":2240,"wires":},{"id":"648adc4a2cc76bdf","type":"comment","z":"ki_io_in_tab_v1","name":"Senor aktiv = ON","info":"","x":480,"y":2120,"wires":},{"id":"d98c17025a9b88bb","type":"comment","z":"ki_io_in_tab_v1","name":"Senor aktiv = ON","info":"","x":480,"y":2060,"wires":},{"id":"ae11c7cda287fa7a","type":"inject","z":"ki_io_in_tab_v1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":80,"y":2160,"wires":[["8a7f30b2c81506f4","355f5529ae7d1fa9","1dc855aa80093acd","3499554470b53ae9"]]},{"id":"32607a6c53936833","type":"mcp pcf chip","chipType":"MCP23017","busNum":"1","addr":"0X24","mcpInputOverride":true,"interval":100,"startAllHIGH":false,"logging":true}]


When I trigger the incect, nothing apperas on the debug nodes and the switches can not react.

  1. Please edit your last message according to this.
  2. there is already an interval = 100ms set via chip config.
    So Triggering via INSERT node makes nothing, just it will check for changes +1 times. (100ms = 10x checking pro sec.)
{..., "chipType":"MCP23017", ..., "interval":100,}
  1. If there is no change since last check, nothing will show.
  2. Which debug are you checking? (node-red-log consol?)
  3. You did not answer many of my questions.
  • how long is your i2c cable ? ( usually it should not be longer than 30-40cm all together ) ->40cm
  • it is properly terminated at the end? ->no
  • is it near 240V cables, or relays? ->no
  • do you know about i2c stabiliser chip? Like this one. ->looks like verry interrested, I will order one
  • did you try to lower the bus frequency? ->yes
    (Usually it is not necessary to run it on default 100kHz, but it depends on how quick responses you need.)
[{"id":"3499554470b53ae9","type":"mcp pcf in","z":"ki_io_in_tab_v1","name":"24PA0 Treppe rein","chip":"32607a6c53936833","bitNum":"0","invert":false,"pullUp":true,"debounce":20,"onMsg":true,"offMsg":true,"diagnostics":true,"x":290,"y":2120,"wires":[["6567de54e77dd90d"]]},{"id":"ae11c7cda287fa7a","type":"inject","z":"ki_io_in_tab_v1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":80,"y":2160,"wires":[["8a7f30b2c81506f4","355f5529ae7d1fa9","1dc855aa80093acd","3499554470b53ae9"]]},{"id":"8a7f30b2c81506f4","type":"mcp pcf in","z":"ki_io_in_tab_v1","name":"24PA1 Treppe raus","chip":"32607a6c53936833","bitNum":"1","invert":false,"pullUp":true,"debounce":20,"onMsg":true,"offMsg":true,"diagnostics":false,"x":290,"y":2060,"wires":[["5fcabaeba24adbe7"]]},{"id":"5fcabaeba24adbe7","type":"change","z":"ki_io_in_tab_v1","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"step_out","tot":"str"}],"x":660,"y":2060,"wires":[["c956f0fc45bf7105","cef278bbcc01fad3"]]},{"id":"6567de54e77dd90d","type":"change","z":"ki_io_in_tab_v1","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"step_in","tot":"str"}],"x":660,"y":2120,"wires":[["c956f0fc45bf7105","775fcf31b083004b"]]},{"id":"cef278bbcc01fad3","type":"debug","z":"ki_io_in_tab_v1","name":"debug 27","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":820,"y":2000,"wires":[]},{"id":"775fcf31b083004b","type":"debug","z":"ki_io_in_tab_v1","name":"debug 26","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":860,"y":2280,"wires":[]},{"id":"32607a6c53936833","type":"mcp pcf chip","chipType":"MCP23017","busNum":"1","addr":"0X24","mcpInputOverride":true,"interval":100,"startAllHIGH":false,"logging":true}]

But you wrote :

"You know that You can force-read an input by placing a trigger before it?
(And set it to do 1 read at startup.)"

I do that and now you wrote it doesn't work, because you have an internal trigger with 100ms.....

I just noticed this discussion was going on. @range4200 I'm not sure why the 4 input nodes are not showing correctly. @PizzaProgram might have a point with your i2c wires being too long. I don't know. I have a development setup here with pretty short i2c wires (10cm or less) and all works perfectly. I assume all your switches are working correctly, are set correctly, have pull-up resistors (or that you are using the internal pull-up resistors). I may be preaching to the choir here, but to be sure measure the switch voltage of all switches to make sure they are showing what you expect.

As far as the node is concerned, select pull up to use the internal pull up resistors. Select On Msg, Off Msg and Diagnostics if you want more more information. These messages will show on a debug node connected to the right side ("output side" of the input node). For the chip node itself you can select log if you want the chip to output data to the node-red-log.

I think I modified @PizzaProgram's software such that inserting a 0 on the input side will trigger an immediate read of the switch voltage connected to the port. Make sure the chip's read interval is set to 0 to disable polling so that there is no 100ms delay. If as you say, your i2c wires are longer than 40cm, I would create a test setup with shorter wires just to be sure that is not your issue.

I can tell you that in my development setup here (which has 5 chips on it) the inputs are all being read correctly on start-up, restart or deploy. And if an input changes, the changed value shows up on the output of the input node.

Hope this helps.

What kind of "restart" are you talking about?

  • flow = Deploy ? Full? Partial?
  • Node-RED ?
  • RPi ?
  • I2C bus?

Because You did not post your setup before, so I could not check if internal read is on/off.
You can:

  • turn OFF the internal read (chip)
  • and activate Inject Node only !
    (1x after 2 sec + repeat every 100ms after it)

Ok, I ordered a LTC4311 I2C Extender an will try.
What kind of "restart" are you talking about?

  • flow = Deploy ? Full? Partial?
  • Node-RED ?
  • RPi ?
  • I2C bus?

That doesen‘t matter. Every restart, or does it change it?
I post my setup at the beginning of this thread, or do you mean another setup?
actually I use a inject node you can see on my post code?
How can I * turn OFF the internal read (chip) ?

@Joe-AB1DO already answered it :wink:

@PizzaProgram is correct: set chip read interval to 0 ms and no polling (reading) will take place and therefore no 100ms delay. In that case, when an input changes, the interrupt is fired (goes from 1 to 0) and the chip's input port is read. With the inject node sending a 0 to the input side of an input node you are simulating an interrupt and telling the chip to read the input value on that port. The result is shown on the output side of the input node.

In fact if I remember correctly, the chip actually reads the status of all ports.

If I were you I would strip your setup to just 1 input port with 1 inject node, disconnect the interrupt physical wire from whatever you have it connected to, wire a debug node directly to the output side of the inject node and also one to the output side of the input node. Then set the switch on the chip's corresponding port to a value (0 or 1) and inject a 0. The node should show the value (0 or 1) on its output side.

To rule out length of i2c wires, bring the chip as close as possible to the controller. And make sure you do not twist the i2c wires.

I'm sorry, I don't have the time right now to look into it in more detail right now. Maybe later.

@range4200 I took a closer look at your test setup. You are injecting a timestamp, which will do nothing. You need to change this to either number:0 or boolean:false.

This is an easier change to make than trying to deal with your i2c wires (which may still be an issue). And make sure you have disconnected the interrupt, just to make sure it is not interfering. Then retest and report back.

Hope this helps. If it doesn't, then length of i2c wires may be your issue.