Thursday, November 7, 2024

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages

Metal Detector Using IndusBoard Coin

Comment errors or corrections found for this circuit, and get the chance to win big!

A metal detector is an instrument that detects the nearby presence of metal. These devices are useful for finding metal objects on the surface, underground, and even underwater. A display can be connected to the IndusBoard coin in which the password can be entered or it can also used to just to give the command of entering the password saved on the board depending on how it is programmed.

In this project, IndusBoard is programmed to work as a metal detector. Magnetometer sensor is used to detect nearby magnetic fields; whenever a metal comes close to the board, there are fluctuations in magnetometer readings which are programmed to detect nearby metal.

Components Required

S. No.ComponentsDescriptionQuantity
1.Indus board coin3cm sized dev board.1
2.Arduino IDETo program the Indus board coin.1
3.USB type C cableTo connect the board to PC for programming.1
4.3.3V batteryTo power the Indus board.1
5.MetalTo test the program.1

Arduino Code


 #include <Wire.h> 
#include <LSM303AGR_ACC_Sensor.h> 
#include <LSM303AGR_MAG_Sensor.h> 
#define SerialPort Serial 
// Initialize components 
LSM303AGR_ACC_Sensor Acc(&Wire); 
LSM303AGR_MAG_Sensor Mag(&Wire); 
// Baseline magnetometer values 
float baselineMag[3]; 
float magThreshold = 100.0; // Threshold for detecting metal 
// Function prototype for calibrateBaseline() 
void calibrateBaseline(); 
void setup() { 
// Initialize serial communication 
SerialPort.begin(115200); 
// Initialize I2C communication 
Wire.begin(); 
// Initialize the accelerometer and magnetometer 
if (Acc.begin() != 0) { 
SerialPort.println("Failed to initialize LSM303AGR accelerometer!"); 
while (1); 
} 
if (Mag.begin() != 0) { 
SerialPort.println("Failed to initialize LSM303AGR magnetometer!"); 
while (1); 
} 
// Enable the accelerometer and magnetometer 
Acc.Enable(); 
Mag.Enable(); 
// Calibrate baseline magnetometer readings 
calibrateBaseline(); 
} 
void loop() { 
// Read accelerometer and magnetometer data 
int32_t accData[3], magData[3]; 
Acc.GetAxes(accData); 
Mag.GetAxes(magData); 
// Calculate magnitude of the current magnetometer readings 
float magMagnitude = sqrt(sq(magData[0]) + sq(magData[1]) + sq(magData[2])); 
// Calculate magnitude of the baseline magnetometer readings 
float baselineMagnitude = sqrt(sq(baselineMag[0]) + sq(baselineMag[1]) + sq(baselineMag[2])); 
// Check for metal detection 
if (abs(magMagnitude - baselineMagnitude) > magThreshold) { 
SerialPort.println("Metal detected!"); 
} else { 
SerialPort.println("No metal detected."); 
} 
// Output sensor data for debugging 
SerialPort.print("Acc[mg]: "); 
SerialPort.print(accData[0]); 
SerialPort.print(" "); 
SerialPort.print(accData[1]); 
SerialPort.print(" "); 
SerialPort.print(accData[2]); 
SerialPort.print(" | Mag[uT]: "); 
SerialPort.print(magData[0]); 
SerialPort.print(" "); 
SerialPort.print(magData[1]); 
SerialPort.print(" "); 
SerialPort.print(magData[2]); 
SerialPort.println(); 
delay(500); // Adjust delay as needed 
} 
void calibrateBaseline() { 
int32_t magData[3]; 
Mag.GetAxes(magData); 
// Store baseline magnetometer readings 
baselineMag[0] = magData[0]; 
baselineMag[1] = magData[1]; 
baselineMag[2] = magData[2]; 
SerialPort.println("Baseline calibration completed."); 
} 

Author(s): Manjeet Vishwakarma,  Abhay Verma and Satywanti Kundu are B.Tech ECE students at GJUS&T HISAR

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics

×