What is this?

  • If you press the button on Intel Edison A, the buzzer on Intel Edison B goes off. And vice versa.
  • The two Intel Edisons "talk" to each other over HTTP (via internal home wifi network)

(for the sake of this Instructable, Edison A may be referred to as "Johnny", and Edison B may be referred to as "Charles"... historical reasons :)

Potential use case / scenario:

  • Imagine your Grandma visits your house over a weekend.
  • You sleep upstairs whilst Grandma sleeps downstairs.
  • At 3am in the morning when everybody are asleep, Grandma feels ill and require urgent help.
  • Grandma presses the "Panic button" by her bed.
  • A buzzer is "buzzed" upstairs.
  • You wake up from your sleep, quickly run downstairs, and help out Grandma urgently.
  • A potential fatal situation is prevented.


The upcoming steps will guide you through deploying Node-RED workflow on each Edison.

    Step 1: Deploy BuzzB Workflow on Edison a (Johnny)

    Access Node-RED editor of Edison A.

    Create a tab called "BuzzB".

    Copy the following JSON text:

    [{"id":"caabdf7b.35542","type":"mraa-gpio-din","z":"1801115f.e7feef","name":"D3: johnny.button","pin":"3","interrupt":"b","x":221,"y":178,"wires":[["1c5922e7.e3a6dd"]]},{"id":"de14e33f.21eb2","type":"debug","z":"1801115f.e7feef","name":"debug-button","active":false,"console":"false","complete":"payload","x":764,"y":189.99996948242188,"wires":[]},{"id":"1c5922e7.e3a6dd","type":"rbe","z":"1801115f.e7feef","name":"","func":"rbe","gap":"","x":402,"y":190,"wires":[["42f49ff6.bd0b6","bbe51a6e.441ae8"]]},{"id":"42f49ff6.bd0b6","type":"function","z":"1801115f.e7feef","name":"isButtoned","func":"isButtoned = msg.payload || 0;\ncontext.global.isButtoned = isButtoned;\nmsg.payload = '{\"d\": {\"isButtoned\": ' + isButtoned + ' }}';\nreturn msg;","outputs":1,"noerr":0,"x":582,"y":189,"wires":[["de14e33f.21eb2"]]},{"id":"bbe51a6e.441ae8","type":"debug","z":"1801115f.e7feef","name":"","active":false,"console":"false","complete":"false","x":597,"y":138,"wires":[]}]

    Within Node-RED, click top-right menu button -> import -> clipboard.

    Paste the JSON text and click ok.

    The "BuzzB" Workflow is deployed on Edison A.

    What does this workflow do?

    • Press button on pin D3.
    • The node "isButtoned" will output either 1 (pressed) or 0 (not-pressed) to a global variable called "context.global.isButtoned". The "rbe" node ensures to only output a value when the state of button is changed.
    • Turn the "debug" nodes on/off for debugging purposes (via the debug tab).

    Next, we need to publish the value of this global variable as a JSON string, via a RESTful API.

    Step 2: Deploy a RESTful API on Edison a (Johnny)

    Within the Node-RED editor of Edison A, create a tab called "RESTful".

    Copy the following JSON text:

    [{"id":"cdb148cc.324eb8","type":"http in","z":"802dc3e5.7fd24","name":"GET /isbuttoned","url":"/isbuttoned","method":"get","swaggerDoc":"","x":235,"y":343,"wires":[["ef03c81d.10fc38"]]},{"id":"ef03c81d.10fc38","type":"function","z":"802dc3e5.7fd24","name":"retrieve-isButtoned","func":"msg.payload = {\"isButtoned\" : context.global.isButtoned};\nmsg.statusCode = 200;\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":343,"wires":[["bde08cf5.421f7"]]},{"id":"bde08cf5.421f7","type":"http response","z":"802dc3e5.7fd24","name":"","x":603,"y":341,"wires":[]}]

    Within Node-RED, click top-right menu button -> import -> clipboard.

    Paste the JSON text and click ok. The "RESTful" Workflow is deployed on Edison A.

    What does this workflow do?

    • Established a HTTP end-point called "/isbuttoned".
    • The "retrieve-isButtoned" node and the "http" node work together to publish the value of the global variable "context.global.isButtoned" as a JSON string.

    For instance, accessing the URL "http://edison-A-name.local/isbuttoned" will give you this output:

    {isButtoned: 0}
    {isButtoned: 1}

    Step 3: Deploy BuzzedByA Workflow on Edison B (Charles)

    Within the Node-RED editor of Edison B (Charles), create a tab called "BuzzedByA" (Buzzed by Johnny).

    Copy the following JSON text:

    [{"id":"5ecbb367.a1344c","type":"http request","name":"Get Johnnys Edison Button On-Off Status","method":"GET","ret":"txt","url":"http://atlantisjc.local:1880/isbuttoned","x":351,"y":228,"z":"9f7039b8.608fc8","wires":[["11a43181.ee5bce","443cbbb2.bbc344"]]},{"id":"5678e01e.a9872","type":"inject","name":"GET Johnny API every 1 second","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"x":195,"y":167,"z":"9f7039b8.608fc8","wires":[["5ecbb367.a1344c"]]},{"id":"11a43181.ee5bce","type":"debug","name":"","active":false,"console":"false","complete":"payload","x":638,"y":222,"z":"9f7039b8.608fc8","wires":[]},{"id":"84425c56.7bbda","type":"debug","name":"","active":false,"console":"false","complete":"false","x":749,"y":347,"z":"9f7039b8.608fc8","wires":[]},{"id":"e5365b33.1ac9a8","type":"function","name":"Json2Number","func":"if (msg.payload.isButtoned == 1) {\n    msg.payload = 1;\n} else {\n    msg.payload = 0;\n}\nreturn msg;","outputs":1,"noerr":0,"x":572,"y":354,"z":"9f7039b8.608fc8","wires":[["84425c56.7bbda","65964c01.9a69b4"]]},{"id":"65964c01.9a69b4","type":"rbe","name":"","func":"rbe","gap":"","x":677,"y":425,"z":"9f7039b8.608fc8","wires":[["e983efdb.167c1","2559d548.daa62a"]]},{"id":"e983efdb.167c1","type":"debug","name":"","active":true,"console":"false","complete":"false","x":833,"y":405,"z":"9f7039b8.608fc8","wires":[]},{"id":"443cbbb2.bbc344","type":"json","name":"","x":414,"y":299,"z":"9f7039b8.608fc8","wires":[["e5365b33.1ac9a8","fa06a34f.05f96"]]},{"id":"fa06a34f.05f96","type":"debug","name":"","active":false,"console":"false","complete":"false","x":583,"y":285,"z":"9f7039b8.608fc8","wires":[]},{"id":"2559d548.daa62a","type":"mraa-gpio-dout","name":"D7-buzzer","pin":"7","set":true,"level":"0","x":816,"y":474,"z":"9f7039b8.608fc8","wires":[]}]

    Within Node-RED, click top-right menu button -> import -> clipboard.

    Paste the JSON text and click ok.

    The "BuzzedByA" (Buzzed By Johnny) Workflow is deployed on Edison B (Charles).

    What does this workflow do?

    • Do a GET request of Edison A (Johnny) at every second interval.
    • If the value of "isButtoned" (on Edison A) is 1, then turn buzzer on (on Edison B). Otherwise, turn buzzer off.
    • Use the Debug nodes to see what payload values are being passed - for debugging purposes.

    Next, let's test out the (so far) one-way buzzing system!

    Step 4: Test It Out!

    Let's test it out!

    If Johnny press the button on Edison A (for at least 1 second or longer), the buzzer of (Charle's) Edison B will get turned on.

    Now we have got the A-to-B flow working (i.e. press button on Edison A, triggering buzzer on Edison B), all we need to do is to repeat the same procedure, the other way round. (replacing all the "A" with "B", and "Johnny" with "Charles").

    Also make sure the HTTP Request node is updated correctly. i.e. within the BuzzedByA or BuzzedByB tab, you will have a HTTP GET node. Double click that node and update the URL field.



    About This Instructable




    Bio: Full-stack Developer - experimenting with Internet-of-Things (IoT) and Intel Edison. Upgrading my JavaScripts/NodeJS skills via FreeCodeCamp and the web. Danced with Python, R, SAS, and ... More »
    More by Atlas7:Two-way Remote Intel Edison Buzzer Install Node-RED on Intel Edison 
    Add instructable to: