Smick_006_analog_in

This flow shows the use of analog sensors (potentiometer, LDR, ...). You will learn how to configure Smick to generate:

  • Measurement sequences read from the sensor;
  • The LOW event when measurements fall below a certain threshold;
  • The High event when measurements exceed a certain threshold. The associated dashboard allows you to:
  • Enable / disable these events;
  • Measurements of real-time display on a received indicator (gauge);
  • Displays the last LOW / HIGH detected and sent to e-mail alarm and Twitter.
[
    {
        "id": "82283593.256f98",
        "type": "link out",
        "z": "c50576d5.b7af18",
        "name": "command",
        "links": [
            "d00f3010.4b85b"
        ],
        "x": 935,
        "y": 380,
        "wires": []
    },
    {
        "id": "b05f8481.58d868",
        "type": "comment",
        "z": "c50576d5.b7af18",
        "name": "actions on actuators",
        "info": "",
        "x": 490,
        "y": 320,
        "wires": []
    },
    {
        "id": "182a53b5.e0602c",
        "type": "comment",
        "z": "c50576d5.b7af18",
        "name": "actions on dashboard",
        "info": "",
        "x": 760,
        "y": 420,
        "wires": []
    },
    {
        "id": "7b9c1fec.633c3",
        "type": "e-mail",
        "z": "c50576d5.b7af18",
        "server": "smtp.gmail.com",
        "port": "465",
        "name": "[email protected]",
        "dname": "mail",
        "x": 710,
        "y": 720,
        "wires": []
    },
    {
        "id": "68b0bc07.f7e484",
        "type": "twitter out",
        "z": "c50576d5.b7af18",
        "twitter": "",
        "name": "tweet",
        "x": 710,
        "y": 780,
        "wires": []
    },
    {
        "id": "92c8a391.39b3f",
        "type": "comment",
        "z": "c50576d5.b7af18",
        "name": "actions on social",
        "info": "",
        "x": 740,
        "y": 660,
        "wires": []
    },
    {
        "id": "dba2835f.b5b5d",
        "type": "function",
        "z": "c50576d5.b7af18",
        "name": "alarm msg",
        "func": "function timeDate(tz) {\n    var d = new Date(Date.now()+tz*3600000);\n\n    return  d.getUTCHours() + \":\" +\n            d.getUTCMinutes() + \":\" +\n            d.getUTCSeconds() + \" \" +\n            d.getUTCDate()\t+\"/\" +\n            (d.getUTCMonth()+1) + \"/\" +\n            d.getUTCFullYear();\n}\n\nmsg.payload=msg.payload + \" level alarm at \" + timeDate(1);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 470,
        "y": 580,
        "wires": [
            [
                "390ea4e5.d7bf1c",
                "38b4d5ef.66eb5a"
            ]
        ]
    },
    {
        "id": "52b00a19.992274",
        "type": "comment",
        "z": "c50576d5.b7af18",
        "name": "events",
        "info": "",
        "x": 150,
        "y": 300,
        "wires": []
    },
    {
        "id": "e213e6f9.afc0c8",
        "type": "comment",
        "z": "c50576d5.b7af18",
        "name": "Description",
        "info": "Questo flusso mostra l'uso di sensori analogici (Potentiometer, LDR,...).\nSi apprenderà come configurare smick per generare:\n- sequenze di misure lette dal sensore;\n- l'evento LOW quando le misure scendono al di sotto di una soglia data;\n- l'evento HIGH quando le misure superano una soglia data.\nLa dashboard associata consente di:\n- abilitare/disabilitare i suddetti eventi;\n- di visualizzare in tempo reale le misure ricevute su un indicatore (gauge);\n- di visualizzare l'ultimo allarme LOW/HIGH rilevato ed inviato su e-mail e twitter.\n\n\nThis flow shows the use of analog sensors (potentiometer, LDR, ...).\nYou will learn how to configure Smick to generate:\n- Measurement sequences read from the sensor;\n- The LOW event when measurements fall below a certain threshold;\n- The High event when measurements exceed a certain threshold.\nThe associated dashboard allows you to:\n- Enable / disable these events;\n- Measurements of real-time display on a received indicator (gauge);\n- Displays the last LOW / HIGH detected and sent to e-mail alarm and Twitter.",
        "x": 110,
        "y": 60,
        "wires": []
    },
    {
        "id": "d2515f8c.357ef",
        "type": "comment",
        "z": "c50576d5.b7af18",
        "name": "Licence & History",
        "info": "Package : Smick v.1\nModule  : LED - digital output\nAuthor  : Curci\nLicence : (CC) BY-NC-SA\n\nThis work is licensed under a Creative Commons \nAttribution-NonCommercial-ShareAlike \n4.0 International License.\n\nHistory\n\nDate        Author  Description\n2016.12.17  Curci   genesis",
        "x": 280,
        "y": 60,
        "wires": []
    },
    {
        "id": "9b87b83d.556c68",
        "type": "comment",
        "z": "c50576d5.b7af18",
        "name": "BOM",
        "info": "Bill Of Material\n\nHardware:\n\n    1 Human internet terminal (PC, tablet or smartphone) connected to the internet\n    1 Smick Wi-Fi connected to the internet\n    1 Pot | LDR + 10kohm resistor\n\nHW Connections:\n\n    Device  pin     Smick pin\n    Pot     left    GND\n    Pot     center  A0\n    Pot     right   3.3V\n    \n    or \n    \n    Device  pin     Smick pin    \n    LDR     1       GND\n    LDR     2       A0\n    R 10k   1       A0\n    R 10k   2       GND\n\nFlow Connections:\n\n    Smick_001_console\n\nAccount:\n\n    Wi-Fi credentials\n    MQTT broker\n    FRED\n    E-mail\n    Twitter\n",
        "x": 430,
        "y": 60,
        "wires": []
    },
    {
        "id": "16727093.2763ef",
        "type": "link in",
        "z": "c50576d5.b7af18",
        "name": "else",
        "links": [
            "bb898c98.f25fd",
            "dcd75773.9926a8"
        ],
        "x": 135,
        "y": 580,
        "wires": [
            [
                "390ea4e5.d7bf1c",
                "dba2835f.b5b5d"
            ]
        ]
    },
    {
        "id": "cad53aa1.dde3e8",
        "type": "ui_gauge",
        "z": "c50576d5.b7af18",
        "name": "analogic sensor",
        "group": "7c709b15.0385b4",
        "order": 2,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "sensor",
        "label": "",
        "format": "{{value}}",
        "min": 0,
        "max": "1023",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "x": 740,
        "y": 520,
        "wires": []
    },
    {
        "id": "71f47e0a.f5777",
        "type": "comment",
        "z": "c50576d5.b7af18",
        "name": "enable/disable",
        "info": "",
        "x": 680,
        "y": 200,
        "wires": []
    },
    {
        "id": "390ea4e5.d7bf1c",
        "type": "debug",
        "z": "c50576d5.b7af18",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 730,
        "y": 840,
        "wires": []
    },
    {
        "id": "38b4d5ef.66eb5a",
        "type": "ui_text",
        "z": "c50576d5.b7af18",
        "group": "7c709b15.0385b4",
        "order": 3,
        "width": 0,
        "height": 0,
        "name": "alarm msg",
        "label": "last alarm",
        "format": "{{msg.payload}}",
        "layout": "col-center",
        "x": 730,
        "y": 580,
        "wires": []
    },
    {
        "id": "5d74af2b.64375",
        "type": "ui_dropdown",
        "z": "c50576d5.b7af18",
        "name": "",
        "label": "mode",
        "group": "7c709b15.0385b4",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "options": [
            {
                "label": "disable",
                "value": "A0==NULL",
                "type": "str"
            },
            {
                "label": "enable",
                "value": "[email protected]",
                "type": "str"
            },
            {
                "label": "set LOW alarm",
                "value": "LOW==A0<340",
                "type": "str"
            },
            {
                "label": "set HIGH alarm",
                "value": "HIGH==A0>680",
                "type": "str"
            }
        ],
        "payload": "",
        "topic": "",
        "x": 710,
        "y": 340,
        "wires": [
            [
                "82283593.256f98"
            ]
        ]
    },
    {
        "id": "734b0c75.314cb4",
        "type": "link in",
        "z": "c50576d5.b7af18",
        "name": "else",
        "links": [
            "8984e8d.24d8118"
        ],
        "x": 135,
        "y": 520,
        "wires": [
            [
                "cad53aa1.dde3e8",
                "da035eef.f0ae6"
            ]
        ]
    },
    {
        "id": "da035eef.f0ae6",
        "type": "debug",
        "z": "c50576d5.b7af18",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 730,
        "y": 460,
        "wires": []
    },
    {
        "id": "7c709b15.0385b4",
        "type": "ui_group",
        "z": "",
        "name": "Analogic sensor",
        "tab": "b07a13ec.60f27",
        "order": 1,
        "disp": true,
        "width": "6"
    },
    {
        "id": "b07a13ec.60f27",
        "type": "ui_tab",
        "z": "",
        "name": "Analogic input",
        "icon": "dashboard",
        "order": 5
    }
]
infosmick

Flow Info

created 9 months, 3 weeks ago

Node Types

Core
  • comment (x8)
  • debug (x2)
  • e-mail (x1)
  • function (x1)
  • twitter out (x1)
Other
  • link in (x2)
  • link out (x1)
  • ui_dropdown (x1)
  • ui_gauge (x1)
  • ui_group (x1)
  • ui_tab (x1)
  • ui_text (x1)

Tags

  • IoT
  • Smick
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option