Pulling readings from i2c chip into Node-Red

I am trying to pull readings in from an i2c device (EZO™ Conductivity Circuit | Atlas Scientific).

I'm running the latest version of Node-Red on a raspberry pi 4 running Raspian.

I have gotten the hardware setup and working using the manufacturer's software (https://www.whiteboxes.ch/docs/tentacle/t3/#/code), So hardware wise everything is working and i2c is functioning on my raspi.

My first instinct was to look for a node to install from the community. I stumbled across GitHub - nielsnl68/node-red-contrib-i2c: This set of node-red nodes communicate with the Raspberry Pi I2C driver and uses the I2C-bus package.

I had some issues installing, but was able to get it installed using the related thread Node-red-contrib-i2c fails to install - #41 by cymplecy

Now, I'm having a hard time figuring out how to use this node.

Any help with this node, or even some javascript suggestions for learning how to get these readings into the node-red framework. I am very new to this kind of thing (i2c, raspi, node-red), but I have some basic coding knowledge, and am willing to do the work, but any help getting there is huge.

Thanks.

1st thing I think is to re-wire your flow so its not trying to do a scan and a reading at the same time (prob not the issue however)

what does the command line i2cdetect -y 1 report ?
(usually Pi uses bus 1 - so this should show all devices connected)

Well spotted :slight_smile: (Looking at orig post in other thread - the scan debug node is showing 2 devices - one on 99 and one on 100)

And now I've read the @akuno post more carefully - I see https://www.whiteboxes.ch/docs/tentacle/t3/#/code

and it tells us what the two addresses are used for

So - another thing would be that looking at your terminal display - a sucessful response to a R command is greater than 255 (your's shows 4752)

That implies at least 2 bytes would be returned and you have your node set to only accept 1

So try changing that and see what happens

Well I've just kind of given up on it some. So I resorted to a little python work around.

Here is the Python that I use in this node node-red-contrib-python-function

Not a fan of anyone's i2c code and if I can figure out how to pull from C library into node-red I'd write it in C

You windows folks are on your own.

import Adafruit_MCP9808.MCP9808 as MCP9808
import os

# May use for timestamp
from time import time as now

# Define a function to convert celsius to fahrenheit.
def c_to_f(c):
	return c * 9.0 / 5.0 + 32.0

# Default constructor will use the default I2C address (0x18) and pick a default I2C bus.
#
# For the Raspberry Pi this means you should hook up to the only exposed I2C bus
# from the main GPIO header and the library will figure out the bus number based
# on the Pi's revision.
#
# For the Beaglebone Black the library will assume bus 1 by default, which is
# exposed with SCL = P9_19 and SDA = P9_20.
sensor = MCP9808.MCP9808()

# Optionally you can override the address and/or bus number:
#sensor = MCP9808.MCP9808(address=0x20, busnum=2)

# Initialize communication with the sensor.
sensor.begin()
temp = sensor.readTempC()

tempc = ('{0:0.3F}'.format(temp))

msg['topic'] = "tempc"
msg['payload'] = tempc

return msg```

First, thank you for the replies and the guidance.

I have 2 probes connected, a pH probe on 0x63 (99dec) and a conductivity probe on 0x64 (100dec) I do want to get both working, but I assume if we get the conductivity sorted the pH will be similar as they are from the same manufacturer.
i2cdetect

I did more reading on the chip documents and discovered the data structure for returned readings:

The first byte is essentially a status code, it will either be 1 followed by ascii incoded string of numbers representing the value, or the first byte will be an error code 2, 254, or 255. 255 being no data to send. Also, It appears that the request should be for 7 bytes.

When I run with with only the single node set to send command 082 to address 100 I get error code 255 and all zeros in the buffer.

However!, when I run the atlas scientific software and perform a poll, the data does get sent to node red.

With this I must imagine there's something more I must do to coax the chip to spit out the buffer, and that the atlas scientific software is doing it when it polls. The buffer does indeed contain the correct number, 1483. 0x31=1 ; 0x34=4 ; 0x38=8 ; 0x33=3

With this, I suppose one solution could be to run the poll software in the background and try to mesh them together where the atlas scientific software receives the 255 error, and the data gets sent to node-red, but this seems awful in so many ways lol.

I found that no matter what command number 082, vs 0, vs NaN it all produces the same result.
255 back with nothing in the buffer, or it works for one reading in between polls in the altas scientific software.

Just trying anything here
Do you think you can send the polling command out using the i2c out node?

Do you get data back on the in node that way?

Okay, I've got it working. I can't say I fully understand everything (i2c in command seems to do nothing for instance lol). However, I do have it working using both the i2c out and i2c in nodes in concert.


I'm guessing I could send the longer commands by changing the number of bytes to send and doing some interesting math. However, I'll likely not be using node-red for calibration, at least not any time soon.

Thanks to everyone for helping me with this. I'm gaining a lot of familiarity outside of the standard windows environment, but the ocean is vast :D.

2 Likes

Thanks for sticking with this! It's going to help allot of us. When I attempt the calibrations, I'll pass the info on to you... :D.

Peter

I've succeeded in getting the EZO Flo, EZO RTD, and EZO pH stamps reading.
I've got to trim the buffer that is returned from the EZO Flo to separate the instantaneous flow and the total flow values to display them independently.

Where, I haven't succeeded is learning how to use this Node (node-red-contrib-i2c ) to send a multiple byte command. For instance, to clear the flow totalizer, you need to pass it a string of 'Clear'. I've tried allot of combinations, but still not succeeded.

Anyway, I'll post my flow here that fetches and displays... it also scans the primary i2c port. For the sake of simplicity, my stamps take all of the defaults (well, obviously they are configured for i2c connectivity and not serial), even the addresses. The flow is configured for the 3/8" sized meter. This code will probably just work if you've taken all the defaults on your ezo stamps as well.. You'll have to figure out the 'clear' bit though...

[{"id":"59165d4d.066034","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"e00b8f43.9ccf9","type":"i2c in","z":"59165d4d.066034","name":"RTDData","address":"102","command":"","count":"8","x":460,"y":100,"wires":[["6588eab1.c5bdb4"]]},{"id":"791936ff.768018","type":"i2c out","z":"59165d4d.066034","name":"RTDCmnd","address":"102","command":"82","payload":"payload","payloadType":"msg","count":"1","x":110,"y":100,"wires":[["33df9f56.5deff"]]},{"id":"418f9978.531ca8","type":"debug","z":"59165d4d.066034","name":"RawBuff","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":520,"y":520,"wires":[]},{"id":"a9306c4d.c7cb9","type":"inject","z":"59165d4d.066034","name":"push1","topic":"","payload":"","payloadType":"num","repeat":"3","crontab":"","once":true,"onceDelay":0.1,"x":120,"y":20,"wires":[["791936ff.768018","863f23ed.6ce2b","4c96ce0f.154ec"]]},{"id":"33df9f56.5deff","type":"delay","z":"59165d4d.066034","name":"delay1","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":270,"y":100,"wires":[["e00b8f43.9ccf9"]]},{"id":"54aae87c.830b48","type":"i2c scan","z":"59165d4d.066034","name":"","x":320,"y":600,"wires":[["7dd33aaa.12b2a4"],[]]},{"id":"42f6e013.13b69","type":"inject","z":"59165d4d.066034","name":"push2","topic":"","payload":"","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":520,"wires":[["b1978dba.68466"]]},{"id":"7dd33aaa.12b2a4","type":"debug","z":"59165d4d.066034","name":"i2c channel devices","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":550,"y":600,"wires":[]},{"id":"a281a3c1.00d56","type":"ui_text","z":"59165d4d.066034","group":"ffc1aa9d.ac4028","order":2,"width":0,"height":0,"name":"degC","label":"degC","format":"{{msg.payload}}","layout":"row-spread","x":830,"y":160,"wires":[]},{"id":"6588eab1.c5bdb4","type":"function","z":"59165d4d.066034","name":"BuffToStr","func":"msg.payload = (String.fromCharCode(msg.payload[1])) + (String.fromCharCode(msg.payload[2]))\n + (String.fromCharCode(msg.payload[3])) + (String.fromCharCode(msg.payload[4]))\n  + (String.fromCharCode(msg.payload[5])) + (String.fromCharCode(msg.payload[6]));\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":100,"wires":[["323c7e18.bdd8e2"]]},{"id":"323c7e18.bdd8e2","type":"change","z":"59165d4d.066034","name":"StrToNum","rules":[{"t":"set","p":"payload.value","pt":"msg","to":"","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":160,"wires":[["a281a3c1.00d56","5b912629.f72478"]]},{"id":"5b912629.f72478","type":"ui_gauge","z":"59165d4d.066034","name":"TankTemp","group":"ffc1aa9d.ac4028","order":1,"width":0,"height":0,"gtype":"donut","title":"Tank Temp","label":"degC","format":"{{value}}","min":0,"max":"40","colors":["#0000a0","#0080ff","#ff8000"],"seg1":"10","seg2":"30","x":850,"y":100,"wires":[]},{"id":"863f23ed.6ce2b","type":"i2c out","z":"59165d4d.066034","name":"pHCmnd","address":"100","command":"082","payload":"payload","payloadType":"msg","count":"1","x":120,"y":240,"wires":[["d76c2c51.1df71"]]},{"id":"d76c2c51.1df71","type":"delay","z":"59165d4d.066034","name":"delay2","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":270,"y":240,"wires":[["4e84ff27.a688"]]},{"id":"4e84ff27.a688","type":"i2c in","z":"59165d4d.066034","name":"pHData","address":"100","command":"","count":"8","x":460,"y":240,"wires":[["5e0af3d3.7bd6bc"]]},{"id":"5e0af3d3.7bd6bc","type":"function","z":"59165d4d.066034","name":"BuffToStr2","func":"msg.payload = (String.fromCharCode(msg.payload[1])) + (String.fromCharCode(msg.payload[2]))\n + (String.fromCharCode(msg.payload[3])) + (String.fromCharCode(msg.payload[4]))\n  + (String.fromCharCode(msg.payload[5])) + (String.fromCharCode(msg.payload[6]));\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":240,"wires":[["ac1f6728.22f578"]]},{"id":"ac1f6728.22f578","type":"change","z":"59165d4d.066034","name":"StrToNum2","rules":[{"t":"set","p":"payload.Value","pt":"msg","to":"","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":300,"wires":[["7176c108.99433","6436f959.83a148"]]},{"id":"7176c108.99433","type":"ui_text","z":"59165d4d.066034","group":"ad7aabd5.7bf318","order":5,"width":0,"height":0,"name":"pH","label":"pH","format":"{{msg.payload}}","layout":"row-spread","x":830,"y":300,"wires":[]},{"id":"6436f959.83a148","type":"ui_level","z":"59165d4d.066034","group":"ad7aabd5.7bf318","order":3,"width":0,"height":0,"name":"TankpH","label":"","colorHi":"#e60000","colorWarn":"#ff9900","colorNormal":"#00b33c","colorOff":"#595959","min":"4","max":"10","segWarn":"6","segHigh":"8.5","unit":"","layout":"sv","channelA":"","channelB":"","decimals":0,"animations":"soft","shape":"3","colorschema":"rainbow","textoptions":"default","colorText":"#eeeeee","fontLabel":"","fontValue":"","fontSmall":"","colorFromTheme":true,"textAnimations":true,"hideValue":true,"tickmode":"segments","peakmode":false,"peaktime":3000,"x":840,"y":260,"wires":[]},{"id":"4c96ce0f.154ec","type":"i2c out","z":"59165d4d.066034","name":"FlowCmnd","address":"104","command":"82","payload":"payload","payloadType":"msg","count":"1","x":110,"y":380,"wires":[["fb7d7fe3.15b03"]]},{"id":"fb7d7fe3.15b03","type":"delay","z":"59165d4d.066034","name":"delay3","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":270,"y":380,"wires":[["89af4958.9414b8"]]},{"id":"89af4958.9414b8","type":"i2c in","z":"59165d4d.066034","name":"FlowData","address":"104","command":"","count":"8","x":460,"y":380,"wires":[["5e8a1754.f437d8"]]},{"id":"5e8a1754.f437d8","type":"function","z":"59165d4d.066034","name":"BuffToStr3","func":"msg.payload = (String.fromCharCode(msg.payload[1])) + (String.fromCharCode(msg.payload[2]))\n + (String.fromCharCode(msg.payload[3])) + (String.fromCharCode(msg.payload[4]))\n  + (String.fromCharCode(msg.payload[5])) + (String.fromCharCode(msg.payload[6]));\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":380,"wires":[["6e7c1c2d.edae24"]]},{"id":"6e7c1c2d.edae24","type":"change","z":"59165d4d.066034","name":"StrToNum3","rules":[{"t":"set","p":"payload.Value","pt":"msg","to":"","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":440,"wires":[["117ae2b.0951e1d","8b9f9a88.59a058"]]},{"id":"117ae2b.0951e1d","type":"ui_text","z":"59165d4d.066034","group":"b03ec9c2.970168","order":3,"width":0,"height":0,"name":"l/min","label":"l/min","format":"{{msg.payload}}","layout":"row-spread","x":830,"y":440,"wires":[]},{"id":"b1978dba.68466","type":"i2c out","z":"59165d4d.066034","name":"TotClear","address":"104","command":"1","payload":"[99,108,101,97,114]","payloadType":"bin","count":"8","x":320,"y":520,"wires":[["418f9978.531ca8"]]},{"id":"33f61e3b.8cb402","type":"inject","z":"59165d4d.066034","name":"push3","topic":"","payload":"","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":600,"wires":[["54aae87c.830b48"]]},{"id":"8b9f9a88.59a058","type":"ui_gauge","z":"59165d4d.066034","name":"PumpFlow","group":"b03ec9c2.970168","order":1,"width":0,"height":0,"gtype":"gage","title":"Pump Flow","label":"l/min","format":"{{value}}","min":0,"max":"40","colors":["#0000a0","#0080ff","#ff8000"],"seg1":"10","seg2":"30","x":850,"y":380,"wires":[]},{"id":"fea649a4.e13928","type":"ui_text","z":"59165d4d.066034","group":"ad7aabd5.7bf318","order":1,"width":0,"height":0,"name":"pHLabel","label":"Tank pH","format":"","layout":"row-center","x":840,"y":220,"wires":[]},{"id":"ffc1aa9d.ac4028","type":"ui_group","z":"","name":"EZO RTD over i2c","tab":"ba830589.55bb38","order":1,"disp":false,"width":"6","collapse":false},{"id":"ad7aabd5.7bf318","type":"ui_group","z":"","name":"EZO pH over I2C","tab":"ba830589.55bb38","order":2,"disp":false,"width":"6","collapse":false},{"id":"b03ec9c2.970168","type":"ui_group","z":"","name":"EZO Flo over I2C","tab":"ba830589.55bb38","order":3,"disp":false,"width":"6","collapse":false},{"id":"ba830589.55bb38","type":"ui_tab","z":"","name":"RPI4-NodeRed-AtlasSciI2C","icon":"dashboard","disabled":false,"hidden":false}]

quick screen shot of the quick and dirty dashboard..

1 Like

Folks,
I'm going to respond again (I used to participate as ODwyerPW, but now I use my company name of SonoraTechnical... I'm the same guy).

I have learned how to use the Node-RED-contrib-i2c i2c-out node to send multiple character commands to Atlas-Scientific Circuits over i2c. Rather than repeat all of that information here, I'd like to direct you to an Aquarium Controller Thread I've started.... where I tackle the Atlas-Scientific Circuits and i2c node issues early on..

Atlas-Scientific i2c circuits and the i2c-out node for complex commands.

I hope this helps allot of you that are using these products.

If it helps anyone with a PCF8574 chip, I have this flow that breaks out the R command into pin status'

[
    {
        "id": "6fd475ff.5ce75c",
        "type": "i2c scan",
        "z": "93690f5d.5a521",
        "name": "",
        "busno": "2",
        "x": 430,
        "y": 300,
        "wires": [
            [
                "31082a2a.05b616"
            ],
            []
        ]
    },
    {
        "id": "31082a2a.05b616",
        "type": "debug",
        "z": "93690f5d.5a521",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 730,
        "y": 294,
        "wires": []
    },
    {
        "id": "3bfad682.2fab7a",
        "type": "inject",
        "z": "93690f5d.5a521",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 170,
        "y": 300,
        "wires": [
            [
                "6fd475ff.5ce75c"
            ]
        ]
    },
    {
        "id": "a39e089d.a86838",
        "type": "i2c in",
        "z": "93690f5d.5a521",
        "name": "",
        "busno": "2",
        "address": "39",
        "command": "",
        "count": "7",
        "x": 430,
        "y": 420,
        "wires": [
            [
                "567f3444.e3b8dc"
            ]
        ]
    },
    {
        "id": "567f3444.e3b8dc",
        "type": "debug",
        "z": "93690f5d.5a521",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "msg",
        "x": 750,
        "y": 420,
        "wires": []
    },
    {
        "id": "762c96e.e9de168",
        "type": "inject",
        "z": "93690f5d.5a521",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 160,
        "y": 420,
        "wires": [
            [
                "a39e089d.a86838"
            ]
        ]
    },
    {
        "id": "d504704f.41e1b",
        "type": "i2c out",
        "z": "93690f5d.5a521",
        "name": "",
        "busno": "2",
        "address": "39",
        "command": "082",
        "payload": "",
        "payloadType": "str",
        "count": "1",
        "x": 440,
        "y": 580,
        "wires": [
            [
                "4c6ffb4f.aae744"
            ]
        ]
    },
    {
        "id": "36778427.78074c",
        "type": "exec",
        "z": "93690f5d.5a521",
        "command": "modprobe aml_i2c",
        "addpay": false,
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "oldrc": false,
        "name": "",
        "x": 440,
        "y": 100,
        "wires": [
            [],
            [],
            []
        ]
    },
    {
        "id": "a8e222b9.176c1",
        "type": "start-up-trigger",
        "z": "93690f5d.5a521",
        "x": 150,
        "y": 100,
        "wires": [
            [
                "36778427.78074c"
            ]
        ]
    },
    {
        "id": "1cf3b3d1.161d5c",
        "type": "inject",
        "z": "93690f5d.5a521",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "00 12 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 160,
        "y": 160,
        "wires": [
            [
                "36778427.78074c"
            ]
        ]
    },
    {
        "id": "8d202513.bbcb18",
        "type": "inject",
        "z": "93690f5d.5a521",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 160,
        "y": 580,
        "wires": [
            [
                "d504704f.41e1b"
            ]
        ]
    },
    {
        "id": "4c6ffb4f.aae744",
        "type": "i2c in",
        "z": "93690f5d.5a521",
        "name": "",
        "busno": "2",
        "address": "39",
        "command": "",
        "count": "1",
        "x": 650,
        "y": 580,
        "wires": [
            [
                "f027917f.43c15",
                "fef2b4be.21e8b8"
            ]
        ]
    },
    {
        "id": "f027917f.43c15",
        "type": "debug",
        "z": "93690f5d.5a521",
        "name": "",
        "active": true,
        "tosidebar": false,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "msg",
        "x": 910,
        "y": 580,
        "wires": []
    },
    {
        "id": "fef2b4be.21e8b8",
        "type": "function",
        "z": "93690f5d.5a521",
        "name": "",
        "func": "//msg.payload = msg.payload.toString(2);\nconst outputs = 8;\n\nlet n = msg.payload;\n// n is supposed to be a numeric value, add checks here if necessary\n\nreturn n.toString(2) // to binary\n    .slice(-outputs) // keep 16 lowest bits if number is too great\n    .padStart(outputs, '0') // fill missing highest bits with 0\n    .split('') // create array of single chars\n    .reverse() // reverse order: lowest bit -> output 1\n    .map((el, i) => { // create message objects\n        return { \n            payload: parseInt(el),\n            topic: 'bit_' + i\n        };\n    });",
        "outputs": 8,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 560,
        "y": 780,
        "wires": [
            [
                "a34ebe7e.e30c6"
            ],
            [
                "e3f192a9.0d131"
            ],
            [
                "be829fcf.60e38"
            ],
            [
                "c3157d3d.09a81"
            ],
            [
                "621cbff8.7b881"
            ],
            [
                "b71bcd20.0949b"
            ],
            [
                "25952257.5e5c7e"
            ],
            [
                "a00c8279.0df12"
            ]
        ]
    },
    {
        "id": "a34ebe7e.e30c6",
        "type": "debug",
        "z": "93690f5d.5a521",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "msg",
        "x": 790,
        "y": 680,
        "wires": []
    },
    {
        "id": "e3f192a9.0d131",
        "type": "debug",
        "z": "93690f5d.5a521",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "msg",
        "x": 970,
        "y": 680,
        "wires": []
    },
    {
        "id": "be829fcf.60e38",
        "type": "debug",
        "z": "93690f5d.5a521",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "msg",
        "x": 1150,
        "y": 680,
        "wires": []
    },
    {
        "id": "c3157d3d.09a81",
        "type": "debug",
        "z": "93690f5d.5a521",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "msg",
        "x": 1310,
        "y": 680,
        "wires": []
    },
    {
        "id": "621cbff8.7b881",
        "type": "debug",
        "z": "93690f5d.5a521",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "msg",
        "x": 790,
        "y": 800,
        "wires": []
    },
    {
        "id": "b71bcd20.0949b",
        "type": "debug",
        "z": "93690f5d.5a521",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "msg",
        "x": 970,
        "y": 800,
        "wires": []
    },
    {
        "id": "25952257.5e5c7e",
        "type": "debug",
        "z": "93690f5d.5a521",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "msg",
        "x": 1150,
        "y": 800,
        "wires": []
    },
    {
        "id": "a00c8279.0df12",
        "type": "debug",
        "z": "93690f5d.5a521",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "msg",
        "x": 1310,
        "y": 800,
        "wires": []
    }
]

I am only it this way, because I can not get this node set to load correctly

My next step is to work out how to set 2 of the pins as outputs and use the PCFLongPulse command

Command Value Extra information
PCFGPIO,, 1,0 Control PCF8574 output pins (1 or 0)
PCFPulse,,, 1,0 Pulse control on PCF8574 output pins (duration in mS, MILLIseconds)
PCFLongPulse,,, 1,0 Pulse control on PCF8574 output pins (duration in S, seconds)
1 Like

Search the forum, I posted an example flow that lets you get and set pins for a PCF8574 breakout board or IC with a Raspberry Pi. The trick really is to maintain a 'register' the pin states, so as you toggle stuff, you can maintain what the state is for each pin per change. So, Have A PCF8574, And Want To Use It Via Node Red?

Although my solution drives the pins for output, using the flow as a base for reading input should be possible. as well, if anyone wants input support.

I use my flow as a foundation for several solutions, driving relays for example, for my garage door, and lights, my sprinkler controller, etc.

But a word of caution, if you are driving DC switching with relays for example, be sure to know the impact of inductive loads/loading. I only drive 5v and 12v solutions that are DC based, so impact of inductive loading is not significant. But higher DC levels can and does have impact on any relays.

1 Like

I have two devices attached to my pi.
ADS1115 ADS1115 16-Bit ADC - 4 Channel with Programmable Gain Amplifier [STEMMA QT / Qwiic] : ID 1085 : $14.95 : Adafruit Industries, Unique & fun DIY electronics and kits
BM280 https://www.adafruit.com/product/2651

Both from adafruit
sudo i2cdetect -y 1 shows:
image

The i2c scan shows:
image
image

What now?
image
What do I fill in to receive/read the measurements?

Look in the flows section - search for ADS1115

I know, I have both working, but I would like to use this i2c node for other components that don't have a dedicated node.

So I use this example for practise purposes (for me and hopefully others!)

So the i2c scan gives the ASCII value. That corresponds to a hex value
(http://www.asciitabel.be/)
77 in my case. That is the bus adress.

What do I enter at msg.command?