I M Lab Report LabVIEW 1

You might also like

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

Instrumentation & Measurement Lab Report

Virtual Instrumentation using LabVIEW


B.S.Bharath Saiguhan
26th October 2018, 31st October 2018

Aim:
To study about the basic concepts of Virtual Instrumentation and Programming in LabVIEW and also, about
interfacing real world data to a Virtual Instrument.

Components Required:
• PC with LabVIEW software installed
• Data Acquisition card

• Function Generator
• Digital Storage Oscillator
• Resistors, Capacitors, Breadboard

myDAQ Specifications
• Analog Input
• Number of Channels - 2 Differential or 1 Stereo Audio Input
• ADC Resolution - 16 bits

• Maximum Sampling Rate - 200 kSamples/s


• Timing Accuracy - 100 ppm of sample rate
• Timing Resolution - 10 ns

Ranges
• Analog Input - ±10 V, ±2 V, DC-coupled
• Audio Input - ± 2 V, AC-coupled

• Passband (-3 dB)


• Analog Input - DC to 400 kHz
• Audio Input - 1.5 Hz to 400 kHz

1
Connector Types
• Analog Input - Screw Terminals
• Audio Input - 3.5 mm Stereo Jack
• Input Type (Audio Input) - Line-in or Microphone

• Microphone Excitation (Audio Input) - 5.25 V through 10 kΩ

Theory:
• LabVIEW stands for Laboratory Virtual Instrument Engineering Workbench.
• It is a graphical programming language used to create Virtual Instruments (VIs), and test them.
• A VI developed in LabVIEW has two parts namely the Front Panel and the Block Diagram. The Front Panel
contains the graphical user interface, using which a user interacts with the instrument, as in real life. The
Block Diagram is the window where graphical code is created, or control is switched.

• Virtual Instrumentation provides advanced computational features, such as delineating the logic flow and the
signal flow in the circuit.
• From Fourier Analysis, we can obtain that a square wave is constructed when Odd Harmonics (sine waves of
frequencies which are odd multiples of the fundamental frequency) are added together. When the first two
terms are added, as below, we get the first approximation to the square wave.

v1 = A1 sin(ω0 ) (First Odd Harmonic)


v2 = A2 sin(3 · ω0 ) (Second Odd Harmonic)

Figure 1: First Partial Sum for a Square Wave: 1st Odd Harmonic + 2nd Odd Harmonic

This is what we expect when we add the two sine waves in LabVIEW.

2
Procedure:
1. Adding Sinusoidal Signals
:::::::::::::::::::::::

• Right click on the Front Panel window to add a Waveform Graph. The corresponding block appears in
the Block Diagram window.
• From Block Diagram window right click → Analog Waveform → Waveform Generation → Simulate
Signal. Place the Simulate Signal block and use Sine option.
• To add two sine signals, from Mathematics → Numeric → Add. Use this block to add two input sine
waves and connect the output to the Waveform Graph block.
• To run the system continuously, enclose the whole setup in a While loop (From Programming → Struc-
tures → While loop).
• To change input values while running the system, place numeric controls in the Front Panel (from Modern
→ Numeric → Numeric Control) and connect corresponding blocks in proper input pins.
• Run the system.
2. Finding the Power expended by a System (Multiplication and Averaging of two Sinusoidal inputs with same
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Frequency)
::::::::::

• Right click on Front Panel window to add Waveform Graph in Front Panel window. Corresponding block
appears in block diagram window.
• From Block Diagram window right click → Analog Waveform → Waveform Generation → Simulate
Signal. Place Simulate Signal block and use Sine option.
• To multiply two sine signals, from Mathematics → Numeric → Multiply. Use this block to multiply two
input sine waves and connect output to Waveform Graph block.
• From Signal Processing → Waveform Conditioning use the Filter block and use Low Pass Filter. Change
the parameters accordingly.
• To change input values while running the system, place numeric controls in the Front Panel (from Modern
→ Numeric → Numeric Control) and connect corresponding blocks in proper input pins.
• Run the system.
3. Data Acquisition
:::::::::::::::

• A data acquisition assistant is placed in Block Diagram window from Express → Input → Input → DAQ
Assistant. The DAQ Assistant launches and the Create New Express Task dialog box appears. Click
Acquire Signals → Analog Input to display the Analog Input options.
• Select Voltage to create a new voltage analog input task.
• In the Supported Physical Channels list, select the physical channel to which the device connects the
signal.
• On the Block Diagram, right-click the data output and select Create → Graph Indicator from the shortcut
menu.
• Enclose the system in while loop.
• Run the system.
4. Data Acquisition Control by Switching
::::::::::::::::::::::::::::::::::

• A data acquisition assistant is placed in Block Diagram window from Express → Input → Input → DAQ
Assistant. The DAQ Assistant launches and the Create New Express Task dialog box appears.
• Click Acquire Signals → Analog Input to display the Analog Input options.
• Select Voltage to create a new voltage analog input task.
• In the Supported Physical Channels list, select the physical channel to which the device connects the
signal.
• On the Block Diagram, right-click the data output and select Create → Graph Indicator from the shortcut
menu.

3
• A switch condition is set up using Boolean Modern in Front Panel. Right click on the switch → Create→
Invoke mode → Reinitialize To Default is used.
• Connect the error out of Reinitialize to Default to error in of the DAQ assistant.
• Enclose the system in separate while loops and provide the conditions to the control loop.
• Run the system.
5. Design and Analysis of a Lowpass Filter
:::::::::::::::::::::::::::::::::::

Figure 2: Circuit Diagram for a Low Pass Filter

• Make the circuit as given above in the circuit diagram, on Bread Board. Give the input using Function
Generator.
• Give the input and output of low pass filter to DAQ Card.
• Select the DAQ assistant in the Control Panel and use a While loop to acquire signals continuously.
• Run it for different frequencies and find phase shift corresponding to each frequency in LabVIEW.

6. Identification of a Passive Filter Circuit having Unknown Cut-off Frequency


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

• Place a sinusoidal signal of frequency 20 Hz and amplitude 3 Vpp as input to the unknown filter.
• The DAQ assistant VI is configured to read input of the unknown filter circuit and the channels are
selected with appropriate ranges.
• A data acquisition assistant is placed in the Block Diagram window.

4
• The associated sensors are connected to PC.
• A Waveform graph is placed.
• The whole setup is enclosed in While loop and control conditions are set.
• Run the system.
• Change input signal frequency and note signal amplitude.
• Plot the frequency response.
• From graph determine gain, Bandwidth, cut-off frequency of the circuit.

Observations
• R1 = 1kΩ, R2 = 5kΩ, R = 10kΩ, C = 0.1µF .
1
Theoretical value of cut-off frequency Fc = 160Hz = .
  2πRC
V0
Gain at Ω = 0 is 6.
Vin

Table 1: Observations for a Lowpass Filter


Frequency Output Voltage (V) Phase Difference (in Degrees)
100 2.96 -32.4
120 2.88 -34.7
140 2.72 -40.8
150 2.56 -43.8
155.5 2.56 -45.3
160 2.48 -45.6
170 2.48 -47.2
180 2.32 -46.6
200 2.24 -49.7
300 1.72 -62.3
400 1.36 -66.3
500 1.12 -77.0
600 0.92 -76.0
700 0.848 -80.0
800 0.760 -86.0
900 0.680 -74.0
1000 0.580 -76.0

5
Table 2: Observations on an Unknown Passive Filter Circuit
Frequency (Hz) Phase Shift (in degrees)
100 -60.7
110 -65.9
120 -73.5
130 -74.5
140 -80.1
150 -83.5
155.3 -87.9
159.6 -86.8
164.9 -89
170 -91.5
180 -92.2
200 -101.5
400 -136.6
800 -155.3
1000 -162.3
2000 -171.4
4000 -178.2

Outputs

Figure 3: Adding Two Sine Waves

6
Figure 4: Resultant Waveform

Figure 5: Multiplication of Two Signals

7
Figure 6: Data Acquisition

Figure 7: Data Acquisition Control by Switching

8
Figure 8: Output of a Lowpass Filter: Magnitude Characteristics

9
Figure 9: Output of a Lowpass Filter: Phase Characteristics

Figure 10: Phase Response of Unknown Circuit

10
Inferences:
• The given sine waves (odd Harmonics) of frequencies 50 Hz and 150 Hz were added and the approximate
square wave from this sum is obtained using LabVIEW, as expected.
• Two sine waves of same frequency (playing the roles of the current and the voltage in a circuit) are multiplied
and their average was calculated using LabVIEW.
• The frequency response of the given Passive Filter Circuit was obtained using LabVIEW and the Data
Acquisition Unit. The circuit is found to be an All Pass Filter (see figure below) (Gain = 1) or a Phase Shifter
Circuit, with a cut-off frequency of about about 165 Hz.

Figure 11: Circuit Diagram of an All-Pass Filter

11

You might also like