Projects:2020s1-2561 LabView Code for Digilent AD2 Instruments

From Projects
Revision as of 13:57, 19 October 2020 by A1688864 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

The Digilent Analog Discovery 2 is a low cost device containing two 14 bit 100 MSPS ADC’s and two14 bit 100 MSPS DACs, 16 bidirectional digital IO’s and a Xilinx Spartan 6 (XC6SLX16-1L) FPGA. During 2019, student's produced hardware to interface with the Digilent AD2 for a low cost Impedance Analyser and Transfer Function analyser up to 1 MHz for University Laboratory Use. However, the project was incomplete and the Labview software, hardware and signal processing will need to be improved to provide a functional and accurate device. The accuracy will be improved using software simulations in AWRDE of the hardwave to determine input impedance and stray capacitance which can then be used to produce more accurate data.

That hardware is being adapted to drive mains voltage relays, to turn a load On and Off, and by measuring the voltage change determine the impedance (resistance and inductance) of the mains at the mains frequency under normal operating conditions.

The aim of this project is to firstly improve and adapt the existing LabVIEW code to obtain an accurate impedance analyser. The second task is to then change the LabVIEW code to control the mains voltage relay and measure the voltage drop and phase shift due to the load being switched On and Off and thus calculate the mains impedance. The outcomes from this project will be very useful for ECE laboratories at the University.

Project Team

Project Students

  • Shane Rosenboom
  • Latif Hossain

Project Supervisors

  • Prof. Keith Kikkert
  • Dr. Wen Soong

Aim

The aim of this project was to develop a low-cost digital impedance and transfer function for student use in university labs with the following key objectives:

  • To achieve a 1% measurement accuracy over a 1Hz to 1MHz frequency range
  • To operate with only the Analog Discovery 2 (AD2) unit, the analyser PCB, a computer & USB cable, and a LabView software license
  • To design for user-friendliness, ease of transport and accessiblity

Background

An entire user interface was built using labview pictured below to support the impedance analyser and transfer function analyser capabilities.

LabView UI

For both we used the onboard signal generator to generate sinusoids, the digital IOs to configure the relays of our hardware through which the signal shall pass and the onboard oscillosopes to measure the voltages. At high frequencies, there is a lot of noise so we used IQ demodulation to convert the signal to base band and filter off undesirable components so that we can get an accurate result.

Methodology

The voltage divider theorem is the fundamental guiding principle in the design of this impedance analyser. The input voltage (Va) and the output voltage (Vb) are measured using voltage probes, and the reference resistance (R) is known. Given these values are known, the load impedance or impedance under test (Zut) can be calculated by voltage divider. The reference resistor is switched to a value that closely matches the impedance under test to satisfy Vb = Va/2. Best measurement accuracy is achieved under this condition as the input and load impedances match, minimising reflection and maximising power transfer.

Voltage Divider Equations

System Overview

High Level Block Diagram

1) Initialisation

The instrument is configured by switching in the reference resistor whose impedance is closest to the device under test. This is done by calculating the voltage gain recursively with different reference resistors.

2) Signal Capture & Processing

Sinusoidal waveforms are generated, passing through the device under test and are measured at the output. We can then multiply this measured data with a local oscillator, down converting it using IQ demodulation and filtering which will remove any high frequencies and allow us to use the DC component for calculation calibration and display of the impedance or frequency response

IQ Demodulation Equations

3) Calibration

Calibration is performed to correct for the gain magnitude and phase errors due to the voltage reading inaccuracy for Va and Vb (gain calibration), and the stray capacitance and inductance in the analyser circuit (Open-circuit/Short-circuit calibration or OC/SC calibration). For transfer function measurement, only gain calibration is used and for impedance measurement, a sequence of gain calibration followed by OC/SC calibration is performed.

Calibration Equivalent Circuit Model
Calibration Equations

Testing

The data was output and we used AWR Development Environment (AWRDE) to model our hardware using this data to determine the best fit model that includes all of the stray capacitances and inductances such that a calibration module could be developed. We also used a 455kHz bandpass filter and a 17kHz low pass filter to test the transfer function. We found that the stray capacitance in the existing hardware was really high and we developed a new PCB with lower stray capacitance and inductance.

Analyser PCB

Software Development

LabView is used to interface with the Analog Discovery 2 (AD2) unit which includes an analog-digital converter (ADC), signal generator and FPGA. Labview is used as the main driving software for the impedance and transfer function analyser.

AWR Development Environment (AWRDE) is used for analysis on captured measurements imported from LabView. This AWRDE analysis involves matching measurement data to a calibration circuit model and finding resulting values for the calibration parameters used in the calibration equations. Simulated calibration is then performed using the calibration equations on the input measurement data to produce calibrated impedance plots in AWRDE.

Matlab is used to convert AWRDE calibration calculations into a code format. The same mathematical equations are performed to produce the same results as AWRDE. The purpose of this stage is to develop a code implementation which can then be transferred into LabView after conversion to Scilab. Once the Matlab code is converted into Scilab, it is then placed into LabView as a series of Scilab code modules.

Results

The resistances 1 Ohm, 10 Ohm, 100 Ohm, 1K Ohm, 10K Ohm, 100K Ohm and 1M Ohm were measured and the corresponding data was input into AWRDE for calibration. The calibrated impedance achieved was to close to 1% accuracy for 1 Ohm up to 10K Ohm. However, the 100K Ohm and 1M Ohm resistors were not measured very accurately even after calibration.

Calibrated (solid) and Uncalibrated (dotted) Impedance Under Test (ZUT)