Raspberry Pi PLC Analog Read Problem

Hey all, completely new to node-red. I'm trying to use the analog read node to read off of an analog pressure sensor on a RPI PLC shield. Right now I'm just connecting 5 V to I0.5 pin (which is the analog/digital input pin on the module) to see if it's reading anything but on the debug message I'm only getting 0 for the payload. On the node-red console I'm getting a message stating: i2c_write: device or resource busy.


Hi @locutus and welcome!! I'm not sure but I think you need to configure some I2C Address in your read node! or the frequency that you are reading the analog input, could you show your node configuration?

Hey hey thanks for replying! Here's the configuration for the analog read node.

And here's the flow:

[
    {
        "id": "d3df6b967180bd06",
        "type": "tab",
        "label": "Pressure Sensor Test",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "fa41a2b693778a4f",
        "type": "ui_button",
        "z": "d3df6b967180bd06",
        "name": "",
        "group": "2834acbfcd022381",
        "order": 3,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "START",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "",
        "payloadType": "str",
        "topic": "topic",
        "topicType": "msg",
        "x": 160,
        "y": 120,
        "wires": [
            [
                "639b667e73f96d87"
            ]
        ],
        "info": "int count = 0"
    },
    {
        "id": "3ea0761ff8e23a52",
        "type": "ui_button",
        "z": "d3df6b967180bd06",
        "name": "",
        "group": "2834acbfcd022381",
        "order": 0,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "STOP",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "0",
        "payloadType": "str",
        "topic": "topic",
        "topicType": "msg",
        "x": 110,
        "y": 620,
        "wires": [
            [
                "a45defed725f8a72"
            ]
        ]
    },
    {
        "id": "639b667e73f96d87",
        "type": "function",
        "z": "d3df6b967180bd06",
        "name": "start flow.count and send python cmd",
        "func": "var count = flow.get('count')||0;\nflow.set('count', count);\nvar newMsg = {payload: \"python -u /home/locutus/hx711py/example.py\"};\nreturn newMsg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 430,
        "y": 120,
        "wires": [
            [
                "ff1d1803d08327d0"
            ]
        ]
    },
    {
        "id": "ff1d1803d08327d0",
        "type": "exec",
        "z": "d3df6b967180bd06",
        "command": "",
        "addpay": "payload",
        "append": "",
        "useSpawn": "true",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 710,
        "y": 120,
        "wires": [
            [
                "fbfac848b893fa78",
                "294cf4c2c2a94c89"
            ],
            [],
            []
        ]
    },
    {
        "id": "368e32f675ae7b70",
        "type": "status",
        "z": "d3df6b967180bd06",
        "name": "",
        "scope": [
            "ff1d1803d08327d0"
        ],
        "x": 160,
        "y": 40,
        "wires": [
            [
                "6908cb897339c750"
            ]
        ]
    },
    {
        "id": "6908cb897339c750",
        "type": "change",
        "z": "d3df6b967180bd06",
        "name": "set flow.pid",
        "rules": [
            {
                "t": "set",
                "p": "pid",
                "pt": "flow",
                "to": "$number($split(status.text, ':'[1])",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 450,
        "y": 40,
        "wires": [
            []
        ]
    },
    {
        "id": "a45defed725f8a72",
        "type": "change",
        "z": "d3df6b967180bd06",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "pid",
                "tot": "flow"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 320,
        "y": 760,
        "wires": [
            [
                "4e8cd9829c35c1d0"
            ]
        ]
    },
    {
        "id": "4e8cd9829c35c1d0",
        "type": "exec",
        "z": "d3df6b967180bd06",
        "command": "sudo kill -9",
        "addpay": "payload",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 590,
        "y": 760,
        "wires": [
            [],
            [],
            []
        ]
    },
    {
        "id": "fbfac848b893fa78",
        "type": "ui_chart",
        "z": "d3df6b967180bd06",
        "name": "",
        "group": "2834acbfcd022381",
        "order": 1,
        "width": 0,
        "height": 0,
        "label": "chart",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "",
        "ymax": "",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "1",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 930,
        "y": 120,
        "wires": [
            []
        ]
    },
    {
        "id": "294cf4c2c2a94c89",
        "type": "ui_gauge",
        "z": "d3df6b967180bd06",
        "name": "",
        "group": "2834acbfcd022381",
        "order": 2,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Bar",
        "label": "Bar",
        "format": "{{value}}",
        "min": 0,
        "max": "100",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "className": "",
        "x": 950,
        "y": 380,
        "wires": []
    },
    {
        "id": "8be32f244aa2ebdb",
        "type": "rpiplc-analog-read",
        "z": "d3df6b967180bd06",
        "rpiplc": "1a79a48be02df255",
        "pin": "I0.2",
        "name": "",
        "x": 320,
        "y": 380,
        "wires": [
            [
                "294cf4c2c2a94c89",
                "b8f403621d7f353b"
            ]
        ]
    },
    {
        "id": "dd140b02b40c503f",
        "type": "inject",
        "z": "d3df6b967180bd06",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "5",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 130,
        "y": 380,
        "wires": [
            [
                "8be32f244aa2ebdb"
            ]
        ]
    },
    {
        "id": "b8f403621d7f353b",
        "type": "debug",
        "z": "d3df6b967180bd06",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 520,
        "y": 260,
        "wires": []
    },
    {
        "id": "2834acbfcd022381",
        "type": "ui_group",
        "name": "Group",
        "tab": "95ad7dbb2df7acac",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "1a79a48be02df255",
        "type": "rpiplc-config",
        "model": "RPIPLC_19R",
        "name": ""
    },
    {
        "id": "95ad7dbb2df7acac",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

I tried execute flow but I don not have an Industrial Shield Rpi based, the nodes don not run in my PC. All the configuration look good, I also check the Industrial Shields Analog tutorial and is the same configuration that you have, you could check if digital inputs/outputs works well, and check if the PLC model is correct... sorry it is all I have....

PD. I only have been working with Industrial Shields M-Duino(Mega based) and Ardbox Relay PLC (Leonardo based), and are great!! I hope use an RPI based.