8th Sem - Final
8th Sem - Final
(EE4191)
BY
2023-2024
i
DECLARATION BY THE CANDIDATES
i) The work contained in the thesis has been done by myself/ourselves under
the general supervision of my/our supervisor/supervisors.
ii) I/We have conformed to the norms and guidelines given in the Ethical Code
of Conduct of the Institute.
iii) Whenever I/we have used materials (data, theoretical analysis and text)
from other sources, I/we have given due credit to them by citing them in the
text of the report and giving their details in the references.
iv) Whenever I/we have quoted written materials from other sources, I/we have
put them under quotation marks and given due credit to the sources by
citing them and giving details in the references.
Date: 02/05/2024
ii
CERTIFICATE
iii
CERTIFICATE OF APPROVAL
Board of Examiners
iv
Acknowledgement
We would like to express our deepest gratitude and sincere appreciation to our
supervisor, Dr. Debabrata Roy, Professor, Department of Electrical Engineering,
Indian Institute of Engineering Science and Technology, Shibpur, for his valuable
advice and constant encouragement to work on this topic which is a fairly new topic
in research.
We are deeply indebted to Mr. Shamik Dasadhikari, Senior Research Fellow, IIEST,
Shibpur and Miss Cherosree Dolui, Junior Research Fellow, IIEST, Shibpur for their
invaluable suggestions, advice and constant encouragement to finish our research
work.
We are thankful to Dr. Anindita Sengupta, Professor and Head, Department of
Electrical Engineering, IIEST Shibpur for allocating us this project in which we had
immense interest and we had a good learning experience.
Lastly, we are thankful to our family and friends for being with us and supporting us
at all times.
v
CONTENTS
Chapter 1 Introduction 1-13
1.1 Motivation for this work 1
1.2 Magnetostriction 3
1.3 Joule Effect 5
1.4 Inverse Magnetostrictive Phenomenon 6
1.5 Physical Origin of Magnetostriction 7
1.6 Magnetostrictive Effects 9
1.7 Preference of Galfenol as the Magnetostrictive Material 10
1.7.1 Comparison between Terfenol-D and Galfenol 10
1.8 Literature Review 12
viii
LIST OF FIGURES
Fig. No. Description Page No.
1.2.1 Molecular dipole rotation during magnetostriction 3
1.2.2 Division into domains within a ferromagnetic material 4
1.2.3 Gradual tilt of molecular dipoles in a Bloch wall (B) to satisfy adjacent 4
1.2.4 domains
Easy and(A)
hardand (C)
directions in the BCC, HCP, and FCC unit cell structures 5
1.3 Size increment of Magnetostrictive material after application of field 6
1.4 Variation of Magnetic Flux Density with Applied Stress 7
1.5.1 Highly magnetostrictive material the spin moment ‘m’ and orbital moment ‘m’ 8
are with external field H
1.5.2 Schematic representation of the phenomena of magnetostriction 8
2.1.1 Configuration of axial-type Magnetostrictive energy harvester 14
2.1.2 Configuration of axial-type Magnetostrictive energy harvester 14
2.1.3 Configuration of rotation type Magnetostrictive energy harvester 15
2.1.4 Configuration of a U-shaped Magnetostrictive unimorph harvester 15
2.1.5 Configuration of a Cantilever type Magnetostrictive Energy harvester 16
2.1.6 Schematics of L-shaped Magnetostrictive energy harvester 16
2.5 Energy flow within a magnetostrictive energy harvester 21
2.7.1 Application of Energy harvesters in structural health monitoring and disaster 24
prevention
2.7.2 Applications of energy harvesters in the automation and in the vehicle 26
suspension system
2.7.3 Applications of energy harvesters in human health monitoring and security 27
purposes
3.1 RT Pro Photon Software 28
3.2 PHOTON+ Dynamic Signal Analyzer 29
3.3 LDS LPA 100 29
3.4 LDS V408 30
3.5 Tektronix TBS 1062 31
3.6 Arduino Uno 32
3.7 Connecting the NRF24L01 with Arduino Uno 33
3.8 USB-6210 DAQ 35
4.1.1 Output Voltage Waveform from DSO(9Hz) 37
4.1…4.1.
4.1.2 Output Voltage Waveform from DSO(10Hz) 37
14.1.3 Output Voltage Waveform from DSO(15Hz) 37
4.1.4 Output Voltage Waveform from DSO(20Hz) 37
4.1.5 Output Voltage Waveform from DSO(25Hz) 38
4.1.6 Output Voltage Waveform from DSO(30Hz) 38
4.2.1 Output Voltage Waveform from DSO(9Hz) 38
4.2.2 Output Voltage Waveform from DSO(10Hz) 38
4.2.3 Output Voltage Waveform from DSO(15Hz) 39
4.2.4 Output Voltage Waveform from DSO(20Hz) 39
4.2.5 Output Voltage Waveform from DSO(25Hz) 39
ix
4.2.6 Output Voltage Waveform from DSO(30Hz) 39
4.3.1 Output Voltage Waveform from DSO(9Hz) 39
4.3.2 Output Voltage Waveform from DSO(10Hz) 39
4.3.3 Output Voltage Waveform from DSO(15Hz) 40
4.3.4 Output Voltage Waveform from DSO(20Hz) 40
4.3.5 Output Voltage Waveform from DSO(25Hz) 40
4.3.6 Output Voltage Waveform from DSO(30Hz) 40
4.4.1 Data collected is displayed in the serial monitor 41
4.5.1 DAQ Card Interfacing with bridge setup 42
4.5.2 LabView setup with DAQ Card 43
4.5.3 DAQ data recorded with sine input 10 Hz 44
4.5.4 DAQ data recorded with sine input 30 Hz 44
4.5.5 DAQ data recorded with square input 10 Hz 44
4.5.6 DAQ data recorded with square input 30 Hz 44
4.5.7 DAQ data recorded with triangular input 10 Hz 44
4.5.8 DAQ data recorded with triangular input 30Hz 44
5.1.1 Pinout of Arduino UNO board 45
5.1.2 Arduino IDE 47
5.1.3 NRF24L01 Pinout 48
5.1.4 SD card module 49
5.3 Arduino connection with NRF24L01 51
5.4.1 Including Libraries and Initializing Pins 51
5.4.2 Implementation of Transmitter Module 52
5.4.3 Implementation of Receiver Module 52
5.5.1 Collected Data for different Frequencies 53
5.5.2 Plot for 5Hz dataset collected using Arduino & NRF24L01 53
5.5.3 Plot for 5Hz 10Hz & 20Hz datasets collected using Arduino & NRF24L01 54
5.6 Connecting NRF24L01 and SD Card Module to same Arduino 55
5.7.1 Arduino Connected to Excel Data Streamer 56
5.7.2 Data Recorded via Excel Data Streamer (10 Hz) 56
6.2.1 Classification using Supervised Learning 57
6.2.2 Clustering 58
6.2.3 Reinforcement Learning 59
6.3.1 Simple Linear Regression 60
6.3.2 Logistic Regression 60
6.3.3 K-Nearest Neighbour model with K=3 61
6.3.4 Decision Tree 61
6.3.5 Random Forest Classifier 62
6.3.6 Support Vector Machine 62
6.3.7 Neural Network 63
6.3.8 K-Means Clustering 64
6.3.9 Gated Recurrent Unit 64
6.3.10 Long Short-Term Memory 65
6.3.11 Convolutional Neural network 66
6.3.12 K-Means Clustering 66
7.2.1 Python implementation of the Moving Average Algorithm 71
7.2.2 Sinusoidal Input of Frequency 11 Hz 71
7.2.3 Sinusoidal Input of Frequency 15 Hz 71
x
7.2.4 Sinusoidal Input of Frequency 25 Hz 72
7.2.5 Sinusoidal Input of Frequency 30 Hz 72
7.2.6 Sinusoidal Input of Frequency 28 Hz 72
7.2.7 Sinusoidal Input of Frequency 26 Hz 72
7.2.8 Triangular Input of Frequency 16 Hz 72
7.2.9 Triangular Input of Frequency 17 Hz 72
7.2.10 Triangular Input of Frequency 19 Hz 73
7.2.11 Triangular Input of Frequency 25 Hz 73
7.2.12 Square Input of Frequency 16 Hz 73
7.2.13 Square Input of Frequency 15 Hz 73
7.2.14 Square Input of Frequency 23 Hz 73
7.2.15 Square Input of Frequency 25 Hz 73
7.2.16 Sine input of frequency =15 Hz 74
7.2.17 Sine input of frequency =20 Hz 74
7.2.18 Square input of frequency =20 Hz 74
7.2.19 Square input of frequency =20 Hz 74
7.2.20 Triangular input of frequency =20 Hz 75
7.2.21 Triangular input of frequency =20 Hz 75
7.4.1 Implementing FFT algorithms in Python 77
7.4.2 Sinusoidal input of Frequency 9 Hz 7
77
7.4.3 Sinusoidal input of Frequency 10 Hz 77
7.4.4 Sinusoidal input of Frequency 14 Hz 77
7.4.5 Sinusoidal input of Frequency 16 Hz 77
7.4.6 Triangular input of Frequency 9 Hz 78
7.4.7 Triangular input of Frequency 10 Hz 78
7.4.8 Triangular input of Frequency 29 Hz 78
7.4.9 Triangular input of Frequency 30 Hz 78
7.4.10 Square input of Frequency 9 Hz 78
7.4.11 Square input of Frequency 10 Hz 78
7.4.12 Square input of Frequency 29 Hz 79
7.4.13 Square input of Frequency 30 Hz 79
7.5.1 Pre-dominant Harmonic versus Input Frequency for Sinusoidal Vibrations 80
7.5.2 Pre-dominant Harmonic versus Input Frequency for Triangular Vibrations 81
7.5.3 Pre-dominant Harmonic versus Input Frequency for Square Vibrations 81
7.5.4 Implementation of a Linear Regression model 82
7.5.5 Result of our Linear Regression model 82
7.6 Loss of Simple RNN model 83
7.7 Loss of GRU model 84
7.8 Loss of LSTM model 85
7.9 Loss of CNN model 86
7.11.1 Loss of DNN model for objective 1(with PCA) 89
7.11.2 Loss of DNN model for objective 2(with PCA) 90
7.11.3 Loss of DNN model for objective 3(with PCA) 91
7.12.1 Amplitudes of the first 6 harmonics of the first 5 output waveforms (Sinusoidal 92
Input)
xi
7.12.2 Amplitudes of the first 6 harmonics of the first 5 output waveforms (Triangular 92
Input)
7.12.3 Amplitudes of the first 6 harmonics of the first 5 output waveforms (Square 93
Input)
7.12.4 Implementation of K-Means Clustering 93
7.12.5 Result of K-Means Clustering 93
7.12.6 Result of K-Means Clustering with Feature Selection 94
7.12.7 Scatter plot of the True Class Labels with Feature Selection 95
7.12.8 Comparison of DSO vs DAQ at 20 Hz 96
7.12.9 Comparison of DSO vs DAQ at 30 Hz 96
xii
List of Tables
xiii
Chapter 1
Introduction
In this day and age, the world is motivated to generate sustainable green and clean energy from
non-conventional energy sources as it decreases the pollution level and also due to the lack of fuel
reserves in the earth. Solar, air, and thermal are complex and costly energy harvesting mechanisms.
A very cost-effective & eco-friendly source of energy is ambient vibrations. Energy harvesting
from ambient vibrations has been in highly researchable work recently. There are various sources of
ambient vibrations like wave vibration, vehicular vibration, structural vibration, machine vibration,
even human walking & these are the self-sufficient sources. Energy can be harvested by utilizing
these vibrations by applying the magnetostrictive effect.
The development of wireless and wearable devices has been growing rapidly in the past few
decades. The advances in the field have made it possible to reduce the power requirement of
common wireless sensor networks to only tens of mW. For long-term operations, batteries require
recharging or even replacement, and degrade over time due to the memory effect. The key
technologies behind the portable and wearable devices, including the central processing unit, the
random-access memory, and the hard disk drive, have experienced rapid improvement. However,
advances in battery research in terms of energy storage density have substantially lagged behind
other electronics. Energy harvesters that can extract electrical power from ambient sources can
supplement and, in some cases, replace batteries.
Potential energy harvesting sources include solar, thermal, electromagnetic, and structural
vibrations. Solar energy can be directly converted to electrical energy via the photoelectric effect.
For a typical cloudless day in summer and for zero zenith angle, the available power density on the
surface of the earth is about 1.0 W/cm2, where up to 46% can be converted to electrical energy
using current solar cells. The strength of solar energy is inconsistent due to its dependence on
weather, time, and season. Temperature difference, or thermal gradient, can generate electrical
energy via the thermoelectric effect. A commercial thermoelectric energy harvester has achieved
0.29 W/cm2 power density from a 200 ◦C temperature difference. But the output power degrades
1
proportionally with respect to the temperature difference. Electromagnetic waves, especially radio
frequency (RF) radiation, have been investigated as possible power sources for wireless sensor
networks. A typical RF energy harvester consists of an antenna, an impedance-matching circuit, and
a voltage rectifier. The output power available from RF energy harvesters is usually in the
microwatt level and the performance of these devices drops off rapidly as distance from the RF
source is increased.
Structural vibrations are one of the most promising consistent energy sources in daily life. The
frequency and amplitude of structural vibrations vary significantly. Vibrations in buildings or
bridges have low frequencies (≤ 0.1 Hz) and low amplitudes (≤ 0.1 g); most vibrations found in
household appliances such as microwave ovens and kitchen blenders, have moderate frequencies
(up to 150 Hz) and amplitudes (≤ 0.5 g). In automobile and rotorcraft, the vibration amplitude is
relatively high while the frequency highly depends on operating conditions. Vibrational energy
harvesting technologies are divided into piezoelectric materials and moving magnet
(electromagnetic induction). However, a few commercial products are being used effectively until
the present. The reasons are their low power output with the order of microwatt, low efficiency, and
poor environmental endurance. Piezoelectric materials are brittle with poor robustness against
bending, tension, and impact. They also suffer from high output impedance (several hundred kΩ to
MΩ) by which small amounts of output energy are transferred to low impedance external loads,
even though the open voltage is high.
More generally, the use of magnetostrictive energy harvesters may facilitate the replacement of
either replaceable batteries or lengthy wires with close proximity energy harvesting. Almost 1
billion per year can be discarded. Wireless sensor systems consume very low power & this enables
the elimination of power cables. The present research is a reflection of all these aspects in a
miniature type & those can be modeled industrially in the future at a large scale due to various
applications of magnetostrictive energy harvesters. The transduction materials proposed for most
energy harvesters under development are either too brittle to endure significant loading or are too
compliant to extract significant energy from a small amplitude vibration. Terfenol-D and Galfenol
each provide a rugged magnetostrictive transduction material that has a good mechanical
impedance, and can, therefore, be used in energy harvesting devices to extract significant power
from vibrations present. Among all the unconventional energy conversion procedures the
2
magnetostrictive energy harvester is the most promising and finds applications in health monitoring
of structures, human, energy-efficient vehicles, Wireless network systems, etc.
1.2 Magnetostriction
As the applied magnetic field increases in intensity, the magnetostrictive strain on the material
increases. Ferromagnetic materials that are isotropic and have few impurities are most effective in
magnetostriction because these properties allow their molecular dipoles to rotate easily.
Magnetostriction was first measured by James Prescott Joule (who was able to magnetize an iron
sample and measure its change in length. The opposite effect, in which applied stress caused the
material to create a magnetic field, was discovered by E. Villari. Gustav Wiedemann then
discovered that a ferromagnetic rod would oscillate torsionally when exposed to a longitudinal and
circular magnetic field. The interior of a ferromagnetic material is divided into magnetic domains.
3
Fig 1.2.2 Division into domains within a ferromagnetic material (a) One domain results in the
largest internal energy (b) Division into two domains decreases the internal energy
(c) Division into four domains produces the smallest internal energy out of these three models
Within a domain, the molecules are aligned so that their dipoles point in the same direction. This
causes a north and south pole or oppositely charged portions on opposite sides of the domain. A
material can have any number of domains as long as the number of domains minimizes the internal
energy of the structure. The boundaries separating these regions (in bulk materials) are called Bloch
walls. Bloch walls are made up of a thin layer of molecules in which their molecular dipoles are
gradually rotated to align with their adjacent domains.
Fig 1.2.3 Gradual tilt of molecular dipoles in a Bloch wall (B) to satisfy adjacent domains (A) and (C)
The orientation of a Bloch wall depends on the directions of the applied magnetic field and the
magnetic anisotropy of the crystal structure. When a magnetic field is applied to a ferromagnetic
material, the magnetic field applies a force on the material’s molecular dipoles which pushes them
to align with the field. As the dipoles rotate, a strain is produced in the material, causing it to
elongate. In addition to magnetic fields, the magnetic anisotropy of a material determines the
preferred direction of molecular dipoles. For example, in a face-centered cubic (FCC) unit cell, the
4
dipoles prefer to align along the edge of the cube. This is called the “easy direction,” and this
direction varies between different unit cell structures.
Fig 1.2.4 Easy and hard directions in the body-centered cubic (BCC), hexagonal close-packed (HCP), and
face-centered cubic (FCC) unit cell structures. The easy direction determines the preferred magnetic field
direction. The hard direction shows the most opposition to the magnetic field
Additionally, magnetic anisotropy can be created by applying stress to the material. If stress is
applied, the direction of stress becomes the preferred magnetic direction, and the Bloch walls will
align with the stress. When a magnetic field is applied in a direction not parallel to the stress, the
stress causes the dipoles to resist rotation to align with the magnetic field. For an applied magnetic
field to reorient the molecular dipoles, it must overcome the material's crystal anisotropy force on
the dipoles. Bloch wall orientation also depends on impurities within the crystal structure, which
inhibit the movement of Bloch walls. Because ferromagnetic materials have few impurities, their
Bloch walls are easily rotated and changed. These properties make ferromagnetic materials ideal for
magnetostriction.
1.3 Joule Effect
The characteristic behavior of magnetostrictive materials is due to a coupling between the elastic
and magnetic states of that material. Below the Curie temperature of the material the crystal
structure of magnetostrictive becomes ferromagnetic and all ferromagnetic materials exhibit
magnetostriction to some degree. Magnetostriction is a property of ferromagnetic materials that
causes them to expand or contract in response to a magnetic field. This effect allows
magnetostrictive materials to convert electromagnetic energy into mechanical energy. As a
magnetic field is applied to the material, its molecular dipoles and magnetic field boundaries rotate
to align along the direction of the applied field. This causes the material to strain and elongate. As
the applied magnetic field intensity increases, the magnetostrictive strain on the material increases.
Ferromagnetic materials that are isotropic and have few impurities are most effective as
magnetostrictive materials because these properties allow their molecular dipoles to rotate easily.
5
Magnetostriction was first discovered by James Prescott Joule (1818-1889) who was able to
magnetize an iron sample and measure its change in length.
6
Fig 1.4 Variation of Magnetic Flux Density with Applied Stress
Magnetic coupling within can be of two forms, namely spin-spin and spin-orbit interactions. In
Ferromagnetic material, the spin coupling which keeps neighboring spins parallel or antiparallel to
one another within the domains can be very strong. But this energy is isotropic since it only
depends on the angle of adjacent spins and not on the direction of the spins relative to the crystal
lattice.
Magnetostriction is due mainly to spin-orbit coupling, which refers to the kind of interactions
between the spin and orbital motion of each electron. This type of coupling is responsible for
crystal anisotropy as well. When a magnetic field is applied to the material and electron spins try to
align with it, the orbit of that electron also tends to be reoriented. But since the orbit is strongly
coupled to the crystal lattice, it resists the attempt to rotate the spin axis.
Thus, the energy required to rotate the spin system of a domain away from the preferred
orientations is the energy required to overcome spin-orbit coupling. The spin-orbit coupling is weak
in most ferromagnetic materials. In the rare earth metals, the spin-orbit coupling is much stronger,
by an order of magnitude. When a magnetic field rotates the spins, the orbital moments rotate and
considerable distortion, and hence magnetostriction results
7
Fig 1.5.1 Highly magnetostrictive material, the spin moment m and orbital moment m are strongly coupled. When the
spin moments to rotate align with external field H, the orbital moment rotates along withproducing considerable
deformation in the lattice field
Fig 1.5.2 Schematic representation of the phenomena of magnetostriction. The surrounding atoms,
schematized as positive charges, are displaced from their initial symmetrical position (open circles) to their
final strained positions (black circles) due to the electrostatic interactions with the aspherical electron
distribution
8
1.6 Magnetostrictive Effects
This section draws a relative comparison between the effects involved in the magnetostriction
phenomenon in a tabular format.
9
1.7 Preference of Galfenol as the Magnetostrictive Material
Research Galfenol and production Galfenol have the same material composition, but they are
manufactured (grown) at different rates, which yields different properties. Both are polycrystalline
materials, but the crystals in research Galfenol are larger and better oriented than those in
production Galfenol due to a slower growing process. Crystal orientation refers to how well each
crystal axis is oriented relative to the molecular lattice orientation that exhibits magnetostriction.
The magnetostrictive material in use here is Galfenol rather than other materials (e.g., Terfenol-D).
It has large inverse magnetostriction, good machinability, and most importantly high ductility.
(i) Piezoelectric materials are brittle with poor robustness against bending, tension and impact.
They also suffer from the high output by which small amounts of output energy are transferred to
low-impedance external loads.
(ii) Terfenol-D and Galfenol each provide a rugged magnetostrictive transduction material that has
a good mechanical impedance and can, therefore, be used in energy harvesting devices to extract
significant power from the vibrations present.
(iii) Here we are using Galfenol as it has low brittleness and high tensile strength compared to
Terfenol-D.
Two magnetostrictive materials are investigated, Terfenol-D and Galfenol. Terfenol- D has been
used successfully in many commercial actuator applications where electrical energy is converted
into a mechanical output. Galfenol is a newer and less well characterized material. Both production
and research-grade Galfenol, the same material, but different production methods, are investigated
in this report.
The most widely used commercially available giant magnetostrictive material is Terfenol-D
(TbxDy1-xFey x = .3 y = 1.92). The material comprises Terbium (Tb), Iron (Fe), and Dysprosium
(Dy), and the ‘nol’ ending stands for ‘Naval Ordinance Laboratory’ where it was developed in the
1960s. In addition to Terfenol- D, the “large” magnetostrictive material, Galfenol is examined in
this thesis. Developed in the late 1990s also by the Navy, Galfenol (Fe1-xGax .13 ≤ x ≤ .31) is
10
composed of Gallium (Ga) and Iron (Fe). Galfenol was developed to create a magnetostrictive
material that didn’t have Terfenol-D’s fewer desirable qualities, predominantly brittleness and low
tensile strength, both of which limit its structural use.
Research Galfenol and production Galfenol have the same material composition, but they are
manufactured (grown) at different rates, which yields different properties. Both are polycrystalline
materials, but the crystals in research Galfenol are larger and better oriented than those in
production Galfenol due to a slower growing process. Crystal orientation refers to how well each
crystal axis is oriented relative to the molecular lattice orientation that exhibits magnetostriction.
The better material properties of Galfenol in research areas are increased significantly
11
1.8 Literature Review
A brief survey of literature dealing with magnetostrictive materials & magnetostrictive energy
harvester is depicted as follow:
A.E. Clark, M.Wun-Fogle & J.B.Restorff et.al [1] investigated magnetostrictive properties of body
centered cubic Fe-Ga-Al alloy. A.E. Clark, M. Wun-Fogle, & J.B. Restorff et.al [2] investigated the
magnetostrictive property of Galfenol alloys under compressive stress. In 2011, T. Ueno et.al [3]
investigated the performance of an energy harvester using an iron gallium alloy using free
(impulsive) vibration. The author proposed a micro energy-harvesting device, using an iron–
gallium alloy (Galfenol), capable of generating electrical energy from ambient vibrations. Galfenol
is a ductile magnetostrictive material with a high piezo magnetic constant, good machinability, and
a large inverse magnetostrictive effect by which magnetization can be varied by mechanical stress.
The device consists of two beams of Galfenol combined with iron yokes, coils, and a bias magnet.
A bending force applied at the tip of the cantilever yields a flux increase by tensile stress in one
beam, and a flux decrease in the other by compression. The time variation of the flux generates a
voltage on the wound coils.
Jin-Hyeong Yoo, B Flatau et.al [4] investigated the bending mode characterization of a Galfenol
based energy harvester. In this study, they prepared a prototype energy harvester that produces an
output voltage proportional to the load-induced bending of the Galfenol element (magnetostrictive
material) caused by a base acceleration of the device. The device consists of a polycrystalline
Galfenol strip bonded to an aluminum cantilever beam, which has an effective length of 35.81 mm.
Deng Z. and Dapino M.J. et.al [5] investigated the Modelling and design of Galfenol unimorph
energy harvesters. Magnetostrictive iron-gallium alloys, known as Galfenol, are a recent class of
smart materials with potential in energy harvesting applications.
Unimorph energy harvesters consisting of a Galfenol beam bonded to a passive substrate are
simple and effective, but advanced models are lacking for these smart devices. This study presents a
finite element model for Galfenol unimorph harvester systems.
12
The free length of the Galfenol unimorph beam is considered as the effective length, the maximum
average power density, peak power density, and open-circuit voltage amplitude achieved in
experiments are 13.97mW/cm3, 35.51 mW/cm3, and 0.66 V, respectively. By only considering the
length of Galfenol surrounded by the pickup coil, the maximum average power density, and peak
power density are 23.66 mW/cm3 and 60.14 mW/cm3, respectively.
In 2016, Deng Z. et.al [6] investigated the influence of electrical impedance and mechanical bi-
stability on Galfenol-based unimorph harvesters. A finite element model for Galfenol unimorph
harvesters, which incorporates magnetic, mechanical, and electrical dynamics, is developed and
validated using impulsive responses. A buckled unimorph beam is experimentally investigated. A
study on iron-gallium (Galfenol) unimorph harvesters is presented which is focused on extending
the power density and the frequency bandwidth of these devices.
In 2017, Dapino M. et.al [7] designed magnetic flux biasing of magnetostrictive sensors. The
performance of magnetostrictive materials, especially those with high initial magnetic permeability
and associated low magnetic reluctance, is sensitive to not just the amount of magnetic bias but also
how the bias is applied. Terfenol-D and Galfenol have been characterized under a constant
magnetic field and constant magneto-motive force, which require active control. This study presents
flux density versus stress major loops of Terfenol-D and Galfenol at various magnetic flux biases.
S. Palumbo, P. Rasilo, M. Zucca [8] provided a wide picture concerning the device behavior
investigating experimentally the output power and voltage as a function of the mechanical and
especially magnetic bias, varying the amplitude and frequency of the driving vibration. It was noted
that by modifying the magnetizer excitation current, the bias is increased from about 5kA/m to
40kA/m and then reduced from 40kA/m to 5kA/m.
13
Chapter 2
Methodology
Some of the different types of energy harvesters include axial-type, rotation-type and U-shaped
Fig 2.1.2 Configuration of axial-type Magnetostrictive energy harvester with pre-stress springs
(a) Cross-section view (b) 3D assembly
14
Fig 2.1.3 Configuration of rotation type Magnetostrictive energy harvester
Fig 2.1.4 Configuration of a U-shaped Magnetostrictive unimorph harvester under base excitation
(a) Schematics and (b) physical assembly
15
Fig 2.1.5 Configuration of a Cantilever type Magnetostrictive Energy harvester
Fig 2.1.6 Schematics of L-shaped Magnetostrictive energy harvester based on Galfenol unimorphs (a)
Assembly, (b) horizontal mode, (c) vertical mode
16
2.2 Comparison of some existing energy harvesters
17
2.3 Tabulation of works on magnetostriction and magnetostrictive materials
18
Table 2.3.2 Comparison of energy harvesters subjected to base excitations
19
2.4 Significance of Energy Harvester Mechanism
Energy harvesting from vibration using magnetostrictive material is a very recent research topic,
though it is observed that several efforts have been made to develop a few magnetostriction based
energy harvesters mainly using Terfenol-D material. However no significant investigation has been
carried out to develop such energy harvesters using Galfenol with high efficiency. Here, for our
project, we have explored the use of Galfenol as the magnetostrictive material as part of the process
to determine the structural health of the experimental setup of a bridge.
Energy harvesting, also referred to as power excitation, can be defined as the conversion of ambient
energies such as RF energy, vibration, temperature difference, light, etc. to usable electrical energy
by employing energy conversion materials or structures and subsequent storage of the energy for
powering electrical devices [?]. The concept of energy harvesting has developed simultaneously
with the advancement of wireless electronics in which a dependable and durable power source is
required. In contrast to electrochemical batteries which have a short lifespan and require periodic
recharging, vibration energy harvesters can supply uninterrupted power by scavenging useful
electrical energy from ambient structural vibration.
Power generation from vibrations also helps in health monitoring systems for bridges and factories,
where battery replacement for devices that monitor structures or pieces of machinery is
troublesome. The technology is useful to harvest electrical energy from industrial machinery
vibrations and also vibrations from waves, water, wind, etc. Structural vibrations are one of daily
life's most promising and consistent energy sources. The frequency and amplitude of structural
vibrations vary significantly.
2.5 Magnetostrictive Energy Harvesting Mechanism
Magnetostrictive harvesters extract electrical energy from vibration sources in two steps. These
steps are:
(1) mechanical energy is transferred to magnetic energy via the magneto-mechanical coupling in
Magnetostrictive materials.
(2) magnetic energy is converted to electrical energy via the electromagnetic coupling on electrical
circuits.
20
The block diagram of the vibrational energy harvesting mechanism through magnetostriction is
depicted:
The electromagnetic coupling is achieved by installing pickup coils around the magnetostrictive
components. The bulk magnetization variation and corresponding flux density variation can
generate usable electrical voltage on the coils via Faraday’s law,
𝜕𝐵 𝜕𝑇
𝑉 = −𝑁𝐴 = −𝑑𝑁𝐴 (2.5.1)
𝜕𝑡 𝜕𝑡
Where A is the coil cross-section area and N is the total number of turns. Now if the external
magnetic field is kept constant with respect to time, then 𝜕𝐻 becomes zero. So, in that case, the flux
𝜕𝑡
density depends only on applied stress. This can be done by external biasing by using a permanent
magnet across the prototype. This helps us to eliminate the nonlinearity of a magnetostrictive
material too.
21
Where, Wout the electrical energy is consumed or stored by the electrical circuit and Win is the total
mechanical energy input. The energy conversion efficiency is calculated based on different excitation
types. For impulsive excitations,
+∞ 𝑒
2
𝑊𝑜𝑢𝑡 = ∫0 𝑅
dt (2.5.3)
Where F0 is the amplitude of the impulsive force and D0 is the initial deflection due to the applied
force.
𝑇
𝑊𝑖𝑛 =∫0 F(t)D(t) dt (2.5.6)
Where D(t) is the corresponding displacement induced by the input force F(t). D(t) is the
corresponding velocity of mechanical vibration. The energy conversion efficiency is equivalent to
the loss factor induced by magneto-mechanical coupling, which is important for magnetostrictive
damper development.
𝑇𝑒2
∫0 𝑅 𝑑𝑡
η= 1 2
(2.5.7)
𝑀𝑣𝑚𝑎𝑥
2
22
where, N: Number of Turns of the coil
𝑅 = 𝜌 𝐿 / 𝜋𝑟2 (2.6.2)
𝑃 = 𝑉2 / 𝑅 (2.6.3)
Now if the dimension is multiplied by k time the above equations are modified to,
𝑉𝑘 = 𝑁(𝐾2𝑆) 2𝜋(𝑓/𝐾) = 𝐾𝑉 (2.6.4)
The above equation represents the scaling effect in this case. Modifying the dimension by a factor
of K results in a change in power output by a factor of the cube of K. This effect can be used to our
advantage and result in the generation of immense power from vibrations. Hence, power generation
here is directly proportional to the volume of the energy harvester.
2.7 Applications of magnetostrictive energy harvesters
Indeed, by employing the inverse magnetostriction or Villari effect, it is possible to scavenge the
vibration energy employing induced magnetization change in the material to generate electric
power. This opens the possibility to have a regenerative source of electrical power, especially useful
in harsh environments. For this reason, this kind of technology can result in great interest in several
application fields, such as health monitoring of civil infrastructure (bridges, buildings), and
automotive & biomedical tasks. Magnetostrictive alloys (Terfenol-D, Galfenol, Metglas) are
actually the most known and employed magneto-elastic materials in this kind of application.
Nevertheless, as previously discussed, they have interesting properties like high energy densities,
high bandwidth, and absence of depolarization phenomena that make them complementary with the
piezoelectrics.
23
Energy harvesting techniques from vibrations have a promising future in civil engineering, where a
strong need for structural monitoring of the health of aging bridges and structures is occurring.
Indeed, for civil infrastructure in general, it is possible to infer structural health by measuring
accelerations & resonant frequencies. Usually, the resonant frequencies are measured in suitable
places along with the structure by using the vibrations induced by wind or traffic. Moreover, the
sensors can detect other local environment parameters as well, namely, temperature, wind speed,
humidity, etc. once the data are measured, among all the possible transmission techniques, the
wireless method is undoubtedly the more effective because, for example, it reduces costs
concerning periodic human intervention and it improves reliability for wired solutions. The use of
sensors together with wireless transmission is known as wireless sensor networks. Of course, in the
same line of reasoning, the source of electrical power for the WSN should be self-contained too.
The easiest choice could be then the use of batteries but, due to their limited life-span of them, an
increment of the sensors' maintenance whole costs should be considered, with the aggravation of
worker’s safety concerns because the sensors could be located in inconvenient places along the
bridge, tunnels, etc. the smart renewable energy method can be used instead. The magnetostrictive
wireless sensor system can be implemented for the health monitoring purposes of tunnels & bridges
to prevent accidents caused by the vibrations of cars.
Fig 2.7.1 Application of Energy harvesters in structural health monitoring and disaster prevention
24
We know that solar & thermal harvesting has been proposed but these solutions can be both costly
& bulky. Nevertheless, bridges and many other civil infrastructures vibrate because of wind action
and or traffic loadings. The possibility to convert this ambient mechanical energy effectively,
otherwise wasted, electrical energy is very attractive in those applications. So, together with
measurement purposes, vibration can be harvested to feed the sensors.
It is worth noting that this type of conversion could be performed utilizing linear electromagnetic
generators too. In those devices, a proof mass oscillates with the structure, making a permanent
magnet move linearly in a coil. This solution is undoubtedly well-assessed and reliable. But,
usually, this type of device has a narrow bandwidth that can be broadened at the cost of a very
sophisticated mechanical construction. Another conversion technique, as already introduced, can
make use of smart materials i.e., the magnetostrictive materials instead. These principles are less
bulky & with higher reliability, because of their simpler mechanical design & construction.
Another field of application for energy harvesting from vibrations using magnetostriction is the
automotive one. In fact, on the one hand, society is looking forward to vehicles that are more and
more efficient. On the other hand, moving vehicles are the site of vibrations of two different kinds.
The first is due to the internal combustion engine operations and so, whenever the engine is on, a
source of vibration is present. These vibrations are usually damped employing engine rubber
supports or even more complicated ways, while they could be used to recover some more energy.
The vibration level is higher in big vehicles like trucks or tractors. The second source of vibrations
can be referred to as external and it is intrinsically related to the vehicle movement and interaction
with the road’s irregularities. Both can be exploited to scavenge electrical power, instead of wasting
the energy in rubber damping or shock-absorbing.
25
Fig 2.7.2 Applications of energy harvesters in the automation and in the vehicle suspension system
Also, in this case, the harvested power can be used to recharge the vehicle battery or for feeding the
monitoring sensor nodes. A typical example is a tyre pressure sensor. In this case, the knowledge of
the tyre health and pressure status allows it to reduce fuel consumption and limit accidents. Another
example of an application on vehicles is mechanical energy harvesting on the suspension system.
Noting that the electrical energy transfers on the load (e.g., the battery) is strictly related to the
mechanical source damping, this kind of solution can be conceived also for obtaining shock
absorption, particularly for workers (e.g., on trucks or tractors). The harvesting from vibrations can
be also considered in flying vehicles. In this case, the vibrations are induced on the wings by the
movement of airflow. A sheet of magnetostrictive material on the wings of a flying vehicle can be
applied to make a harvester in a sort of unimorph cantilever arrangement.
Another potential huge field of application of magnetostrictive energy harvesting is the biomedical
one. In this case, the source of vibrations is the human gait (walking or running) and it could be
used to power devices aimed to monitor human health conditions, out of personal multimedia
readers, smartphones, etc. in this framework of human activities induced vibrations, even the
movement of the heart muscle has been conceived as a possible energy source to feed internal
biomedical devices such as pacemakers.
26
Fig 2.7.3 Applications of energy harvesters in human health monitoring and security purposes
It is possible to extract electrical energy from the mechanical vibrations of wave energy in a more
reliable & cost-effective way by using the magnetostrictive effect. It is observed that the potential
along the 6000 km of coast in India is about 40,000 MW. This energy is however less intensive than
what is available in more northern and southern latitudes. In India, the research and development
activity for exploring wave energy started at the Ocean Engineering Centre, Madras in 1982.
Primary estimates indicate that the annual wave energy potential along the Indian coast is between
5 MW to 15 MW per meter, thus a theoretical potential for a coastline of nearly 6000 KW works
out to 40000-60000 MW approximately. However, realistic & economical potential is likely to be
considerably less.
Various applications of these magnetostrictive energy harvesters are depicted here using various
pictures for more clear understanding. For pushing a button or a TV, the mechanical energy of the
pushing button device will produce electrical energy if a magnetostrictive energy harvester can be
implemented inside that type of pushing button device like a remote control. This will eliminate the
requirement of using dry cells. This contributes to the reduction of using dry cells. Almost 1
billion/year will be discarded.
27
Chapter- 3
Experimental Setup
In the experimental setup, we first downloaded the RT Pro Software in the computer. With
PHOTON+’s RT Pro software, real-time measurements, data recording and post-processing are all
available with only one click. Here, we have selected the waveform of our choice (sine, triangle or
square) and then keeping the magnitude at 1 volt, we have varied the frequencies from 9 Hz up to
30 Hz.
28
Fig 3.2 PHOTON+ Dynamic Signal Analyzer
Now to drive the permanent magnet shaker we use a Linear Power Amplifier LDS LPA 100. This
stand-alone, compact, and efficient unit is designed for driving the permanent magnet shakers, as
well as our low-force shakers, when operated with a separate LDS FPS Field Power Supply. LDS
linear power amplifiers offer low-noise, low-distortion performance. Now we start the software at a
fixed frequency and voltage and then we start the amplifier and keep the voltage between 3.0 Volts
to 3.1 Volts while noting the current in the amplifier.
29
3.4 Magnetic Shaker
Here, we used a permanent magnet, electrodynamic shaker for vibration testing of civil structural
analysis. It can impart maximum forces up to 196 N (44 lbf). LDS V408 shakers feature a usable
frequency range from 5 to 9000 Hz and, when supplied as standard, have a nominal peak sine rating
of 98 N (22 lbf). In addition to armature diameters of 38 mm (1.5 in), these shakers incorporate a
robust-yet-lightweight moving armature that provides adequate support for test loads without
undermining force capability. Two laminated-fiber flexures are bonded to the armature to afford it
with axial support and to enhance lateral and rotational restraints.
A Galfenol beam of cuboidal structure has been considered for the shaker having dimensions as 7
mm width x 2 mm thickness x 42 mm length Ga-Fe alloy exhibits high magnetization (1200kA/m)
and modest magnetostriction (400 ppm) at fewer magnetic fields, compared to this Terfenol-D
offers a higher value of magnetostriction around 1600 ppm but it shows quite a low magnetization
and requires a high magnetic field around 170 kA/m to saturate. Hence, Galfenol being more
favorable is used for this research.
Now this magnetic shaker is placed in different parts of the bridge and the linear power amplifier
drives the shaker. For every combination of the input waveform, frequency and position of the
sensor, the data is recorded on the DSO.
30
After placing the shaker at different parts of the bridge and getting the necessary data required for
machine learning applications, we need to transfer the data to our PC to analyze the result and make
suitable observations. That is why, to transmit the data we use Arduino Uno and nRF24L01
transceiver modules.
• 150 MHz, 100 MHz, 60 MHz, 40 MHz, and 25 MHz Bandwidth Model
• 2-channel Models
• Up to 1 GS/s Sample Rate on All Channels
• 2.5k point Record Length on All Channels
• Advanced Triggers including Pulse Width Trigger and Line-selectable video Trigger
31
3.6 Arduino Uno
The Arduino Uno is a revolutionary microcontroller board that has transformed the landscape of do-
it-yourself (DIY) electronics and embedded systems programming. At the heart of the Arduino Uno
is the versatile ATmega328P microcontroller. This compact yet powerful brain serves as the central
processing unit, executing code and interfacing with a variety of sensors, actuators, and
communication modules. With a total of 20 pins, the Arduino Uno provides a versatile interface for
connecting to the external world. The six analogue pins on the Arduino Uno facilitate the
conversion of real-world analogue signals into digital data, making it an ideal choice for interfacing
with various sensors. It is equipped with TX and RX pins, the Arduino Uno supports serial
communication, crucial for programming the board and establishing communication with other
devices. The USB port simplifies programming and enables seamless communication with a
computer.
32
3.7 NRF24L01 Transceiver Module
The NRF24L01 is a popular 2.4GHz wireless transceiver module often used for communication
between microcontrollers or other embedded systems. It operates in the 2.4 GHz ISM (Industrial,
Scientific, and Medical) band, providing a good balance between range and data rate. Implements a
simple and efficient communication protocol with support for point-to-point and multi-node
communication. It offers selectable data rates, commonly ranging from 250 kbps to 2 Mbps.
Typically, it operates at 3.3V, but many modules are designed to work with 5V microcontrollers
with the help of level shifters or voltage regulators. It provides adjustable transmit power settings,
allowing users to balance range and power consumption based on their application requirements. It
communicates with a microcontroller (such as Arduino) via SPI (Serial Peripheral Interface), which
is a common communication protocol. It supports multiple address pipes, enabling communication
with multiple NRF24L01 modules in the same environment without interference. Implements an
automatic retransmission mechanism to enhance the reliability of communication in noisy
environments. It is designed with power-saving features to minimize energy consumption during
operation.
Fig 3.7 Connecting the NRF24L01 Transceiver module with the Arduino Uno
33
Typical Connection to Arduino:
CSN (Chip Select Not): Connect to another digital pin (e.g., 10).
SCK (Serial Clock): Connect to the SPI clock pin (13 on Arduino Uno).
MOSI (Master Out Slave In): Connect to the SPI MOSI pin (11 on Arduino Uno).
MISO (Master In Slave Out): Connect to the SPI MISO pin (12 on Arduino Uno).
The National Instruments DAQ USB-6210 is a 16-bit multifunction data acquisition (DAQ) device
that offers high-performance data acquisition in a compact and portable form factor. It is designed
to deliver accurate and reliable measurements in a variety of applications, including laboratory
automation, research, and design verification.
The device features analog input, digital input, digital output, and two 32-bit counters, making it
suitable for a wide range of measurement tasks. The onboard amplifier is designed for fast settling
times at high scanning rates, ensuring accurate and reliable measurements.
The USB-6210 also features signal streaming technology, which enables sustained bidirectional
high-speed data streams across USB. This technology allows for fast and efficient data transfer,
making it ideal for applications that require high-speed data acquisition and processing.
It is compatible with a variety of programming languages, including LabVIEW, C++, and Python,
and comes with NI-DAQmx driver and measurement services software, which provides a range of
tools for system setup and measurement.
34
Fig 3.8 USB-6210 DAQ
35
Chapter 4
Data Collection
The frequency of vibration can significantly impact the health of bridges. When cars pass over a
bridge, they create vibrations at a certain frequency, which can also cause the bridge to vibrate. If
the frequency of the car's vibrations matches the bridge's natural frequency, this can cause the
bridge to resonate, leading to more significant vibrations and potentially causing damage to the
bridge's structure. Therefore, it's crucial to monitor and collect data on the frequency of vibration
affecting the health of bridges to ensure their safety and prevent potential damage.
The presence of magnetostrictive sensors on the bridge would result in the collection of the
vibration data of the bridge. The data collected here in turn shall be used to further analyze and
monitor the condition of the civil structure. Hence, the vibrational analysis of the sensor becomes
important. For our given setup to do these the frequency and desired waveform shape is supplied
from the PC to the shaker.
In the beginning, via the RT Photon+ software, variable frequency input ranging from 9-30 Hz is
applied from the PC. The nature of the waveform applied can also be controlled from here, the
options being - Sine/Triangular/Square/Random Waves.
Now the signal generated from the PC is sent to the PHOTON+ dynamic signal analyzer or the
Data Acquisition Card in this case. The output of the DAQ card is connected to the Linear Power
Amplifier.
With the help of the knob present in the Linear Power Amplifier, the amplitude of the voltage is
controlled and sent to the shaker for vibration. It is to be noted that the amplitude should be around
the range of 2.5 - 3 V for optimal data collection else the data would be full of noise and
fluctuations.
36
Finally, as the shaker vibrates our present structure, the open circuit voltage from the
magnetostrictive material is the data we intend to collect.
(a) The Voltage waveform of the magnetostrictive sensor was plotted against time and with the
help of two probes it was viewed on the Digital Storage Oscilloscope.
(b) The Voltage data was sent to the Arduino Uno board via its analog channel and the data was
displayed on the laptop screen. [Real Time Data]
4.1 Output for Sine Wave Input
(1) Input Waveform Frequency 9Hz (2) Input Waveform Frequency 10Hz
Fig 4.1.1 Output Voltage Waveform from DSO(9Hz) Fig 4.1.2 Output Voltage Waveform from DSO(10Hz)
(3) Input Waveform Frequency 15Hz (4) Input Waveform Frequency 20Hz
Fig 4.1.3 Output Voltage Waveform from DSO(15Hz) Fig 4.1.4 Output Voltage Waveform from DSO(20Hz)
37
(5) Input Waveform Frequency 25Hz (6) Input Waveform Frequency 30Hz
Fig 4.1.5 Output Voltage Waveform from DSO(25Hz) Fig 4.1.6 Output Voltage Waveform from DSO(30Hz)
(1) Input Waveform Frequency 9Hz (2) Input Waveform Frequency 10Hz
Fig 4.2.1 Output Voltage Waveform from DSO(9Hz) Fig 4.2.2 Output Voltage Waveform from DSO(10Hz)
38
(3) Input Waveform Frequency 15Hz (4) Input Waveform Frequency 20Hz
Fig 4.2.3 Output Voltage Waveform from DSO(15Hz) Fig 4.2.4 Output Voltage Waveform from DSO(20Hz)
(5) Input Waveform Frequency 25Hz (6) Input Waveform Frequency 30Hz
Fig 4.2.5 Output Voltage Waveform from DSO(25Hz) Fig 4.2.6 Output Voltage Waveform from DSO(30Hz)
(1) Input Waveform Frequency 9Hz (2) Input Waveform Frequency 10Hz
Fig 4.3.1 Output Voltage Waveform from DSO(9Hz) Fig 4.3.2 Output Voltage Waveform from DSO(10Hz)
39
(3) Input Waveform Frequency 15Hz (4) Input Waveform Frequency 20Hz
Fig 4.3.3 Output Voltage Waveform from DSO (15Hz) Fig 4.3.4 Output Voltage Waveform from DSO (20Hz)
(5) Input Waveform Frequency 25Hz (6) Input Waveform Frequency 30Hz
Fig 4.3.5 Output Voltage Waveform from DSO (25Hz) Fig 4.3.6 Output Voltage Waveform from DSO(30Hz)
In this method of data collection, the voltage data from the magnetostrictive sensor is directly put into the
analog channel of the Arduino UNO via a constant DC bias (1 unit of AA Battery). The voltage data required
is collected and displayed in the Serial Monitor. Further description and function of the data transfer process
are described in the next chapter.
40
Fig 4.4.1 Data collected is displayed in the serial monitor
As shown in the above picture, the data collection here shows the magnitude of the data collected
along with the transmission time.
In this section of the report, the concept of computer-based data acquisition (DAQ) and LabVIEW,
a software package developed by National Instruments that is used extensively in laboratory
settings. LabVIEW is an extensive programming platform and includes a multitude of
functionalities ranging from basic algebraic operators to advanced signal-processing components
that can be integrated into rather sophisticated and complex programs for use in the laboratory (and
even industrial settings).
One of the most important features is that LabVIEW provides a graphical programming
environment, where you can design custom virtual instruments. For the design of the graphical user
interface in LabVIEW, the controls, buttons, menus, displays, and other items needed for software
design are placed on the front panel. The purpose of the panel is to interact with the user so that it
can configure the input signal and display and study the waveforms being captured.
41
In our project, the output from the galfenol strip is directly taken into the terminals of the DAQ
card. The DAQ card we are using here is NI USB-6210 from National Instruments. This card has 16
inputs and provides the advantage of having multifunction input/output ports. The port diagram of
the NI-6210 is shown below for the reference of how we interface our output from the bridge to the
DAQ card.
42
From the Pin-out diagram here, the terminals used in our project to take reading are terminals 15
and 16 (AI0 and AI8). The two voltage output wires from the strip are connected to the Analog
Input terminals for the data collection process. The DAQ card in turn is connected to the PC with
the USB cable.
The DAQ card is then detected by the LABVIEW software where the Analog Input channels are
specified for the output display. DAQ Assistant is an add-on where we use the Acquire Signal
feature and select the required channel to set up the configuration. Then, we deploy the block
diagram by selecting the required Voltage range, custom scaling, Acquisition mode, Number of
samples to read, and Rate (Hz).
Then by varying the type of Input Waveform type and frequency in RT Photon Software we directly
obtain the live waveform of the voltage output of the strip for different input waveforms (Sine,
Square, Triangular). The waveform can be paused and a screenshot can be taken for further ML
analysis. Data logging is also done for the above waveforms where we obtain 500 Excel data points
directly from the Labview software.
43
Fig4.5.3 DAQ data recorded Sine input (10 Hz) Fig4.5.4 DAQ data recorded Sine input (30 Hz)
Fig4.5.5 DAQ data recorded Square input (10 Hz) Fig4.5.6 DAQ data recorded Square input (30 Hz)
Fig4.5.7 DAQ data recorded Triangle input (10 Hz) Fig4.5.8 DAQ data recorded Triangle input (30 Hz)
44
Chapter 5
Data Transfer
After successfully collecting the vibrational data from magneto strictive sensors, Arduino Uno and
NRF24L01 modules have been used for transferring the data from the sensor to a PC for further
analysis. One NRF24L01 module with the Arduino serves as the transmitter connected to the
sensor, it reads the data through analog read thereafter converting it to digital using the built-in
Arduino ADC. While the other connected with the PC acts as receiver to collect and store the data.
The Arduino Uno boards and NRF24L01 modules communicate wirelessly to transmit the data.
A SD Card module is also used on receiver side to store the received data in .csv format.
The entire system is programmed using the Arduino IDE, providing a user-friendly software
interface for code development and uploading to the Arduino boards.
5.1.1 Arduino UNO: An essential part of the project is the Arduino Uno, which is used to gather
and handle vibrational data from magnetostrictive sensors.
It is an open-source microcontroller board that was developed by Arduino and is notable for
its adaptability and user-friendliness, making it a great option to use in our project.
45
The ATmega328P microcontroller, which powers the Arduino Uno, is its central
component. It has 14 digital input/output pins, including 6 PWM output pins and 6 analog
inputs. This offers the interface that we need to connect the several actuators, sensors, and
electronic parts that are vital to our project. Accurate timing is ensured for precise data
processing and capture by the 16 MHz quartz crystal.
5V: This pin of the Arduino board is used as a regulated power supply voltage and it is used
to give supply to the board as well as onboard components.
3.3 V: This pin of the board is used to provide a supply of 3.3V which is generated from a
voltage regulator on the board.
GND: This pin of the board is used to ground the Arduino board.
Reset: This pin of the board is used to reset the microcontroller.
Analog Pins: The pins A0 to A5 are used as an analog input and it is in the range 0-5V.
Digital Pins: The pins 0 to 13 are used as a digital input or output for the Arduino board.
SPI Pins: These are the Serial Peripheral Interface pins, used to maintain SPI
communication with the help of the SPI library.
SPI pins include:
i. SS: Pin number 10 is used as a Slave Select.
ii. MOSI: Pin number 11 is used as a Master Out Slave In.
iii. MISO: Pin number 12 is used as a Master In Slave Out.
iv. SCK: Pin number 13 is used as a Serial Clock.
The Arduino Uno's USB port makes programming and data transmission easier by enabling
smooth connectivity for uploading code and transferring data. The board is even more
versatile because it can be powered by an external power supply or by a USB connection.
46
Fig 5.1.2 Arduino IDE
47
Fig 5.1.3 NRF24L01 Pinout
48
5.1.3 SD Card Module: The SD (Secure Digital) card module is a crucial component in our
project, facilitating the storage of collected data in a compact and portable format. This
module enables the interfacing of Arduino with SD cards, offering a convenient means to
log and retrieve information without the need for a computer connection.
VCC: It provides power to the module and should be connected to the Arduino’s 5V pin.
GND: It is the ground pin.
MISO: It is the SPI output from microSD card module.
MOSI: It is the SPI input to the microSD card module.
SCK: It is the serial clock pin which accepts the clock pulses from the master (Arduino in
our case) to synchronize data transmission.
CS: It is the chip select pin that is used to select one of slave devices on the SPI bus.
49
5.2 Why Arduino and NRF24L01 over DSO?
In our project's evolution, we transitioned from utilizing a Digital Storage Oscilloscope (DSO) for
waveform recording and data collection to adopting the Arduino and NRF24L01 setup.
The decision to replace DSO with the above said setup was motivated by the inherent limitations of
the DSO, particularly its sluggish data acquisition speed. The DSO's slow recording capabilities
was major drawback as real-time data collection efficiency was very low.
The Arduino and NRF24L01 setup offered a viable alternative, providing a faster and more
streamlined approach to capture and transfer vibrational data. By using the wireless communication
capabilities of the NRF24L01 modules, we eliminated the need for physical connections between
transmitter and receiver and the time-consuming process of transferring data to a pen drive by the
DSO. The Arduino's ability to rapidly process and transmit data with the NRF24L01 modules
significantly improved the overall speed and efficiency of our data collection process.
This transition not only addressed the performance limitations of the DSO but also enhanced the
project's overall functionality, allowing for more dynamic and real-time data acquisition. The
subsequent comparison of the plotted data from both systems using Origin Pro Software confirmed
the consistency and accuracy of the Arduino and NRF24L01 setup.
50
Fig 5.3 Arduino connection with NRF24L01
SCK, MISO, MOSI pins of Arduino are connected with the corresponding pins of NRF24L01
module. Rest two pins CE and CSN are connected with pin 7 and pin 8 of Arduino respectively,
different pins of Arduino board can also be used for CE and CSN that can be configured using the
code.
After establishing the connections, the codes have been written on Arduino IDE using RF24 library
(code library for NRF24L01 modules, offers various configurations and compatible with different
architectures).
51
Necessary libraries (SPI and RF24) are included and pins for the Chip Enable (CE) and Chip Select
Not (CSN) are defined. The system is designed with a transmitter (TX) and receiver (RX) role,
controlled by the boolean variable.
The transmitter module reads analog data from analog Pin A5 representing sensor input. This
sensor reading is then converted to a voltage value and assigned to the payload variable.
In case the transmission fails, an appropriate message is printed to the serial monitor. The delay of
25 milliseconds between transmissions ensures a controlled and consistent data transfer rate of 40
samples/sec.
While on the receiver side, the Arduino Uno continuously checks for incoming data using the
radio.available (&pipe) function. When data is available, the pipe number and payload size are
retrieved. The payload is then read into the payload variable using radio.read (&payload, bytes).
Communication protocol ensures that data is consistently exchanged between the two nodes and the
program structure allows for seamless integration into various applications requiring wireless data
transfer.
52
5.5 Collected Data and Plots
Using the above hardware setup and codes, data has been collected for various different frequencies
(5 Hz,10Hz,20Hz etc…)
The collected data has been plotted using Origin Pro Software for comparative analysis with the
previous datasets obtained using DSO (Digital Storage Oscilloscope) and it was found to be
consistent.
Fig 5.5.2 Plot for 5Hz dataset collected using Arduino & NRF24L01
53
Fig 5.5.3 Plot for 5Hz, 10Hz & 20Hz datasets collected using Arduino & NRF24L01
5.6 Challenge in connecting two devices (NRF24L01 & SD Card Module) with an Arduino
To overcome this challenge, our initial strategy involved using a breadboard to establish separate
connections for each device and employing distinct slave select (SS) pins for the NRF24L01 and
SD card module. However, this approach revealed an unexpected issue related to voltage levels.
The SD card module breakout board presented a mismatch in voltage levels as it works on 5V but
the SD card may get damage over 3.6 V so it uses an inbuilt shifter to bring down the voltage to
3.3V, complicating the integration process. This discrepancy resulted in an ineffective connection,
preventing successful communication between the Arduino board, NRF24L01 & SD card module.
54
Fig 5.6 Connecting NRF24L01 and Sd Card Module to same Arduino
This can be solved by using a SD card breakout board with no active electronics and directly
working on 3.3V. Hence, it will not interfere in the communication between Arduino and
NRF24L01 and we can receive and save data to SD card at the same time.
Microsoft Excel Data Streamer is used to receive and display the data transmitted by the Arduino.
The Data Streamer add-in is enabled in Excel, allowing real-time data streaming from external
sources. Data Streamer is a bidirectional data transfer utility that streams data between Excel and a
microcontroller via the serial port. It allows to stream low latency data directly in to worksheet from
connected devices via COM port.
The receiver application on the PC reads the incoming data packets from the NRF24L01 module and
communicates with Excel via the COM port. The data is sent to Excel using a serial communication
protocol (e.g., UART) and is displayed in real-time on a designated worksheet. Data intervals,
number of rows etc. can be modified via settings.
55
Fig 5.7.1 Arduino Connected to Excel Data Streamer
In Excel, the received data is displayed in tabular format, with each row corresponding to a data packet
received from the Arduino. The data can be visualized, analyzed, and stored in Excel for further processing.
The data stored in excel can be used with machine learning model developed further in the project.
Fig 5.7.2 Data Recorded via Excel Data Streamer (10 Hz)
56
Chapter 6
Machine learning can be broadly classified into 3 categories depending upon how the algorithm
learns from the training data:
1. Supervised Learning: Supervised learning makes use of labelled datasets. Training a
machine learning model to predict whether a picture is that of a dog or a cat, using a dataset
containing pictures of cats and dogs, along with the corresponding labels (that is, 1 if the
picture is that of a dog and 0, if the picture is that of a cat) is an example of supervised
learning.
57
Applications of supervised learning:
• Classification: When the output of a machine learning model is discrete, then the
problem being solved by the model, is said to be a classification problem. For
example, a model can predict whether a picture is of a dog or not. Here, there are
only two outcomes: true or false (or 1 or 0). Since, the output is not continuous, the
problem is a classification problem. If the number of possible outcomes is 2, then it
is known as Binary Classification.
• Regression: When the output of a machine learning is continuous, then the problem
being solved by the model, is said to be a regression problem. For example, a model
canpredict the sales of a company by learning from its previous sales’ record. Such a
problem, is said to be a regression problem as the output of the model is not limited
to discrete quantities.
2. Unsupervised Learning: Unsupervised learning makes use of unlabeled datasets. Training
a machine learning model to predict whether a picture is that of a dog or a cat, using a
dataset containing pictures of cats and dogs, but with no labels, is an example of
unsupervised learning. The model simply categorizes the dataset into two halves (one
containing cats and the other containing dogs) and gives a unique name to that category.
58
Applications of Unsupervised Learning:
59
𝒏
𝒀 = 𝑩 + ∑ 𝑿𝒌𝑾𝒌
𝒌=𝟏
Where, Wk are the weights assigned to each independent variable and B is the bias.
3. K-Nearest Neighbors: This algorithm can be used for both classifications, as well as
60
regression. Suppose, the given dataset contains N variables, along with their corresponding
labels or values, Y. The model first fits all the data points (N-dimensional vectors) in an N-
dimensional space. When a new data point is entered (to get the prediction), the model
places that point in the N-dimensional space and finds out its K-Nearest Neighbors.
Depending upon the label or values of those data-points, classification or regression is done.
The value of K is settable.
4. Decision Trees: A decision tree is a popular and intuitive machine learning algorithm used
for both classification and regression tasks. It models decisions and their possible
consequences in a tree-like structure, where each node represents a decision or a test on a
particular attribute, each branch represents an outcome of the decision, and each leaf node
represents a class label (for classification) or a predicted value (for regression). Decision
trees are the building blocks of Random Forest and Gradient Boosted Trees. However, by
themselves decision trees are prone to overfitting.
61
5. Random Forest: Random Forests consist of multiple decision trees, each of which is
trained on a random subset of the feature space. Depending upon the outcomes of the
individual decision trees, the overall outcome is generated by the random forest model. For
classification, a majority voting is done. For regression, a weighted average is done. As
such, random forest models are less prone to overfitting.
6. Support Vector Machine (SVM): Its main objective is to find a hyperplane that separates
the classes based on features. The hyperplane is a decision boundary to separate classes in
such a way that there is the largest margin and maximum distance between this hyperplane
and instances. It also aims to reduce the error between the predicted value and the target
value.
7. Deep Neural Networks: A Deep Neural Network comprises multiple layers of neurons,
also known as perceptrons. Within each layer, these perceptrons receive inputs from either
all or a subset of the perceptrons in the preceding layer. These inputs are then weighted and
summed with a certain bias. Subsequently, an activation function is applied, introducing
non-linearity into the model based on the inherent patterns in the data. Some of the most
62
common activation functions are tanh and ReLU. The model is then compiled using an
optimizer, a loss function, and a metric.
During training, the objective is to minimize the value of the loss function by adjusting the
weights and biases of each perceptron. Various regularization techniques, such as L1 and L2
regularization, can be employed to optimize the training process.
Typically, the model is trained over several epochs, with each epoch representing one
complete iteration through the training set. Random batches of data are selected in each
epoch to train the model.
To mitigate the risk of overfitting in Deep Neural Networks, techniques such as early
stopping callbacks and the inclusion of dropout layers can be utilized. This process is
commonly referred to as hyperparameter tuning.
9. Gated Recurrent Unit: Gated Recurrent Unit is a simpler alternative to Long Short-Term
Memory and is an improvement upon Simple Recurrent Neural Networks. Using gating
mechanisms, the model selectively updates the hidden state of the model. Thus, these gating
mechanisms control the flow of information in and out of the model. GRU has two gating
mechanisms, namely, the reset gate and the update gate.
The reset gate determines how much of the previous information can be discarded and the
update gate determines how much of the current information should be used to update the
hidden state of the model. The output of the model depends upon the updated hidden state.
Gated Recurrent units have proved to be effective in tasks such as natural language processing
and speech recognition. Even though its less known compared to LSTM, it is just as effective,
arguably much more than Simple Recurrent Neural Networks.
64
10. Long Short-Term Memory: Long Short-Term Memory is another type of Recurrent Neural
Network. LSTM’s strength lies in its ability to capture long term dependencies in the
sequential data. This makes LSTM one of the most efficient models, when it comes to tasks
involving natural language processing and time series forecasting. This Recurrent Neural
Network was developed by Hochreiter and Schidhuber.
Long Short-Term memory consists of a memory cell which holds information about the
sequence for extended periods of time. Unlike Gated Recurrent Units, which consists of two
gates, LSTM consists of 3 gates, namely, the input gate, the output gate and the forget gate.
The memory cell of LSTM is controlled by these three gates.
The input gate controls what information is added to the memory cell. The forget gate
controls what information can be discarded from the memory cell. The output gate controls
what information is given as output from the cell.
11. Convolutional Neural Network: Convolutional Neural Networks are a type of Neural
Network, extensively used in tasks such as image processing and computer vision. CNNs
work on grid-like structures such as images. It is important to note that images are nothing
but sequences of pixels, arranged in a 2D array. For example, an image of size 28×28
consists of 28 rows of 28 pixels, where each pixel is a value ranging from 0 to 255.
A typical CNN usually consists of an input layer, convolutional layers, pooling layers and
finally an output layer. The convolutional layer consists of a filter, or kernel, of a particular
size. The filter slides over the input image data and computes the dot product of the kernel
weights and the corresponding input image patch. The output of the filter also depends on the
65
activation function. Thereafter, to decrease the size of the output of the convolutional layer,
pooling layers are used. Some of the most common pooling techniques are average pooling
and max pooling.
Once the image has gone through all the convolutional and pooling layers, it can be flattened
and passed through a Deep Neural Network. Thus, the primary objective of CNN is to set the
filter weights in such a way that the loss function is minimized.
The following steps must be followed to train any machine learning model:
1. Data Collection: The key to any accurate machine learning model is the availability of
appropriate data. Steps should be taken to ensure that the data is clean, that is, it is free from
66
noise and null values.
2. Data Preprocessing: If the collected data contains noise, we must remove the noise before
proceeding any further. Noise removal can be done using techniques such as moving
average. Null values, if any, should be removed or replaced by zeroes, as and when
required. Categorical values must be encoded using One-Hot Encoding or by using numeric
labels. Numeric values must be standardized so that no one feature can dominate the
training process.
3. Feature Engineering: Create new features based on the domain knowledge that will enhance
the model’s performance.
4. Model Selection: Based on the nature of our tasks and the nature of our data, we must select
the appropriate machine learning algorithm. For example, for unsupervised learning, we can
use K-Means Clustering, whereas for supervised learning, we can use K-Nearest Neighbors
for classification and Neural Networks for regression.
5. Splitting the Data: Depending upon our model, the data must be split into the training
dataset and the test dataset. In case of a neural network, an additional dataset, called the
validation dataset may also be required. Usually, data is randomly split in the ratio 70:30 if
we require two datasets, and in the ratio 70:15:15 if we require 3 datasets.
6. Model Training: Once we have split the dataset, we train our model using the training
dataset. Steps should be taken to prevent the overfitting of the curve. Overfitting leads to the
loss of generalization and hence, must be avoided. In case of neural networks, this can be
done using an additional dataset called the validation dataset. By employing call-backs such
as Early Stopping, the best weights can be restored.
7. Hyperparameter Tuning: The hyperparameters of a model can be fine-tuned to improve the
performance of the model. Examples of hyperparameters include, optimizers, activation
functions, dropout layers (in neural networks) and max depth (in decision trees and random
forests).
8. Evaluate the Model: Using our test dataset, we can evaluate our model. Common metrics
include accuracy and binary cross entropy for classification and mean absolute error and
root mean squared error for regression.
9. Iterate and Improve: We must repeatedly make improvements by analyzing the
model’sperformance, even if it means going through steps 1-8 again and again.
67
6.5 Terms used in Machine Learning
• Training: The process by which a machine learning model learns the patterns in the data.
The data may or may not be labelled. More the data, the more accurately the machine
learning model will be able to learn the patterns in the data.
• Weights: They are the numerical values related to the connections of perceptrons in neural
networks or features in other algorithms or models. At first, weights are just some random
numbers. But as the model starts to train, they are adjusted in such a way that the trained
model gives high accuracy and precision. In short, it controls how much the target values
are affected by the input features.
• Hyperparameters: These are the parameters or settings which are fixed before and during
training. These include the no. of hidden layers, regularization strength, etc.
• Model parameters: They are a set of weights captured by the trained model from the
training data, to give an optimized prediction.
• Model architecture: This is the configuration of the algorithm used to train the model on
the data. It consists of the number of nodes, layers, neurons, etc. which is present inside the
machine learning model.
• Loss function: It measures the degree of difference between the predicted value and the
real target value. Examples of loss function include mean absolute error (MAE), root mean
squared error (RMSE) and mean absolute percentage error (MAPE).
• Validation: After the model is trained on the data using the algorithms, the model is
evaluated by using validation data on the trained model. Validation data are those 30/20
percent of the total data taken from the original dataset which is used to test how well the
trained model performs. The trained model is evaluated using some parameters like
accuracy, precision, confusion matrix, overfitting, under fitting, etc.
• Overfitting: This happens when the algorithms work properly on the training data but
makes inaccurate predictions on new unseen data. This happens because the algorithm
might capture irrelevant data like noise.
• Underfitting: If the algorithm or model becomes too simple to learn the patterns in the
input data, then underfitting occurs. In such a case, the model fails to make accurate
predictions.
68
• Cross Validation: It splits the data into multiple subsets and evaluates how the model
responds to a change in input data.
• Accuracy: It expresses the ratio (True Positives + True Negatives)/ (Total Number of
Predictions) as a percentage. It is a measure of how reliable the model is after training it on
the given data.
• Precision: It measures the percentage of true positive instances out of the total true and
false positive instances.
• Recall: It measures the amount of true positive instances present in the total number of
both true positive and true negative instances.
• Mean Squared Error: It measures the difference between the predicted value and actual
value, squares it, sums it up and takes an average.
• Confusion Matrix: It is a table that consists of rows and columns when one of them
represents predicted labels, and the other represents the actual label. It shows true positive,
true negative, false positive, and false negative to evaluate the model performances.
The next chapter deals with how we have selected and implemented certain machine learning
algorithms to label the data into two categories, namely, healthy and unhealthy.
69
Chapter 7
7.1 Introduction
The primary objective is to monitor the structural health of civil structures such as bridges and
buildings. Instead of utilizing complicated simulations, the entire process is conducted using a
hardware setup. This hardware setup is a simplified miniature replica of a bridge, constructed in
segments and secured with screws. To replicate the unhealthy conditions of a bridge, some of the
screws are deliberately loosened. This action alone generates meaningful patterns in the data, which
are then utilized to classify the structure as either healthy or unhealthy.
The entire problem statement can be divided into three main objectives:
1. Classify the structure as either healthy or unhealthy based on the waveform data (Binary
Classification.)
2. Identify the predominant waveform type present in the input vibrations (Categorical
Classification.)
3. Predict the frequency of the input vibrations (Regression.)
The first objective has been achieved by all the previously mentioned models. The second and third
objectives have been accomplished using the Random Forest method. These latter objectives are
crucial as they enable us to analyze the types of loads to which civil structures are exposed and
determine which type of load is most detrimental to their structural health.
The visualizations of waveform data reveal a significant presence of noise within the system, a
common occurrence in electrical and electronic systems. The primary concern lies in devising a
method capable of discerning genuine data from the noisy signals. Should the waveform data be
predominantly composed of noise, the model may struggle to discern meaningful patterns or, worse
yet, might inadvertently classify the noise itself, rendering the model unreliable. As such, Simple
Moving Average and Digital Butterworth Filter were adopted as data cleaning methods.
70
Simple Moving Average (SMA) Algorithm stands as one of the simplest methods for eliminating
unwanted noise from time-series data. The moving average effectively mitigates abrupt spikes within
the data, ensuring a smoother waveform. The approach involves selecting a window of a specific
length, carefully chosen to filter out noise while preserving pertinent information. Once this optimal
window length, denoted as "L," is determined, the algorithm commences by examining the initial
window, extending from the first observation to the Lth observation. Subsequently, the average of all
values within this window is computed, replacing the Lth observation with this calculated average.
The window is then iteratively updated, eliminating the first observation while incorporating the next
observation at (L+1), thus perpetuating the process.
In Python, the moving average algorithm can be implemented in the following way:
Some of the results of the moving average algorithm on the data obtained from the digital storage
oscilloscope from a sinusoidal wave input to the shaker is as follows:
Fig 7.2.2 Sinusoidal Input of Frequency 11Hz Fig 7.2.3 Sinusoidal Input of Frequency 12 Hz
71
Fig 7.2.4 Sinusoidal Input of Frequency 25 Hz Fig 7.2.5 Sinusoidal Input of Frequency 30 Hz
Fig 7.2.6 Sinusoidal Input of Frequency 28 Hz Fig 7.2.7 Sinusoidal Input of Frequency 26 Hz
Some of the results of the moving average algorithm on the data obtained from the digital storage
oscilloscope from a triangular wave input to the shaker is as follows:
Fig 7.2.8 Triangular Input of Frequency 16 Hz Fig 7.2.9 Triangular Input of Frequency 17 Hz
72
Fig 7.2.10 Triangular Input of Frequency 19 Hz Fig 7.2.11 Triangular Input of Frequency 25 Hz
Some of the results of the moving average algorithm on the data obtained from the digital storage
oscilloscope from a square wave input to the shaker is as follows:
Fig 7.2.12 Square Input of Frequency 16 Hz Fig 7.2.13 Square Input of Frequency 15 Hz
Fig 7.2.14 Square Input of Frequency 23 Hz Fig 7.2.15 Square Input of Frequency 25 Hz
73
Digital Butterworth Filter is a signal processing technique which makes sure that its frequency
response is as flat as possible in the passband. Not only were the noise in the experimental setup, of
very high frequency but also, much higher than the frequency of the input vibrations. As such, a low-
pass Butterworth filter was utilized to remove the high frequency noise. The cut-off frequency of the
filter was set to three times the frequency of the input vibrations. The results obtained from this filter
were much smoother than those obtained from the SMA algorithm, and provided insights on which
recording instrument was performing better at capturing the waveform data. The SciPy library of
Python provides an in-built low-pass butter-worth filter which can readily be used in our analysis.
Though less in number, these two methods proved to be sufficient in analyzing the underlying
patterns in the data. However, to efficiently train the machine learning models, the amount of data
needs to be increased and this is done by means of Data Augmentation.
Fig 7.2.16 Sine Input of Frequency 15 Hz Fig 7.2.17 Sine Input of Frequency 20 Hz
Fig 7.2.18 Square Input of Frequency 15 Hz Fig 7.2.19 Square Input of Frequency 20 Hz
74
Fig 7.2.20 Triangle Input of Frequency 15 Hz Fig 7.2.21 Triangle Input of Frequency 20 Hz
75
valid approach to data augmentation. Note that in this technique, no modification is made to
the original data.
2. Simple Moving Average (SMA) Algorithm: This is the same method that was used to clean
the data. In this instance, however, the window size was kept constant, at two. Thus, this
technique modifies the existing data. Since the sampling rate is very high, (that is, 6250 Hz)
using a simple moving average on window of size two, retains all the important underlying
patterns in the data, whilst ensuring that no two instances are in the resulting dataset are
alike. This method, however, cannot be used indefinitely. With each use, the information loss
will increase, thereby resulting in model inaccuracy. Therefore, this method can, at most,
increase the size of the dataset by a factor of two.
Now that adequate quantity of data was obtained, various feature extraction and
dimensionality reduction techniques were applied for improved model performance.
Feature Extraction is a fundamental process in machine learning where the most important and
relevant features are obtained from the raw data. More often than not machine learning models
work better with the features extracted from the raw data rather than the raw data itself.
The raw data underwent augmentation through data segmentation. Subsequently, waveform images
of these segments were generated. These images were then utilized as training data for the image
classification model.
The Fast Fourier Transform (FFT) is an efficient algorithm for computing the Discrete Fourier
Transform (DFT) and its inverse. The Discrete Fourier Transform is a mathematical technique
used to analyze the frequency content of discrete signals. In simpler terms, it transforms a signal
from the time domain to the frequency domain, revealing the different frequency components
present in the signal. Thus, in our project, FFT is used as a feature engineering technique.
The FFT is an algorithmic implementation of the DFT that significantly reduces the
computation time. The standard DFT has a time complexity of (𝑛2), while the FFT reduces it to
𝑂(𝑛𝑙𝑜𝑔𝑛),making it much more efficient, especially for large datasets.
The FFT is widely used in various fields, including signal processing, audio analysis, image
processing, telecommunications, and many other areas where the frequency content of a signal
needs to be analyzed or modified. It is a fundamental tool in understanding the frequency
76
domain characteristics of a signal and is a key component in many digital signal processing
applications.
In Python, libraries such as NumPy and SciPy provide FFT algorithms that can be
readilyimplemented.
Fig 7.4.2 Sinusoidal Input of Frequency 9 Hz Fig 7.4.3 Sinusoidal Input of Frequency 10 Hz
Fig 7.4.4 Sinusoidal Input of Frequency 14 Hz Fig 7.4.5 Sinusoidal Input of Frequency 16 Hz
77
Fig 7.4.6 Triangular Input of Frequency 9 Hz Fig 7.4.7 Triangular Input of Frequency 10 Hz
Fig 7.4.8 Triangular Input of Frequency 29 Hz Fig 7.4.9 Triangular Input of Frequency 30 Hz
Fig 7.4.10 Square Input of Frequency 9 Hz Fig 7.4.11 Square Input of Frequency 10 Hz
78
Fig 7.4.12 Square Input of Frequency 29 Hz Fig 7.4.13 Square Input of Frequency 30 Hz
Furthermore, Principal Component Analysis (PCA) was incorporated to further reduce the
dimensionality of the dataset. By using principal component analysis, linear combinations of the
attributes can be obtained. The first principal component indicates the direction in which the most
variance takes place. Likewise, the second principal component indicates the direction in which the
most variance takes place, after the first principal component has been removed. In this way, most
of the information can be captured by just a few components, thereby reducing the size of the
dataset. For 31 attributes, there were 31 principal components but only the first 15 principal
components were selected for the purpose of model training.
As a substitute for principal component analysis, various feature selection algorithms were
developed and tested. They are as follow:
1. Sequential Forward Selection: In the initial step, the selection of the most crucial feature
takes precedence. Subsequently, the selection process progresses to identifying the most
significant pair of features, which includes the feature obtained in the first step. This
iterative process continues until the desired number of attributes is achieved.
2. Sequential Backward Removal: In each step, the removal of the least crucial feature takes
precedence. This iterative process continues until the desired number of attributes is
achieved.
3. Sequential Floating Forward Selection: In each step, the selection of the most important
feature takes precedence. Thereafter, the least important features in the selected subset are
removed as long the performance of the model increases. This iterative process continues
until the desired number of attributes is achieved.
79
4. Sequential Floating Backward Removal: In each step, the removal of the least important
feature takes precedence. Thereafter, the most important features from the removed subset
are selected as long as the performance of the model increases. This iterative process
continues until the desired number of attributes is achieved.
Once all the appropriate data collection, data cleaning, data augmenting and feature extracting
methods have been incorporated, the model selection and training methods need to be considered
and evaluated.
Using linear regression, we can predict which harmonic will have the highest magnitude for an
input signal having any waveform and any frequency. From our FFT analysis, we can easily
calculate which harmonic has the highest magnitude. Plotting a graph of the pre-dominant harmonic
versus the input frequency shows a very interesting observation.
Fig 7.5.1 Pre-dominant Harmonic versus Input Frequency for Sinusoidal Vibrations
80
Fig 7.5.2 Pre-dominant Harmonic versus Input Frequency for Triangular Vibrations
Fig 7.5.3 Pre-dominant Harmonic versus Input Frequency for Square Vibrations
Clearly, from the above plots, the pre-dominant harmonic changes in steps. For frequencies 9-10
Hz, the pre-dominant harmonic is 2, for frequencies 11-14 Hz, the pre-dominant harmonic is 3 and
so on. The reasons behind this result can be an area of research in the following semester. This
exploratory data analysis showed us the relationship with the two variables at concern. Moreover, it
can be of great significance in feature engineering for our final model, that is, the K-Means
Clustering model. Since, the pre-dominant harmonic increases (even if it is in the form of steps)
with the increase in input frequency, a linear regression model can be implemented to predict the
pre-dominant harmonic for any waveform and any frequency.
81
To implement the model, the Scikit-Learn library of Python is used. This library has many in-built
models, which we can readily train with our data. Examples of such models include linear
regression, logistic regression, decision tree and random forest. First, we must import the library
before declaring our model. Once declared, we can train the model using the data which contains
the one-to-one mapping of the pre-dominant harmonic to the input frequency. The metric used for
evaluating the model is mean absolute error (MAE).
Since the plots in Fig 7.29, Fig 7.30 and Fig 7.31 are practically the same, only one of the results of
the models has been shown, even though a separate model was trained and evaluated for each type
of waveform.
The mean absolute error can be calculated by importing the mean_absolute_error function from
the sklearn.metrics library. The mean absolute error of our model is 0.2507571479903496, which is
acceptable.
82
7.6 Simple Recurrent Neural Network (RNN)
The performance metrics of the model on the test data (for objective 1) are as follows:
However, this model was underfitting when trained with the raw data obtained from the Data
Acquisition Card and hence, it was not used to achieve the remaining two objectives.
83
7.7 Gated Recurrent Unit (GRU)
The performance metrics of the model on the test data (for objective 1) are as follows:
Like Simple RNN, this model was underfitting when trained with the raw data obtained from the Data
Acquisition Card and hence, it was not used to achieve the remaining two objectives.
84
7.8 Long Short-Term Memory
The performance metrics of the model on the test data (for objective 1) are as follows:
Like Simple RNN, this model was underfitting when trained with the raw data obtained from the
Data Acquisition Card and hence, it was not used to achieve the remaining two objectives.
85
7.9 Convolutional Neural Network
The performance metrics of the model on the test data (for objective 1) are as follows:
However, this model too was underfitting when trained with the raw data obtained from the Data
Acquisition Card and hence, it was not used to achieve the remaining two objectives.
86
7.10 Random Forest Model
The Recurrent Neural Network Models (Simple RNN, GRU and LSTM) and Convolutional Neural
Network models performed satisfactorily for the data obtained from the Digital Storage
Oscilloscope, but failed to achieve the same level of performance for the data obtained from the
Data Acquisition Card. Thus, these models are not generalizable to the measuring instruments. This
is not desirable, as the model should be able perform satisfactorily, irrespective of the measuring
instrument being used. As such, the focus was shifted to other models. The problem statement was
changed from working with sequential data to working with non-sequential data.
The healthy and unhealthy data were labelled as 1 and 0, respectively.
For the second objective, classes were designated as 0, 1, and 2, representing sinusoidal, square, and
triangular waveforms, respectively. This labelling scheme was applied to both the healthy and
unhealthy datasets.
In the case of the third objective, the target variable was defined as the frequency of the input
vibrations, and this was carried out for both healthy and unhealthy datasets as well.
Python's Scikit-Learn library offers built-in Random Forest models for classification (binary and
categorical) and regression tasks, accompanied by a wide array of evaluation functions.
The performance metrics of the model on the test data (for objective 1) are as follows:
87
The performance metrics of the model on the test data (for objective 2) are as follows:
The performance metrics of the model on the test data (for objective 3) are as follows:
Mean Absolute
0.0485 0.0788 0.0433
Percentage Error
Thus, Random Forest Models were able to perform satisfactorily, irrespective of the measuring
instrument. Moreover, the small size of the dataset, made Random Forest models even more
suitable for all the above tasks. With this model, tasks such as inspection and health monitoring can
be performed with due diligence.
88
vibrations, and this was carried out for both healthy and unhealthy datasets as well.
Using Python's TensorFlow library, Deep Neural Network models were developed for classification
(binary and categorical) and regression tasks. Evaluation functions were used from the Scikit-Learn
library.
The performance metrics of the model on the test data (for objective 1) are as follows:
The performance metrics, though acceptable, in its own right, were not comparable to those of the
random forest model
89
Fig 7.11.2 Loss of DNN model for Objective 2 (with PCA)
The performance metrics of the model on the test data (for objective 2) are as follows:
Thus, a significant drop in performance of the DNN model was observed compared to the Random
Forest model.
90
Fig 7.11.3 Loss of DNN model for Objective 3 (with PCA)
The performance metrics of the model on the test data (for objective 3) are as follows:
Mean Absolute
5.65 5.197 9.96
Percentage Error
Clearly, the Deep Neural Network models fails to perform at par with the Random Forest models.
This can be owed to the fact that the size of the dataset is limited, even after data augmentation.
Deep Neural Networks generally require more data to discern underlying patterns.
91
7.12 K-Means Clustering
By means of the FFT analysis, we have calculated the amplitudes all the harmonics present in the
output waveform. The data that we receive from the digital storage oscilloscope contains data which
is of sequential nature. Of course, we can use a Recurrent Neural Network to classify sequential or
time-series data. However, the problem can be simplified by the representing the output waveform
as an N-dimensional vector, where N is the highest harmonic component, whose amplitude we have
computed through the FFT analysis. These vectors can now be segmented into two categories,
namely, the healthy category and the unhealthy category, by using K-Means Clustering. This shifts
our methodology from supervised to unsupervised learning.
From the FFT analysis, we have seen that the amplitude is almost negligible for harmonics beyond
the 30th harmonic. By using our linear regression model, we have seen that the 30th harmonic will
be the highest predominant harmonic for input frequencies above 125 Hz. Such high frequencies
are usually not encountered in civil structures and thus, it should suffice to represent a waveform by
just the first 30 harmonics.
Fig 7.12.1 Amplitudes of the first 6 harmonics of the first 5 output waveforms (Sinusoidal Input)
Fig 7.12.2 Amplitudes of the first 6 harmonics of the first 5 output waveforms (Triangular Input)
92
Fig 7.12.3 Amplitudes of the first 6 harmonics of the first 5 output waveforms (Square Wave Input)
K-Means Clustering will be performed after merging the above outputs into a single CSV file,
thereby, eliminating the need to develop different models for different input waveforms.
The results show that higher the frequency or higher the order of the pre-dominant harmonic, the
more susceptible to collapse, the civil structure is.
Since, it is not possible to visualize 30 dimensions, we have plotted the data points by taking X as
the summation of the amplitudes of the 2nd and 3rd harmonic, Y as the summation of the amplitudes
93
of the 4th and 5th harmonic and Z as the summation of the amplitudes of the 6th and 7th harmonic.
From the 3D plot, we can see that there is a clear distinction between the healthy and unhealthy
categories. In an N-dimensional space, the distinction would be even clearer as in the 3D plot, there
is considerable exemption of data.
The above clustering was done by generating linear combinations of the first 6 Fourier coefficients.
This method might in fact fail to assume the importance of other Fourier coefficients in the
extracted feature space. Thus, the 3 most important Fourier coefficients were determined using
certain feature selection algorithms for the purpose of clustering.
According to the feature selection algorithms, the most important features were the 0 th, 11th and
30th Fourier coefficients. Thus, the clustering was done using the 0th, 11th and 30th Fourier
coefficients. Two scatter plots were generated, one for the clustering and the other for the true class
labels.
94
Fig 7.12.7 Scatter Plot of the True Class Labels with Feature Selection
The feature selection algorithms, though non-deterministic, revealed an interesting pattern when
paired up with K-Means clustering. No matter which three Fourier coefficients, the feature selection
algorithms selected, the accuracy of the K-Means clustering model always remained at 70%. Thus,
at most 70% accuracy can be achieved by unsupervised learning using K-Means clustering based on
the 3 most important Fourier coefficients.
95
7.13 Variation in Model Performance Across Different Measuring Instruments
This is where the Digital Butterworth Filter came into use. The data obtained from the Digital
Storage Oscilloscope and the data obtained from the Data Acquisition Card, were passed through a
Digital Butterworth Filter.
The filtered waveforms were then plotted using the Matplotlib library of Python and compared side
by side. It was apparent that certain inter-harmonics were attenuated in the data obtained from the
Data Acquisition Card. This can very well be one of the reasons that prohibit the RNN and CNN
models to work efficiently on the data.
Thus, specifications of the measuring instruments, might very well contribute to the performance of
various ML models. An appropriate model should be such that it is able to discern the underlying
patterns in the data, irrespective of the measuring instrument being used. Hence, the Random Forest
Models were more reliable in this case.
Fig 7.12.8 Comparison of DSO vs DAQ at 20Hz Fig 7.12.9 Comparison of DSO vs DAQ at 30
96
Chapter 8
• We learnt about the properties of Magnetostriction and Reverse Magnetostriction and how
such a phenomenon can be useful in health monitoring of civil structures. Once complete,
our prototype will be able to detect anomalies in civil structures, thereby preventing loss and
destruction of property, and harm to human and animal life.
• We learnt how to perform the experiments on the setup. Firstly, the desired waveform,
amplitude and frequency were to be selected from the RT Pro Photon software. From the
software, the digital signal goes to Photon+ which converts the signal into an analogue one.
This analogue signal is amplified by the Linear Power Amplifier and supplied to the
Permanent Magnet Shaker. The shaker provides vibrations to the arrangement, and the
output voltage waveform is picked up by the Energy Harvester. This output voltage
waveform can be seen on the DSO or can be transmitted via the transmitter-receiver module
for real-time processing.
• Using the data obtained from the DSO, we were able to perform certain preliminary data
exploration, where we saw that the pre-dominant harmonic changes in steps of four. This
observation was crucial in developing our linear regression model and features for our k-
means clustering model.
• Data cleansing was done using Moving Average Algorithm, which smoothened the output
waveform. This proved to be of considerable consequence, as patterns in the data arose
which were not seen in the presence of noise. A digital Butterworth filter was incorporate
to attenuate high frequency components. The use of this filter gave us insights about the
nature of the measuring instruments.
• With the use of Arduino Uno and NRF24L01 transceiver module, we were able to bypass
the need of the oscilloscope. The data transmitted could be directly saved on the receiving
computer by using Excel Streamer. Thereafter, the ML scripts can be run to perform real-
time health monitoring. However, a limitation of this method was its sampling and
transmission speed. This can be improved upon in the future.
97
• The use of an SD card with Arduino Uno and NRF24L01 was discarded as it increased the
complications in the transfer of data.
• By implementing Linear Regression, we developed and trained a model that will be able to
predict the pre-dominant harmonic for any waveform and any frequency. The knowledge
about the pre-dominant harmonic of the output, gives us an idea about the waveform of the
output. Moreover, higher the order of the pre-dominant harmonic of the output waveform,
more susceptible to collapse the civil structure is. This was the basis for using Fourier
coefficients as the Feature space.
• Using Fourier amplitudes, we converted our sequential (or time-series) data into an N- dimensional
vector. By incorporating K-Means Clustering, we were able to categorize the vectors into two
categories, namely, the healthy category and the unhealthy category. Since, it is not possible to
visualize 30 dimensions, a 3D scatter plot was generated using the harmonics 2 through 7. A clear
distinction is there between the clusters. This distinction would be even clearer in a 30-
dimensional space. Moreover, another clustering was performed on the 3 most important features,
as selected by the feature selection algorithms. Such a clustering revealed that at most 70%
accuracy can be obtained by unsupervised learning using K-Means clustering and the 3 most
important Fourier coefficients.
• Using Random Forest models on the Fourier coefficients, we were able to reach significant
performance levels both for the data obtained from the DSO and from Data Acquisition
Card. A Deep Neural Network was incorporated to incorporate the said objectives but its
performance was not at par with those of the Random Forest models. This could be due to
inadequacy of the data,
• We were able to extend our problem definition from health monitoring to health monitoring
along with diagnostics on input vibrations. Such diagnostics would enable a civil engineer
to make more informed decisions.
98
For real-time analysis of signals, it needs to be converted to its 30-dimensional vector form by
performing a Fast Fourier Transform. This vector is fed to the Random Forest model which will
determinewhich category the signal belongs to.
99
Chapter 9
Energy harvesters that transform usable energy from ambient vibration sources are able to provide
sustainable power to wireless or wearable devices. Compared with existing passive vibration energy
harvesters (e.g., magneto-electric or electromagnetic), magnetostrictive devices provide higher
energy density. Compared with piezoelectric devices, magnetostrictive devices can generate similar
levels of output power with no need for power management circuits. Certain ductile and flexible
magnetostrictive materials, such as Galfenol, Metglas, Alfenol, and C-Galfenol are versatile in
practice and can be integrated into MEMS.
For the individual waveforms i.e., sine, square or triangular waveform as we varied the frequency of
the shaker from 9Hz to 33Hz the voltage waveform obtained from the magnetostrictive sensors are
changing noticeably, also we can observe more and more noises getting into the waveform as we
increase the frequency. By transforming it from time-domain to frequency-domain we can get a
rough idea about the frequencies that are significant in the sensor’s output voltage waveform. By
taking more and more data sets we can somewhat classify the relation between the input frequency
of the vibrations fed to the magnetostrictive sensor with the output voltage waveform frequency.
As is evident from the graphs obtained, the maximum voltages obtained for different frequencies
for the various waveforms vary linearly with that of the applied frequencies within the range of the
experimental errors. But on analyzing the dominant frequencies obtained for various applied
frequencies, it can be observed that there lies no such linearity within the obtained graphs.
From this analysis, a conclusion that can be drawn is that the maximum voltage obtained for various
frequencies can be a decisive parameter for various practical applications of magnetostrictive
energy harvesters, one such prominent application being structural health monitoring of civil
structures. One more point that needs a mention is that the maximum voltages that have been
obtained have the highest value of 33Hz for all the applied frequencies for all waveforms. The value
is around 4V. This obtained voltage is quite sufficient for powering up wireless sensor networks
which makes them self-sustained and the dependency on conventional sources of power such as
100
batteries reduces. So, this reduces the cost and is also beneficial in economic aspects.
By implementing Linear Regression, we developed and trained a model that will be able to predict
the pre-dominant harmonic for any waveform and any frequency. The knowledge about the pre-
dominant harmonic of the output, gives us an idea about the waveform of the output. Moreover,
higher the order of the pre-dominant harmonic of the output waveform, more susceptible to collapse
the civil structure is.
Using sequential models like Simple Recurrent Neural Network, Gated Recurrent Unit and Long
Short-Term Memory, we able to achieve high accuracies for the data from the digital storage
oscilloscope.
Likewise, the Convolutional Neural Network was able to achieve high accuracy when classifying
images of waveforms of the data obtained from digital storage oscilloscope. Thus, there is no one
way to achieve the said objectives. All we require is adequate the adequate amount of data.
Using Fourier amplitudes, we convert our sequential (or time-series) data into an N-dimensional
vector. By incorporating K-Means Clustering, we were able to categorize the vectors into two
categories, namely, the healthy category and the unhealthy category. Since, it is not possible to
visualize 30 dimensions, a 3D scatter plot was generated using the harmonics 2 through 7. A clear
distinction is there between the clusters. This distinction would be even clearer in a 30-dimensional
space. For real-time analysis of signals, it needs to be converted to its 30-dimensional vector form
by performing a Fast Fourier Transform. This vector is fed to the K-means model which will
determine which category the signal belongs to. Again, the 3 most important Fourier coefficients
were determined by the feature selection algorithms. This revealed that at most 70% accuracy can
be achieved by unsupervised learning using K-Means and the 3 most important Fourier coefficients.
The best performance was achieved by the Random Forest models. The performance could be
replicated by Deep Neural Network models, given sufficient data is available.
Machine learning has the potential to revolutionize many industries and solve some of the world's
most challenging problems. As research in this field continues to advance, we are likely to see even
101
more exciting applications emerge in the coming years. However, it is important to consider the
challenges and ethical considerations that come with this technology. By addressing these concerns,
we can ensure that machine learning is used in a responsible and beneficial way, while also
unlocking its full potential for improving our lives and society. The data predicted has many errors
so huge amounts of data is required for training.
102
References
[1] A.E. Clark, M. Wun-Fogle, and J.B. Restorff, “Magnetostrictive properties of body-centered
cubic Fe-Ga and Fe-Ga-Al alloy,” IEEE Trans. Magn, vol. 37, no. 5, pp.3238-3240, Sep. 2000.
[2] M. Wun-Fogle, J.B. Restorff, and A.E. Clark, “Magnetomechanical coupling in stress-annealed
Fe-Ga and Fe-Al alloys,” IEEE Trans. Magn. , vol. 42, no. 10, pp. 3120-3122, oct. 2006.
[3] T. Ueno and S. Yamada, “performance of energy harvester using iron-gallium alloy in free
vibration”, IEEE Trans. Magn. 47(10), 2407-2409(2011).
[4] Alison B Flatau, Jin-HyeongYoo. “A bending-mode galfenol electric power harvester”. Journal
of intelligent material systems and structures. 23(6) 647-654.
[6] Anton S R and Sodano H A. “A review of power harvesting using piezoelectric materials
(2003–2006).” Smart materials and Structures, 16(3):R1, 2007.
[7] Deng Z and Dapino M J. “Modeling and design of Galfenol unimorph energy harvesters.” Smart
Materials and Structures, 24(12):125019, 2015.
103
Appendix
#include <SPI.h>
#include "printf.h"
#include "RF24.h"
#define CE_PIN 7
#define CSN_PIN 8
RF24 radio(CE_PIN, CSN_PIN);
uint8_t address[][6] = { "1Node", "2Node" };
bool radioNumber = 0; // 0 uses address[0] to transmit, 1 uses address[1] to
transmit
bool role = 1; // true = TX role, false = RX role
float payload = 0.0;
void setup() {
Serial.begin(115200);
radio.begin();
radio.setPALevel(RF24_PA_LOW); // RF24_PA_MAX is default.
radio.setPayloadSize(sizeof(payload)); // float datatype occupies 4 bytes
radio.openWritingPipe(address[radioNumber]); // always uses pipe 0
radio.stopListening(); // put radio in TX mode
}
void loop() {
bool report = radio.write(&payload, sizeof(float)); // transmit & save the
report
if (report) {
Serial.println(payload); // print payload sent
payload = analogRead(A5);
payload = payload*5/1023; // increment float payload
} else {
Serial.println(F("Transmission failed or timed out")); // payload was not
delivered
delay(25); // slow transmissions down by 25 millisecond
}
}
104
A.2 Arduino Uno Code for the Receiver
#include <SPI.h>
#include "printf.h"
#include "RF24.h"
#define CE_PIN 7
#define CSN_PIN 8
// instantiate an object for the nRF24L01 transceiver
RF24 radio(CE_PIN, CSN_PIN);
void setup() {
Serial.begin(115200);
radio.begin();
radio.setPALevel(RF24_PA_LOW); // RF24_PA_MAX is default.
radio.setPayloadSize(sizeof(payload)); // float datatype occupies 4 bytes
radio.openReadingPipe(1, address[!radioNumber]); // using pipe 1
radio.startListening(); // put radio in RX mode
} // setup
// int cnt=0;
void loop() {
// This device is a RX node
uint8_t pipe;
// if(cnt>=100){
// return;
// }
if (radio.available(&pipe)) { // is there a payload? get the pipe
number that recieved it
uint8_t bytes = radio.getPayloadSize(); // get the size of the payload
radio.read(&payload, bytes); // fetch payload from FIFO
Serial.print(payload); // print the payload's value
Serial.print(',');
// cnt++;
}
} // loop
105
A.3 Jupyter Notebook Code for Data Cleansing and Developing the Linear Regression Model
import pandas as pd
import numpy as np
from scipy.fft import fft, rfft
from scipy.fft import fftfreq, rfftfreq
import plotly.graph_objs as go
from plotly.subplots import make_subplots
import matplotlib.pyplot as plt
harmonics=[]
for i in range(0,24):
if i==20 or i==1:
continue
name = "F000"+str(i)+"CH1.CSV" if i<10 else "F00"+str(i)+"CH1.CSV"
data = pd.read_csv(name)
data[data.columns[0]]=data[data.columns[0]]+0.0040
plt.plot(data[data.columns[0]],data['mag'],color='yellow')
plt.title("Frequency = "+str(9+i) if i<2 else str(8+i) if i<=20 else
str(7+i))
plt.xlabel("Time")
plt.ylabel("Magnitude")
trend = data['mag'].rolling(
window=250,
center=True,
min_periods=6
).mean()
plt.plot(data[data.columns[0]],trend,color='red')
plt.show()
fourier = fft(trend.values)
fourier = np.abs(fourier[0:30])/(len(trend)/2)
harmonic, content=0,0
for j in range(2,30):
if fourier[j]>content:
content=fourier[j];
harmonic=j
harmonics.append(harmonic)
x=[]
sub=10
for i in range(9,31):
x.append(i)
plt.scatter(x,harmonics)
from sklearn.linear_model import LinearRegression
106
model = LinearRegression()
model.fit(np.array(x).reshape(-1,1),np.array(harmonics).reshape(-1,1))
plt.plot(x,model.predict(np.array(x).reshape(-1,1)),color="red")
plt.xlabel("Input Frequency")
plt.ylabel("Pre-dominant Harmonic")
from sklearn.metrics import mean_absolute_error
mean_absolute_error(harmonics,model.predict(np.array(x).reshape(-1,1)))
A.4 Jupyter Notebook Code to Generate the FFT of the Output Waveforms
import pandas as pd
import numpy as np
from scipy.fft import fft, rfft
from scipy.fft import fftfreq, rfftfreq
import plotly.graph_objs as go
from plotly.subplots import make_subplots
import matplotlib.pyplot as plt
map = {}
for i in range(0,31):
map.update({
'Harmonic: '+str(i):[]
})
harmonics=[]
for i in range(0,24):
if i==20 or i==1:
continue
name = "F000"+str(i)+"CH1.CSV" if i<10 else "F00"+str(i)+"CH1.CSV"
data = pd.read_csv(name)
data[data.columns[0]]=data[data.columns[0]]+0.0040
#plt.plot(data[data.columns[0]],data['mag'],color='yellow')
#plt.title("Frequency = "+str(9+i) if i<2 else str(8+i) if i<=20 else
str(7+i))
#plt.xlabel("Time")
#plt.ylabel("Magnitude")
trend = data['mag'].rolling(
window=250,
center=True,
min_periods=6
).mean()
#plt.plot(data[data.columns[0]],trend,color='red')
#plt.show()
fourier = fft(trend.values)
fourier = np.abs(fourier[0:31])/(len(trend)/2)
for pos in range(0,31):
107
map['Harmonic: '+str(pos)].append(fourier[pos])
plt.plot(fourier[0:30],color='blue')
plt.title("Frequency = "+str(9+i) if i<2 else str(8+i) if i<=20 else
str(7+i))
plt.xlabel("Harmonic")
plt.ylabel("Magnitude")
plt.show()
harmonic, content=0,0
for j in range(2,30):
if fourier[j]>content:
content=fourier[j];
harmonic=j
harmonics.append(harmonic)
data=pd.DataFrame(map)
data.head()
data.to_csv('FFT-Sine.csv')
A.5 Jupyter Notebook Code for Developing the K-Means Clustering Model
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
import pandas as pd
from sklearn.preprocessing import StandardScaler
sine = pd.read_csv('FFT-Sine.csv')
square = pd.read_csv('FFT-Square.csv')
triangle = pd.read_csv('FFT-Triangle.csv')
data = pd.concat([sine,square],ignore_index=True)
data = pd.concat([data,triangle],ignore_index=True)
data=data.drop('Unnamed: 0',axis=1)
from sklearn.cluster import KMeans
kmeans = KMeans(n_clusters=2)
kmeans.fit(data)
centroids = kmeans.cluster_centers_
labels = kmeans.labels_
data['Healthy']=labels
twothree=[]
fourfive=[]
sixseven=[]
for i in range(0,66):
twothree.append(data.loc[i]['2']+data.loc[i]['3'])
fourfive.append(data.loc[i]['4']+data.loc[i]['5'])
sixseven.append(data.loc[i]['6']+data.loc[i]['7'])
108
data['Two And Three']=twothree
data['Four And Five']=fourfive
data['Six And Seven']=sixseven
import pandas as pd
import numpy as np
from sklearn.cluster import KMeans
import plotly.express as px
import plotly.graph_objects as go
import matplotlib.pyplot as plt
fig = px.scatter_3d(data,
color='Healthy',
x="Two And Three",
y="Four And Five",
z="Six And Seven",
category_orders={"Healthy": ["0", "1"]},
color_discrete_sequence=['red', 'blue'] # Specify
cluster colors
)
fig.update_layout()
fig.show()
import plotly.io as pio
pio.write_html(fig, 'scatter_plot.html')
import pandas as pd
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.keras.layers import LSTM, Dense, Input, Dropout
from tensorflow.keras.models import Model
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
data = pd.read_csv('BridgeData.csv')
X, y = sequences_padded, data['Healthy']
109
X_train, X_test, y_train, y_test = train_test_split(X, y,
test_size=int(len(data)*0.1), shuffle=True, random_state=42)
scaler = StandardScaler()
X_train_scaled = scaler.fit_transform(X_train.reshape(-1,
max_len)).reshape(X_train.shape)
X_test_scaled = scaler.transform(X_test.reshape(-1,
max_len)).reshape(X_test.shape)
model.compile(
optimizer=tf.keras.optimizers.Adam(learning_rate=0.0001),
loss='binary_crossentropy',
metrics=['accuracy']
)
history = model.fit(
X_train_scaled,
y_train,
batch_size=32,
epochs=40,
validation_split=0.1,
verbose=1
)
y_pred = model.predict(X_test_scaled).round().astype(int)
from sklearn.metrics import classification_report
print(classification_report(y_test, y_pred))
data = pd.read_csv('BridgeData.csv')
data['Sequence'] = data['Sequence'].apply(lambda x: [float(val.strip(',')) for
val in x.strip('[]').split()])
sequences = np.array(data['Sequence'].tolist())
data['Healthy'] = data['Healthy'].astype(int)
X, y = sequences_padded, data['Healthy']
scaler = StandardScaler()
X_train_scaled = scaler.fit_transform(X_train.reshape(-1,
max_len)).reshape(X_train.shape)
X_test_scaled = scaler.transform(X_test.reshape(-1,
max_len)).reshape(X_test.shape)
model.compile(
optimizer=tf.keras.optimizers.Adam(learning_rate=0.0001),
loss='binary_crossentropy',
metrics=['accuracy']
)
early_stopping =tf.keras.callbacks.EarlyStopping(
patience=20,
min_delta=0.01,
restore_best_weights=True
)
history = model.fit(
X_train_scaled,
y_train,
batch_size=32,
epochs=80,
validation_split=0.1,
verbose=1,
callbacks=[early_stopping]
)
y_pred = model.predict(X_test_scaled).round().astype(int)
from sklearn.metrics import classification_report
print(classification_report(y_test, y_pred))
import pandas as pd
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.keras.layers import GRU, Dense, Input, Dropout
from tensorflow.keras.models import Model
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
data = pd.read_csv('BridgeData.csv')
data['Sequence'] = data['Sequence'].apply(lambda x: [float(val.strip(',')) for
val in x.strip('[]').split()])
sequences = np.array(data['Sequence'].tolist())
data['Healthy'] = data['Healthy'].astype(int)
X, y = sequences_padded, data['Healthy']
scaler = StandardScaler()
X_train_scaled = scaler.fit_transform(X_train.reshape(-1,
max_len)).reshape(X_train.shape)
X_test_scaled = scaler.transform(X_test.reshape(-1,
max_len)).reshape(X_test.shape)
112
outputs = Dense(1, activation='sigmoid')(x)
model.compile(
optimizer=tf.keras.optimizers.Adam(learning_rate=0.0001),
loss='binary_crossentropy',
metrics=['accuracy']
)
history = model.fit(
X_train_scaled,
y_train,
batch_size=32,
epochs=40,
validation_split=0.1,
verbose=1
)
test_loss, test_accuracy = model.evaluate(X_test_scaled, y_test)
print("Test Loss:", test_loss)
print("Test Accuracy:", test_accuracy)
y_pred = model.predict(X_test_scaled).round().astype(int)
from sklearn.metrics import classification_report
print(classification_report(y_test, y_pred))
A.7 Health Monitoring using Random Forest & Deep Neural Network
import pandas as pd
import numpy as np
from scipy.fft import fft, rfft
from scipy.fft import fftfreq, rfftfreq
import os
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from imblearn.over_sampling import RandomOverSampler
from sklearn.metrics import accuracy_score
from sklearn.preprocessing import StandardScaler
path = "./DAQ_Healthy/"
positions = ['Position-I/', 'Position-II/']
waveforms = ['Sine/', 'Square/', 'Triangle/']
df = {}
for i in range(0,32):
df[i]=[]
113
df['Healthy']=[]
fourier1 = fft(seq1)
fourier1 = np.abs(fourier1[0:32])/(len(seq1)/2)
fourier2 = fft(seq2)
fourier2 = np.abs(fourier2[0:32])/(len(seq2)/2)
for j in range(0,32):
df[j].append(fourier1[j])
df[j].append(fourier2[j])
df['Healthy'].append(1)
df['Healthy'].append(1)
path = "./DAQ_Unhealthy"
positions = ['_1/', '_2/']
for position in positions:
for waveform in waveforms:
curpath = path + position + waveform
for i in range(9,31):
data = pd.read_csv(curpath+str(i)+'.csv')
fourier1 = fft(seq1)
fourier1 = np.abs(fourier1[0:32])/(len(seq1)/2)
fourier2 = fft(seq2)
fourier2 = np.abs(fourier2[0:32])/(len(seq2)/2)
for j in range(0,32):
df[j].append(fourier1[j])
df[j].append(fourier2[j])
df['Healthy'].append(0)
df['Healthy'].append(0)
114
data = pd.DataFrame(df)
data = data.sample(frac=1).reset_index(drop=True)
model = RandomForestClassifier()
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
print("Accuracy:" + str(accuracy_score(y_test, y_pred)))
print("Precision:" + str(precision_score(y_test, y_pred, average='weighted')))
print("Recall:" + str(recall_score(y_test, y_pred, average='weighted')))
print("F1-score:" + str(f1_score(y_test, y_pred, average='weighted')))
model = RandomForestClassifier()
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
print("Accuracy:" + str(accuracy_score(y_test, y_pred)))
print("Precision:" + str(precision_score(y_test, y_pred, average='weighted')))
print("Recall:" + str(recall_score(y_test, y_pred, average='weighted')))
print("F1-score:" + str(f1_score(y_test, y_pred, average='weighted')))
class FeatureSelection:
def __init__(self, data, clabel, oversample) -> None:
X, y = data.drop(clabel, axis=1), data[clabel]
self.clabel = clabel
features = {_ for _ in data.columns}
115
features.remove(clabel)
self.features = features
if oversample:
over = RandomOverSampler()
X, y = over.fit_resample(X,y)
scaler = StandardScaler()
X = pd.DataFrame(scaler.fit_transform(X), columns=list(features))
if len(feature_set)==0:
return (feature_subset, self.wrapper(feature_subset))
accuracy = 0
for _ in range(0,count):
best_attribute = ""
best_report = 0
for attribute in feature_set:
feature_subset.add(attribute)
report = self.wrapper(feature_subset)*100
if report > best_report:
best_attribute=attribute
best_report=report
feature_subset.remove(attribute)
accuracy = best_report
feature_subset.add(best_attribute)
feature_set.remove(best_attribute)
feature_subset.remove(worst_attribute)
accuracy = self.wrapper(feature_subset)*100
return (feature_subset, accuracy)
accuracy = self.wrapper(feature_subset)*100
return (feature_subset, accuracy)
else:
feature_subset=feature_set.copy()
while len(feature_subset)>count:
temp_subset = self.sbr(len(feature_subset)-r)[0]
feature_set = feature_set | (feature_subset-temp_subset)
feature_subset = temp_subset
temp_subset = self.sfs(l, feature_subset)[0]
feature_set = feature_set - (temp_subset-feature_subset)
feature_subset = temp_subset
accuracy = self.wrapper(feature_subset)*100
return (feature_subset, accuracy)
model = RandomForestClassifier()
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
print("Accuracy:" + str(accuracy_score(y_test, y_pred)))
print("Precision:" + str(precision_score(y_test, y_pred, average='weighted')))
print("Recall:" + str(recall_score(y_test, y_pred, average='weighted')))
print("F1-score:" + str(f1_score(y_test, y_pred, average='weighted')))
cluster0 = go.Scatter3d(
x=data[data['cluster']==0][8],
y=data[data['cluster']==0][12],
z=data[data['cluster']==0][20],
mode='markers',
marker=dict(
118
color='red',
size=10,
symbol='circle'
),
name='Unhealthy'
)
cluster1 = go.Scatter3d(
x=data[data['cluster']==1][8],
y=data[data['cluster']==1][12],
z=data[data['cluster']==1][20],
mode='markers',
marker=dict(
color='green',
size=10,
symbol='circle'
),
name='Healthy'
)
fig = go.Figure()
fig.add_trace(cluster0)
fig.add_trace(cluster1)
fig.update_layout(
title='Healthy vs Unhealthy',
scene=dict(
xaxis=dict(title='8'),
yaxis=dict(title='12'),
zaxis=dict(title='20')
),
showlegend=True,
width=800,
height=600
)
fig.show()
cluster0 = go.Scatter3d(
x=data[data['Healthy']==0][8],
y=data[data['Healthy']==0][12],
z=data[data['Healthy']==0][20],
mode='markers',
marker=dict(
color='red',
size=10,
symbol='circle'
),
name='Unhealthy'
)
cluster1 = go.Scatter3d(
x=data[data['Healthy']==1][8],
y=data[data['Healthy']==1][12],
119
z=data[data['Healthy']==1][20],
mode='markers',
marker=dict(
color='green',
size=10,
symbol='circle'
),
name='Healthy'
)
fig = go.Figure()
fig.add_trace(cluster0)
fig.add_trace(cluster1)
fig.update_layout(
title='Healthy vs Unhealthy',
scene=dict(
xaxis=dict(title='8'),
yaxis=dict(title='12'),
zaxis=dict(title='20')
),
showlegend=True,
width=800,
height=600
)
fig.show()
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import random
import tensorflow as tf
import os
from PIL import Image
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
data = pd.read_csv('BridgeData.csv')
data['Sequence'] = data['Sequence'].apply(lambda x: [float(val) for val in
x.strip('[]').split()])
sequences = np.array(data['Sequence'].tolist())
data['Healthy'] = data['Healthy'].astype(int)
X, y = [], []
clabels = np.array(data['Healthy'])
for i in range(len(sequences)):
plt.clf()
plt.plot(sequences[i], color='black')
name = 'image'+str(clabels[i])+'.png'
plt.savefig(name)
image = Image.open(name)
120
image = image.resize((128,128))
X.append(np.array(image))
y.append(clabels[i])
X, y = np.array(X), np.array(y)
image = Image.open('image0.png')
image
X_train, X_temp, y_train, y_temp = train_test_split(X,y,
test_size=int(len(data)*0.3), shuffle=True, random_state=42)
X_test, X_valid, y_test, y_valid = train_test_split(X_temp, y_temp,
test_size=int(len(X_temp)*0.5), shuffle=True, random_state=42)
model = tf.keras.models.Sequential([
tf.keras.layers.Rescaling(1./255),
tf.keras.layers.Conv2D(128, (3,3), activation='relu', input_shape=(128, 128,
4)),
tf.keras.layers.AveragePooling2D((2,2)),
tf.keras.layers.Dropout(0.25),
tf.keras.layers.Conv2D(64, (3,3), activation='relu',
kernel_regularizer=tf.keras.regularizers.l2(l=0.01)),
tf.keras.layers.AveragePooling2D((2,2)),
tf.keras.layers.Dropout(0.25),
tf.keras.layers.Conv2D(32, (3, 3), activation='relu',
kernel_regularizer=tf.keras.regularizers.l2(l=0.01)),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(128, activation='relu'),
tf.keras.layers.Dropout(0.25),
tf.keras.layers.Dense(1)
])
model.compile(
optimizer=tf.keras.optimizers.Adam(0.001),
loss=tf.keras.losses.BinaryCrossentropy(from_logits=True),
metrics=['accuracy']
)
history = model.fit(
X_train,
y_train,
validation_data=(X_valid, y_valid),
epochs=5,
verbose=1,
batch_size=32
)
model.evaluate(X_test, y_test)
121
plt.legend()
plt.show()
import pandas as pd
import numpy as np
from scipy.fft import fft, rfft
from scipy.fft import fftfreq, rfftfreq
import os
path = "./DAQ_Healthy/"
positions = ['Position-I/', 'Position-II/']
waveforms = ['Sine/', 'Square/', 'Triangle/']
df = {}
for i in range(0,31):
df[i]=[]
df['freq']=[]
fourier1 = fft(seq1)
fourier1 = np.abs(fourier1[0:31])/(len(seq1)/2)
fourier2 = fft(seq2)
fourier2 = np.abs(fourier2[0:31])/(len(seq2)/2)
for j in range(0,31):
df[j].append(fourier1[j])
df[j].append(fourier2[j])
df['freq'].append(i)
df['freq'].append(i)
path = "./DAQ_Unhealthy"
positions = ['_1/', '_2/']
for position in positions:
for waveform in waveforms:
curpath = path + position + waveform
for i in range(9,31):
122
data = pd.read_csv(curpath+str(i)+'.csv')
fourier1 = fft(seq1)
fourier1 = np.abs(fourier1[0:31])/(len(seq1)/2)
fourier2 = fft(seq2)
fourier2 = np.abs(fourier2[0:31])/(len(seq2)/2)
for j in range(0,31):
df[j].append(fourier1[j])
df[j].append(fourier2[j])
df['freq'].append(i)
df['freq'].append(i)
data = pd.DataFrame(df)
data = data.sample(frac=1).reset_index(drop=True)
data.head()
model = RandomForestRegressor()
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
print("Mean Absolute Percentage Error:" +
str(mean_absolute_percentage_error(y_test, y_pred)))
y_pred = model.predict(X_test)
print("Mean Absolute Percentage Error:" +
str(mean_absolute_percentage_error(y_test, y_pred)))
import pandas as pd
import numpy as np
from scipy.fft import fft, rfft
from scipy.fft import fftfreq, rfftfreq
import os
path = "./DAQ_Healthy/"
positions = ['Position-I/', 'Position-II/']
waveforms = ['Sine/', 'Square/', 'Triangle/']
df = {}
for i in range(0,31):
df[i]=[]
df['form']=[]
fourier1 = fft(seq1)
fourier1 = np.abs(fourier1[0:31])/(len(seq1)/2)
fourier2 = fft(seq2)
fourier2 = np.abs(fourier2[0:31])/(len(seq2)/2)
for j in range(0,31):
df[j].append(fourier1[j])
df[j].append(fourier2[j])
df['form'].append(waveforms.index(waveform))
df['form'].append(waveforms.index(waveform))
path = "./DAQ_Unhealthy"
positions = ['_1/', '_2/']
124
for position in positions:
for waveform in waveforms:
curpath = path + position + waveform
for i in range(9,31):
data = pd.read_csv(curpath+str(i)+'.csv')
fourier1 = fft(seq1)
fourier1 = np.abs(fourier1[0:31])/(len(seq1)/2)
fourier2 = fft(seq2)
fourier2 = np.abs(fourier2[0:31])/(len(seq2)/2)
for j in range(0,31):
df[j].append(fourier1[j])
df[j].append(fourier2[j])
df['form'].append(waveforms.index(waveform))
df['form'].append(waveforms.index(waveform))
data = pd.DataFrame(df)
data = data.sample(frac=1).reset_index(drop=True)
data.head()
model = RandomForestClassifier()
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
print("Accuracy:" + str(accuracy_score(y_test, y_pred)))
print("Precision:" + str(precision_score(y_test, y_pred, average='weighted')))
print("Recall:" + str(recall_score(y_test, y_pred, average='weighted')))
print("F1-score:" + str(f1_score(y_test, y_pred, average='weighted')))
125
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, precision_score, recall_score,
f1_score
model = RandomForestClassifier()
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
print("Accuracy:" + str(accuracy_score(y_test, y_pred)))
print("Precision:" + str(precision_score(y_test, y_pred, average='weighted')))
print("Recall:" + str(recall_score(y_test, y_pred, average='weighted')))
print("F1-score:" + str(f1_score(y_test, y_pred, average='weighted')))
126