Circuit Theory Ii Lab Report 2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

SCHOOL OF COMPUTING AND ENGINEERING SCIENCES (SCES)

BACHELOR OF SCIENCE IN ELECTRICAL AND ELECTRONIC


ENGINEERING
(BSEEE)

CIRCUIT THEORY II LAB REPORT 2 ON GERARATION OF VARIABLE


FREQUENCY SOURCES
BY:
Evans Muoki Munyao 144067
Lecturer:

Prof. Mwangi Mbuthia

1
Abstract
The aim of this lab report is to detail the procedure, results, and analysis of generating
variable frequency sources using electronic equipment. The experiment involves
generating sinusoidal waveforms with adjustable frequencies using a function
generator and observing the behavior of these waveforms on an oscilloscope. The
generated waveforms are utilized to explore the effects of frequency changes on the
waveform characteristics.

i
Table of Contents
Abstract ..................................................................................................................................... i
List of figures ......................................................................................................................... iii
List of symbols ....................................................................................................................... iii
1.0 CHAPTER 1: INTRODUCTION ..................................................................................1
1.1. Wein-Bridge Oscillator............................................................................................1
1.2. Sine Wave generator using Arduino code. ...........................................................2
2.0 CHAPTER 2: OBJECTIVES AND EXPECTED OUTCOMES ........................3
2.1. Objectives ..................................................................................................................3
2.2. Expected Outcomes .................................................................................................3
3.0 CHAPTER 3: THEORETICAL ANALYSIS, SAMPLE CALCULATIONS,
SIMULATIONS AND CIRCUIT DIAGRAMS .................................................................4
3.1. Theoretical Analysis .................................................................................................4
3.1.1. Wein Bridge Oscillator ........................................................................................4
3.1.2 Arduino Sine wave Generator ...........................................................................5
4.0 CHAPTER 4: EXPERIMENTAL DESIGN AND SCHEMATIC ......................7
5.0 CHAPTER 5: APPARATUS AND PROCEDURE ...............................................8
5.1. Apparatus .................................................................................................................8
5.1.1. Wein-Bridge Oscillator........................................................................................8
5.1.2 Arduino Sine wave generator ............................................................................8
5.2. Procedure ..................................................................................................................8
5.2.1. Wein-Bridge Oscillator....................................................................................8
5.2.2 Arduino Sine wave generator ...........................................................................8
6.0 CHAPTER 6: EXPERIMENTAL SETUP AND RESULTS...............................9
6.1. Experimental Setup .................................................................................................9
6.1.1. Wein-Bridge Oscillator....................................................................................9
6.1.2 Arduino Sine wave Generator ...........................................................................9
6.2. Results and findings...............................................................................................10
6.2.1. Wein-Bridge Oscillator Experiment ............................................................10
6.2.1.1. Simulation Results ......................................................................................10
6.2.1.2. Practical Results .....................................................................................12
6.2.2. Arduino Sine wave generator experiment .................................................13
6.2.2.1. Arduino Programming Language code..............................................13
6.2.2.2. Simulation Results ..................................................................................14
6.2.2.3. Practical Results .....................................................................................15
7.0 CHAPTER 7: REFERENCES ................................................................................17

ii
List of figures
Figure 1 Function Generator ......................................................................................................1
Figure 2 Circuit of Wein-Bridge Oscillator ..................................................................................2
Figure 3: Example of an Arduino sine wave generator ..............................................................2
Figure 4 Example of a Wein-Bridge Oscillator ..........................................................................4
Figure 5 Example of an Output Waveform of a Wein-Bridge Oscillator ....................................5
Figure 6An example of an Arduino Sine wave Generator programming language code ...........6
Figure 7 Example of a sine wave generated by an Arduino. ......................................................6
Figure 8 Wein-Bridge oscillator experimental design ................................................................7
Figure 9 Arduino sine wave generator experimental design .....................................................7
Figure 10 Wein-Bridge Oscillator experimental setup ...............................................................9
Figure 11 Arduino Sine wave generator experimental setup ..................................................10

List of symbols

1. τ- (tau) Lower case Greek letter denoting the time constant of an RC circuit
2. DC-
3. Ω-Ohm
4. A- Amperes
5. V-Voltage
6. DC- Direct current
7. MHz – Megahertz
8. PWM – Pulse Width Modulation

iii
1.0 CHAPTER 1: INTRODUCTION
A variable frequency source is a fundamental component in various electronic systems,
including communication devices, signal processing applications, and control systems. The
ability to generate waveforms of different frequencies allows for the study of signal behavior
under different conditions. In this experiment, a function generator is employed to produce
sinusoidal waveforms with adjustable frequencies. The resulting waveforms are then
visualized using an oscilloscope to observe changes in amplitude, period, and phase as the
frequency is varied.
A function generator is a device that generates electrical signals with different shapes,
frequencies, and amplitudes. Examples of these shapes include square waves and Sinusoidal
waves.
A function generator works in close contact with an oscilloscope which is used to display
signals that are being received over time.
A commercial function generator can be used to simulate electronic circuits like oscillators
etc. which have many applications hence building our own function generator will help us
better understand how such kind of circuits are built inside digital signal processors.

Figure 1 Function Generator

1.1. Wein-Bridge Oscillator


A Wein bridge Oscillator is widely used to generate sinusoids below 1MHz making it suitable
for many electronic circuits like microwave devices, communication systems etc.
The oscillator consists of a noninverting amplifier with two feedback paths. The positive
feedback to the noninverting input creates oscillations while the negative feedback to the
inverting loop controls the gain.
The core principle of the Wein-Bridge oscillator involves using a bridge network of resistors
and capacitors in a feedback loop. The oscillator operates based on the concept of a Wien
bridge, which is a balanced bridge circuit capable of producing a pure sinusoidal output when
its arms are balanced. The circuit consists of two arms, each containing a resistor (R) and a
capacitor (C). The bridge is connected in a feedback loop with an amplifier.
The feedback network causes the output signal to be phase-shifted and amplified. The
amplifier amplifies the signal and feeds it back into the bridge network. The bridge circuit
itself introduces phase shifts in the signal. By carefully selecting resistor and capacitor values,
the oscillator can be set to oscillate at a specific frequency where the phase shifts introduced
by the bridge network and amplifier add up to 180 degrees, resulting in positive feedback and
sustained oscillation.

1
Figure 2 Circuit of Wein-Bridge Oscillator

1.2. Sine Wave generator using Arduino code.


For a sine wave generator using Arduino code the sinusoidal wave is generated from a sine or
cosine function where a Resistor and Capacitor filter (RC Filter) is used to reduce noise.
Creating a sine wave generator using an Arduino involves generating a series of digital values
that approximate the analog waveform of a sine wave. An Arduino does not have a Digital to
analog converter meaning basically it cannot generate a sine wave. Since the Arduino outputs
digital signals, we'll use a technique called pulse-width modulation (PWM) to simulate an
analog-like signal.

Example of a sine wave generator using Arduino

Figure 3: Example of an Arduino sine wave generator

2
2.0 CHAPTER 2: OBJECTIVES AND EXPECTED OUTCOMES
2.1. Objectives
➢ Use a Wein-bridge to build an oscillator.
➢ Use Arduino Code to build a function generator.

2.2. Expected Outcomes


➢ I will be able to understand how to use a simple analogue circuit to build an
oscillator.
➢ I will be able to investigate how to use code running on an Arduino Uno to build
a function generator.
By completing this project, I will have gained valuable practical experience in circuit design,
coding, and simulation, setting a solid foundation for your understanding of signal generation,
electronics, and Arduino programming.

3
3.0 CHAPTER 3: THEORETICAL ANALYSIS, SAMPLE
CALCULATIONS, SIMULATIONS AND CIRCUIT DIAGRAMS
3.1. Theoretical Analysis
3.1.1. Wein Bridge Oscillator
A Wein-Bridge Oscillator is a type of electronic oscillator that generates sine waves.
It can generate a large range of frequencies. A Wein-Bridge Oscillator is based on a bridge
circuit where the bridge comprises of four resistors and two capacitors.
The oscillator also consists of a noninverting amplifier with two feedback paths. The positive
feedback to the noninverting input creates oscillations while the negative feedback to the
inverting loop controls the gain.
A typical example of a Wein-Bridge oscillator is as shown below where;
𝑅1 = 𝑅2
𝐶1 = 𝐶2

Figure 4 Example of a Wein-Bridge Oscillator

And the formula for obtain frequency of the oscillation is given by;
1
𝐹ℎ𝑧 =
2𝜋𝑅𝐶
And the condition to obtain a stable oscillation is given by;
𝑅𝑓 = 2𝑅𝑔

Wein-Bridge Oscillators can be used to generate electrical signals with different kinds of
shapes, frequencies, and amplitudes. These shapes include square waves, triangular waves
etc.
In our case we will be focusing on the sinusoidal or sine waves. An example of sinusoidal
wave generated by a Wein-Bridge Oscillator is shown below.

4
Figure 5 Example of an Output Waveform of a Wein-Bridge Oscillator

Wein-Bridge oscillators have a variety of applications which include;


➢ They are highly used for audio testing.
➢ They are used to excite AC Bridges.
➢ They are also used in distortion testing of power amplifiers.

3.1.2 Arduino Sine wave Generator


-An Arduino is a device that does not have the Digital to analog converter meaning it cannot
generate a sine wave, but it has some PWM pins by which we take analog output by using the
analog Write Function.
-PWM stands for “Pulse Width Modulation” and involves switching rapidly any circuit
between 0 volt and 5 Volts in the case of an Arduino.
-By changing the ON and OFF time periods we can get different analog voltages.
-To create a sine wave from an Arduino will require the use of the digital signal processing
concept where we take samples of the sine wave at a particular sampling rate then we will
convert the sampled data into the range of 0-255 corresponding to the voltage level of that
sample.
Converting the sampled data requires an Arduino programming language which has a sine
function. The sin function takes the angle values in radians and gives the sine value of that
angle from -1 to 1. We can use that function to create the lookup table of PWM values.
The function ranges from -1 to 1, so we have to multiply it by 2555 to find the
correspondence PWM value.
Multiplying by 255 will result in the development of negative values of PWMs and Arduino
accepts only positive PWM values to output analog voltage.
To avoid development of negative we have to shift the sin output by 1 to make the range from
0 to 2 meaning we have to add 1 to the output of the sin value. Then we multiply this value
from 127. This way if the sin value is zero then we will get 0 PWM value and if the sin value
is 2 then we will get 254 PWM value. That will make a 0-5v output at the Arduino’s PWM
pin in accordance with the sine signal.

An example of an Arduino programming language code is shown below.

5
Figure 6An example of an Arduino Sine wave Generator programming language code

Figure 7 Example of a sine wave generated by an Arduino.

6
4.0 CHAPTER 4: EXPERIMENTAL DESIGN AND SCHEMATIC
We used the experimental designs as shown in the schematics below to carry out our
experiment.

Figure 8 Wein-Bridge oscillator experimental design

Figure 9 Arduino sine wave generator experimental design

7
5.0 CHAPTER 5: APPARATUS AND PROCEDURE
5.1. Apparatus
5.1.1. Wein-Bridge Oscillator
➢ 33-Ohm resistor
➢ 10K Ohm resistor
➢ 0.022 microfarads capacitor
➢ 1K Ohm variable resistor
➢ Oscilloscope
➢ Operational Amplifier (741)
➢ 12 Volts power supply
➢ Breadboard
➢ Jumper wires
5.1.2 Arduino Sine wave generator
5.2. Procedure
5.2.1. Wein-Bridge Oscillator
➢ Connect the 33-Ohm resistor, 10K-Ohm resistor, 0.022 microfarads capacitor, 1K-
Ohm variable resistor, jumper wires, operational amplifier, and the power supply onto
to the breadboard as shown in the design.
➢ Connect the Vout of the operational amplifier onto the oscilloscope.
➢ Vary the 1K-Ohm variable resistor until your desired sine wave is displayed on the
oscilloscope.
➢ Observe the sine wave and record your observations.

5.2.2 Arduino Sine wave generator


➢ Connect the 1000 micro-farads capacitor and the jumper wires onto the breadboard as
shown in the design.
➢ Connect the Arduino uno onto the breadboard and the oscilloscope
➢ Connect the power supply cable of the Arduino onto the computer and onto the
Arduino
➢ Upload the Arduino code and observe the sine wave being displayed on the oscillator
➢ Record your observations.

8
6.0 CHAPTER 6: EXPERIMENTAL SETUP AND RESULTS
6.1. Experimental Setup
6.1.1. Wein-Bridge Oscillator
- The setup used to carry out the Wein-Bridge Oscillator experiment is as shown below
where the jumper wires, resistors, capacitors, and the operational amplifier have been
connected onto the breadboard.

Figure 10 Wein-Bridge Oscillator experimental setup

6.1.2 Arduino Sine wave Generator


- The setup used to carry out the Arduino sine wave generator is as shown below where
the Capacitor, Jumper wires, Arduino Uno, Arduino Uno power cable have all been
connected.

9
Figure 11 Arduino Sine wave generator experimental setup

6.2. Results and findings


6.2.1. Wein-Bridge Oscillator Experiment
-The resistor values to be used during the experiment were obtained through calculation as
shown below

Figure 12 Resistor values calculation

6.2.1.1. Simulation Results


When the circuit was connected as shown below in proteus.

10
Figure 13 Wein-Bridge Oscillator simulated circuit

-And the simulation run, the sine wave obtained is as shown below

Figure 14 Sine wave Generated by a Wein-Bridge Oscillator through simulation

11
Figure 15 Sine wave generated by Wein-Bridge Oscillator through simulation

6.2.1.2. Practical Results


- The circuit was connected practical as shown below,

Figure 15 Wein-Bridge oscillator circuit connected practically

-After connecting the circuit to the oscilloscope and varying the variable resistor to the
desired resistance, the sine wave shown below was obtained.

12
Figure 16 Sine wave generated by a Wein-Bridge Oscillator Practically

6.2.2. Arduino Sine wave generator experiment


6.2.2.1. Arduino Programming Language code
- The Arduino programming language code used to carry out the experiment is as
shown below.

13
6.2.2.2. Simulation Results
-The Arduino sine wave generator circuit was connected as shown below in proteus

Figure 17 Arduino sine wave generator simulated circuit.

-When the simulation was run, the sine wave shown below was obtained

14
Figure 18Sine wave generated by an Arduino sine wave generator through simulation.

Figure 19Sine wave generated by an Arduino sine wave generator through simulation.

6.2.2.3. Practical Results


-The Arduino sine wave generator was connected practically as shown below

Figure 20Arduino sine wave generator connected practically.

When the Arduino Programming Language code was uploaded, the sine curve shown below
was obtained

15
Figure 21Sine wave generated by An Arduino sine wave generator practically.

Table of results

Results obtained Practically


Experiment Sine/Sinusoidal Wave Frequency

Arduino Sine wave OBTAINED 8.412Hertz


Generator experiment
Wein-Bridge Oscillator OBTAINED 49.4690Hertz
experiment
Results obtained through Simulation
Arduino Sine wave OBTAINED 13Hertz
Generator experiment
Wein-Bridge Oscillator OBTAINED 31769Hertz
experiment

16
7.0 CHAPTER 7: REFERENCES
➢ https://en.wikipedia.org/wiki/Wien_bridge_oscillator
➢ https://www.watelectronics.com/wien-bridge-oscillator-circuit-operation/
➢ https://electronicscoach.com/wien-bridge-oscillator.html
➢ https://electronics-fun.com/arduino-sine-wave-generator/

17

You might also like