Professional Documents
Culture Documents
Session: 2019-2023
June, 2023
Remote Detection of Metallic Objects Concealed on Human Body
By
June, 2023
2|Page
Declaration
We Waleed Abdullah, Muhammad Ali and Ali Hamza Javed hereby state that our
BS thesis titled” Remote Detection of Metallic Objects Concealed on Human Body” is
our own work and has not been submitted previously by us for taking any degree
from University of Engineering and Technology, Lahore or anywhere else in the
country/world.
At any time if our statement is found to be incorrect even after our graduation the
university has the right to withdraw our BS degree.
June, 2023
3|Page
Plagiarism Undertaking
We Waleed Abdullah, Muhammad Ali and Ali Hamza Javed solemnly declare
that research work presented in the thesis titled, “Remote Detection of Metallic Objects
Concealed on Human Body” is solely our research work with no significant
contribution from any other person. Small contribution/help wherever taken has
been duly acknowledged and that complete thesis has been written by us.
We Waleed Abdullah, Muhammad Ali and Ali Hamza Javed understand the zero-
tolerance policy of the HEC and University of Engineering and Technology, Lahore
towards plagiarism.
Therefore, we as Authors of the above titled thesis declare that no portion of our
thesis has been plagiarized and any material used as reference is properly
referred/cited. We Waleed Abdullah, Muhammad Ali and Ali Hamza Javed
undertake that if we found guilty of any formal plagiarism in the above titled thesis
even after awarding of BS degree, the University reserves the rights to
withdraw/revoke our BS degree and that HEC and the University have the right to
publish our names on the HEC/University Website on which names of students are
placed who have submitted plagiarized thesis.
June, 2023
4|Page
Certificate of Approval
This is to certify that the research work presented in this thesis, entitled” Remote
Detection of Metallic Objects Concealed on Human Body” was conducted by Waleed
Abdullah, Muhammad Ali and Ali Hamza Javed under the supervision of Dr. Imran
Javed.
Any part of this thesis has not been submitted anywhere else for any other degree. This
thesis is submitted to Department of Electrical Engineering, University of
Engineering and Technology, Lahore, Narowal Campus in partial fulfillment of the
requirements for the degree of BS Electrical Engineering.
5|Page
Acknowledgments
6|Page
Abstract
Security is a top priority for governments around the world due to increasing global
terrorism. Detecting weapons is crucial for maintaining public safety in places such
as airports, shopping malls, and schools. Current security equipment such as door
frame detectors, screens, and hand-held detectors have limitations in detecting
potentially dangerous metal objects, which has led to the need for remote and
automated weapon detection systems. This project proposes a remote wireless
detection system that achieves an accuracy of over 85% in detecting metallic objects.
The developed system utilizes Wi-Fi transmissions to extract features about
suspicious/non-suspicious objects, compiles a Channel State Information (CSI)
dataset and then trains a machine learning model to differentiate among the persons
with metal and non-metal objects. The proposed system is portable, cost-effective,
and could be a valuable tool for maintaining safety and security in public spaces.
Future work could focus on improving the system's accuracy in detecting suspicious
objects carried by moving persons and enhancing the dataset further to include other
types of weapons and non-weapon objects.
7|Page
Contents
Declaration 3
Plagiarism Undertaking 4
Acknowledgements 6
Abstract 7
1. Introduction 13
1.1. General Background / Literature Review....................................................13
1.2. Problem Statement..............................................................................................16
1.3. Motivation and Objectives of Thesis.................................................................23
1.4. Thesis Organization....................................................................................27
2. Proposed Methodology 28
2.1. Block Diagram............................................................................................28
2.2. Flow Charts.................................................................................................29
4. Hardware Implementation 32
4.1. Hardware Discussion..................................................................................32
4.2. Results................................................................................................................39
5. Conclusion 40
5.1. Thesis Work........................................................................................................40
5.2. Future Work........................................................................................................40
8|Page
A. Appendix 66
A.1. Sustainable Development Goals (SDGs).....................................................66
A.2. Complex Engineering Problem Attributes..................................................66
Bibliography 67
9|Page
List of Figures
4.2. D i r e c t i o n a l A n t e n n a .............................................................................33
4.3. E S P - 3 2 W R O O M ....................................................................................34
4.4. E S P - 3 2 - S 2 W R O O M -1..........................................................................35
4.5. O m n i A n t e n n a .........................................................................................35
4.6. W i f i C h a n n e l A n a l y z e r ........................................................................36
4.7. S C V a r i a n c e P l o t ...................................................................................37
4.8. P D F o f 6 4 S u b c a r r i e r ...........................................................................37
4.9. H i s t o g r a m o f t w o c l a s s e s ...................................................................38
4.10. C o n f u s i o n M a t r i x .................................................................................38
4.11. H e a t m a p ..................................................................................................39
10 | P a g e
List of Tables
1. Contents................................................................................................................8
2. List of Figures.....................................................................................................10
11 | P a g e
Acronyms
CSI: Channel State Information
SC: Sub-carrier
NLOS: Non-Line-of-Sight
12 | P a g e
1. Introduction
1.1. General Background / Literature Review
1.1.1 Background of the research
Brief History of metal detection techniques:
In human history, metal and weapon detection have had an essential role, particularly
during war and warfare. To find weapons buried beneath the ground or concealed in the
surrounding landscape, the ancient armies utilized metal detectors. To find metal items,
these detectors relied on electromagnetic induction theory.
Metal detectors were often employed to find mines and unexploded bombs during
World War II. These detectors made use of sizable coils that produced an electromagnetic
field that caused metal objects to conduct electricity. A receiver then recognized this
current and displayed it on a meter to reveal the presence of metal.[1]
Metal and weapon detection are becoming essential components of security screening,
particularly in public spaces like airports and governmental buildings. In these
environments, conventional electromagnetic induction-based metal detectors are still
often utilized. These detectors are made up of a receiver coil that tracks the current
produced in metal objects and a transmitter coil that produces an electromagnetic field.
An alarm is set off when a metal object enters the electromagnetic field because it causes
a disturbance that the receiver detects.
Traditional metal detectors, however, have trouble picking up small, non-metallic
objects like ceramic blades and plastic explosives. They are also susceptible to false
alarms brought on by non-metallic objects like coins and keys. New methods of metal and
weapon identification are therefore required in order to get around these restrictions.[2]
One of the earliest methods for metal detection was the use of a simple compass. This
method relied on the fact that metal objects can interfere with the Earth’s magnetic field,
causing a disturbance that can be detected by a compass needle. Another early method for
metal detection was the use of a “dowsing rod”. When the rod crossed over a buried metal
object, it was believed to twitch or move in the operator’s hands.
Metal detectors were often employed to find mines and unexploded bombs during
World War II. These detectors made use of sizable coils that produced an electromagnetic
field that caused metal objects to conduct electricity. A receiver then recognized this
current and displayed it on a meter to reveal the presence of metal.
Metal and weapon detection are becoming essential components of security screening,
particularly in public spaces like airports and governmental buildings such that:
Airports:
Metal detectors are a common sight in airports worldwide, where they are used to detect
weapons and other prohibited items carried by passengers.[5]
Sporting Events:
Security measures are often heightened during major sporting events to prevent any
incidents. Metal detectors may be used to detect weapons or other dangerous items that
could pose a threat to the safety of spectators.
Government Buildings:
Metal detectors are used at the entrances of government buildings to ensure that only
authorized personnel with no weapons enter the building.
Public Gatherings:
Security measures may be increased at large public gatherings, such as concerts, political
rallies, and protests, where metal detectors can be used to screen for weapons and other
prohibited items.[6]
Prisons:
Metal detectors are often used in prisons to prevent weapons from being smuggled in by
visitors, employees, or inmates.[7]
Courthouses:
Metal detectors are used at the entrances of courthouses to detect weapons or other
prohibited items brought by visitors, litigants, or lawyers.
Two phases make up the object identification process, which separates objects from the
group structure. To perform the classification, we first specifically take into account
suspicious cases by 1) using the reconstructed CSI complexity pattern as a feature, and 2)
by obtaining the complex difference CSI between two receiving antennas, which allows us
to determine whether the hazardous material is made of metal or liquid. We use learning-
based methodologies at each stage to create object profiles. We initially use feature
selection technique of KNN to choose CSI-based features from the top base stations and
antenna pairs during training.[11]
The drawbacks of video-based systems are not present with Wi-Fi, which also has a
advanced accessibility and has significant range than other signal-based systems like ultra-
wideband (UWB). There is a lot of promise in being able to follow people without sending
out a second signal or needing other items to cooperate like other signal-based systems do.
The Wi-Fi sensor can also discriminate between items and offer a clear 3D depiction of an
object. It has no detrimental effects on people and is ecologically friendly. Wi-Fi can also
be used due to following reasons:
Broad coverage, Wi-Fi networks are approaching rapidly both for commercial and
17 | P a g e
private use.
Suitable transmitted power provides Wi-Fi signal an edge over other low range
technologies such as UWB
Guo tested separating users of Wi-Fi signals for the first time in the SDR section. By
comparing the received signal, We can localize a person over a large region without any
interference by the utilization of Wi-Fi signal.
The received signal strength (RSS) or CSI can be used to monitor changes in the
received signal. Different target movement patterns and non-line-of-sight (NLOS)
scenarios are addressed by RSS. On the other hand, it has been demonstrated that under
NLOS settings, CSI detection provides a steady and accurate representation of the non-
magnetic channel with little fading. As a result, we employ CSI data to spot changes in
the signal's characteristics. In order to prevent frequent fading, Wi-Fi employs orthogonal
frequency division multiplexing (OFDM), which sends data over many Subban’s. To put
it simply, CSI uses complex integers to represent the channel properties of distinct
subgroups. For example, the vector y acquired across M subsets may be expressed as y =
H + n If Vector M of transmitted signal(for each subset) have length x and H is diagonal
matrix, with each diagonal represents the complex response of channel sub band I and the
additive Gaussian white noise is given by vector n.. The fine-grained Csi equivalent to
the Wi-Fi channel is also available in commercially available off the shelf Wi-Fi devices .
The fundamental idea behind utilizing Wi-Fi radios to find hidden metallic items is that
metal causes variations in the signal that can be detected and separated from non-metal
situations.[12]
The researcher gathers csi input from Wi-Fi transmitter and receiver by employing CSI
measurement present in Wi-Fi equipment.. Two approaches of product categorization and
symptom-based product risk assessment were used in the procedure. The ideal subcarriers
for the CSI complex were chosen using the KNN (K Nearest Neighbor) approach based
on data selection. We may examine data points based on their height and other factors
using the supervised learning technique known as KNN, where k is set to be an odd
number. Based on the outcomes of the categorization of other comparable items, we may
utilize the squared error to assign the product type. Less time is required to master this
model because it is algorithm-based. However, the long-term assessment. Additionally,
following the classification of the product's quality, the risk level of this product is
assessed based on the presentation of its signal output [8]. An ESP32-based temperature
sensor, a Wi-Fi network at home, and a web interface are all included in the remote
sensing hardware version of the home automation system.
We employ an ESP32 node, a portable IoT solution for Wi-Fi/Bluetooth communication
and detection, to investigate the new Wi-Fi CSI platform. The ESP32 CSI Toolkit is
introduced as a fresh CSI approach, with an emphasis on its usability and accessibility. To
establish numerous Wi-Fi connections, The transmitter has access point and Aps and
receiver has station and STAs are made by the node of esp32.. Each Tx/Rx pair is given a
separate SSID and password enabling individualized communication with a
programmable packet rate using ESP32 CSI tools. The AP continually makes CSI queries
to the STA because ESP32 nodes are controlled, and the STA then provides the observed
CSI information to the AP so that we may determine the channel state between the AP
and the STA by the AP. Overall, this part gives a thorough summary of the current
research on wireless detection of metallic items hidden on human body, highlighting the
benefits and drawbacks of various approaches, and suggesting potential topics for further
18 | P a g e
study.
The Ettus Research USRP E312, a battery-operated SDR with 2x2 MIMO capabilities,
is used to produce the SD Radar sensor. It employs Sdr having Ultra-Wideband to provide
detailed pictures of subsurface objects simulating landmines using commercial USRP
SDR gear. Results from experiments show how well the focusing algorithm and SD Radar
function. The other sub-surface imaging activities and landmines detection is done by
developing unmanned aerial vehicles(UAV) that has low cost and high resolution is also
an area of concerned in our study.. A USB WIFI module has been added for remote
control and wireless data collecting. The transmitting/receiving antennas are UWB
Vivaldi antennas from RFSpace, capable of operating within the 600 − 6000 MHz
frequency range [13].
A specific kind of radio called SDR, or software-defined radio, allows the physical layer
functions to be specified and managed by software. These functions are often
implemented using hardware in the traditional method. If, however, changes must be
made to a particular function, developing and implementing the change in hardware is a
time- and money-consuming procedure. As opposed to this, these functions are made
flexible and simple to reconfigure by being defined in software. This drastically cuts
down on the amount of time needed for prototyping. [14]
Atomic read-modify-write operations and polling on system memory-stored
synchronization variables are frequently used to synchronize between activities or threads.
Because the primary system bus is blocked during this procedure, processor throughput is
decreased, and software busy-waits unnecessarily increase power consumption. To solve
this problem, the SDR design has put in place a specialized synchronization infrastructure
that makes synchronization effective and power-saving. Three parts make up this
infrastructure: 1) For synchronized variables,it has small central memory.2) A star
topology link established between core and synchronized memory is formed by the 8 bit
point to point connections , and 3) A sync memory housed by a hardware block offers the
network interfaces, deciding how to access memory, and supporting synchronization
operations. [15]
In-vehicle, sensing has been suggested as a way to improve safety in vehicles and large
equipment controlled by people. Identification and observation of occupants' presence,
movements, gestures, and attentiveness are the goals. Since they overcome the constraints
of conventional RSSI (Received Signal Strength Indication) methods and enable a larger
variety of applications, sensing techniques based on CSI (Channel State Information)
have recently gained prominence. Modified laptops, routers, desktop computers, and
USRPs (Universal Software Radio Peripherals) are frequently used in Wi-Fi CSI
experiments. [16]
Interest in ocean monitoring has increased, notably in the Arctic area, as a result of
growing worries about climate change and rising sea levels. L-band microwave
radiometers are used to measure ocean conditions and monitor thin sea ice. When used in
conjunction with imagers, these radiometers produce regular maps that provide a greater
level of resolution. The execution of the radiometer and imager payloads having RITA is
made possible by the IoT payload’s integration of an SDR-based LoRa modulation is on
demand. The extensive details of the objectives, operational concept, hardware and
software architecture, and implementation of this module will be given as a part of this
project. [17]
FMCW is often used for signal production due to the use of solid state microwave
amplifiers on a large scale. A more affordable and straightforward method is to
19 | P a g e
implement and analyze FMCW radar using SDR. The real-time implementation of SDR-
based FMCW radar is proposed by this study for target identification and radar
applications for traffic control. hardware, USRP N210 and software GNU is used, open
source software and hardware is used to implement FMCW radar model. Radar signals
are sent and received using a log-periodic antenna that operates at a frequency of 1 GHz.
Targets can be found by looking at the beat signal that was received and taking the range
resolution into account. [18]
In 4G/5G technology, srsLTE and OAI are widely used as open source SDR. It is
difficult to implement SDR on EE802.11. After successfully receiving a packet, SIFS
needs packets to be sent within 10 or 16 seconds (2.4 or 5 GHz). Therefore, PC-based
SDR architecture is unfeasible due to the delay (100 s) between Peripherals. Researchers
use simulations, commercial chip hacking, or the purchase of pricey reference designs to
test their theories in order to get around this problem. To solve this problem, we create
open Wi-Fi for the implementation of open source SDR.The SOC based Xilinx Zynq
System, which combines an ARM CPU with an FPGA, serves as the foundation for this
solution. By solving compatibility connections between FPGA and RF front end, we can
achieve precise timing of SIFS by the implementation of the physical layer(PHY) and
low-level Media Access Control(MAC) on the FPGA. [19]
We can find the design of SDR(multinode and multi-mode) in this study. The SDR
platform includes waveform generators for LFM Chirp and multi-mode digital modules,
as well as multi-band RF modules and reconfigurable SDR-GUI software modules for the
user interface, that platform has several uses, including radar imaging, traffic monitoring,
collision avoidance, and security monitoring. A digital signal processing module,
reconfigurable software module, and generic RF module. Unlike conventional radar RF
components, which are often hardware-based and include Modulators, mixers, filters,
demodulator and detectors, SDR parts can be built by using software on a PC, DSP, or
FPGA. The expanding trend of SDR technology is significantly impacting the existing
radar market due to its low cost, compactness, reconfigurability, and versatility. [20]
Numerous steps are required for the installation of GNU radio and RTL-SDR drivers on
the Raspberry Pi, which makes it error-prone and detrimental to hardware performance
and application development. It is strongly advised to write a Linux script for the
automated installation of the programmers and their dependencies on the RPi2 in order to
minimize these mistakes and guarantee a smooth installation. The utilization of GNU
radio has shown to be quite helpful for learning and understanding digital signal
processing. Furthermore, compared to alternative choices, its GPL license helps keep
expenses low. GNU radio companion that carries out real-time FM signal demodulation
can also be run on Raspberry Pi 2 and enable visualization of waterfall frequency-time
representation and FFT power spectral density. [21]
A Software Defined Radio (SDR) may be built using an open-source software toolkit
that provides a variety of operations including
demodulation,modulation,encoding,filtering,sourcecoding, decoding, and channel coding
as software codes. The flexibility for SDR to be reconfigured is a benefit of using
software modules for these tasks. SDR enables customization by only changing the
appropriate code, in contrast to conventional radios where changing the modulation
scheme necessitates modifying the complete analogue equipment. With its graphical user
interface(GUI), GNU Radio Companion (GRC), which enables experimentation with
signal processing blocks written in C++ and Python, GNU Radio makes this possible.
Radio construction is achieved by making a graph that uses signal processing primitives
20 | P a g e
as nodes and data flow between them is represented by edges. [22]
Researchers are now interested in using SDR technology for cutting-edge radio
communication applications including radar, electronic warfare, and signal intelligence.
By using MATLAB, Xilinx, and Simulink environment, this study focuses on the
methods and approach for constructing a low complexity SDR transceiver. The system
uses QPSK modulation to encode and decode the IF signal while sampling a spectrum
frequency ranges from 5 MHz and 20 MHz the methods and approach of the proposed
transceiver design enable quick system modifications with little complexity, facilitating
SDR development. Additionally, it offers the chance to include cognitive radio features
into next wireless networks like 3G and 4G. [23]
The Doppler metric is used as the main measure in this research to propose a real-time
system for recording human movement based on passive signals from the 802.11
standard. the cross-ambiguity function (CAF) approach is used for Doppler extraction due
to the poor range resolution of 802.11 signals,. The suggested system can identify slow
and minute human motions through prolonged integration periods by utilizing quick CAF
processing. To reduce direct signal interference (DSI) and improve, pre- and post-
processing methods like the normalized least mean square (NLMS) filter or CLEAN
algorithm may be simply included and detection performance. Through experiments using
software-defined radio (SDR) in numerous circumstances, including hand movement and
tremor sensing utilizing leaked laptop Wi-Fi signals, through-wall human body motion
sensing using a commercial off-the-shelf (COTS) Wi-Fi access point, and even respiration
detection using a 2.4 GHz ISM band CW signal that can be adapted to Wi-Fi signals the
concept's viability is confirmed. [24]
In terms of wireless data capture and control for diverse devices, the ESP32
outperforms its predecessor, the ESP8266. Comparing ESP32 to ESP8266, it was
discovered that ESP32 performs remarkably well and is advised for non-professional
developers [11]. One useful usage of ESP32 is to allow people to remotely monitor their
smart homes using a smartphone. The gadget may be immediately accessed by users, for
example, to monitor the state of their smart home. The STAARS Wi-Fi network is in
charge of sending temperature data from the sensor to the web interface. A general Wi-Fi
password dictionary called "rock you developers" was used to discover the network
password [25].
Due to the fast expansion of wireless communication technology, an adaptable base
station that can successfully adapt to various wireless communication systems is
becoming more necessary. The needed flexibility is provided by base station
implementation of Software-Defined Radio (SDR) technology, and a GSM wireless
system-specific SDR base station is already operating. SDR base stations should be able
to effortlessly switch between different wireless systems and autonomously adapt to
changing environmental parameters like the volume of data traffic and the quantity of
mobile devices in order to offer more sophisticated network services. For instance, within
a venue like an event hall, The type of event, number of users, and service content, the
requirements of wireless system and number of channels vary significantly . In such
dynamic scenarios, an ideal solution would be an SDR base station capable of adapting
wireless systems to the specific situation. This part outlines the design of proposed system
and presents the results evaluation of the SDR base station, highlighting its distinctive
features and autonomous adaptive control technology. [26]
Advanced wireless sensing systems will be built on widespread improvements in
commercial Wi-Fi transmissions. These systems will provide a wide range of extremely
21 | P a g e
precise, dependable, secure, and practical application services, with the main emphasis
being on publicly accessible human activities identification technologies. The IEEE
802.11n/ac standard-compliant modern Wi-Fi devices use OFDM multi-carrier
modulation technology and frequently include several transmitting and receiving
antennas, providing MIMO functionality. The wireless channel's performance in wireless
communication systems is impacted by variables including time delay, amplitude
attenuation, and phase shift. In order to appropriately distribute transmit power and adjust
rates for each unique MIMO stream, Wi-Fi devices must continually check the condition
of the wireless channel. [27]
In this research work, a novel Base Transceiver Station (BTS) design and
implementation method for GSM mobile communication in rural and disaster-affected
regions is presented. This method makes use of Software-Defined Radio (SDR)
technology. YateBTS is used as the BTS solution in terms of software. The system was
put through a thorough testing process that included sending SMS and phone calls, as
well as evaluating the received power at various distances from the BTS. Notably,
successful audio calls and SMS exchanges were achieved in a range of 90 meters, having
received power of -105dBm. Furthermore, the dual-band GSM patch antenna was
assembled by using a 1.6mm thick FR4 epoxy substrate, featuring dimensions of 85mm x
85mm.The results of simulation demonstrated a loss value of -34.22dB and -36.99dB for
the downlink (953MHz) frequencies and uplink (907MHz) respectively [28].
In particular, in the fields of vital sign detection and object identification, this survey
study examines possible Wi-Fi applications that might be advantageous to society. We
evaluate the efficiency of Wi-Fi-based technologies in identifying heart rates to
conventional sensor-based techniques by examining prior research in this area. We stress
the significance of deploying cutting-edge Wi-Fi technologies, particularly in the medical
industry where non-contact devices are more useful for spotting anomalies in vital signs
like tachycardia and bradycardia. We suggest swapping out the physical sensor with Wi-
Fi technologies to enable contactless heart rate monitoring, even though sensor systems
may rely on Wi-Fi for communication between parts. Notably, Wi-Fi based systems such
as Vital Radio and Wi-Sleep have the ability to monitor the heart beats of multiple people
simultaneously. Thus, non contacting Wi-Fi-based systems prove to be well organized
and in for everyday use. Furthermore, we highlight the potential for improving contactless
systems to identify multiple users at extended distances, taking inspiration from the UWB
radar system and the Fresnel model, which demonstrate higher accuracy rates at shorter
distances. Lastly, in addition to heart beat detection, we discuss other valuable benefits of
Wi-Fi technology. [29]
The use of directional antennas improved power radiation and reception in certain
directions for GPR performance. Due to less interference from outside sources, detection
capabilities were successfully boosted. Additionally, the creation of a Software-Defined
Radio (SDR)-based GPR that may be changed. Due to its adaptability, the GPR's power,
frequency, bandwidth, carrier, and other characteristics may be changed depending on the
testing circumstance. The suggested method recognized underground artefacts in smaller
transverse areas successfully without requiring that they be made entirely of metal. [30]
A number of indoor fine-grained Wi-Fi-based systems have been proposed for passive
intrusion detection, a developing approach utilized in smart homes and home security.
The lengthy offline training procedures used by these present detection systems, however,
slow down the rapid deployment of wireless devices and reduce system robustness. We
introduce APID, an adaptive indoor passive intrusion detection system that uses features
22 | P a g e
extraction of channel state information (CSI) from Wi-Fi signals to provide human
intrusion detection in order to overcome these difficulties. The spread of the CSI
amplitude, which is not affected by the mean amplitude, is evaluated first by APID. The
ratio of dispersion between two successive time frames of CSI amplitude is then extracted
and used as a sensitive measure for detection. Finally, APID performance in two typical
indoor scenarios is evaluated by implementing APID on readily available WI-FI devices.
Experimental results shows that APID have an average detection accuracy of over 95%.
[31]
However, because to the identical CSI fluctuations brought on by pets, current
techniques for identifying people based on CSI are unable to tell humans and pets apart
with accuracy. We carried out an experiment to show the problem in order to confirm this.
While a volunteer went down a different path that was one meter distant, we told a cat to
move 0.3 meters away from the (LoS) path. Both transceivers, which are shown as
hollow stars, were set 10 cm off the ground. It shows how a moving cat can induce CSI
fluctuations similar to those brought on by a person going farther away, leading to false
alerts in the interior intrusion detection system [32].
24 | P a g e
response at different events of time for further classification to confirm that whether the
metallic object is weapon or not.
1.3.2. Significance/Motivation
The wireless detection of metallic objects concealed on human body is an important area
of research with significant implications for various fields, such as security, law
enforcement, and healthcare. Here are some of the potential significances of your FYP:
Security:
Wireless detection of hidden metallic objects on human body has significant
ramifications for security applications, including border control, law enforcement, and
airport security: The wireless detection system created in your FYP could aid in
preventing security threats and enhancing public safety by increasing the precision and
effectiveness of screening operations.
Healthcare:
The wireless detection system created in your FYP may have significant uses in the
field of medicine, such as the identification of metallic foreign bodies in patients that, if
not discovered, can lead to serious health consequences. A non-intrusive and effective
technique to find and find these foreign bodies could be made available by the wireless
detecting system.
Non-intrusive screening:
As opposed to conventional screening techniques that rely on physical touch, including
pat-downs and metal detectors, the wireless detection system built in your FYP offers a
non-intrusive means to screen for hidden metallic objects on human body. As a result,
there may be less chance of discomfort or privacy concerns for those undergoing
screening.
Research novelty:
The wireless detection of hidden metallic objects on human body is a relatively new
field of study, and your FYP could help create new methods and approaches for finding
these objects. This might progress the subject and open the door to more investigation in
this area.
Scope:
The study focuses on employing a specially created detection system to wirelessly find
metallic things that are hidden on the human body.
The purpose of the study is to assess the performance of the wireless detection system by
putting it to the test with various metallic items that are covered up on the human body at
various depths and positions.
The project will examine how machine learning techniques may be used to increase
detection precision and decrease false positives and false negatives.
The effectiveness of the wireless detection system will be examined in relation to
environmental parameters as temperature, humidity, and electromagnetic interference.
The study's goal is to demonstrate the feasibility of wirelessly detecting metallic objects
hidden on the human body, with possible uses in security, healthcare, and other fields.
Limitation:
Non-metallic objects that could likewise be a threat in some security applications will not
be included in the study, which will be restricted to the wireless detection of metallic
objects.
The study won't take into account any possible ethical repercussions of utilizing the
wireless detection technology on people, such as privacy issues or potential health
dangers.
Because the study will only be conducted in a lab environment, it may not accurately
reflect real-world circumstances like interference from other wireless signals or
movement of the subject being screened.
The study will concentrate on a particular kind of wireless detection system; thus, it might
not be applicable to other technologies or systems.
The study's focus will be on finding metallic objects disguised on people; other security
issues will not be covered such as detecting explosives or narcotics.
Thus, even if the study has the potential to offer insightful information about the wireless
detection of metallic objects hidden on human body, it is crucial to recognize these
limitations and take them into account when evaluating the study's findings.
26 | P a g e
Fig. 1.2: Thesis Organization
27 | P a g e
2. Proposed Methodology
28 | P a g e
2.2. Flow Charts
29 | P a g e
3. Mathematical Modelling
Orthogonal frequency-division multiplexing (OFDM) and multiple-input multiple-output
(MIMO), two crucial methods used in the 802.11 protocol, allow Wi-Fi signals to offer
more precise channel measurements. The signal is broadcast using the OFDM method. The
CSI is measured across several orthogonal subcarriers at various subcarrier frequencies,
i.e., at the subcarrier level. The MIMO approach uses several antennas to transmit the
signal, taking use of spatial variety to enhance diversity gain, array gain, and multiplexing
gain. Consequently, a can be expressed as the signal that was received at the receiver.
yi = Hi*xi + ni
where i is the subcarrier index, xi ∈ R N and yi ∈ R N are the transmitted signal and the
T R
subcarrier i.
Inter-carrier variance:
where p indicates packet index, M total number of subcarriers and |Hi [p]| is the CSI
magnitude for i-th subcarrier at packet index p.
The antenna gain is a measure of the ability of the antenna to direct energy in a particular
direction. It is usually expressed in decibels (dB). A higher gain means that more energy is
directed in a particular direction, resulting in a narrower beamwidth. The antenna gain can
be calculated using the following formula:
G = 10*log (Pout/Pin)
30 | P a g e
64 subcarrier amplitude out of 52 are useable over which we apply moving average filter
that smooth waveform by taking average of consecutive 10 sample and storing it from first
index respectively.
Noise Power η k refers to the power of the background noise present in the system. Noise is
unwanted random variations that can interfere with the desired signal. Signal Power α k
refers to the power of the desired signal, which is the component of the signal that carries
the information of interest. The signal power represents the strength or magnitude of the
signal.
Wireless signals travel at the speed of light 3 ×108 m s−1. AS we are using 2.4GHz
frequency. By using formula, we calculate wavelength parameter.
v=fλ
8 8
3 ×10 ∕ 2⋅ 4 ×10 =0 ⋅125 m
Wavelength of a 2.4GHz signal is 0.125 meters or 12.5cm.
31 | P a g e
4. Hardware Implementation
32 | P a g e
Direct Sequence Spread Spectrum (DSSS) modulation to spread the signal over a wide
bandwidth, making it less susceptible to interference and jamming.
The power (P) of a signal transmitted by an antenna can be calculated using the following
formula:
P = G × P₀
Where G is the gain of the antenna and P₀ is the power input to the antenna.
33 | P a g e
Fig. 4.2 Directional Antenna
3. CSI Technology:
The ESP32 IoT device uses Channel State Information (CSI) technology to analyze the
changes in signal strength caused by metallic objects concealed on the human body. When
a metallic object is present, it causes a phase shift in the signal, which can be detected by
analyzing the CSI data.
The phase shift (Δϕ) caused by a metallic object can be calculated using the following
formula:
Δϕ = 4πΔd/λ
Where Δd is the change in distance caused by the metallic object and λ is the wavelength of
the signal. Assuming a wavelength of 12.5 cm and a change in distance of 1 cm caused by
a metallic object, the phase shift can be calculated as follows:
Δϕ = 4π × 0.01 / 0.125 = 10.053 radians
4. Microcontroller:
The microcontroller, such as an Arduino or Raspberry Pi, processes the data collected by
the ESP32 IoT device and provides a visual or audible alert if a metallic object is detected.
The microcontroller can be programmed to perform various actions, such as sounding an
alarm, flashing a light, or sending a notification to a smartphone.
34 | P a g e
Fig. 4.4 ESP32-S2-WROOM-I
5. Omni-Antenna:
Omni directional antenna provide 360-degree coverage. The gain of an Omni antenna is
typically lower than that of a directional antenna, but it provides coverage in all directions
around the antenna. The radiation pattern of an Omni antenna is a three-dimensional graph
that shows the relative strength of the radio signal in all directions around the antenna. In
an ideal Omni antenna, the radiation pattern is a perfect sphere, but in practice, it is
affected by the physical dimensions and mounting location of the antenna.
Wi-Fi is a line-of-sight radio technology, which means it connects to your device directly
through any walls, subflooring, or other electronic devices that are in the way rather than
surrounding it with a wireless signal. The signal will be attenuated by each solid object in
the path between your computer and the antenna of your wireless access point
(router/modem). Even a slight change in location can have a significant impact.
35 | P a g e
Interference sources are not always easy to determine. You may frequently experience
interference from undetected wireless networks or even certain electronics. The 2.4 GHz
radio frequency has a higher prevalence of electronic interference. Always select Channels
1, 11, or 6 for Wireless-N on the 2.4 GHz spectrum. Other than channels 1, 11, or 6, there
will be greater interference.
2.4 GHz channels 1–5 will interfere with channel 1 while receiving interference from it.
2.4 GHz channels 2 to 10 will both generates and receive interference on channel 6.
2.4 GHz channels 7 to 11 will both cause and receive interference from channel 11.
36 | P a g e
Fig. 4.7 SC Variance plot
In above figure, we make three Case. For First Case of Human with metal sudden fall of
variance below threshold and in second case of Human without metal variance increase
above threshold value and kept constant. In third case, when human move sudden peak
come. We draw pdf graph by using variance. When Object moving these two pdfs one with
metal and other in absence overlap and separable distance between them. To train a model,
we need a data set. This data set consists of feature extraction of reflected wave detected by
the receiver. These features are called raw csi data. OFDM breaks the channel into 52-sub
carriers. These 52-subcarriers has their own mean variance and RSI values as a csi data.
The mean of RSSI data is very important in our case. The raw csi data is extracted with
metal and without metal and recorded as a csv file
4.3. Results
To conclude, we can scan one person at a maximum range of 20ft whether any sharp
weapon concealed in clothes or in any baggage with 85% accuracy of ML model.
39 | P a g e
5. Conclusion
5.1. Current Work
The safety and security of public places is burning issue in the modern era, especially in
Pakistan like other countries, Pakistan also faces problems to give protection to its citizens
in crowded areas like airports, railway station and bus terminals. The existing systems
typically depend on the analysis of post events to detect metallic weapons and are only
alerted when the event has occurred.
The proposed system not only uses an advanced algorithm to point out potential
threats at real time but also leverages the latest advancement in machine learning to
automatically detect metal in real time. The proposed system is economically Significant. It
will attract tourism and investment in country. Channel State Information (CSI) is one of
the most important parts of Orthogonal Frequency Division Multiplexing (OFDM). CSI has
many applications such as counting, object detection, old age person and etc. Metals are
also detected by carefully analyze CSI data. Metals have ability they reflect light sharply.
When the area is illuminated by radio waves through transmitting antenna, the metal placed
in line of sight of antenna causes reflection which is detected by receiving antenna. The
analyzing of transmitting and receiving signal gives us CSI data. The data is useful enough
for pre-processing. The CSI data is recorded in the form of CSV file. CSI data is also
recorded without metal as CSV file. This CSV file with metal and without metal is given to
machine learning as an input. Support Vector Machine is used to train the model. The
model has an accuracy of 85%. This system works better in the reflections scenario and in
indoor environment. In short, This AI model will improve will remove the flaws in
surveillance system and will be alerted before the event has occurred.
40 | P a g e
Source Code:
GUI-CSI Acquisition
classdef WIFI_CSI_v16 < matlab.apps.AppBase
LLTF_csi_data;
HTLLTF_csi_data;
STBC_HTLLTF_csi_data;
sc_mean;
sc_var;
pdf;
real_csi;
42 | P a g e
imag_csi;
mag_csi;
phs_csi;
a_mean_val;
var_val;
cs;
mag;
ph;
real;
imag;
rsl;
idx;
mag_data;
phs_data;
mean_data;
var_data;
decision_hold;
decision_threshold;
cntr;
decision_flg;
MAF_samples;
MAF_array;
MAF_en;
end
%------------------------------------------------------------------
function [] = serial_read(app,~,~)
bytes=app.serConn.NumBytesAvailable;
if(bytes)
app.data=readline(app.serConn);
43 | P a g e
str=split(app.data,',');
if(strcmp(str(1),'CSI_DATA'))
app.pkt_cnt=app.pkt_cnt+1;
app.rssi=str2double(str(4));
app.noise_fl=str2double(str(15));
app.channel=str2double(str(17));
%------------------------------------------------------
app.csi_data=str2num(str(26));
%------------------------------------------------------
app.real_csi=app.csi_data(2:2:end);
app.imag_csi=app.csi_data(1:2:end);
%------------------------------------------------------
app.mag_csi=abs(complex(app.real_csi,app.imag_csi));
app.mag_csi(1,1)=0;app.mag_csi(1,2)=0;
%------------------------------------------------------
app.phs_csi=phase(complex(app.real_csi,app.imag_csi));
%------------------------------------------------------
app.a_mean_val=mean([app.mag_csi(7:32)
app.mag_csi(34:59)]); % mean value of all sub carriers
app.var_val=var([app.mag_csi(7:32) app.mag_csi(34:59)]);
% variance of all subcarriers
temp1=app.phs_csi;
temp1(1,1)=0;temp1(1,2)=0;
app.mag_data(1,:)=app.mag_csi;
app.phs_data(1,:)=temp1;
44 | P a g e
app.mean_data(1,:)=app.a_mean_val;
app.MAF_array(1,:)=app.var_val;
ma_var=(sum(app.MAF_array)/app.MAF_samples);
ma_var= ma_var*app.MAF_en + app.var_val*(1-app.MAF_en);
app.var_data(1,:)=ma_var;
app.mag_data=circshift(app.mag_data,1);
app.phs_data=circshift(app.phs_data,1);
app.mean_data=circshift(app.mean_data,1);
app.var_data=circshift(app.var_data,1);
app.MAF_array=circshift(app.MAF_array,1);
if(ma_var<app.decision_threshold)
app.cntr=app.cntr+1;
else
app.cntr=0;
end
if(app.cntr>app.decision_hold)
app.decision_flg=1;
else
app.decision_flg=0;
end
if(app.decision_flg==1)
app.DecisionBoxEditField.Value='Metal';
app.DecisionBoxEditField.BackgroundColor='Red';
else
app.DecisionBoxEditField.Value='No Metal';
app.DecisionBoxEditField.BackgroundColor='Green';
end
45 | P a g e
% Plotting Data
if(app.plot_option(1)==1)
imagesc(app.UIAxes,app.mag_data',[1
app.ColorbarmaxEditField.Value]);
end
if(app.plot_option(2)==1)
plot(app.UIAxes5,app.mag_csi');
end
if(app.plot_option(4)==1)
plot(app.UIAxes3,[app.mean_data, app.var_data]);
legend(app.UIAxes3, 'SC Mean','SC Variance') ;
end
if(app.plot_option(3)==1)
histogram(app.UIAxes4,app.var_data,11);
end
app.RSSIEditField.Value=double(app.rssi);
app.NFloorEditField.Value=double(app.noise_fl);
app.ChannelEditField.Value=double(app.channel);
% Write to file
46 | P a g e
if(app.savedata)
try
fwrite(app.fileID, app.data);
catch e
errordlg(e.message);
end
end
end
end
end
%------------------------------------------------------------------
function [] = timer_action(app,~)
app.PKTRateEditField.Value=app.pkt_cnt;
app.pkt_cnt=0;
app.SelectCommPortListBox.Items= serialportlist("all");
display('Timer is working');
end
end
47 | P a g e
% Variable initializtion
app.idx=1;
app.savedata=0;
app.rssi=0;
app.noise_fl=0;
app.channel=0;
app.pkt_cnt=0;
app.mag=0;
app.ph=0;
app.real=0;
app.imag=0;
app.decision_flg=0;
app.decision_hold=10;
app.decision_threshold=10;
app.cntr=0;
app.MAF_samples=10;
app.MAF_en=0;
app.MAF_array=zeros(app.MAF_samples,1);
app.plot_option=zeros(1,4);
app.mag_csi=zeros(1,64);
app.phs_csi=zeros(1,64);
app.mag_data=zeros(app.SampleWindoweditField.Value*10,64); % Rows
Column=64
app.phs_data=zeros(app.SampleWindoweditField.Value*10,64); % Rows
Column=64
app.mean_data=zeros(app.SampleWindoweditField.Value*10,1);
app.var_data=zeros(app.SampleWindoweditField.Value*10,1);
app.RSSIEditField.Value=double(app.rssi);
app.NFloorEditField.Value=double(app.noise_fl);
app.ChannelEditField.Value=double(app.channel);
app.PKTRateEditField.Value=double(app.pkt_cnt);
48 | P a g e
app.UIAxes.XLim = [0 app.SampleWindoweditField.Value*10];
%
app.UIAxes.XTickLabel=[0:app.SampleWindoweditField.Value/10:app.SampleWindowed
itField.Value];
app.UIAxes.XDir = 'reverse';
app.UIAxes.YLim = [1 64];
% set(app.UIAxes.YLabel,[-31:8:32]);
% Initial plot is all zeros
imagesc(app.UIAxes,app.mag_data');
colorbar(app.UIAxes);
colormap(app.UIAxes,'hot');
% app.cs1_plot = plot(app.UIAxes,-32:31,zeros(1,64));
app.UIAxes.Title.String='CSI Magnitude Heatmap';
start(app.tim);
app.UIAxes5.XLim=[1 64];
app.UIAxes5.YLim=[0 50];
app.UIAxes3.XDir = 'reverse';
app.UIAxes3.YLim=[0 50];
% app.UIAxes4.YLim=[0 1];
app.plot_option(4) = app.CSIMagnitudeStatsCheckBox.Value;
app.plot_option(3)=app.HistogramPlotCheckBox.Value;
app.plot_option(2) = app.MagnitudeSpectrumCheckBox.Value;
app.plot_option(1) = app.MagnitudeHeatmapCheckBox.Value;
end
49 | P a g e
serPortn = app.SelectCommPortListBox.Value;
if serPortn == 1
errordlg('Select valid COM port');
else
serPort= app.SelectCommPortListBox.Value;
delete(app.serConn);
instrreset;
app.serConn =
serialport(serPort,double(app.BAUDRateEditField.Value));
app.PortStatLabel.Text=strcat('Port Status: ',serPort,'
Connected');
configureCallback(app.serConn,"byte",100,@app.serial_read);
app.ConnectButton.Text='Disconnect';
end
configureCallback(app.serConn,"off");
end
end
if(app.savedata)
app.filename=
strcat('CSI',datestr(now,'ddmmyyyy_HHMMSS'),'.txt');
app.FileNameLabel.Text=strcat('File: '," ",app.filename);
try
app.fileID = fopen(app.filename,'w');
fclose(app.fileID);
app.fileID = fopen(app.filename,'a');
catch e
errordlg(e.message);
end
else
try
fclose(app.fileID);
app.FileNameLabel.Text='';
catch e
errordlg(e.message);
end
end
end
51 | P a g e
app.mean_data=zeros(app.SampleWindoweditField.Value*10,1);
app.var_data=zeros(app.SampleWindoweditField.Value*10,1);
app.UIAxes3.XLim = [0 app.SampleWindoweditField.Value*10];
% app.UIAxes.XTickLabel=[0:app.SampleWindoweditField.Value];
end
end
end
end
% Callback function
function XLimEditFieldValueChanged(app, event)
value = app.XLimEditField.Value;
app.UIAxes2.XLim=[-value value];
end
% Callback function
function YLimEditFieldValueChanged(app, event)
value = app.YLimEditField.Value;
app.UIAxes2.YLim=[-value value];
end
52 | P a g e
% Value changed function: GraphMaxEditField
function GraphMaxEditFieldValueChanged(app, event)
value = app.GraphMaxEditField.Value;
app.UIAxes3.YLim=[0 value];
end
end
end
end
end
end
53 | P a g e
% Value changed function: EnableMAFIlterCheckBox
function EnableMAFIlterCheckBoxValueChanged(app, event)
app.MAF_en = double(app.EnableMAFIlterCheckBox.Value);
end
end
% Component initialization
methods (Access = private)
% Create UIAxes
app.UIAxes = uiaxes(app.WiFI_CSI);
title(app.UIAxes, 'CSI Magnitude Heatmap')
xlabel(app.UIAxes, 'Samples Lapsed')
ylabel(app.UIAxes, 'Subcarrier Index')
app.UIAxes.PlotBoxAspectRatio = [2.33009708737864 1 1];
app.UIAxes.XTickLabelRotation = 0;
app.UIAxes.YTickLabelRotation = 0;
app.UIAxes.ZTickLabelRotation = 0;
app.UIAxes.XGrid = 'on';
app.UIAxes.YGrid = 'on';
app.UIAxes.Position = [12 424 753 358];
% Create UIAxes4
app.UIAxes4 = uiaxes(app.WiFI_CSI);
title(app.UIAxes4, 'Variance Histogram')
xlabel(app.UIAxes4, 'Variance')
ylabel(app.UIAxes4, 'Occurance')
54 | P a g e
app.UIAxes4.PlotBoxAspectRatio = [1.75471698113208 1 1];
app.UIAxes4.XTickLabelRotation = 0;
app.UIAxes4.YTickLabelRotation = 0;
app.UIAxes4.ZTickLabelRotation = 0;
app.UIAxes4.XGrid = 'on';
app.UIAxes4.YGrid = 'on';
app.UIAxes4.Position = [797 71 500 316];
% Create UIAxes5
app.UIAxes5 = uiaxes(app.WiFI_CSI);
title(app.UIAxes5, 'CSI Magnitude Spectrum')
xlabel(app.UIAxes5, 'Subcarrier Index')
ylabel(app.UIAxes5, 'Magnitude')
app.UIAxes5.XTickLabelRotation = 0;
app.UIAxes5.YTickLabelRotation = 0;
app.UIAxes5.ZTickLabelRotation = 0;
app.UIAxes5.XGrid = 'on';
app.UIAxes5.YGrid = 'on';
app.UIAxes5.Position = [798 448 494 310];
% Create UIAxes3
app.UIAxes3 = uiaxes(app.WiFI_CSI);
title(app.UIAxes3, 'CSI Magnitude Stats')
xlabel(app.UIAxes3, 'Time Lapsed')
ylabel(app.UIAxes3, 'Value')
app.UIAxes3.XTickLabelRotation = 0;
app.UIAxes3.YTickLabelRotation = 0;
app.UIAxes3.ZTickLabelRotation = 0;
app.UIAxes3.XGrid = 'on';
app.UIAxes3.YGrid = 'on';
app.UIAxes3.Position = [12 67 753 338];
% Create PortStatLabel
app.PortStatLabel = uilabel(app.WiFI_CSI);
app.PortStatLabel.FontWeight = 'bold';
app.PortStatLabel.FontColor = [0.502 0.502 0.502];
app.PortStatLabel.Position = [12 7 250 22];
app.PortStatLabel.Text = 'Port Status: Disconnected';
% Create SerialPortSettingsPanel
app.SerialPortSettingsPanel = uipanel(app.WiFI_CSI);
55 | P a g e
app.SerialPortSettingsPanel.AutoResizeChildren = 'off';
app.SerialPortSettingsPanel.TitlePosition = 'centertop';
app.SerialPortSettingsPanel.Title = 'Serial Port Settings';
app.SerialPortSettingsPanel.FontWeight = 'bold';
app.SerialPortSettingsPanel.Position = [1339 583 158 173];
% Create BAUDRateEditFieldLabel
app.BAUDRateEditFieldLabel = uilabel(app.SerialPortSettingsPanel);
app.BAUDRateEditFieldLabel.HorizontalAlignment = 'right';
app.BAUDRateEditFieldLabel.FontWeight = 'bold';
app.BAUDRateEditFieldLabel.Position = [11 37 70 22];
app.BAUDRateEditFieldLabel.Text = 'BAUD Rate';
% Create BAUDRateEditField
app.BAUDRateEditField = uieditfield(app.SerialPortSettingsPanel,
'numeric');
app.BAUDRateEditField.Limits = [9600 460800];
app.BAUDRateEditField.ValueDisplayFormat = '%.0f';
app.BAUDRateEditField.HorizontalAlignment = 'center';
app.BAUDRateEditField.FontWeight = 'bold';
app.BAUDRateEditField.Position = [88 37 54 22];
app.BAUDRateEditField.Value = 115200;
% Create SelectCommPortListBoxLabel
app.SelectCommPortListBoxLabel =
uilabel(app.SerialPortSettingsPanel);
app.SelectCommPortListBoxLabel.HorizontalAlignment = 'center';
app.SelectCommPortListBoxLabel.FontWeight = 'bold';
app.SelectCommPortListBoxLabel.Position = [24 129 109 22];
app.SelectCommPortListBoxLabel.Text = 'Select Comm Port';
% Create SelectCommPortListBox
app.SelectCommPortListBox =
uilistbox(app.SerialPortSettingsPanel);
app.SelectCommPortListBox.Items = {'Item 1', 'Item 2', 'Item 3'};
app.SelectCommPortListBox.FontWeight = 'bold';
app.SelectCommPortListBox.Position = [16 66 124 63];
% Create ConnectButton
app.ConnectButton = uibutton(app.SerialPortSettingsPanel, 'push');
56 | P a g e
app.ConnectButton.ButtonPushedFcn = createCallbackFcn(app,
@ConnectButtonPushed, true);
app.ConnectButton.FontWeight = 'bold';
app.ConnectButton.Position = [28 6 99 24];
app.ConnectButton.Text = 'Connect';
% Create RSSIEditFieldLabel
app.RSSIEditFieldLabel = uilabel(app.WiFI_CSI);
app.RSSIEditFieldLabel.FontWeight = 'bold';
app.RSSIEditFieldLabel.Position = [1354 497 55 22];
app.RSSIEditFieldLabel.Text = 'RSSI';
% Create RSSIEditField
app.RSSIEditField = uieditfield(app.WiFI_CSI, 'numeric');
app.RSSIEditField.Editable = 'off';
app.RSSIEditField.HorizontalAlignment = 'center';
app.RSSIEditField.FontWeight = 'bold';
app.RSSIEditField.Position = [1409 497 72 22];
% Create NFloorEditFieldLabel
app.NFloorEditFieldLabel = uilabel(app.WiFI_CSI);
app.NFloorEditFieldLabel.FontWeight = 'bold';
app.NFloorEditFieldLabel.Position = [1354 472 55 22];
app.NFloorEditFieldLabel.Text = 'NFloor';
% Create NFloorEditField
app.NFloorEditField = uieditfield(app.WiFI_CSI, 'numeric');
app.NFloorEditField.Editable = 'off';
app.NFloorEditField.HorizontalAlignment = 'center';
app.NFloorEditField.FontWeight = 'bold';
app.NFloorEditField.Position = [1409 472 72 22];
% Create ChannelEditFieldLabel
app.ChannelEditFieldLabel = uilabel(app.WiFI_CSI);
app.ChannelEditFieldLabel.FontWeight = 'bold';
app.ChannelEditFieldLabel.Position = [1354 549 55 22];
app.ChannelEditFieldLabel.Text = 'Channel';
% Create ChannelEditField
app.ChannelEditField = uieditfield(app.WiFI_CSI, 'numeric');
app.ChannelEditField.Editable = 'off';
57 | P a g e
app.ChannelEditField.HorizontalAlignment = 'center';
app.ChannelEditField.FontWeight = 'bold';
app.ChannelEditField.Position = [1409 549 72 22];
% Create PKTRateEditFieldLabel
app.PKTRateEditFieldLabel = uilabel(app.WiFI_CSI);
app.PKTRateEditFieldLabel.FontWeight = 'bold';
app.PKTRateEditFieldLabel.Position = [1354 523 59 22];
app.PKTRateEditFieldLabel.Text = 'PKT Rate';
% Create PKTRateEditField
app.PKTRateEditField = uieditfield(app.WiFI_CSI, 'numeric');
app.PKTRateEditField.Editable = 'off';
app.PKTRateEditField.HorizontalAlignment = 'center';
app.PKTRateEditField.FontWeight = 'bold';
app.PKTRateEditField.Position = [1409 523 72 22];
% Create FileNameLabel
app.FileNameLabel = uilabel(app.WiFI_CSI);
app.FileNameLabel.FontColor = [0.502 0.502 0.502];
app.FileNameLabel.Position = [293 7 293 22];
app.FileNameLabel.Text = 'File:';
% Create YLimMaxEditFieldLabel
app.YLimMaxEditFieldLabel = uilabel(app.WiFI_CSI);
app.YLimMaxEditFieldLabel.HorizontalAlignment = 'right';
app.YLimMaxEditFieldLabel.Position = [165 44 91 22];
app.YLimMaxEditFieldLabel.Text = 'Time span (sec)';
% Create SampleWindoweditField
app.SampleWindoweditField = uieditfield(app.WiFI_CSI, 'numeric');
app.SampleWindoweditField.Limits = [0 10000];
app.SampleWindoweditField.ValueChangedFcn = createCallbackFcn(app,
@SampleWindoweditFieldValueChanged, true);
app.SampleWindoweditField.Position = [263 44 40 22];
app.SampleWindoweditField.Value = 60;
% Create SaveDataCheckBox
app.SaveDataCheckBox = uicheckbox(app.WiFI_CSI);
app.SaveDataCheckBox.ValueChangedFcn = createCallbackFcn(app,
@SaveDataCheckBoxValueChanged, true);
58 | P a g e
app.SaveDataCheckBox.Text = 'Save Data';
app.SaveDataCheckBox.FontColor = [0.502 0.502 0.502];
app.SaveDataCheckBox.Position = [207 7 78 22];
% Create ColorbarmaxEditFieldLabel
app.ColorbarmaxEditFieldLabel = uilabel(app.WiFI_CSI);
app.ColorbarmaxEditFieldLabel.HorizontalAlignment = 'right';
app.ColorbarmaxEditFieldLabel.Position = [601 421 78 22];
app.ColorbarmaxEditFieldLabel.Text = 'Colorbar max';
% Create ColorbarmaxEditField
app.ColorbarmaxEditField = uieditfield(app.WiFI_CSI, 'numeric');
app.ColorbarmaxEditField.Position = [697 422 40 22];
app.ColorbarmaxEditField.Value = 50;
% Create MagnitudeHeatmapCheckBox
app.MagnitudeHeatmapCheckBox = uicheckbox(app.WiFI_CSI);
app.MagnitudeHeatmapCheckBox.ValueChangedFcn =
createCallbackFcn(app, @MagnitudeHeatmapCheckBoxValueChanged, true);
app.MagnitudeHeatmapCheckBox.Text = 'Magnitude Heatmap';
app.MagnitudeHeatmapCheckBox.Position = [1351 403 130 22];
% Create MagnitudeSpectrumCheckBox
app.MagnitudeSpectrumCheckBox = uicheckbox(app.WiFI_CSI);
app.MagnitudeSpectrumCheckBox.ValueChangedFcn =
createCallbackFcn(app, @MagnitudeSpectrumCheckBoxValueChanged, true);
app.MagnitudeSpectrumCheckBox.Text = 'Magnitude Spectrum';
app.MagnitudeSpectrumCheckBox.Position = [1351 376 133 22];
app.MagnitudeSpectrumCheckBox.Value = true;
% Create CSIMagnitudeStatsCheckBox
app.CSIMagnitudeStatsCheckBox = uicheckbox(app.WiFI_CSI);
app.CSIMagnitudeStatsCheckBox.ValueChangedFcn =
createCallbackFcn(app, @CSIMagnitudeStatsCheckBoxValueChanged, true);
app.CSIMagnitudeStatsCheckBox.Text = 'CSI Magnitude Stats';
app.CSIMagnitudeStatsCheckBox.Position = [1350 349 136 22];
app.CSIMagnitudeStatsCheckBox.Value = true;
% Create MaxMagLimEditFieldLabel
app.MaxMagLimEditFieldLabel = uilabel(app.WiFI_CSI);
app.MaxMagLimEditFieldLabel.HorizontalAlignment = 'right';
59 | P a g e
app.MaxMagLimEditFieldLabel.Position = [798 404 85 22];
app.MaxMagLimEditFieldLabel.Text = 'Max Mag Lim ';
% Create MaxMagLimEditField
app.MaxMagLimEditField = uieditfield(app.WiFI_CSI, 'numeric');
app.MaxMagLimEditField.Limits = [0 Inf];
app.MaxMagLimEditField.ValueChangedFcn = createCallbackFcn(app,
@MaxMagLimEditFieldValueChanged, true);
app.MaxMagLimEditField.Position = [881 404 37 22];
app.MaxMagLimEditField.Value = 50;
% Create HistogramPlotCheckBox
app.HistogramPlotCheckBox = uicheckbox(app.WiFI_CSI);
app.HistogramPlotCheckBox.ValueChangedFcn = createCallbackFcn(app,
@HistogramPlotCheckBoxValueChanged, true);
app.HistogramPlotCheckBox.Text = 'Histogram Plot';
app.HistogramPlotCheckBox.Position = [1350 323 100 22];
app.HistogramPlotCheckBox.Value = true;
% Create GraphMaxEditFieldLabel
app.GraphMaxEditFieldLabel = uilabel(app.WiFI_CSI);
app.GraphMaxEditFieldLabel.HorizontalAlignment = 'right';
app.GraphMaxEditFieldLabel.Position = [49 45 65 22];
app.GraphMaxEditFieldLabel.Text = 'Graph Max';
% Create GraphMaxEditField
app.GraphMaxEditField = uieditfield(app.WiFI_CSI, 'numeric');
app.GraphMaxEditField.ValueChangedFcn = createCallbackFcn(app,
@GraphMaxEditFieldValueChanged, true);
app.GraphMaxEditField.Position = [121 46 30 22];
app.GraphMaxEditField.Value = 50;
% Create EnableMAFIlterCheckBox
app.EnableMAFIlterCheckBox = uicheckbox(app.WiFI_CSI);
app.EnableMAFIlterCheckBox.ValueChangedFcn =
createCallbackFcn(app, @EnableMAFIlterCheckBoxValueChanged, true);
app.EnableMAFIlterCheckBox.Text = 'Enable MA FIlter';
app.EnableMAFIlterCheckBox.Position = [512 42 111 22];
% Create NoofSamplesEditFieldLabel
app.NoofSamplesEditFieldLabel = uilabel(app.WiFI_CSI);
60 | P a g e
app.NoofSamplesEditFieldLabel.HorizontalAlignment = 'right';
app.NoofSamplesEditFieldLabel.Position = [644 42 88 22];
app.NoofSamplesEditFieldLabel.Text = 'No of Samples ';
% Create NoofSamplesEditField
app.NoofSamplesEditField = uieditfield(app.WiFI_CSI, 'numeric');
app.NoofSamplesEditField.Limits = [1 1000];
app.NoofSamplesEditField.RoundFractionalValues = 'on';
app.NoofSamplesEditField.ValueChangedFcn = createCallbackFcn(app,
@NoofSamplesEditFieldValueChanged, true);
app.NoofSamplesEditField.HorizontalAlignment = 'center';
app.NoofSamplesEditField.Position = [737 42 28 22];
app.NoofSamplesEditField.Value = 10;
% Create EnableDecisionCheckBox
app.EnableDecisionCheckBox = uicheckbox(app.WiFI_CSI);
app.EnableDecisionCheckBox.ValueChangedFcn =
createCallbackFcn(app, @EnableDecisionCheckBoxValueChanged, true);
app.EnableDecisionCheckBox.Text = 'Enable Decision';
app.EnableDecisionCheckBox.Position = [1361 254 109 22];
% Create SetThresholdEditFieldLabel
app.SetThresholdEditFieldLabel = uilabel(app.WiFI_CSI);
app.SetThresholdEditFieldLabel.HorizontalAlignment = 'right';
app.SetThresholdEditFieldLabel.Position = [1335 220 80 22];
app.SetThresholdEditFieldLabel.Text = 'Set Threshold';
% Create SetThresholdEditField
app.SetThresholdEditField = uieditfield(app.WiFI_CSI, 'numeric');
app.SetThresholdEditField.Limits = [0 Inf];
app.SetThresholdEditField.RoundFractionalValues = 'on';
app.SetThresholdEditField.ValueChangedFcn = createCallbackFcn(app,
@SetThresholdEditFieldValueChanged, true);
app.SetThresholdEditField.HorizontalAlignment = 'center';
app.SetThresholdEditField.Position = [1423 220 47 22];
app.SetThresholdEditField.Value = 10;
% Create SamplesEditFieldLabel
app.SamplesEditFieldLabel = uilabel(app.WiFI_CSI);
app.SamplesEditFieldLabel.HorizontalAlignment = 'right';
app.SamplesEditFieldLabel.Position = [1350 189 52 22];
61 | P a g e
app.SamplesEditFieldLabel.Text = 'Samples';
% Create SamplesEditField
app.SamplesEditField = uieditfield(app.WiFI_CSI, 'numeric');
app.SamplesEditField.Limits = [0 Inf];
app.SamplesEditField.RoundFractionalValues = 'on';
app.SamplesEditField.ValueChangedFcn = createCallbackFcn(app,
@SamplesEditFieldValueChanged, true);
app.SamplesEditField.HorizontalAlignment = 'center';
app.SamplesEditField.Position = [1423 189 48 22];
app.SamplesEditField.Value = 10;
% Create DecisionBoxEditFieldLabel
app.DecisionBoxEditFieldLabel = uilabel(app.WiFI_CSI);
app.DecisionBoxEditFieldLabel.HorizontalAlignment = 'right';
app.DecisionBoxEditFieldLabel.Position = [1371 149 76 22];
app.DecisionBoxEditFieldLabel.Text = 'Decision Box';
% Create DecisionBoxEditField
app.DecisionBoxEditField = uieditfield(app.WiFI_CSI, 'text');
app.DecisionBoxEditField.HorizontalAlignment = 'center';
app.DecisionBoxEditField.FontSize = 18;
app.DecisionBoxEditField.FontWeight = 'bold';
app.DecisionBoxEditField.Position = [1350 98 125 47];
app.DecisionBoxEditField.Value = 'No Metal';
% Construct app
function app = WIFI_CSI_v16
if nargout == 0
clear app
end
end
function results=CSIDataDecoding(fileName)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script reads CSI data text file recorded from ESP32 and decodes its
% magnitude and phase of subcarriers.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%==========================================================================
% Script Inputs:
% File name to decode.Enter full file path if not in same folder.
% fileName='CSI03042023_064521';
%==========================================================================
%==========================================================================
% Script Outputs:
%
% This scripts outputs the following variables and save it in same folder
% as the input text file.
%
% rssi = Receive Signal Strength Indicator (1 x pkt_cnt)
% noise_fl = Noise Floor (1 x pkt_cnt)
63 | P a g e
% channel = CSI sensing Channel (1 x pkt_cnt)
% pkt_cnt = Packet counter (1x1)
% mag = Magnitude of Subcarriers (pkt_cntx64)
% phs = Phase of Subcarriers (pkt_cnt x 64)
%==========================================================================
%--------------------------------------------------------------------------
% Read data from text file
%--------------------------------------------------------------------------
fid=fopen(strcat(fileName,'.txt'),'r');
pkt_cnt=0; % packet counter
while (feof(fid) == 0)
data = fgetl(fid);
str=split(data,',');
pkt_cnt=pkt_cnt+1;
rssi(pkt_cnt)=str2double(str(4));
noise_fl(pkt_cnt)=str2double(str(15));
channel(pkt_cnt)=str2double(str(17));
%------------------------------------------------------
csi_data=cell2mat(str(26));
csi_data=csi_data(2:length(csi_data)-1);
csi_data=str2num(csi_data);
real_csi=csi_data(2:2:end);
imag_csi=csi_data(1:2:end);
mag_csi=abs(complex(real_csi,imag_csi));
% mag_csi(1)=0;mag_csi(2)=0;
mag(pkt_cnt,:)=mag_csi;
phs_csi=phase(complex(real_csi,imag_csi));
phs(pkt_cnt,:)=phs_csi;
%-----------------------------------------------------
end
fclose(fid);
mag(:,1:2)=0;
phs(:,1:2)=0;
mag_var=var([mag(:,7:32) mag(:,34:59)]');
save(fileName,'rssi','noise_fl','channel','pkt_cnt','mag','mag_var','phs') ;
64 | P a g e
writematrix(mag,strcat(fileName,'.csv'),'WriteMode','append');
% clear workspase
clear all
end
ds=mag;
l=size(ds);
l=l(1);
cnt_x=round(l/pix) % total number of heatmap pictures
i=0;
idx=0;
while (i<cnt_x-1)
idx=1+pix*i;
img=imagesc(ds(idx:idx+pix,:)',[1 25]);
colormap('hot');
saveas(img,strcat(fileName,'_',num2str(i+1),'.png') ,'png');
i=i+1;
end
65 | P a g e
display(strcat(fileName,' processing completed.'));
end
A. Appendix
A.1. Sustainable Development Goals (SDGs)
The Sustainable Development Goals (SDGs) are a set of global objectives established by
the United Nations to address various social, economic, and environmental challenges.
Here are some SDGs that might be relevant to your final year project on "Remote
Detection of Metallic Weapons Concealed on the Human Body":
Goal 16: Peace, Justice, and Strong Institutions
Your project directly aligns with the objective of promoting peace and
security. By developing a remote detection system for metallic weapons
concealed on the human body, your project can contribute to preventing
potential threats, enhancing safety, and maintaining social stability.
Goal 9: Industry, Innovation, and Infrastructure
Your project involves the development of a WIFI-based remote detection
system, which falls within the realm of innovation and infrastructure
development. It contributes to advancing technological capabilities and
promoting sustainable solutions for security purposes.
Goal 3: Good Health and Well-being
Your project indirectly relates to this goal by contributing to the overall
safety and well-being of individuals. By detecting concealed metallic
weapons, it aims to prevent potential harm and create safer environments,
promoting good health and well-being.
Goal 17: Partnerships for the Goals
66 | P a g e
Collaborating with relevant stakeholders such as security agencies, law
enforcement, or research institutions can foster partnerships and knowledge-
sharing, contributing to the development and implementation of your
project. This goal emphasizes the importance of collaboration to achieve
sustainable development.
It's important to note that while your project may directly align with specific SDGs, it's
essential to consider the potential ethical implications, privacy concerns, and human rights
considerations associated with detecting weapons concealed on the human body. Ensuring
that the technology is used responsibly and respects individuals' rights is crucial for a
sustainable and equitable implementation.
67 | P a g e
Bibliography
[1] A. Rehman et al., “Remote Detection of Concealed Explosives and Weapons Using
Millimeter-Wave Technology,” Sensors, vol. 21, no. 2, pp. 1-22, Jan. 2021.
[5] "Karachi airport attack: Gunmen launch brazen assault on Pakistan's largest airport."
CBC News, 8 June 2014, https://www.cbc.ca/news/world/karachi-airport-attack-
gunmen-launch-brazen-assault-on-pakistan-s-largest-airport-1.2663824.
[6] "Paris Attacks: What Happened on the Night." BBC News, 20 Nov. 2015.
[7] "Pulse Nightclub Shooting: What Happened." BBC News, 3 June 2019.
[8] M. Khalid et al., “Backscatter X-ray Imaging for Detection of Concealed Metallic
Objects on the Human Body,” IEEE Access, vol. 8, pp. 1–16, 2020.
[9] S. S. Park et al., “Terahertz Imaging for Detection of Concealed Metallic Objects
on the Human Body,” J. Infrared Millim. Terahertz Waves, vol. 38, no. 7, pp.
806–820, Jul. 2017.
[15] K. Vachhani, "Experimental study on Wide Band FM Receiver using GNU Radio
and RTL-SDR," IEEE, 2015.
[21] J.-S. J. I.-S. W. Young-Kil Kwag, "Multi-Band Multi-Mode SDR Radar Platform,"
IEEE, 2015.
[22] G. A. R. A. E. G. Sierra, "Low Cost SDR Spectrum Analyzer and Analog Radio
Receiver Using GNU Radio, Raspberry Pi2 and SDR-RTL Dongle," IEEE, 2015.
69 | P a g e
[29] M. A. W. I. T. J. a. H. Uud Prayuda, "Design and Implementation of SDR-based
GSM Mobile BTS for Remote and Disaster Affected Areas," 2018 IEEE.
[31] J. D. C. M. Manuel Ricardo Pérez Cerquera, "UAV for Landmine Detection Using
SDR-Based GPR Technology," INTECH 2017.
70 | P a g e