Hardware components | ||||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
Software apps and online services | ||||||
| ||||||
| ||||||
|
Hi everyone!
This is a project which will be very useful for a person who lives alone and most of the time being out for work, meetings, party etc so in his absence at home whenever it gets heavily rained or floods come then he much be worried about his home so after installing this setup in his house he will be getting alert every time whenever the water level in the house is crossing the threshold value.
He will be getting an email saying that water level is too high and he can be prepared for that situation.
here is the youtube link of the output:
https://youtu.be/cjueUUkLUcg
thank you!
#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:
}
{
"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"
}
}
Comments