4 Replies Latest reply on Nov 10, 2015 1:38 PM by toofewacres

    Analog Input in Edison with Node-RED

    bill_tex

      I have Node-RED running on the Edison with the node-red-contrib-gpio and galileo-io modules installed.

       

      Digital Input and Output works fine, but when I configure a pin for Analog Input (e.g. A1) it doesn't work. It also seems to break the Digital input.

       

      No errors in the console.

       

      Has anyone successfully used this combination to read analog I/O?

       

      Versions:

      Node-RED version: v0.10.10

      Node.js  version: v0.10.35

      node-red-contrib-gpio v0.2.2

      galileo-io 0.8.18

        • 1. Re: Analog Input in Edison with Node-RED
          JPMontero_Intel

          Hi bill_tex,

           

          Could you specify which image and board you are using? Also, which code are you using and how are you testing it?

           

          Regards,
          JPMontero_Intel

          • 2. Re: Analog Input in Edison with Node-RED
            bill_tex

            Image:

            uname -a

            Linux edison 3.10.17-poky-edison+ #1 SMP PREEMPT Wed Apr 29 03:54:01 CEST 2015 i686 GNU/Linux

             

            Board: Edison with the Arduino-style shield.

             

            To test I am using Node-RED with simple flows. These can be pasted and imported to Node-RED.

             

            An all digital I/O flow that works is

             

            [{"id":"e71025e0.18efd8","type":"nodebot","name":"Edison","username":"","password":"","boardType":"galileo-io","serialportName":"","connectionType":"local","mqttServer":"","pubTopic":"","subTopic":"","tcpHost":"","tcpPort":"","sparkId":"","sparkToken":"","beanId":"","impId":""},{"id":"1055a7ac.efaa58","type":"gpio in","name":"","state":"INPUT","samplingInterval":"300","pin":"5","board":"e71025e0.18efd8","x":226,"y":201,"z":"9dc8ce60.62373","wires":[["f8e4314f.071bd"]]},{"id":"56e5e5aa.a91a1c","type":"debug","name":"","active":true,"console":"false","complete":"true","x":665,"y":201,"z":"9dc8ce60.62373","wires":[]},{"id":"f8e4314f.071bd","type":"function","name":"debounce","func":"if (context.global.debounce === undefined) context.global.debounce = {};\n\nif (context.global.debounce[msg.topic] === undefined){\n    context.global.debounce[msg.topic] = msg.payload;\n} else {\n    if (msg.payload == context.global.debounce[msg.topic]){\n        msg = null;\n    } else {\n        context.global.debounce[msg.topic] = msg.payload;\n    }\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":441,"y":201,"z":"9dc8ce60.62373","wires":[["56e5e5aa.a91a1c"]]},{"id":"6de62cf6.9219d4","type":"debug","name":"","active":true,"console":"false","complete":"true","x":677,"y":116,"z":"9dc8ce60.62373","wires":[]},{"id":"2b9d1440.d462ec","type":"gpio in","name":"","state":"INPUT","samplingInterval":"5000","pin":"13","board":"e71025e0.18efd8","x":229,"y":116,"z":"9dc8ce60.62373","wires":[["6de62cf6.9219d4"]]}]

             

            Then when I change the Digital I/O 13 to analog I/O A1, the analog doesn't report anything, and the digital also stops working. It can only be recovered by restarting node-RED. That is, if I revert the analog to digital I/O it doesn't work. I have to kill and restart Node-RED.

             

            [{"id":"e71025e0.18efd8","type":"nodebot","name":"Edison","username":"","password":"","boardType":"galileo-io","serialportName":"","connectionType":"local","mqttServer":"","pubTopic":"","subTopic":"","tcpHost":"","tcpPort":"","sparkId":"","sparkToken":"","beanId":"","impId":""},{"id":"2d17c435.d2e83c","type":"gpio in","name":"","state":"INPUT","samplingInterval":"300","pin":"5","board":"e71025e0.18efd8","x":126,"y":222,"z":"8a069b22.75f968","wires":[["3e810185.c17efe"]]},{"id":"cfdba13f.30246","type":"debug","name":"","active":true,"console":"false","complete":"true","x":565,"y":222,"z":"8a069b22.75f968","wires":[]},{"id":"3e810185.c17efe","type":"function","name":"debounce","func":"if (context.global.debounce === undefined) context.global.debounce = {};\n\nif (context.global.debounce[msg.topic] === undefined){\n    context.global.debounce[msg.topic] = msg.payload;\n} else {\n    if (msg.payload == context.global.debounce[msg.topic]){\n        msg = null;\n    } else {\n        context.global.debounce[msg.topic] = msg.payload;\n    }\n}\n//\nreturn msg;","outputs":1,"noerr":0,"x":341,"y":222,"z":"8a069b22.75f968","wires":[["cfdba13f.30246"]]},{"id":"5a9dca83.a56234","type":"debug","name":"","active":true,"console":"false","complete":"true","x":577,"y":137,"z":"8a069b22.75f968","wires":[]},{"id":"eea8c096.11574","type":"gpio in","name":"","state":"ANALOG","samplingInterval":"5000","pin":"A1","board":"e71025e0.18efd8","x":129,"y":137,"z":"8a069b22.75f968","wires":[["5a9dca83.a56234"]]}]

             

            Hope this makes sense. I might try to run Johnny 5 direct in node.js

            • 3. Re: Analog Input in Edison with Node-RED
              CMata_Intel

              Hi bill_tex

               

              Do you have updates in this? Have you been able to use Node-RED? Did you try with Johnny5?

               

              Regards,

              Charlie

              • 4. Re: Analog Input in Edison with Node-RED
                toofewacres

                I am having the same issue. I also tried the Johnny5, same results. Same results using Octoblu since it uses the same scripts..

                 

                If I use the Arduino IDE or the Intel XDK, I can read A(0) with no issues.

                 

                Anybody successful??