Project_Report (1) (1)
Project_Report (1) (1)
MACHINE LEARNING
A PROJECT REPORT
Submitted by
UTHAYA KANNAN C 715521105057
MOZHIARASU P 715520105302
IN
BONAFIDE CERTIFICATE
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 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 gratitude to all the faculty and staff members, friends and our
parents for their constant support and guidance.
iii
TABLE OF CONTENTS
1 INTRODUCTION 5
1.2 OBJECTIVES 7
2 LITERATURE SURVEY 8
4 EXTRACTION OF DATASET 17
4.1 INTRODUCTION 17
5 MACHINE LEARNING 20
5.1 INTRODUCTION 20
6.3 GRAPH 27
iv
CHAPTER 1
INTRODUCTION
The motive of this project is to develop an efficient fault detection system for analog circuits,
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
5
1.1 NEED FOR ANALYSIS
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
intervention.
classification.
Understanding Fault Impact: Helps determine how resistor failures affect circuit
performance.
costs.
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
circuit malfunctions.
such as amplitude, frequency, and phase shift for precise fault classification.
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
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
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
Kozłowski, E., & Napieralski, A. (2015). "Application of Random Forest to the Fault
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
This research proposes a CNN-based method for fault detection in analog circuits. The
Shuhan Zhao, Xu Liang, Ling Wang, Hao Zhang, Guiqiang Li, Jing Chen (2024). "A
(EEMD), Particle Swarm Optimization (PSO), and Support Vector Machine (SVM)
for fault detection in analog circuits. The approach improves classification accuracy
Congzhi Huang, Zhendong Shen, Jianhua Zhang, Guolian Hou (2022). "BIT-Based
The authors develop a BIT-based deep forest classifier for diagnosing intermittent
faults in analog circuits. The technique processes large-scale circuit data effectively
This book discusses model-based fault diagnosis methods, covering design principles,
9
control, and electronic circuits.
Boulesteix, A.-L., Janitza, S., Kruppa, J., & König, I.R. (2012). "Overview of Random
and Bioinformatics."
This paper provides an extensive overview of the Random Forest algorithm, detailing
Choi, K., Singh, S., Kodali, A., Pattipati, K.R., Sheppard, J.W., et al. (2009). "Novel
This research examines various classifier fusion methods for fault diagnosis in
Liu, H., Liu, Z., Liu, T., Han, J., & Bu, S. "Signal Model-Based Fault Coding for
This paper introduces a fault coding technique for diagnosing and predicting faults in
analog circuits using signal modeling. The approach improves circuit reliability and
Qiang Wang, GuoPing Ma. (2022). "Analog Circuit Fault Diagnosis Method Based on
CBA-SVM."
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
SVM approach for analog circuit fault diagnosis. The method improves feature
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
Minggang Liu, Weigui Zeng, Tianyu Li. (2021). "Research on Simulation Platform of
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
and Improved Convolution Neural Network for Analog Circuit Fault Diagnosis."
This paper presents a CNN-based model incorporating nonlinear spectrum analysis for
This research explores a fault diagnosis technique for analog circuits using random
Claudio Giovanni Mattera, Joseba Quevedo, Teresa Escobet, Hamid Reza Shaker,
Muhyiddine Jradi. "Fault Detection and Diagnostics in Ventilation Units Using Linear
The authors develop a fault detection system for ventilation units using linear
Paolo Mercorelli. "Recent Advances in Intelligent Algorithms for Fault Detection and
Diagnosis."
This paper reviews recent advancements in AI-based fault detection algorithms and
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
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
The Impact of Using Regression Models to Build Defect Classifiers" investigates how
13
Nicolò Oreste Pinciroli Vago, Francesca Forbicini, Piero Fraternali ( 2024) “ Predicting
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
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.
Recurrent Neural Networks (RNNs) are effective for analog circuit fault diagnosis by
extracting spatial and temporal features, while Echo State Networks (ESNs) capture
14
complex fault patterns. These approaches outperform traditional methods by
Chenggong Zhang, Daren Zha, Lei Wang , Nan Mu (2021), A Novel Analog Circuit Soft
Difference
diagnosis in analog circuits, enabling automatic feature extraction and accurate fault
potential fault characteristics. This method dynamically adjusts its receptive field,
Yanghong Tan, Yigang He, Chun Cui, and Guanyuan Qiu, (2008) "A Novel Method for
This study presents a systematic approach that integrates neural networks with genetic
unified fault features from measurable voltage deviations, which are then classified
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
due to the continuous nature and component tolerances inherent in analog circuits. To
Junyou shi, Qinggjie He, Zili Wang (2019). "A Data-Driven Approach to Fault
Fault diagnosis in analog circuits is essential for ensuring the reliability and
component tolerances and the continuous nature of analog signals. To address these
Power system failures, often resulting from short circuits or "faults," can lead to
for utilities to minimize downtime and associated costs. Traditional fault detection
16
mechanisms, like relays and digital fault recorders, may not promptly relay fault
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.
techniques, machine learning algorithms, and hybrid methods that enhance fault
classification accuracy.
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
Several studies introduce novel algorithms to address challenges like intermittent faults,
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
CHAPTER 3
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
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
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
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
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
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
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
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
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
grow, machine learning plays a crucial role in advancing technology and improving decision-
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.
labels. Each label yi∈C , where C is the set of possible class labels. The test point x
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:
This formula computes the straight-line distance between the test point and each training
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.
Where yi1,yi2,…,yik are the class labels of the K nearest neighbors, and the mode
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
The prediction is then based on weighted majority voting, where the vote of each
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
26
and the distance metric, and it can be computationally expensive, especially with large
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
Where:
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
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
dependent variable (target) and one or more independent variables (predictors). In simple
y=β0+β1x+ϵ
where
x is the predictor,
β0 is the intercept,
β1 is the slope,
28
y=β0+β1x1+β2x2⋯+βmxm+ϵ
The goal is to find the best-fit line by minimizing the sum of squared errors, often using
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
introduce variability, ensuring diverse decision trees that work independently but
contribute to a unified output. This randomness makes the model more robust and
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
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.
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
rules.
CHAPTER 6
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.
The dataset would contain pairs of time values and corresponding output voltages
The oscilloscope records these values in real-time, so you’ll have a time series of
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
The fault condition might show erratic behavior, such as large fluctuations or
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