MetaDec is a rover-based metal detector for detection and mapping of metals in a digitally scanned environment.

Figure 1.0: MetaDec Pseudo-code

This project’s aim was to enable a robot to autonomously navigate, whilst detecting and mapping metals.

The development started with the basic understanding of how metal detectors worked, this led us to the development of our own metal detector using electromagnetic waves for detection.

Figure 1.1: Metal detector operational logic

First Prototype

The first prototype includes 3 main components:

Initially, the intention was to “hack” a Lego EV3 brick to run ROS. The system would use the signals generated by a metal detector to publish the position of the brick when metal was detected via an ESP32 to the laptop running the brick via keyboard teleop.

Functional Diagram

The coil is a RX/TX (receiver/transmitter), it has the ability to receive and transmit the electromagnetic fields during detection.

Second Prototype

The second prototype was an iteration in changing the navigation bot and a few tweaks in the detection hardware.

Because of versioning issues with the ROS and the EV3, it was substituted with a Turtlebot 2 (TB2).

Functional diagram

Using two smaller coils on both ends of the turtle bot instead of one big coil. The reason behind the same is because the bigger coil needed a capacitor with more electrical storage. The two-coil approach makes it easier to use smaller capacitors and spread the detection radius around the bot.

Hardware List

Hardware Diagram



13 – sending pulses

26 – LED + buzzer


36/SP – reading sensor




Hardware Setup

An simple adapted setup of 3D printed components to house and connect the TX/RX coils and the processing unit physically to the turtlebot.



The environment is divided in two parts:

  • Mapping the environment: Using RPLiDAR on the turtlebot to scan the environment and to digitize it for future steps.
  • Localizing the turtlebot in this environment to navigate autonomously.


Terminal Setup for Mapping

Terminal setup for Localization


Common Issues:

  • SerialPort errors for RPLiDAR
  • nuc connection 


  • Provide permissions – >//sudo chmod 666 /dev/ttyUSB(x) // (x) -> serial port number for RPLiDAR [//dmesg// for checking ports]
  • Check connection to nuc WiFi //ping nuc //
  • Create an IP on nuc’s “/etc/hosts/” file : 10.42.1.x    <YourHostName>


The program to detect the metal with the coil compared different readings of the capacitor’s charge during certain periods of time. The ESP32 module would send a specific rate of pulses charging the capacitor and driving it through the metal coil. Once some metals would get at a distance lower than 5cm from the coil, its inductive field would become altered and so the pulse rate back, modifying the frequency of the oscillation wave scanned by the program.

Both the LED and the buzzer would activate and blink/buzz on a rate defined by the variation registered on the program, from slower bauds to solid signal while in touch with the material.

As mentioned above, the original script gave several signal reading relations to clean and fix the filtering of the readings. After fixing the wiring and elements on the circuit, and testing with several metallic materials, we got consistent results from the main signal (sum) referred to the rea-ltime charge on the capacitor, and the average charge on the period set from the last peak variation reading (avgsum), as it helped to define a stable reading preventing from external noise and disturbances on the wave.

Signal readings:

(sum) – charge of capacitor (µA) in real time (avgsum) – average charge from previous readings

The detection of the metals are due to the peaks or events that out-stood from the common rate readings. In our case, we set the detection event when the reading went under 630mA.

On further readings we tested different metals, finding out that while stainless steel would get variations under 630mA, on aluminum the variations would go under 628. Not exaggeratedly different results but still became solid patterns.



Using the signal published by the metal detector, sent over the ESP32 and brokered by MQTT and interpreted with MQTT_Bridge, we are able to establish a connection between the robot’s position and the state of the metal detector.

We first evaluate if the broker is publishing a value below 630mA, then we get the robot’s position.

We use the robot’s position as the origin for publishing our marker in RViz.

This marker is stored in an array so that we can check the placed markers’ positions to ensure markers don’t get created more than once.

This code is subscribing to a button press on an arduino board as a way to test the marker creation.

Each time the metal detector publishes a value below 630mA (which continues every 0.1 seconds (or whichever publish rate is defined in the code) until the metal is far enough away from its initial detection) the array of previously set markers is checked against the position of the robot. If the distance is greater than a given amount (in this case 0.5m), a new marker is generated and added to the marker array.

Further Development

Next steps for Dev_2.0 would include measuring using Electromagnetic Waves for higher accuracy and meteorological data dependencies.

Theoretical Fundamentals of Distance Measurement using Electromagnetic Waves

Parameters to consider for measuring distance:

  • Travel Time
  • Change of state the wave undergoes in measured distance

Determine the shape of the path curve of the wave and the velocity with which it is passed.

Meteorological measurements are also required (both depend on the structure of the atmosphere where waves are moving).


Metal Detection and Classification Technologies, Johns Hopkins Apl Technical Digest, C. Nelson

Rinner, K. “Distance Measurement with the Aid of Electromagnetic Waves.” Geophysical Surveys 1, no. 4 (June 1974): 459–79.

MetaDec is a project of IAAC, Institute for Advanced Architecture of Catalonia developed as part of the Master in Robotics and Advanced Construction in 2021/2022 by:







Oscar Gonzalez Fernandez


Daniil Koshelyuk