Check Out This DIY Arduino-Powered Metal Detector Robot

This remote-controlled metal detecting Arduino-powered robot is legit.
Christopher McFadden

If the video player is not working, you can click on this alternative video link.

Everyone loves metal detecting. But when you combine it with remote-controlled robots, the experience is taken to a whole new level. 

Read on to find out how to build one for yourself!

Like most projects of this nature, you'll need a few basic tools (listed below) and some other components.

We have included links to some of the products in case you need to buy them: 

Main components:

Other gear needed:

Now that you've gathered together/order in what you need, the first thing to do is to print all the required 3D-printed parts. You can find the parts models here.

The creator used an Anet ET4 3D printer but you can use any 3D printer capable of printing them. 

arduino metal detector robot print
Source: Interesting Engineering

Next, take the TT gear motors and bolt them to the correct 3D printed component mounts. You will be using all four, plus two mirror image 3D mounts.

Watch the video for more details on which pieces to use. 

arduino metal detector tt gear
Mount TT gear motors to 3D printed mount, Source: Interesting Engineering

Mount the TT gears and mounts to the main box base. 

arduino metal detector box
Source: Interesting Engineering

Next, take the rubber wheels, and mount them into place on the TT gears. 

arduino metal detector wheels
Source: Interesting Engineering

Next, wire up the motors as shown in the video. With that stage complete, turn over the robot.

Now grab the battery holder and mount it into the center of the robot chassis. 

arduino metal detector battery
Source: Interesting Engineering

With most of the mechanical bits sorted, it is now time to turn our attention to the micro-electrical gubbins. 

Here are the circuit diagrams. 

arduino metal detector receiver
Robot/metal detector circuit diagram. Source: Interesting Engineering

Build the PCB as shown, with the components required. Then insert the Arduino RF Nano, and the DC Motor Driver onto the board.

Place the completed PCB board into the belly of the robot, as shown in the video. Next, wire up as shown. 

arduino metal detector circuit board
Source: Interesting Engineering

Next, grab the metal detector module. Wire up and solder as instructed. Secure the metal detector module to its relevant 3D printed mounting, as well as, the positioning arm.

Attach the entire metal detecting assembly to the front of the main robot assembly as shown. 

arduino metal detector arm
Source: Interesting Engineering

Wire up to the previously completed PCB. Now upload the code to the Arduino RF Nano. 

The code is pretty long so we have included at the end of this instruction guide. There are two sets of code, one is for the remote control, and the other is for the robot. 

Ensure you load the RX code to the robot's Arduino. Watch the video for more details. Now place the lid on top of the robot and we've completed half the project (more or less).

Arduino robot cap
Source: Interesting Engineering

Insert two of the batteries to the battery holder and the robot is ready to go. 

Now it is time to build the remote control. Grab the LCD display and mount it into the front face of the remote control. 

arduino robot remote control lcd
Source: Interesting Engineering

Now grab the joystick modules and mount onto the rear plate of the remote controller. Screw into place. 

arduino metal detector joystick
Source: Interesting Engineering

Next, it is time to build the main PCB for the remote control. Here is the circuit diagram.

ardunio transmitter circuit
Remote controller circuit diagram. Source: Interesting Engineering

Assemble as instructed and solder components into place, where required. Mount the second Arduino RF board into place on the PCB, and affix to the rear plate of the remote controller 3D printed piece.

arduino metal detector remote circuits
Source: Interesting Engineering

Wire up the joysticks to the PCB, as shown in the video. 

arduino remote wiring
Source: Interesting Engineering

Next, take the second battery holder, and affix it to the rear of the rear plate of the remote control. Thread the wires through and connect to the main remote PCB, as shown. 

Now connect the LCD screen to the main remote PCB. 

arduino metal detector lcd pcb
Source: Interesting Engineering

Now load the second .ino file onto the remote control Arduino board. This should be the TX file only. We have included the full code at the end of this instruction guide. 

Make sure you also install the required libraries too. 

With that complete, fully assemble the remote controller. 

arduino metal detector remote
Source: Interesting Engineering

Stick the second pair of batteries into the remote controller, and this phase is also complete. 

You can now power up the remote controller and the robot and search for metal to your heart's content. 

arduino metal detector complete
Source: Interesting Engineering

As promised here is the code you will need. If you are going to tinker with the code, make sure you make clean backups first (or redownload, of course). 

Code for the metal detector (save and upload as Metal_Detector_RX.ino or download from here)

//Arduino Metal Detector Robot 
//Receiver Sktech
//Created by DIY Builder
// Contact me https://www.instagram.com/diy.builder/
// Before uploading the sketch you have to install the required libraries
// First go to sketch section >> include library >> manage libaries >> Search RF24 and LiquidCrystal >> Install it >> Done

#include
#include
#include
#define sensor A7

int PWM1 = 6;
int DIR1 = 7;
int PWM2 = 5;
int DIR2 = 4;

int sensorValue = 0;
unsigned long lastReceiveTime = 0;
unsigned long currentTime = 0;

RF24 radio(10,9);
const byte address[6] = "00001";
const byte address1[6] = "00003";

struct Data_Package {
byte x1Value;
byte y1Value;
byte x2Value;
byte y2Value;
byte sValue;


};
Data_Package data;


void setup() {
Serial.begin(9600);

pinMode(DIR1, OUTPUT);
pinMode(DIR2, OUTPUT);
pinMode(sensor, INPUT);



radio.begin();
radio.openReadingPipe(1,address);
radio.openWritingPipe(address1);
radio.setPALevel(RF24_PA_HIGH);


resetData();
}

void loop() {

radio.startListening();

if(radio.available()) {
radio.read(&data, sizeof(Data_Package));
lastReceiveTime = millis();
}
currentTime = millis();
if(currentTime - lastReceiveTime > 1000) {
resetData();
}
Serial.print("j1PotX: ");
Serial.println(data.x1Value);
Serial.print("j1PotY: ");
Serial.println(data.y1Value);

if(data.y1Value > 200 ) {
analogWrite(PWM1, 100);
analogWrite(PWM2, 100);
digitalWrite(DIR1, HIGH);
digitalWrite(DIR2, HIGH);


}else if(data.y1Value < 100) {
analogWrite(PWM1, 100);
analogWrite(PWM2, 100);
digitalWrite(DIR1, LOW);
digitalWrite(DIR2, LOW);

}
else if(data.x1Value > 200 ) {
analogWrite(PWM1, 100);
analogWrite(PWM2, 100);
digitalWrite(DIR1, LOW);
digitalWrite(DIR2, HIGH);


}else if(data.x1Value < 100 ) {
analogWrite(PWM1, 100);
analogWrite(PWM2, 100);
digitalWrite(DIR1, HIGH);
digitalWrite(DIR2, LOW);

}else if(data.y2Value > 200) {
analogWrite(PWM1, 255);
analogWrite(PWM2, 255);
digitalWrite(DIR1, HIGH);
digitalWrite(DIR2, HIGH);

}else if(data.y2Value < 100) {
analogWrite(PWM1, 255);
analogWrite(PWM2, 255);
digitalWrite(DIR1, LOW);
digitalWrite(DIR2, LOW);

}else if(data.x2Value > 200) {
analogWrite(PWM1, 255);
analogWrite(PWM2, 255);
digitalWrite(DIR1, LOW);
digitalWrite(DIR2, HIGH);

}else if(data.x2Value < 100) {
analogWrite(PWM1, 255);
analogWrite(PWM2, 255);
digitalWrite(DIR1, HIGH);
digitalWrite(DIR2, LOW);
}

else {

analogWrite(PWM1, 0);
analogWrite(PWM2, 0);
}
delay(5);

radio.stopListening();
sensorValue = analogRead(sensor);
data.sValue = sensorValue;
Serial.print("sensor");
Serial.println(sensorValue);
radio.write(&data, sizeof(Data_Package));

delay(5);
}
void resetData() {
data.x1Value = 127;
data.y1Value = 127;
data.x2Value = 127;
data.y2Value = 127;
data.sValue = 0; 
}

 

Code for the metal detector (save and upload as Metal_Detector_TX.ino or download from here)

 

//Arduino Metal Detecting Robot
// Transmitter Sketch
// Created by DIY Builder
// Contact me https://www.instagram.com/diy.builder/
// Before uploading the sketch you have to install the required libraries
// First go to sketch section >> include library >> manage libaries >> Search RF24 and LiquidCrystal >> Install it >> Done

#include
#include
#include
#include
#include

LiquidCrystal_I2C lcd(0x3F, 20, 4);


RF24 radio(10,9);
const byte address[6] = "00001";
const byte address1[6] = "00003";
struct Data_Package {
byte x1Value;
byte y1Value;
byte x2Value;
byte y2Value;
byte sValue;
};
Data_Package data;

 

void setup() {

Serial.begin(9600);

lcd.init();
lcd.backlight();

radio.begin();
radio.openWritingPipe(address);
radio.openReadingPipe(1, address1);
radio.setPALevel (RF24_PA_HIGH);

}

void loop() {
delay(5);

radio.stopListening();

Serial.print("x1Value");
Serial.println(data.x1Value);
Serial.print("y1Value");
Serial.println(data.y1Value);
Serial.print("x2Value");
Serial.print(data.x2Value);
Serial.print("y2Value");
Serial.print(data.y2Value);


data.y1Value = map(analogRead(A0), 0, 1023, 0, 255);
data.x1Value = map(analogRead(A1), 0, 1023, 0, 255);
data.y2Value = map(analogRead(A2), 0, 1023, 0, 255);
data.x2Value = map(analogRead(A3), 0, 1023, 0, 255);

radio.write(&data, sizeof(Data_Package));


delay(5);
radio.startListening();
if(radio.available()) {
radio.read(&data, sizeof(Data_Package));
int sensor = data.sValue;
Serial.print("button");
Serial.println(sensor);

lcd.setCursor(0,0);
lcd.print("Robot Connected");

if(sensor < 200){
lcd.setCursor(0,1);
lcd.print("Metal Searching ");
}else {
lcd.setCursor(0,1);
lcd.print(" Metal Found ");
}


}else {
lcd.setCursor(0,0);
lcd.print(" Hello World! ");
lcd.setCursor(0,1);
lcd.print("Robot Disconnected");
}

}
Add Interesting Engineering to your Google News feed.
Add Interesting Engineering to your Google News feed.
message circleSHOW COMMENT (1)chevron
Job Board