Project tutorial
Metal Detector Alert Monitoring System

Metal Detector Alert Monitoring System © MIT

This Bolt IoT-based project shows how to build a metal detector alert monitor.

  • 2,491 views
  • 1 comment
  • 14 respects

Components and supplies

Apps and online services

About this project

Introduction

This metal detector alert monitoring system i have made because in the consideration of the critical ... requirements in relation to foreign body prevention and detection,The designing of a metal detector robot vehicle can be done by using any micro-controller, ... The proposed system comprises a transmitter (Tx) and receiver (Rx) circuit. ... Here is a war field land rover that alerts on sensing planted land mine ahead ....and it is useful for finding metal inclusions hidden within objects, or metal objects buried underground. They often consist of a handheld unit with a sensor probe which can be ... the change in the magnetic field due to the metallic object can be detected.project video:-

Steps to Build Project

Step 1: First we should have to make a metal detector sensor by connecting it as it is given in the circuit diagram.

Step 2: After making of all the connections we should have to connect it through Bolt cloud using some process like this https://docs.boltiot.com/docs.

Step 3: After connecting it through the Bolt module you should download the blue print code which is .json format which i have given you below .

Step 4: Before going to see the mail alert and you should have to upload code in the Arduino ide after upload the code you should move to make the id on integromat

Using the following step to clone the 'Water Level Detection' scenario, that I created.

1. Download the blueprint of the Water Level Detection scenario attached in the code section of this project. Remember to save the file with the filename 'MetalDetection.json'.

2. Create a scenario, by clicking the blue 'Create a new scenario' button at the top right corner, and click on continue.

3. Click on the 'more' button at the bottom of the screen.

4. Select 'Import Blueprint' and click on 'Choose file'.

5. Navigate to the folder to which you download the 'MetalDetection.json' file, select the file and click open. Once done click save. The MetalDetection scenario will be loaded.

6. Click on the name of the scenario and change it to Metal Detection.

Use the following steps to configure the Metal Detection scenario.

1. Get your Bolt Cloud API key clicking here. The images below show how to enable and copy the API key.

2. Go back to the Integromat scenario, and click on the first BoltIoT bubble, and then click the 'add' button.

3. Paste the API key you had copied earlier, and click on 'continue' button.

4. Add the device name of your device. You can find out your Bolt WiFi module's device name by clicking here. Then click on ok.

5. For the second and third BoltIoT bubble, you can click on the drop down menu and select 'My Bolt Connection'. Remember to add the correct device name to each of them.

6. Click on the math bubble, and change the value 4 to the height at which you have kept your sensor,. Then click on ok.

7. Click on the red dot between the math and gmail bubble, replace 2 with the metal at which you want to be alerted, and click on ok.

8. Click on the gmail bubble, and click on the edit button.

9. Add your email id and click ok.

10. Click on the Add button, then continue button and allow Integromat access to your gmail account.

11. You can add more recipients by click on 'Add a recipient' button, and then click ok.

12. Make sure that your circuit is powered up, and click the Run button. The scenario will run and wait before the filter, indicated by the '1' in a thought bubble.

Mounting the System

Once this is done, all you have to do is mount the system such that the sensor points to the floor, power up the system and ensure that the Bolt has continuous access to the internet via your WiFi.

Applications

The system can be used in the following applications.

  • The consideration of the critical ... requirements in relation to foreign body prevention and detection
  • For finding metal inclusions hidden within objects, or metal objects buried underground.
  • The change in the magnetic field due to the metallic object can be detected.

Code

arduino codeArduino
#define capPin A0
#define buz 9
#define pulsePin A4

#define led 10

long sumExpect=0; //running sum of 64 sums 
long ignor=0;   //number of ignored sums
long diff=0;        //difference between sum and avgsum
long pTime=0;
long buzPeriod=0; 

void setup() 
{
  Serial.begin(9600);
  pinMode(pulsePin, OUTPUT); 
  digitalWrite(pulsePin, LOW);
  pinMode(capPin, INPUT);  
  pinMode(buz, OUTPUT);
  digitalWrite(buz, LOW);
  pinMode(led, OUTPUT);
}

void loop() 
{
  int minval=1023;
  int maxval=0;
  long unsigned int sum=0;
  for (int i=0; i<256; i++)
  {
    //reset the capacitor
    pinMode(capPin,OUTPUT);
    digitalWrite(capPin,LOW);
    delayMicroseconds(20);
    pinMode(capPin,INPUT);
    applyPulses();
    
    //read the charge of capacitor
    int val = analogRead(capPin); //takes 13x8=104 microseconds
    minval = min(val,minval);
    maxval = max(val,maxval);
    sum+=val;
    
    long unsigned int cTime=millis();
    char buzState=0;
    if (cTime<pTime+10)
    {
      if (diff>0)
        buzState=1;
      else if(diff<0)
        buzState=2;
    }
    if (cTime>pTime+buzPeriod)
    {
      if (diff>0)
      buzState=1;
      else if (diff<0)
      buzState=2;
      pTime=cTime;   
    }
    if (buzPeriod>300)
    buzState=0;

    if (buzState==0)
    {
      digitalWrite(led, LOW);
      noTone(buz);
    }  
    else if (buzState==1)
    {
      tone(buz,2000);
      digitalWrite(led, HIGH);
    }
    
    else if (buzState==2)
    {
      tone(buz,500);
      digitalWrite(led, HIGH);
    }
  }

  //subtract minimum and maximum value to remove spikes
  sum-=minval; 
  sum-=maxval;
  
  if (sumExpect==0) 
  sumExpect=sum<<6; //set sumExpect to expected value
  long int avgsum=(sumExpect+32)>>6; 
  diff=sum-avgsum;
  if (abs(diff)<avgsum>>10)
  {
    sumExpect=sumExpect+sum-avgsum;
    ignor=0;
  } 
  else 
    ignor++;
  if (ignor>64)
  { 
    sumExpect=sum<<6;
    ignor=0;
  }
  if (diff==0) 
    buzPeriod=1000000;
  else 
  buzPeriod=avgsum/(2*abs(diff));    
}

void applyPulses()
{
    for (int i=0;i<3;i++) 
    {
      digitalWrite(pulsePin,HIGH); //take 3.5 uS
      delayMicroseconds(3);
      digitalWrite(pulsePin,LOW);  //take 3.5 uS
      delayMicroseconds(3);
    }
}
blueprint codeJSON
{
    "name": "Metal 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": "Get detected",
                    "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 metal is detected",
                "conditions": [
                    [
                        {
                            "a": "{{18.result}}",
                            "b": "30",
                            "o": "number:greater"
                        }
                    ]
                ]
            },
            "mapper": {
                "cc": [],
                "to": [
                ],
                "bcc": [],
                "html": "metal detection",
                "subject": "Warning! metal detected",
                "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"
    }
}

Schematics

circuit diagram of the metal detector
Metal detector circuit diagram dfvp9yb5oj
schematic diagram of the project
Img201902261738541 44mtrv2cim

Comments

Similar projects you might like

Humidity and Temperature Monitoring System

Project tutorial by Vinayak Shantaram Joshi

  • 4,796 views
  • 2 comments
  • 16 respects

Heart Rate Monitoring System

Project tutorial by Team HRMS

  • 16,276 views
  • 2 comments
  • 29 respects

Water Level Alerting System

Project tutorial by Pranav Kundaikar and Vinayak Shantaram Joshi

  • 2,535 views
  • 2 comments
  • 7 respects

Plant Monitoring System using AWS IoT

Project tutorial by CJA3D

  • 31,278 views
  • 6 comments
  • 78 respects

Entry Level Door Monitoring Alarm System

Project tutorial by Team Robodia Technology Solutions

  • 5,432 views
  • 1 comment
  • 16 respects

WaterPi: Houseplant Remote Watering and Monitoring System

Project tutorial by Demirhan Aydin

  • 30,802 views
  • 16 comments
  • 136 respects
Add projectSign up / Login