Samad Abdul
Published

Flood Water Level Alert

This project is made to send you an alert via email whenever water is been filled in your house.

IntermediateProtip2 hours2,781
Flood Water Level Alert

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Arduino UNO
Arduino UNO
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
Arduino IDE
Arduino IDE
Integromat

Story

Read more

Schematics

create New scenario

then click on create a new scenario

continue

click on continue

click on more

click on more

import file

then click on import

choose json file

click on the choose file and choose the json code provided in the code section you need to download the code

New scenario

then this page will come

click on first bubble

now click on the first bubble named as bolt iot fill all the details.
in connection you need to put the bolt iot api key after that you will be asked to put the device name put the bolt iot id in it

bolt iot api

you will get the bolt iot api here

bolt iot id

and bolt iot id here

click on second bubble

then similarly click on the second bubble and do the same

click on third bubble

click on next bubble and do the same

click on math bubble

now click on the bubble named math and change the value as required here in my case i set the value to 100

click on the dot

now click on the red dot in between math and gamil and change the value as required here it is set to 60

click on gmail bubble

now click on the gmail button and enter required details connect your gmail with integroment and put your email id in the place of "To"

click run once

now click on run once and you can see the output

output

Here is the output you will get the E-Mail alert whenever the threshold is crossing

Adruino_code

video showing the output

uploading code in arduino

schematic

Setting up Integromat Scenario to Send Email Alerts

you need to setup an account in Integromat Scenario. to setup an account you need to use this link given below...
https://www.integromat.com

then click on try integromat for free and enter required details

Code

Adruino_code

Arduino
#include <BoltDeviceCredentials.h>
#include <BoltIoT-Arduino-Helper.h>

#include <Ultrasonic.h>
#include <BoltIoT-Arduino-Helper.h>

#define ULTRASONIC_TRIG_PIN 12
#define ULTRASONIC_ECHO_PIN 13

Ultrasonic ultrasonic(ULTRASONIC_TRIG_PIN,ULTRASONIC_ECHO_PIN);
int distance=0;

String getDistance(String *arguments){
  distance = ultrasonic.read();
    String returnString=""+String(distance);
    return returnString;
}

void setup() {
  boltiot.begin(Serial);
  // put your setup code here, to run once:
  boltiot.setCommandString("RD\r",getDistance);
  boltiot.setCommandString("GetDistance",getDistance);
}

void loop() {
  boltiot.handleCommand();
  // put your main code here, to run repeatedly:
  
}

water_level_alert

JSON
This is a json file containing the blueprint for the Integromat scenario.
{
    "name": "Water Level Detection",
    "flow": [
        {
            "id": 15,
            "module": "app#bolt-iot:executeCommand",
            "version": 1,
            "parameters": {
                "__IMTCONN__": 445281
            },
            "mapper": {
                "command": "serialBegin",
                "parameters": {
                    "baud": "9600",
                    "deviceName": ""
                }
            },
            "metadata": {
                "designer": {
                    "x": 8,
                    "y": -3
                },
                "restore": {
                    "command": {
                        "label": "Initialize serial communication"
                    },
                    "__IMTCONN__": {
                        "label": "My Bolt connection"
                    }
                },
                "parameters": [
                    {
                        "name": "__IMTCONN__",
                        "type": "account",
                        "label": "Connection",
                        "required": true
                    }
                ],
                "expect": [
                    {
                        "name": "command",
                        "type": "select",
                        "label": "Command",
                        "required": true,
                        "validate": {
                            "enum": [
                                "digitalWrite",
                                "digitalRead",
                                "analogRead",
                                "analogWrite",
                                "serialBegin",
                                "serialWrite",
                                "serialRead",
                                "version",
                                "restart",
                                "isAlive"
                            ]
                        }
                    },
                    {
                        "name": "parameters",
                        "spec": [
                            {
                                "name": "deviceName",
                                "type": "text",
                                "label": "Device name",
                                "required": true
                            },
                            {
                                "name": "baud",
                                "type": "number",
                                "label": "Baud",
                                "required": true
                            }
                        ],
                        "type": "collection",
                        "label": "Parameters"
                    }
                ]
            }
        },
        {
            "id": 1,
            "module": "app#bolt-iot:executeCommand",
            "version": 1,
            "parameters": {
                "__IMTCONN__": 445281
            },
            "mapper": {
                "command": "serialWrite",
                "parameters": {
                    "data": "GetDistance",
                    "deviceName": ""
                }
            },
            "metadata": {
                "designer": {
                    "x": 300,
                    "y": 0
                },
                "restore": {
                    "command": {
                        "label": "Send serial data output"
                    },
                    "__IMTCONN__": {
                        "label": "My Bolt connection"
                    }
                },
                "parameters": [
                    {
                        "name": "__IMTCONN__",
                        "type": "account",
                        "label": "Connection",
                        "required": true
                    }
                ],
                "expect": [
                    {
                        "name": "command",
                        "type": "select",
                        "label": "Command",
                        "required": true,
                        "validate": {
                            "enum": [
                                "digitalWrite",
                                "digitalRead",
                                "analogRead",
                                "analogWrite",
                                "serialBegin",
                                "serialWrite",
                                "serialRead",
                                "version",
                                "restart",
                                "isAlive"
                            ]
                        }
                    },
                    {
                        "name": "parameters",
                        "spec": [
                            {
                                "name": "deviceName",
                                "type": "text",
                                "label": "Device name",
                                "required": true
                            },
                            {
                                "name": "data",
                                "type": "text",
                                "label": "Data",
                                "required": true
                            }
                        ],
                        "type": "collection",
                        "label": "Parameters"
                    }
                ]
            }
        },
        {
            "id": 14,
            "module": "app#bolt-iot:executeCommand",
            "version": 1,
            "parameters": {
                "__IMTCONN__": 445281
            },
            "mapper": {
                "command": "serialRead",
                "parameters": {
                    "till": "10",
                    "deviceName": ""
                }
            },
            "metadata": {
                "designer": {
                    "x": 600,
                    "y": 0
                },
                "restore": {
                    "command": {
                        "label": "Read incoming serial data"
                    },
                    "__IMTCONN__": {
                        "label": "My Bolt connection"
                    }
                },
                "parameters": [
                    {
                        "name": "__IMTCONN__",
                        "type": "account",
                        "label": "Connection",
                        "required": true
                    }
                ],
                "expect": [
                    {
                        "name": "command",
                        "type": "select",
                        "label": "Command",
                        "required": true,
                        "validate": {
                            "enum": [
                                "digitalWrite",
                                "digitalRead",
                                "analogRead",
                                "analogWrite",
                                "serialBegin",
                                "serialWrite",
                                "serialRead",
                                "version",
                                "restart",
                                "isAlive"
                            ]
                        }
                    },
                    {
                        "name": "parameters",
                        "spec": [
                            {
                                "name": "deviceName",
                                "type": "text",
                                "label": "Device name",
                                "required": true
                            },
                            {
                                "name": "till",
                                "type": "number",
                                "label": "Till",
                                "required": true,
                                "validate": {
                                    "max": 127,
                                    "min": 0
                                }
                            }
                        ],
                        "type": "collection",
                        "label": "Parameters"
                    }
                ]
            }
        },
        {
            "id": 18,
            "module": "math:EvaluateExpression",
            "version": 1,
            "parameters": {},
            "mapper": {
                "expression": "100-{{parseNumber(14.value)}}"
            },
            "metadata": {
                "designer": {
                    "x": 869,
                    "y": -2
                },
                "expect": [
                    {
                        "name": "expression",
                        "type": "text",
                        "label": "Expression",
                        "required": true
                    }
                ]
            }
        },
        {
            "id": 13,
            "module": "google-email:ActionSendEmail",
            "version": 1,
            "parameters": {
                "account": 445282
            },
            "filter": {
                "name": "Check if water level to high",
                "conditions": [
                    [
                        {
                            "a": "{{18.result}}",
                            "b": "60",
                            "o": "number:greater"
                        }
                    ]
                ]
            },
            "mapper": {
                "cc": [],
                "to": [
                ],
                "bcc": [],
                "html": "Water level has reached {{18.result}}cms.",
                "subject": "Warning! Water Level is too high!!",
                "attachments": []
            },
            "metadata": {
                "designer": {
                    "x": 1145,
                    "y": -3
                },
                "restore": {
                    "cc": {
                        "mode": "chose",
                        "items": []
                    },
                    "to": {
                        "mode": "chose",
                        "items": [
                            "undefined"
                        ]
                    },
                    "bcc": {
                        "mode": "chose",
                        "items": []
                    },
                    "account": {
                        "label": ""
                    },
                    "attachments": {
                        "mode": "chose",
                        "items": []
                    }
                },
                "parameters": [
                    {
                        "name": "account",
                        "type": "account",
                        "label": "Connection",
                        "required": true
                    }
                ],
                "expect": [
                    {
                        "name": "to",
                        "spec": {
                            "name": " ",
                            "type": "email",
                            "label": "Email address",
                            "required": true
                        },
                        "type": "array",
                        "label": "To",
                        "labels": {
                            "add": "Add a recipient",
                            "edit": "Edit a recipient"
                        },
                        "required": true
                    },
                    {
                        "name": "subject",
                        "type": "text",
                        "label": "Subject"
                    },
                    {
                        "name": "html",
                        "type": "text",
                        "label": "Content"
                    },
                    {
                        "name": "attachments",
                        "spec": [
                            {
                                "name": "fileName",
                                "type": "filename",
                                "label": "File name",
                                "required": true,
                                "semantic": "file:name"
                            },
                            {
                                "name": "data",
                                "type": "buffer",
                                "label": "Data",
                                "required": true,
                                "semantic": "file:data"
                            },
                            {
                                "name": "cid",
                                "type": "text",
                                "label": "Content-ID"
                            }
                        ],
                        "type": "array",
                        "label": "Attachments",
                        "labels": {
                            "add": "Add an attachment",
                            "edit": "Edit an attachment"
                        }
                    },
                    {
                        "name": "cc",
                        "spec": {
                            "type": "email",
                            "label": "Email address"
                        },
                        "type": "array",
                        "label": "Copy recipient",
                        "labels": {
                            "add": "Add a copy recipient",
                            "edit": "Edit a copy recipient"
                        }
                    },
                    {
                        "name": "bcc",
                        "spec": {
                            "type": "email",
                            "label": "Email address"
                        },
                        "type": "array",
                        "label": "Blind copy recipient",
                        "labels": {
                            "add": "Add a blind copy recipient",
                            "edit": "Edit a blind copy recipient"
                        }
                    }
                ]
            }
        }
    ],
    "metadata": {
        "version": 1,
        "scenario": {
            "roundtrips": 1,
            "maxErrors": 3,
            "autoCommit": false,
            "sequential": false,
            "confidential": false,
            "dataloss": false,
            "dlq": false
        },
        "designer": {
            "orphans": []
        },
        "zone": "eu1.integromat.com"
    }
}

Credits

Samad Abdul

Samad Abdul

1 project • 1 follower

Comments