0% found this document useful (0 votes)
15 views

Project_Report (1) (1)

The project report presents a machine learning-based approach for fault analysis in analog circuits, specifically focusing on an RC phase shift oscillator. By utilizing the K-Nearest Neighbors (K-NN) algorithm, the model effectively distinguishes between normal and faulty conditions based on sine wave outputs, identifying specific faulty resistors. The findings indicate that this method enhances fault detection accuracy and supports real-time monitoring, ultimately improving the maintenance of electronic systems.

Uploaded by

d22e703
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Project_Report (1) (1)

The project report presents a machine learning-based approach for fault analysis in analog circuits, specifically focusing on an RC phase shift oscillator. By utilizing the K-Nearest Neighbors (K-NN) algorithm, the model effectively distinguishes between normal and faulty conditions based on sine wave outputs, identifying specific faulty resistors. The findings indicate that this method enhances fault detection accuracy and supports real-time monitoring, ultimately improving the maintenance of electronic systems.

Uploaded by

d22e703
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 35

FAULT ANAYSIS IN ANALOG CIRCUIT USING

MACHINE LEARNING

A PROJECT REPORT

Submitted by
UTHAYA KANNAN C 715521105057

STEPHEN VARMA M 715520105050

MOZHIARASU P 715520105302

VIJAY MOHAN 715520105058

In partial fulfillment for the award of the degree


of
BACHELOR OF ENGINEERING

IN

ELECTRICAL AND ELECTRONICS ENGINEERING

PSG INSTITUTE OF TECHNOLOGY AND APPLIED


RESEARCH, COIMBATORE - 641062

ANNA UNIVERSITY: CHENNAI


ANNA UNIVERSITY: CHENNAI 600025

BONAFIDE CERTIFICATE

Certified that this project report “FAULT ANAYSIS IN ANALOG CIRCUIT


USING MACHINE LEARNING” is the bonafide work of “UTHAYA KANNAN
C, STEPHEN VARMA M, MOZHIARASU P, VIJAY MOHAN” who carried out
the project work under my supervision .

Dr. SUBASH KUMAR C.S Dr. SATHIYANADHAN M


Head Of the Department
Supervisor
Professor & HoD Department of
Associate Professor
Electrical and Electronics
Department of Electrical and
Engineering PSG Institute of
Electronics Engineering PSG
Technology and Applied
Institute of Technology and
Research
Applied Research

i
ABSTRACT

Detecting faults in electronic circuits is a critical task for ensuring the reliability of systems that
rely on analog components. This paper proposes an innovative approach using machine learning
techniques to identify faults in an RC phase shift oscillator, which is commonly utilized in signal
generation. The goal of the study is to develop a model that can distinguish between normal
operation and faulty conditions by analyzing the sine wave outputs of the oscillator. Additionally,
the model is designed to pinpoint the specific resistor(s) responsible for any detected faults. The
dataset used in this study includes time-stamped sine wave data collected under different fault
scenarios, where various resistors are deliberately altered to simulate faults. Key characteristics of
the sine wave, such as amplitude, frequency, and phase shift, are extracted as features for input into
the model.

A K-Nearest Neighbors (K-NN) algorithm was selected for this task due to its effectiveness in
handling complex, non-linear patterns within data. Its ability to classify data points based on
similarity enhances the model's performance in predicting fault conditions.

To measure how well the model performs, various evaluation methods were used, including
accuracy, precision, recall, and the F1-score. These metrics help in understanding how effectively
the model can differentiate between a properly functioning oscillator and one with faults.

The findings show that the K-NN model is very effective in spotting faults and correctly identifying
which resistor is faulty. This approach improves fault detection techniques in analog circuits and
provides a useful solution for real-time monitoring and maintenance of electronic systems.

ii
ACKNOWLEDGEMENT

We would like to express our gratitude to Dr. N. Saravanakumar, Principal


and the management of PSG Institute of Technology and Applied Research, for
providing us the opportunity to carry out our project with the best infrastructure and
facilities .

We extend our sincere thanks to Dr. Subash Kumar C.S, Professor and Head
of the Department of Electrical and Electronics Engineering for providing consistent
support through the project.

We extend our sincere thanks to our project guide Dr. Sathiyanadhan M,


Associate Professor , Department of Electrical and Electronics Engineering for giving
their unfailing support throughout the project .

We extend our gratitude to all the faculty and staff members, friends and our
parents for their constant support and guidance.

iii
TABLE OF CONTENTS

CHAPTER NO. TITLE PAGE


NO.

1 INTRODUCTION 5

1.1 NEED FOR ANALYSIS 6

1.2 OBJECTIVES 7

2 LITERATURE SURVEY 8

3 RC PHASE SHIFT OSCILLATOR 15

4 EXTRACTION OF DATASET 17

4.1 INTRODUCTION 17

4.2 SUMMARY OF THE DATASET 18

5 MACHINE LEARNING 20

5.1 INTRODUCTION 20

5.2 K-NEAREST NEIGHBORS (KNN) 20

5.3 RMSE (Root Mean Squared Error) 22

5.4 LINEAR REGRESSION 24

5.5 RANDOM FOREST 24

6 GRAPH AND RESULTS 26

6.1 DATASET OVERVIEW 26

6.2 GRAPHING THE DATASET 26

6.3 GRAPH 27

iv
CHAPTER 1

INTRODUCTION

The motive of this project is to develop an efficient fault detection system for analog circuits,

specifically targeting an RC phase shift oscillator. Conventional circuit fault diagnosis

methods depend on manual inspection, which can be both time-intensive and prone to errors.

This project leverages machine learning to automate fault detection, enhancing accuracy

while minimizing maintenance efforts.. The objective is to distinguish between normal and

faulty conditions by analyzing sine wave outputs and identifying the specific resistor

responsible for faults. To achieve this, the project requires essential hardware components

such as an RC phase shift oscillator, resistors, capacitors, and an oscilloscope for data

collection. On the software side, Python-based tools, including machine learning libraries

like Scikit-Learn and signal processing tools, are used for feature extraction and model

training. The dataset consists of sine wave data collected under different fault conditions,

with features like amplitude, frequency, and phase shift extracted for analysis. The K-Nearest

Neighbors (K-NN) algorithm is utilized for fault classification, with its effectiveness

assessed through metrics like accuracy, precision, recall, and F1-score. This approach

enhances real-time monitoring and fault diagnosis, making electronic systems more reliable

and easier to maintain.

5
1.1 NEED FOR ANALYSIS

Analyzing faults in electronic circuits is essential for maintaining their performance,

reliability, and longevity. Faults in analog circuits, such as an RC phase shift oscillator,

can lead to signal distortion, efficiency loss, or complete system failure. A structured

analysis is required to automate fault detection and improve accuracy.

Key Reasons for Analysis:

 Ensuring Reliability: Prevents unexpected failures by detecting faults early.

 Reducing Maintenance Effort: Automates troubleshooting, minimizing manual

intervention.

 Improving Accuracy: Machine learning models provide precise fault

classification.

 Understanding Fault Impact: Helps determine how resistor failures affect circuit

performance.

 Predictive Maintenance: Enables early detection, reducing downtime and repair

costs.

 Optimization of Detection Process: Ensures timely corrective actions to prevent

critical failures.

By analyzing key waveform features such as amplitude, frequency, and phase shift, this

approach enhances fault diagnosis, making electronic systems more efficient and easier to

maintain.

6
Figure 1.1 Block Diagram of RUL Prediction

1.2 OBJECTIVES

 Develop an Automated Fault Detection System: Implement a machine

learning-based model to identify faults in an RC phase shift oscillator.

 Classify Normal and Faulty Conditions: Analyze sine wave outputs to

distinguish between properly functioning and faulty circuits.

 Identify Faulty Components: Pinpoint the specific resistor responsible for

circuit malfunctions.

 Enhance Accuracy and Efficiency: Utilize machine learning techniques to

improve fault detection compared to traditional manual methods.

 Feature Extraction for Fault Analysis: Extract key waveform characteristics

such as amplitude, frequency, and phase shift for precise fault classification.

 Utilize K-Nearest Neighbours (K-NN) Algorithm: Train and validate the

model using K-NN to recognize fault patterns effectively.

 Evaluate Model Performance: Measure precision, accuracy , F1-score , and

recall to assess the reliability of the fault detection system.

 Enable Real-Time Monitoring: Provide a solution for continuous circuit

analysis, reducing maintenance time and costs.

 Improve Circuit Maintenance and Troubleshooting: Assist engineers in

diagnosing and resolving circuit issues efficiently

7
CHAPTER 2

LITERATURE SURVEY

El Mrabet, Z., Sugunaraj, N., Ranganathan, P., & Abhyankar, S. (2022). "Random

Forest Regressor-Based Approach for Detecting Fault Location and Duration in Power

Systems."

 This paper presents a fault detection method for power systems using a Random Forest

Regressor. The model predicts fault location and duration, enhancing the accuracy of

power system monitoring. It provides a more reliable method for real-time fault

tracking, reducing downtime and maintenance costs.

Kou, L., Gong, X., Zheng, Y., Ni, X., Li, Y., Yuan, Q., & Dong, Y. (2021). "A Random

Forest and Current Fault Texture Feature–Based Method for Current Sensor Fault

Diagnosis in Three-Phase PWM VSR."

 The authors propose a fault detection method using Random Forest and current fault

texture features to identify sensor faults in three-phase PWM voltage source rectifiers.

This approach enhances the accuracy and reliability of sensor fault diagnosis, reducing

failures in power electronics applications.

Kozłowski, E., & Napieralski, A. (2015). "Application of Random Forest to the Fault

Detection of Analog Electronic Circuits."

 This study explores the use of the Random Forest algorithm for diagnosing faults in

analog electronic circuits. The method improves fault classification accuracy and
8
provides a machine learning-based approach to automated circuit analysis.

Han, L., Liu, F., & Chen, K. (2015). "Analog Circuit Fault Diagnosis Using a Novel

Variant of a Convolutional Neural Network."

 This research proposes a CNN-based method for fault detection in analog circuits. The

model enhances feature extraction and classification accuracy, outperforming

traditional machine learning models in diagnosing faulty circuit behavior.

Shuhan Zhao, Xu Liang, Ling Wang, Hao Zhang, Guiqiang Li, Jing Chen (2024). "A

Fault Diagnosis Method for Analog Circuits Based on EEMD-PSO-SVM."

 This paper introduces a hybrid method combining Empirical Mode Decomposition

(EEMD), Particle Swarm Optimization (PSO), and Support Vector Machine (SVM)

for fault detection in analog circuits. The approach improves classification accuracy

and robustness against signal noise.

Congzhi Huang, Zhendong Shen, Jianhua Zhang, Guolian Hou (2022). "BIT-Based

Intermittent Fault Diagnosis of Analog Circuits by Improved Deep Forest Classifier."

 The authors develop a BIT-based deep forest classifier for diagnosing intermittent

faults in analog circuits. The technique processes large-scale circuit data effectively

and enhances fault localization.

Ding, S.X. (2008). "Model-Based Fault Diagnosis Techniques: Design Schemes,

Algorithms, and Tools."

 This book discusses model-based fault diagnosis methods, covering design principles,

algorithm implementation, and real-world applications in power systems, industrial

9
control, and electronic circuits.

Boulesteix, A.-L., Janitza, S., Kruppa, J., & König, I.R. (2012). "Overview of Random

Forest Methodology and Practical Guidance with Emphasis on Computational Biology

and Bioinformatics."

 This paper provides an extensive overview of the Random Forest algorithm, detailing

its practical applications in bioinformatics and computational biology. The

methodology is also applicable to fault diagnosis in electronic systems.

Choi, K., Singh, S., Kodali, A., Pattipati, K.R., Sheppard, J.W., et al. (2009). "Novel

Classifier Fusion Approaches for Fault Diagnosis in Automotive Systems."

 This research examines various classifier fusion methods for fault diagnosis in

automotive systems. It compares multiple machine learning techniques and highlights

the benefits of combining classifiers to improve fault detection accuracy.

Liu, H., Liu, Z., Liu, T., Han, J., & Bu, S. "Signal Model-Based Fault Coding for

Diagnostics and Prognostics of Analog Electronic Circuits."

 This paper introduces a fault coding technique for diagnosing and predicting faults in

analog circuits using signal modeling. The approach improves circuit reliability and

reduces repair time.

Qiang Wang, GuoPing Ma. (2022). "Analog Circuit Fault Diagnosis Method Based on

CBA-SVM."

 The authors propose a component-based analysis (CBA) combined with Support

Vector Machine (SVM) for diagnosing faults in analog circuits. The method enhances

10
fault classification by focusing on individual circuit components.

PeiLin Liu, MeiRong Liu, YiGang He. (2022). "Research on Fault Diagnosis Method of

Analog Circuit Based on Improved VMD and SVM."

 This research presents an improved Variational Mode Decomposition (VMD) and

SVM approach for analog circuit fault diagnosis. The method improves feature

extraction and classification accuracy.

Anuvab Nandi, Samiran Chakraborti, Himadri Himani, Sumit Mukherjee, Sayan

Chakraborty, Chiranjib Mitra. "An Oscilloscope-Based Method for Pulsed Optically

Detected Magnetic Resonance in an Ensemble of NV Centers in Diamond."

 This study develops an oscilloscope-based method for pulsed ODMR in NV centers in

diamonds, providing insights into quantum sensing and fault detection in electronic

circuits.

Wenxin Yu, Yigang He. "Analog Circuit Fault Diagnosis via Sensitivity Computation."

 This paper proposes a fault diagnosis approach using sensitivity computation. The

method analyzes circuit response variations to identify faulty components effectively.

Minggang Liu, Weigui Zeng, Tianyu Li. (2021). "Research on Simulation Platform of

Analog Circuit Fault Diagnosis Based on MATLAB GUI."

 The authors develop a MATLAB GUI-based simulation platform for fault diagnosis in

analog circuits. The platform allows engineers to visualize and test circuit faults in a

controlled environment.

11
Chen LeRui, Khan Umer Sadiq, Khattak Muhammad Kashif, Wen ShengJun, Wang

HaiQuan, Hu HeYu. (2023). "An Effective Approach Based on Nonlinear Spectrum

and Improved Convolution Neural Network for Analog Circuit Fault Diagnosis."

 This paper presents a CNN-based model incorporating nonlinear spectrum analysis for

analog circuit fault detection, improving diagnostic accuracy.

J. Sun, G. B. Hu, C. H. Wang. (2019). "Fault Diagnosis of Analog Circuit Based on

Random Projection and NB Network."

 This research explores a fault diagnosis technique for analog circuits using random

projection and Naïve Bayes (NB) networks, improving classification efficiency.

Claudio Giovanni Mattera, Joseba Quevedo, Teresa Escobet, Hamid Reza Shaker,

Muhyiddine Jradi. "Fault Detection and Diagnostics in Ventilation Units Using Linear

Regression Virtual Sensors."

 The authors develop a fault detection system for ventilation units using linear

regression virtual sensors, improving HVAC system reliability.

Paolo Mercorelli. "Recent Advances in Intelligent Algorithms for Fault Detection and

Diagnosis."

 This paper reviews recent advancements in AI-based fault detection algorithms and

their applications across different engineering domains.

Piotr Bilski. (2015). "Application of Random Forest to the Fault Detection in Analog

12
Circuits."

 This study examines the effectiveness of the Random Forest algorithm in fault

detection for analog circuits, demonstrating its advantages in automated fault

classification.

Ke Huang, Salvador Mir (2010) “ Fault diagnosis of analog circuits based on machine

learning”.

 This study explores the application of machine learning techniques, including linear

regression analysis, for fault diagnosis in analog circuits. The methodology involves

using a linear feedback shift register to generate pseudo-random analog input stimuli

for the circuit under test. The output's probability density function is estimated using a

non-Gaussian auto-regressive model, and the Bhattacharyya coefficient is measured to

assess fault detectability

Gopi Krishnan Rajbahadur, Shaowei Wang, Yasutaka Kamei, Ahmed E. Hassan

(2022). “ The Impact of Using Regression Models to Build Defect Classifiers”

 The Impact of Using Regression Models to Build Defect Classifiers" investigates how

different approaches to building defect classifiers affect their performance and

interpretability. Traditionally, continuous defect counts are discretized into binary

classes (defective or non-defective) to train classifiers—a method referred to as

discretized classifiers. However, this discretization can lead to information loss.

13
Nicolò Oreste Pinciroli Vago, Francesca Forbicini, Piero Fraternali ( 2024) “ Predicting

machine failures from multivariate time series”

 Predicting Machine Failures from Multivariate Time Series: An Industrial Case Study"

investigates how varying the sizes of reading windows (RW) and prediction windows

(PW) impact the performance of machine learning (ML) and deep learning (DL)

models in forecasting machine failures. The research utilizes three industrial datasets

Dezan Zhao, Jun Xing, and Zhisen Wang. (2016) "Analog Circuit Fault Diagnosis

Based on Deep Learning"

 Fault detection in analog circuits is crucial for system reliability. Traditional methods

struggle with complex fault patterns, making machine learning (ML) and deep

learning (DL) effective alternatives. Models like stacked autoencoders (SAE) and

CFPNN automatically learn fault features, improving accuracy and classification. This

study explores DL-based fault diagnosis, comparing ML models and highlighting their

advantages.

M. Isabel Dieste-Velasco (2021), Application of a Pattern-Recognition Neural Network

for Detecting Analog Electronic Circuit Faults

 Recurrent Neural Networks (RNNs) are effective for analog circuit fault diagnosis by

analyzing sequential data. A CNN-GRU hybrid model enhances accuracy by

extracting spatial and temporal features, while Echo State Networks (ESNs) capture

14
complex fault patterns. These approaches outperform traditional methods by

leveraging temporal dependencies

Chenggong Zhang, Daren Zha, Lei Wang , Nan Mu (2021), A Novel Analog Circuit Soft

Fault Diagnosis Method Based on Convolutional Neural Network and Backward

Difference

 Convolutional Neural Networks (CNNs) have been effectively applied to fault

diagnosis in analog circuits, enabling automatic feature extraction and accurate fault

classification. A notable approach involves a multi-scale CNN with a selective kernel

(MSCNN-SK), which computes multi-scale average difference sequences to mine

potential fault characteristics. This method dynamically adjusts its receptive field,

enhancing diagnostic accuracy

Yanghong Tan, Yigang He, Chun Cui, and Guanyuan Qiu, (2008) "A Novel Method for

Analog Fault Diagnosis Based on Neural Networks and Genetic Algorithms"

 This study presents a systematic approach that integrates neural networks with genetic

algorithms to diagnose faults in analog circuits. The method involves extracting

unified fault features from measurable voltage deviations, which are then classified

using a neural network optimized by a genetic algorithm. This hybrid approach

enhances diagnostic accuracy and reduces computational requirements.

Y. Sun, C. Zhang, and M. F. da Silva, (2011) "Fault Diagnosis of Analog Circuits Based

on Machine Learning"

15
 Accurate fault diagnosis in analog integrated circuits is crucial for maintaining the

reliability of electronic systems. Traditional diagnostic methods often face challenges

due to the continuous nature and component tolerances inherent in analog circuits. To

address these challenges, this research proposes a machine learning-based approach

that integrates multiple learning machines to enhance diagnostic accuracy.

Junyou shi, Qinggjie He, Zili Wang (2019). "A Data-Driven Approach to Fault

Diagnosis in Analog Circuits Using K-Means Clustering and Decision Trees."

 Fault diagnosis in analog circuits is essential for ensuring the reliability and

performance of electronic systems. Traditional methods often face challenges due to

component tolerances and the continuous nature of analog signals. To address these

issues, data-driven approaches have been proposed, leveraging machine learning

techniques to improve diagnostic accuracy.

Zakaria El Mrabet, Niroop Sugunaraj, Prakash Ranganathan, and Shrirang

Abhyankar,(2022) "Random Forest Regressor-Based Approach for Detecting Fault

Location and Duration in Power Systems"

 Power system failures, often resulting from short circuits or "faults," can lead to

prolonged service interruptions with significant socio-economic impacts. Timely

identification of fault characteristics—such as location, type, and duration—is crucial

for utilities to minimize downtime and associated costs. Traditional fault detection

16
mechanisms, like relays and digital fault recorders, may not promptly relay fault

details to control centers, delaying corrective actions.

The literature review explores various fault detection and diagnosis methods in analog

circuits, which are crucial for ensuring the reliability and efficiency of electronic systems.

The reviewed studies highlight diverse approaches, including traditional model-based

techniques, machine learning algorithms, and hybrid methods that enhance fault

classification accuracy.

Machine learning techniques such as k-Nearest Neighbors (k-NN), Random Forest,

Support Vector Machines (SVM), and Deep Learning models have been widely explored

for their ability to analyze complex circuit behavior. These approaches utilize extracted

features from circuit signals—such as amplitude variations, phase shifts, and frequency

distortions—to differentiate between normal and faulty conditions. Advanced

methodologies, including ensemble learning, sensitivity analysis, and data-driven

classification models, have further improved diagnostic precision.

Several studies introduce novel algorithms to address challenges like intermittent faults,

nonlinear behavior, and environmental variations. Hybrid approaches integrating signal

processing techniques (e.g., Empirical Mode Decomposition, Wavelet Transform) with

machine learning models have demonstrated improved fault detection performance.

Experimental validation using simulated and real-world circuit data has proven the

17
effectiveness of these methods in identifying faulty components, such as resistors and

capacitors.

Furthermore, the review emphasizes the importance of real-time fault detection in analog

circuits for predictive maintenance, reducing downtime, and improving the reliability of

electronic devices. By leveraging advanced fault diagnosis techniques, this research

contributes to the development of intelligent monitoring systems, enhancing circuit design

and troubleshooting in various engineering applications.

CHAPTER 3

RC PHASE SHIFT OSCILLATOR

An RC phase shift oscillator is a fundamental electronic circuit that generates a continuous

sine wave without requiring an external input. It relies on a network of resistors and capacitors

to produce a specific phase shift, ensuring sustained oscillations. This section outlines

the framework governing its operation, including key equations and relationships. The oscillator

18
consists of an amplifier, typically a transistor or an operational amplifier, configured for

negative feedback. A chain of three resistor-capacitor (RC) sections provides a phase shift,

which, along with the amplifier’s inherent 180-degree phase shift, results in the required 360-

degree phase condition for continuous oscillation. For an RC phase shift oscillator to function

correctly, it must adhere to the Barkhausen criterion, which states that the total loop gain

should be equal to unity, and the overall phase shift must be a multiple of 360 degrees. The

oscillation frequency is influenced by the values of the resistors and capacitors within the

feedback network. It is given by the equation:

1
f=
2 πRC √ 6

indicates that the frequency is inversely related to both resistance and capacitance. Larger

values of R or C result in a lower frequency, while smaller values yield a higher frequency.

Selecting appropriate R and C values ensures stable and predictable oscillations. For the

circuit to sustain oscillations, the amplifier must compensate for the signal attenuation

introduced by the RC network. The minimum required gain is:

Ensuring the amplifier provides at least this gain allows the oscillator to start and maintain

oscillations without external intervention. The RC phase shift oscillator is a crucial circuit

for low-frequency sinusoidal signal generation. By carefully choosing resistance and

capacitance values, designers can control the oscillation frequency. The mathematical

analysis presented confirms the necessary conditions for steady operation and frequency

stability.

Here, the values of R and C used are 1000 ohms and 0.01 micro farad. Such that the optimal

19
frequency of the output sine wave would be:

1
f=
2 πRC √ 6

Such that, frequency obtained theoretically was 6.497 KHz. But due to the effects of series

resistance across the capacitors used the practically obtained frequency of sine wave was

5.29 KHz under non-faulty condition

RC PHASE SHIFT

OSCILLATOR

CHAPTER 4

EXTRACTION OF DATASET

4.1 INTRODUCTION

For fault detection in an analog circuit using machine learning, analog circuits like RC

20
phase shift oscillators play a critical role in various applications, requiring reliable fault

detection methods. The RC phase shift oscillator, often used for signal generation, is

particularly sensitive to faults, especially those involving resistors, which can cause

significant changes in its output.

The approach involves collecting time-stamped sine wave data from the oscillator under both

normal and faulty conditions. To simulate faults, resistor values in the oscillator circuit are

intentionally modified, creating multiple fault scenarios. The dataset includes voltage values

recorded under these varying fault conditions, ensuring a comprehensive representation of

potential faults in the system.

Key characteristics of the sine wave, such as amplitude, frequency, and phase shift, are

extracted as features for input into the machine learning model. The model is then trained to

classify normal versus faulty operating conditions and to pinpoint the specific resistor

responsible for the fault.

4.2 SUMMARY OF THE DATASET

The dataset consists of sine wave outputs collected from an RC phase shift oscillator under

both normal and faulty conditions. The data was gathered from both software and hardware

sources. To simulate faults, different resistor values in the oscillator circuit were deliberately

altered, creating multiple fault scenarios. This approach ensures the dataset covers a wide

range of possible faults, making the model more robust in distinguishing between normal and

faulty conditions.
21
Simulink was used to generate the sine wave outputs under various fault conditions.

However, the software-generated data had unequal time and voltage intervals, which could

lead to inconsistencies and inaccuracies during analysis. Despite the ability to simulate fault

scenarios, the irregular intervals in the software data made it less suitable for the project’s

analysis, necessitating the use of hardware data for more accurate results.

To overcome the limitations of the software data, data from the hardware setup was

prioritized. The hardware data was collected by recording the output signals with an

oscilloscope, ensuring consistent time and voltage intervals. The recorded signals were then

stored in CSV (Comma-Separated Values) format for further analysis. Each data entry

includes time-stamped voltage values, which allows for a detailed examination of variations

in amplitude, frequency, and phase shift—key indicators of circuit health. This data provides

22
more reliable and accurate insights into the behavior of the RC phase shift oscillator under

fault conditions.

By combining both software and hardware data, this project ensures a comprehensive dataset

with a wide range of fault scenarios, while maintaining the consistency and accuracy needed

for effective fault detection and analysis.

CHAPTER 5

MACHINE LEARNING

5.1 INTRODUCTION

Machine learning (ML) is a branch of artificial intelligence (AI) that enables computers to

learn from data and make decisions without being explicitly programmed. Instead of

23
following predefined rules, ML algorithms identify patterns in data and use them to make

predictions or improve their performance over time. There are three main types of machine

learning: supervised learning, where the model learns from labeled data (such as spam

detection in emails); unsupervised learning, where the model finds patterns in unlabeled data

(like customer segmentation in marketing); and reinforcement learning, where the model

learns by trial and error to maximize rewards. Machine learning is used to find fault

conditions by analyzing datasets, helping in predictive maintenance and fault detection in

industries like manufacturing, power systems, and telecommunications. As data continues to

grow, machine learning plays a crucial role in advancing technology and improving decision-

making across industries.

5.2 K-Nearest Neighbors (K-NN)

The K-Nearest Neighbors (K-NN) algorithm is a supervised, non-parametric

classification technique that works by identifying the K closest training data points to a

test point and making a prediction based on the majority class of these neighbors.

In mathematical terms, let the training dataset be represented by X={x1,x2,…,xn}, where

each xi∈Rm is a feature vector, and Y={y1,y2,…,yn} represents the corresponding

labels. Each label yi∈C , where C is the set of possible class labels. The test point x

′∈Rm is the new data point we wish to classify.

The first step in the K-NN algorithm is calculating the distance between the test point x′

and every training point xi in the dataset. The most common distance metric used is the

24
Euclidean distance, which is calculated as:

Where:

 xij represents the j-th feature of the i-th training point,

 xj′ represents the j-th feature of the test point x′,

 m is the number of features (dimensions).

This formula computes the straight-line distance between the test point and each training

point in the feature space.

Once the distances between x′ and all the training points are computed, the next step is to

identify the K nearest neighbors by selecting the K points that have the smallest distances

to x′. These K points are the closest to the test point in terms of feature similarity.

After selecting the K nearest neighbors, the K-NN algorithm performs majority voting to

determine the predicted class label for the test point. The predicted class y^ is the one

that appears most frequently among the labels of the K nearest neighbors.

Mathematically, this can be expressed as:

Where yi1,yi2,…,yik are the class labels of the K nearest neighbors, and the mode

represents the most frequent label.

Alternatively, a weighted K-NN version can be applied where the influence of each

25
neighbor is weighted by its distance from the test point. Closer neighbors have more

influence on the prediction. In this case, the weight wi of the i-th neighbor is inversely

proportional to its distance from the test point:

The prediction is then based on weighted majority voting, where the vote of each

neighbor is weighted by wi . The predicted class is determined by the weighted sum:

Where 1(yi = y)is an indicator function that is 1 if the label yi matches class y, and 0

otherwise. This allows closer neighbors to have a stronger impact on the classification

decision.

Thus, the KNN algorithm works by computing the distances between a test point and all

the points in the training set, selecting the K nearest neighbors, and determining the class

label for the test point through majority voting (or weighted voting). This method is

highly flexible and does not make strong assumptions about the underlying data

distribution, which makes it effective in situations where data relationships are complex

or non-linear. However, the algorithm's performance can be sensitive to the choice of K

26
and the distance metric, and it can be computationally expensive, especially with large

datasets since distances must be calculated for every training point.

5.3 RMSE (Root Mean Squared Error)

RMSE (Root Mean Squared Error) is a commonly used metric to evaluate the performance

of regression models. It measures the average magnitude of the errors between predicted

values and the actual values. RMSE gives a sense of how well the model's predictions

align with the true data.

Mathematically, RMSE is calculated as:

Where:

 n is the number of data points.

 yi is the true value of the i-th data point.

 y^ is the predicted value for the i-th data point.

Interpretation:

 Lower RMSE: Indicates better model performance, as the predictions are closer to the

actual values.

 Higher RMSE: Indicates a poorer fit of the model to the data, as the predictions

deviate more from the true values.


27
RMSE is useful because it provides an interpretable value in the same units as the target

variable, making it easier to understand how large the typic4.al prediction error is.

However, it's sensitive to outliers because errors are squared, which means larger errors

have a disproportionately higher impact on RMSE.

5.4 LINEAR REGRESSION

Linear Regression is a statistical method used to model the relationship between a

dependent variable (target) and one or more independent variables (predictors). In simple

linear regression, the relationship is modeled as:

y=β0+β1x+ϵ

where

 Y is the target variable

 x is the predictor,

 β0 is the intercept,

 β1 is the slope,

 ϵ is the error term.

In multiple linear regression, there are multiple predictors:

28
y=β0+β1x1+β2x2⋯+βmxm+ϵ

The goal is to find the best-fit line by minimizing the sum of squared errors, often using

Ordinary Least Squares (OLS). Key assumptions include linearity, independence,

homoscedasticity, and normality of residuals.

5.5 RANDOM FOREST

Random Forest is a powerful ensemble learning algorithm used for both classification

and regression tasks. It operates by building multiple decision trees during training and

combining their outputs to improve accuracy and robustness. The fundamental idea

behind Random Forest is that a collection of weak models (individual decision trees)

can collectively make a strong model, reducing overfitting and improving generalization.

Unlike a single decision tree, which may capture noise and lead to overfitting, Random

Forest uses bagging (Bootstrap Aggregation) and random feature selection to

introduce variability, ensuring diverse decision trees that work independently but

contribute to a unified output. This randomness makes the model more robust and

reduces the likelihood of errors caused by noisy data.

In classification problems, each decision tree in the forest makes a prediction, and the

final output is determined by majority voting among the trees. In regression tasks, the

final prediction is obtained by averaging the outputs of all the trees. The inclusion of

multiple decision trees enhances accuracy, minimizes variance, and helps in handling

missing data effectively.

29
One of the significant advantages of Random Forest is its ability to provide feature

importance rankings, making it useful for feature selection. This capability helps in

identifying which variables contribute the most to predictions, which is valuable in fields

like medical diagnosis, finance, and marketing. Additionally, Random Forest is resistant

to overfitting, especially when tuned properly with an optimal number of trees and depth.

However, Random Forest is computationally expensive compared to simpler models.

Training multiple decision trees requires more time and memory, making it less ideal for

real-time applications. Moreover, while decision trees are easily interpretable, the

ensemble nature of Random Forest makes it harder to extract human-readable decision

rules.

CHAPTER 6

GRAPH AND RESULT

Dataset from an oscilloscope that captures the output voltage under normal and abnormal

conditions for a resistor, the dataset likely represents the voltage measurements over time for

both scenarios. The oscilloscope would record voltage changes, which could be displayed as

a waveform. The normal condition could be when the resistor is operating as expected, while

the fault condition could represent issues like overheating, short circuits, or faulty
30
connections.

6.1 Dataset Overview:

 The dataset would contain pairs of time values and corresponding output voltages

measured by the oscilloscope.

 The oscilloscope records these values in real-time, so you’ll have a time series of

voltage values for both normal and fault conditions.

6.2 Graphing the Dataset:

 A graph can be plotted with time on the x-axis and voltage on the y-axis..

 The normal condition voltage might show stable, consistent behavior (e.g., a steady

DC voltage or a smooth sinusoidal waveform).

 The fault condition might show erratic behavior, such as large fluctuations or

instability in the voltage, indicating a malfunctioning resistor or other issues in the

circuit.

6.3 Graph:

31
Under normal operating conditions, the resistor maintains a stable and predictable

resistance. This stability results in a smooth and consistent output voltage waveform. In

fault conditions, the resistor's resistance may change due to factors such as ageing,

temperature variations, and the effect of other components in the circuit. These factors

cause the resistance to fluctuate, which in turn leads to changes in the output voltage

32
To better understand the variations in oscillator output under different conditions,
graphical representations of the voltage waveforms were generated for both normal and
faulty scenarios. These visualizations provide a clear insight into how circuit behavior
changes when faults occur, making it easier to identify and Analyze deviations in the sine
wave characteristics.
By plotting the output voltage against time, we can observe key differences in amplitude,
frequency, and phase shift under different fault conditions. In the normal state, the sine
wave maintains a consistent pattern with stable frequency and amplitude. However, when
faults are introduced by altering resistor values, noticeable distortions occur in the
waveform. Some faults result in reduced amplitude, while others cause frequency shifts
or irregular waveforms, indicating circuit instability.
These visualizations play a crucial role in feature extraction for the Root Mean Square
Error (RMSE) analysis. By analysing the plotted waveforms, we can extract meaningful
attributes that help distinguish between normal and faulty conditions. Additionally, these
graphs serve as a useful reference for validating the model’s predictions and
understanding how different faults impact circuit performance. The graphical analysis
enhances fault detection accuracy by providing a visual confirmation of abnormalities,
complementing the dataset used for training and testing the machine learning model.
Following the graph, the output of the ML model has been shown below for various
conditions, also mentioning the RMSE between the non-correct predictions for better
understanding.

Result

33
34

You might also like