Wiki

This version is outdated by a newer approved version.DiffThis version (10 Apr 2018 19:19) was approved by Doug Mercer.The Previously approved version (24 Feb 2018 02:52) is available.Diff

This is an old revision of the document!


Active Learning Interface (for) Circuits (and) Electronics M1K:

Objective:

This document serves as a User’s Guide for the ALICE Desktop software interface written for use with the ADALM1000 active learning kit hardware. If you are looking for ALICE for the ADALM2000 (M2K) look here.

Background:

Although the word ALICE can be spelled out from the title of this users guide, it is actually an allusion to the fantasy works of Lewis Carroll: 1865’s Alice’s Adventures in Wonderland and its 1871 sequel Through the Looking-Glass, and What Alice Found There. In these stories Alice explores a strange and wondrous world down a rabbit hole and on the other side of a mirror ( looking glass ).

Alice Meets the Caterpillar, John Tenniel illustration from Alice in Wonderland by Lewis Carroll

Hopefully, through the use of this software along with the ADALM1000 active learning kit hardware, Students can explore the strange and wondrous world of Circuits, Electronics and Electrical Engineering.

Functions:

The ALICE Desktop software provides the following functions:

  • Two Channel Oscilloscope for time domain display and analysis of voltage and current waveforms.
  • Two Channel Arbitrary Waveform Generator (AWG) controls.
  • X-Y display for plotting captured voltage and current vs voltage and current data as well as voltage waveform histograms.
  • Two Channel Spectrum Analyzer for frequency domain display and analysis of voltage waveforms.
  • Bode plotter and network analyzer with built-in sweep generator.
  • Impedance Analyzer for analyzing complex RLC networks and as a RLC meter and Vector Voltmeter.
  • DC Ohmmeter, measures unknown resistance with respect to known external resistor or known internal 50 ohms.
  • Board Self-Calibration using the AD584 precision 2.5V reference from the ADALP2000 Analog Parts Kit

Required files:

The ALICE Desktop program is written in Python and if run from the source code requires version 2.7.8 or greater of Python be installed on the user’s computer. The program only imports modules generally included with standard Python installation packages.

Windows:

Windows users who do not wish to install Python and the other required software packages can install the standalone executable from here.

Download Windows installer here:

The installer should include all required packages but not the USB device drivers for the ADALM1000. The drivers can be installed by installing the Libsmu library and clicking on the install WinUSB driver box when prompted. If you encounter any issues, the Visual Studio 2015 runtime library may need to be installed which can be downloaded from this Microsoft web page.

Run the alice-desktop-1.1-setup.exe or alice-desktop-1.2-setup.exe installer program. ALICE desktop opens and saves info and data to various files in the installation directory. Because of user permission issues with some installations of Windows you may need to install the software in a directory other than the default “Program Files”. C:\ALM Software\ would be a good second choice. The installer adds desktop icons for each tool in the suite. Alternatively, under the properties for the icons, you can change the directory the program(s) start in.

Or run ALICE Desktop from the Python 2.7 compatible source code with the following packages installed:

Python 2.7.11 (or higher, 32 bit version recommended)
numpy numerical package extension
libsmu/pysmu

Note: For firmware versions greater than or equal to 2.08 you must run a version of ALICE desktop 1.1 dated on or after 10-4-2016

Linux and OSX:

Most releases of the Linux operating system have Python included and many also include the numpy numerical package as well. Linux ( including Raspberry Pi ) and OSX users must manually compile libsmu/pysmu. Directions on how to manually install Numpy can be found here.

Manually installing libsmu / pysmu and ALICE Desktop Python source

The latest release of the ALICE 1.1 and 1.2 desktop tool set Python source files is available for download:

Version 1.1 Python Source Archive.

Version 1.2 Python Source Archive.

Note: ALICE Desktop 1.1 requires the older 0.89 version of libsmu. The Windows executable contains the proper version of libsmu. To run from source code you need to have version 0.89 installed.
Note: The source code for ALICE desktop 1.2 requires libsmu version 1.0. To run from source code you need to have version 1.0 installed.

To manually install on Windows download either, libsmu-setup-x86.exe or libsmu-setup-x64.exe, depending on your Python installation, from the libsmu page on GitHub. When prompted be sure to select installing pysmu for Python as well.

OS X and Linux users will currently have to compile their own version of libsmu.so from the libsmu source in GitHub. The command(s) to make things are shown in the GitHub Readme. You will also need the development version of python installed (apt-get install python2.7-dev).

Apple Mac OSX users, in addition to or in some cases in place of steps listed on GitHub may need:

Run `cmake -DBUILD_PYTHON=ON -DCMAKE_INSTALL_PREFIX=/usr/local/ .`, for the documented `cmake` step for libsmu on github.
Run dos2unix on the alice-desktop-1.1.pyw script.
Edit alice-desktop-1.1pyw for the #! to point at your homebrew python and not /usr/bin/python.

The last step may be needed to getting rid of “pysmu not found” error. You may also try updating your PATH so homebrew python will be found first and set PYTHONPATH, but possibly not needed.

Raspberry Pi users with Raspbian need to have the Jessie distribution installed which includes the most up to date versions of gcc ( 4.9.2 ) and libusb-1.0-0-dev (apt-get install libusb-1.0-0-dev libudev-dev). As with other Linux OS the command(s) to make things are shown in the GitHub Readme. You will also need the development version of python installed (apt-get install python2.7-dev). Cmake may also need to be installed if it has not been done already (apt-get install cmake).

Manually installing numpy Python extension

For Linux users, numpy might already be part of your Python 2.7 distribution. Otherwise you can download and install numpy through the software / package manager on your particular version of Linux.

For Windows users, there are Windows binary installers that can be downloaded from SourceForge. The latest version may or may not have a Windows binary so you may need to look back one or two version releases to find a Windows binary. As of this writing the newest version with a binary is numpy-1.10.2-win32-superpack-python2.7.exe 2015-12-14. Be sure to download the version for Python 2.7! Note that the developers have only created a Windows binary for 32 bit Python 2.7. Users more familiar with building from source code can download the source archive and use the setup scripts to install ( build ) numpy for their 64 bit version of Python.

Directions:

It is assumed that the reader is somewhat familiar with the functionality and capabilities of the ADALM1000 hardware. For more on the ADALM1000 hardware please refer to the following documents:

ADALM1000 Overview
ADALM1000 Hardware
ADALM1000 Design Document
ADALM1000 Analog Inputs
ADALM1000 Analog Multiplexers
ADALM1000 Digital Outputs
ADALM1000 Low Capacitance FET Input Buffers

The Windows executable installer, in addition to the main ALICE Desktop program, includes the following DC measurement tools:

A few notes on nomenclature used in this document:
CA-V refers to the Channel A voltage signal
CA-I refers to the Channel A current signal
CB-V refers to the Channel B voltage signal
CB-I refers to the Channel B current signal

Main Window:

Be sure that the ALM1000 board is plugged into a USB port before starting the program. Once the program is running the main window, as shown in figure 1, should appear. This is the main desktop window and serves as the Oscilloscope Tool Window as well as controls for opening the other display windows and certain common control functions. It is sub divided into 4 sections.

Figure 1, ALICE Desktop main window

Many of the drop down menus on the main oscilloscope screen and the screens for the other instruments include accelerator keys, indicated by [] around the accelerator keyboard character next to the menu item. Typing one of these characters while the mouse cursor is inside the graphics drawing area will invoke that menu function. For example typing 1 or 2 will toggle on and off the CA-V and CB-V traces.

The Right Side Menu Section

The Green Conn button in the top row indicates that a ALM1000 board is connected and ready to go. If the button is red and says Recon then a ALM1000 board was not found. Connect board and click on the button to connect to board.

The File drop down menu lists commands for saving and loading configuration settings (.cfg file). Save config does not save waveform data. Only the values of the various controls and settings etc. Which windows are open and where they are placed on the computer screen is also saved. When you Exit ALICE the program saves the configuration in a file named “alice-last-config.cfg”. When ALICE is restarted this configuration is reloaded so the program will be set up as it was when last exited. ALICE also has a feature to read an init file that can set the sizes of the graphics display areas and the trace colors etc upon start-up ( see the section at the end of this document on configuring ALICE for more details ).

On most operating systems there is a way to capture a bit map graphic of any of the display windows at any time. Some are built in or done through a support program or application. In Windows:

Press the <alt> and <printscreen> keys to capture the currently selected window in the copy buffer (clip-board). Then start a program such as Word or Paint (any similar program). Use Paste to place the screen shot into your document or drawing etc. Then save that file to disk.

It is possible to save the graphics display area to an encapsulated postscript file (.eps). This is used to save a graphics file to be included in another program like a word processor to write a Lab report. It is also possible to save the captured channel A and B voltage and current signal data to a coma separated values file (.csv). For most Time/Div settings the number of sample points is 2 screen widths with a minimum of 2,000 samples and a maximum of 90,000. This saved table of raw sample values can then be loaded into other programs for analysis such as a spreadsheet program or numerical processing program like MATLAB, or Octave. Similarly, it is possible to load in trace data into the channel A and B voltage and current signal data buffers from a saved csv file. This only works when stopped. If the green Run button is pressed new data is captured over writing the data that was loaded from the file.

The Options drop down menu, figure 2, lists a command for enabling smoothing where spline curves are used to connect the input sample points rather than the default straight lines. A second option for connecting the sample points is to use a zero order hold function where a horizontal line and a vertical line are used. This looks like a stair step waveform much like the output of the Digital-to-Analog converters used to generate the AWG output signals actually produce.

Figure 2, Options Drop Down Menu

The Trace Avg button turns on trace averaging. The number of sweeps to average can be set with the Num Avg button. The width of the traces in pixels can be set with the Trace Width button.

The currently displayed traces will be saved via the Snap-Shot option as reference traces. They can be added to the graphics plot area by selecting the desired trace from the Curves drop down menu for time plots. They will be drawn in a darker color corresponding to the matching live waveform trace.

The Graphics display area can be drawn with either a Black (default) or White background. Use these two buttons to select which is used. The last option button starts the self calibration procedure. See later section for more details.

The CA and CB measure drop down menus, figure 3, list which vertical measurements for the Channel A and B voltage and current signals are to be displayed along the bottom of the graphics display area.

Figure 3, Measurements Drop Down Menu ( CA )

The displayed vertical measurements can be the following:

  • Average, which is the sample by sample sum of the data record divided by the number of samples. For most Time/Div settings the number of samples is 2 screen widths.
  • Minimum, which is the minimum value within the data record.
  • Maximum, which is the maximum value within the data record.
  • Base, used mainly for square waves it is the voltage level of the lower flat portion of the wave which may be different from the Min value due to undershoot.
  • Top, used mainly for square waves it is the voltage level of the upper flat portion of the wave which may be different from the Max value due to overshoot.
  • Midpoint, which is the maximum value plus the minimum value divided by two.
  • Peak-to-Peak, which is the maximum value minus the minimum value.
  • RMS, or True RMS which is the square root of the sum of the sample by sample data record squared divided by the number of samples.
  • CA-CB and CB-CA differences of the Average ( DC ) voltage values of the channels.
  • The true RMS value of the sample by sample difference of the A and B channel voltages (A-B RMS)
  • Display User defined measurement.

The displayed horizontal measurements for the voltage traces can be the following:

  • High pulse width ( time waveform is above the mid-value )
  • Low pulse width ( time waveform is below the mid-value )
  • Duty Cycle ( percent of time waveform is High )
  • Period ( time between 2 rising edges where waveform crosses mid-value )
  • Frequency ( 1 / period )

Figure 3g shows examples of many of the possible waveform measurements. Six of the vertical measurements are derived directly from the waveform data array. These are Avg, Min, Max, Top, Base and RMS. The rest are calculated from these six. P-P is obviously Max – Min. Mid is (Max + Min / 2). CA-CB is CA Avg – CB Avg.

Figure 3g, Measurement examples

The User measurement option allows the user to calculate any other measurements based off these constants. When clicked on the user is prompted for a label to be used while displaying the value and a formula for calculating the value. Clicking on Cancel for either the label or formula turns off the display of the User measurement.

For example the overshoot can be calculated by the formula:

(MaxV1 –VATop)/(VATop-VABase)

A second example would be the gain of a circuit where channel A is considered the input and channel B is the output. The gain would be the ratio of the two P-P values:

(MaxV2-MinV2)/(MaxV1-MinV1)

A third example is to calculate the rms value of just the AC portion of a signal. The ALM1000 inputs only accept positive voltages thus all “AC” signals must have some DC offset. The built-in True RMS calculation includes this DC component. To remove the DC portion and just display the rms value of the AC portion of Channel A you can use the following formula:

math.sqrt(SV1**2 - DCV1**2)

The Crest factor can be calculated which is the ratio of peak-to-RMS values. The crest factor for single frequency sine waves is 1.414 (1/0.707), but can be as high as five or more for random noise. The crest factor for the channel A waveform would be the ratio of the Max and RMS values:

MaxV1/SV1

Another common waveform calculation is the peak-to-average ratio or PAR.

MaxV1/DCV1

Two more examples are to calculate the Peak positive and negative slew rates. The Numpy ediff1d function takes the differences between consecutive elements of an array. We can use this to calculate the dv/dt or the time rate of change between samples. Each sample is 10 uSec apart so we get V/10uS or we can divide by 10 for V/uS or multiply by 100 for V/mS. We can then use the Numpy max or min function to find the positive ( maximum ) slew rate or the negative ( minimum ) Slew Rate using the following formulas:

numpy.max(numpy.ediff1d(VBuffA))*100 or
numpy.min(numpy.ediff1d(VBuffA))*100

We can extend this calculation to estimate the rise and fall times for square wave signals assuming a more or less constant ( peak ) slew rate between the 10% to 90% levels. If we divide 0.8 ( 80% ) times the peak-to-peak value of the waveform by the peak slew rate we get the rise or fall times.

(MaxV1-MinV1)*0.8 / (numpy.max(numpy.ediff1d(VBuffA))*100) or
(MaxV1-MinV1)*0.8 / (numpy.min(numpy.ediff1d(VBuffA))*100)

If the waveform has significant overshoot or undershoot you could alternatively use the VATop and VABase values rather than the Max and Min values.

Waveform calculated Vertical measurement scalars:

DCV1 is the channel A Average voltage
MinV1 is the channel A Minimum voltage
MaxV1 is the channel A Maximum voltage
VATop is the channel A Top voltage
VABase is the channel A Base voltage
SV1 is the channel A RMS voltage
DCV2 is the channel B Average voltage
MinV2 is the channel B Minimum voltage
MaxV2 is the channel B Maximum voltage
VBTop is the channel B Top voltage
VBBase is the channel B Base voltage
SV2 is the channel B RMS voltage
DCI1is the channel A Average current in mA
MinI1 is the channel A Minimum current in mA
MaxI1 is the channel A Maximum current in mA
SI1 is the channel A RMS current in mA
DCI2 is the channel B Average current in mA
MinI2 is the channel B Minimum current in mA
MaxI2 is the channel B Maximum current in mA
SI2 is the channel A RMS current in mA

Waveform calculated Horizontal measurement constants:

CHAHW is the channel A High Pulse Width
CHALW is the channel A Low Pulse Width
CHADCy is the channel A Duty Cycle
CHAperiod is the channel A Period
CHAfreq is the channel A Frequency
CHABphase is the channel A to channel B relative phase angle
CHBHW is the channel B High Pulse Width
CHBLW is the channel B Low Pulse Width
CHBDCy is the channel B Duty Cycle
CHBperiod is the channel B Period
CHBfreq is the channel B Frequency

The Math drop down menu, figure 4, lists which sample point by sample point calculated waveform combining the Channel A and B voltage and current signals is to be displayed vs time.

Figure 4, Math Drop Down Menu

One of the following built-in calculated waveforms can be displayed at a time:

  • CA-V + CB-V, the sum of the channel A and B voltage waveforms
  • CA-V – CB-V, the difference of the channel A and B voltage waveforms
  • CB-V – CA-V, the difference of the channel B and A voltage waveforms
  • CA-I – CB-I, the difference of the channel A and B current waveforms
  • CB-I – CA-I, the difference of the channel B and A voltage waveforms
  • CA-V * CA-I, the product of the channel A voltage and current waveforms which is instantaneous power
  • CB-V * CB-I, the product of the channel B voltage and current waveforms which is instantaneous power
  • CA-V / CA-I, the ratio of the channel A voltage and current waveforms which is instantaneous resistance
  • CB-V / CB-I, the ratio of the channel B voltage and current waveforms which is instantaneous resistance
  • CB-V / CA-V, the ratio of the channel B voltage and channels A voltage waveforms which is instantaneous voltage gain assuming CA-V is input and CB-V is output
  • CB-I / CA-I, the ratio of the channel B current and channel A current waveforms which is instantaneous current gain assuming CA-I is input and CB-I is output

The first three calculations result in voltages and share the corresponding left side voltage scale on the display grid. The two current differences result in a current and share the corresponding right side current scale on the display grid. The two product waveform calculations result in mW and share the corresponding right side scale on the display grid. The two voltage over current waveform calculations result in Ohms and share the corresponding right side scale on the display grid. These calculated waveforms can produce strange looking results for periodic waveforms driving non-resistive loads such as capacitors or inductors. The final two ratio calculations can be used to calculate voltage gain and current gain respectively and are dimensionless.

If Formula is selected then the mathematical formula entered with the Enter Formula button, will be plotted vs time. This allows greater flexibility in waveform plotting at the expense of typing in the function to be plotted. See section on Advanced Math Traces below on how to enter formulas. Any one of the four channel vertical axis controls can be chosen for the Formula axis using the Math Axis button. Generally when plotting using Formula, one or the other of the four channels are not being displayed and its axis controls will be available to be used.

The AWG control Window is opened by default when the program is started. Since all of the displays use the AWGs in some fashion, it is important that this window be available to all. If you dismiss ( minimize to the tool bar ) the AWG control window, clicking on the AWG Window button will bring back the window.

The X-Y Plots Window button opens the X vs Y display window.

The Spectrum Window button opens the Spectrum Analyzer display window.

The Bode Plot Window button opens the Bode Plot display window.

The Impedance Window button opens the Impedance Analyzer display window.

To update the display window for a particular tool ( when running ) the matching Time Plot, X-Y Plot, Freq Plot, Bode Plot and/or Impedance Plot enable check boxes must be selected. More than one display can be selected at a time but some combinations such as X-Y and Spectrum or X-Y and Impedance would not make much sense while Time and X-Y or Time and Spectrum might.

At the bottom of this section, just above the ADI logo, are entry windows which allow input gain and offset adjustments or corrections for any external resistor divider attenuator networks that might be added to the channel A and B inputs ( possibly used when in the high impedance or Split I/O modes ). Save and Load Adj buttons can be found under the File drop down menu. For more on the use of input attenuators please refer to the following two documents:

M1K Analog Inputs
M1K Breadboard Adapters

The Top Menu Section

The menu section along the top contains various buttons and drop-down menus that control Oscilloscope Triggering, Horizontal time base, Horizontal position, how and what signals are displayed, and run acquisition looping / stop acquisition looping / exit program.

The Trigger button is a drop down menu listing which signal to trigger on, CA-V, CA-I, CB-V, CB-I or none. The use of Triggering to display a stable trace is generally only necessary when viewing externally generated signals. When viewings internally generated signals from one or the other of the AWG channels a stable trace happens automatically in that the beginning of the AWG output waveform is restarted at the same point at the start of each time sweep.

The Auto Level option automatically sets the trigger level to the selected waveform midpoint on each sweep. The trigger point will thus track any changes in the input waveform. The Single shot option allows a single sweep to be captured each time the Run button is clicked.

The Edge button is a drop down menu listing either the rising or falling edge for triggering. The Trigger Level entry window contains the trigger level in volts for CA-V and CB-V or mA for CA-I and CB-I. The 50% button sets the trigger level to the midpoint (50% point) of the selected trigger waveform. i.e. to the (maximum + minimum)/2.

The Hold Off entry window, in mS, is used to shift the horizontal position ( apparent time 0 start point ) within the acquired sample point buffers being displayed. The data used for the vertical and horizontal waveform calculations is also shifted by that amount. The sample buffer is generally two screens long so setting the hold off time to more than one screen width is not recommended. This is mainly used when synced to the AWG. Due to the discontinuous nature of the AWG outputs this allows the user to skip over any initial transients that might appear if the system being measured has “inertia” or “state” that needs to settle out. Alice (Python) only supports discontinuous mode right now so the AWG outputs turn off and go into a high impedance state between sweeps.

The Horz Pos entry window is used to change the horizontal position of the time trace. Normally, with the Horz Pos set to 0 the left edge of the grid is “time 0”. Setting Horz Pos to something else shifts the 0 time point on the grid by that amount ( in mSec ). So if you set Horz Poss to a negative number for example you can see time before the trigger.

The Time mS/Div spinbox entry window is used to set the horizontal time base in the standard 1, 2, 5 step increments. Other values maybe entered manually.

The Curves button allows the selection of which signal waveforms will be displayed when plotting vs time. The All button selects all four curves to be displayed and the None button clears all four curves. It is also possible to select which of the possible stored reference time traces, if saved via the Snap-Shot option, will be displayed.

The green PWR-On button toggles on and off the fixed analog +2.5 V and +5 V power supplies. The button turns red when the supplies are off. The power supplies do not turn completely off but go to around +2 V and can supply only about 20 mA when shorted to ground. This is much less than the 200 mA or so they could supply if accidentally shorted when on. It is good practice to turn off the supplies ( or better yet disconnect them ) when making any modifications to the circuit under test.

The green Run button starts continuous looping acquiring input samples. The red Stop button stops or pauses the acquisition looping. The Stop button also serves as a sort of refresh button. If the Stop button is clicked when stopped the graphics display is redrawn using any new settings that might have changed but using the existing data buffers. The Exit button exits (kills) the program.

The Bottom Menu Section

The menu section along the bottom contains the range ( V/Div, mA/Div ) and position controls for the Channel A and B voltage and current waveform displays. The entry labels are color coded to match the waveform trace colors. The V/Div and mA/Div spinboxs set the corresponding vertical ranges in the standard 1, 2, 5 step increments. Other values maybe entered manually. The position entry windows determine the vertical position of their scales with respect to the blue center line on the grid. That is to say the value entered corresponds to the number displayed next to the blue center line.

The Graphics Display Area

The graphics display area, show in figure 5, is where the various signal waveforms are plotted on either a black or white background depending on which is selected under the Options drop down. It consists of a main 10 by 10 grid with the center vertical and horizontal grid lines drawn in dark blue. Each major grid is sub divided into 5 sub grids by the short tick marks along the blue center lines. The horizontal grid lines are labeled with color coded text to match the corresponding waveform trace with the voltage scales on the left and current scales on the right.

The red triangle, drawn on the left side in the example shown because the trigger input is set to CA-V indicates the trigger level.

Above the main grid area is a line of text showing the device ID and Sample rate and if the acquisition loop is running or stopped. Below the main grid are three lines of text which display various information about the displayed plots. The first line shows the current time per division setting and the horizontal position of the left most grid line with respect to 0 time i.e. the trigger point.

The second and third lines of text are for displaying information related to Channel A and Channel B respectively. The selected V/Div is displayed along with any of the vertical measurements selected for that voltage channel. If a current waveform is being displayed the selected mA/Div is displayed along with any of the vertical measurements selected for that current channel.

Figure 5 Graphics display area

Grid Markers and Cursors

While stopped (red Stop button clicked) if you left click anywhere within the display grid a numbered marker “x” point will appear at that position. In the upper left corner of the display grid the maker number along with the vertical ( voltage or current ) and horizontal ( time ) values will also appear. For marker points > 1 the vertical and horizontal delta to the previous point will also be displayed. Clicking the red Stop button again will clear the markers. Clicking on the green CA-V/Div, cyan CA mA/Div, orange CB-V/Div or yellow CB mA/Div buttons along the bottom of the main Time display window will select which vertical range / position axis will be used and the marker will be drawn in that color.

Under the Curves Drop down menu there are selectors for displaying the T cursor ( time ) and V cursor ( voltage ). When selected if you right click anywhere within the display grid either a vertical or horizontal cursor line, or both, will be drawn at that location. The vertical, horizontal, or both values for that point will be displayed. Scrolling with the mouse wheel will move the vertical line left–right when only the T cursor is selected and the horizontal line up-down when only the V cursor is selected. When both are selected the mouse wheel moves the vertical line left–right. With the Shift key pressed the mouse wheel will move the horizontal line up-down.

Advanced Math Traces

In addition to the pre-programed Math traces, ALICE Desktop provides a method of plotting user defined equations or formulas using the voltage and current waveform buffers for channels A and B. The formulas are written in conventional Python syntax which is basically the same as you would expect to write any math expression. Any of the Python math ( and numpy ) module functions can be used such as math.sqrt() or math.sin() etc. Any of the ALICE global variables can be used but below is a list of the most useful available variables and constants:

Waveform Buffers:

VBuffA is the Channel A voltage sample array ( in volts )
VBuffB is the Channel B voltage sample array ( in volts )
IBuffA is the Channel A current sample array ( in amps, multiply by 1000 for mA )
IBuffB is the Channel B current sample array ( in amps, multiply by 1000 for mA )
VmemoryA is the Channel A voltage memory array used for Trace Averaging
VmemoryB is the Channel B voltage memory array used for Trace Averaging
ImemoryA is the Channel A current memory array used for Trace Averaging
ImemoryB is the Channel B current memory array used for Trace Averaging
AWGAwaveform is the Channel A AWG waveform memory array (used for non-built in waveforms)
AWGBwaveform is the Channel B AWG waveform memory array (used for non-built in waveforms)
t is the time index ( 10 uSec per point )
SAMPLErate is the sampling rate, 100000 samples per Sec, or 10 uSec per sample

Vertical Position variables:

CHAOffset is the value in the channel A voltage position entry window
CHBOffset is the value in the channel B voltage position entry window
CHAIOffset is the value in the channel A current position entry window
CHBIOffset is the value in the channel B current position entry window

As a simple example, to plot the difference between the channel A and B voltage waveforms the following formula would be used:

(VBuffA[t] - VBuffB[t] - CHAOffset)

As the program iterates over the time index t, the channel B voltage value is subtracted from the channel A voltage value and then offset on the screen by the channel A position variable. This replicates the built-in math trace CA-V – CB-V.

A more advanced example calculates the time derivative of the channel B voltage waveform, or slew rate, and scales it to V/mSec:

(VBuffB[t] - VBuffB[t-1] ) * 100

Again as the program iterates over the time index t, the channel B voltage value at t-1 is subtracted from the channel B voltage value at t and then multiplied by 100. The 100 scales the time from the 10 uSec per time sample to 1 mSec. The screen shot in figure 6, shows the result for a 4 V p-p triangle wave at 1 KHz. Since we are not displaying the channel B current we can use its settings as the vertical axis for the math trace by setting the Math Axis to I-B. The orange triangle wave changes 4 V in 500 uS for a slew rate of + and – 8 V/mSec shown with the magenta Math trace.

Figure 6, Calculating the slew rate

A few words of caution, care must be taken when writing the formula to not cause a Python syntax error or other math exception such as divide by zero. If you make a mistake ALICE will stop and put up the math formula entry window so you can find and correct your mistake.

AWG Controls Window:

The AWG controls window is shown in figure 7.

Figure 7 AWG Controls window

There are two identical sets of controls for configuring the Channel A and B outputs. First there is a drop down menu for selecting the Mode, figure 8. The SVMI option is for sourcing voltage / measure current. The SIMV option is for sourcing current / measure voltage. The Hi-Z option disables the generator output (High Impedance mode). The default at start-up is that both channels are in Hi-Z mode. The Split I/O option separates the generator output signal from the voltage measurement input. In the Rev D version of ALM1000 hardware only the source current function operates when the output and input are on separate pins so the Split I/O option automatically puts the hardware into the source current configuration. To turn the sourced current into a voltage the output termination options can be used. The hardware includes two 50 Ohm resistors that can be connected to the generator output pin. One resistor is tied to ground and the other is tied to the 2.5 V power supply. The drop down menu provides three options Open, To GND, and To 2.5V. If you are just looking at voltage in SVMI mode there should be no noticeable change in the voltage waveform. The current waveform should change to reflect the current now flowing into the resistor. If you are in SIMV then the resistors can act as current to voltage converters.

Figure 8, AWG Modes drop down menu

The Min and Max entry windows program the minimum and maximum values for the output waveform. When in the source voltage mode the values are in Volts, when in source current mode the values are in mAmps. If the value entered in the Min window is higher ( more positive ) than the value entered in the Max window the apparent phase of the output wave is inverted. While this is somewhat redundant for the Sine, Triangle and Square wave shapes, given the Phase control described later, it is useful for determining if the Sawtooth or Stairstep shapes are rising or falling ramps.

The Freq entry window programs the frequency of the waveform in Hertz. Given the 100KSPS maximum sample rate, the maximum possible frequency is, by definition, 50 KHz but the practical upper limit is more like 20 KHz or less.

The relative timing between the two AWG channels can be set as either a phase angle or delay in time. The Phase and Delay buttons choose between the two methods. The entry window programs either the phase of the output waveform in degrees from 0 to 360 or the time delay in mSec. The % entry window only applies to the Square shape and programs the duty cycle in percent from 0% to 100%.

The 0.89 version of the low level ALM1000 software library used in ALICE 1.1 only outputs the signals as single bursts each sweep when the analog signals ( voltage and current ) are being generated. The analog outputs will enter the high impedance state ( Hi-Z ) between sweeps and when the program is stopped ( Red Stop button pressed ). The 1.0 version of the low level ALM1000 software library used in ALICE 1.2 supports outputing the signals as single bursts each sweep or as continuous streams when the analog signals ( voltage and current ) are being generated.

With the Sync AWG check box in either version the outputs are produced in sync with the analog trace sweeps. In version 1.1 if the Sync AWG check box is not checked the outputs are in Hi-Z mode. In version 1.2 if the Sync AWG check box is not checked the outputs stream continuously.

The Shape drop down menu is used to select the shape of the output waveform. There are 6 built in waveform shapes, DC, Sine, Triangle, Sawtooth, Square, and a 10 level Stair Step. When DC is selected the constant value of the output voltage or current is set by the value in the Max entry window.

Figure 9, AWG Shapes drop down menu

Wave Shapes below the line separator in the menu use the AWGAwaveform or AWGBwaveform array buffers to contain the waveform sample data points. A new data set based on the entered values is generated each time the button is clicked. The Impulse, Trapezoid, U-D Ramp, UU Noise ( uncorrelated uniform distribution ) and UG Noise (uncorrelated gaussian distribution ) buttons are used to build waveform arrays based on user input parameters.

The basic shape of the Impulse waveform is shown in figure 10. The Max, Min, Freq, Phase and Duty-Cycle values are used to construct the waveform. The Freq setting determines the Period ( 1/Freq ) or spacing between the pulses. The output starts and ends at a value midway between the Min and Max values. The impulse consists of a positive peak followed by a negative peak. The width of the peaks are equal to (Period * DutyCycle)/ 2. The center of the pulse is delayed by the Phase setting. For example if the phase is set to 180 then the pulse is delayed by ½ the Period (Phase/360).

Figure 10, Impulse waveform

The Trapezoid waveform makes a pulse with a rise and fall time set by the number of mSec entered in the delay entry slot. The Min, Max, Freq, and Duty-cycle entries operate as in the Square Shape.

The U-D Ramp ( ramp up ramp down ) shape is much like the triangle shape except that the Duty-cycle entry sets the symmetry of the up and down ramps. For example if the Duty-cycle is set to 25% the wave will ramp up from Min to Max for 25% of the Period ( 1/Freq ) and then ramp down from Max to Min for 75% of the period.

The Fourier Series shape builds a waveform based on the Fourier series of cosines for a square wave. The number of odd harmonics of the fundamental, is entered in the % entry slot which changes to Harmonics when in Fourier shape mode. The minimum and maximum values of the fundamental are set using the Min and Max entries and the fundamental frequency is set using the Freq entry. Entering 1 for the number of harmonics will result in just the cosine wave at the fundamental frequency. Entering 3 for the number of harmonics will include the third harmonic, entering 5 for the number of harmonics will include the third and fifth harmonics and so forth. More information on this can be found in the Advanced Users Guide.

There are two Noise like waveforms that can be generated. A new data set is generated each time the button is clicked. That fixed data pattern is then send to the output each time sweep. UU Noise or uncorrelated uniform distribution is made using a random number with a uniform distribution between the Min and Max settings. The average value of the noise should be equal to Max+Min/2. UG Noise or uncorrelated Gaussian distribution is made using a random number with a Gaussian distribution centered on Max+Min/2 with a sigma of (Max-Min)/3.

Waveform data point values can be read in from a simple single column csv text file ( one row per time sample ) by clicking on the Read File button. For voltage waveforms the values can be decimal numbers ranging from 0 to 5 in volts. For current waveforms the values can be decimal numbers ranging from -0.2 to 0.2 in amps. If the .csv file contains more than one column the user will be prompted to choose which column number to import. The contents of the Min, Max, Freq, Phase and % entry slots are not used for wave shapes input from a file. Use the Custom Math Waveforms feature below to change the amplitude and offset of the waveform. The contents of the AWG A or B waveform arrays can be saved to a csv file by clicking on the Save File button.

Waveform data point values can also be read in from an audio file in .wav format, 16 bit data. The sample rate is assumed to be 100 KSPS. Mono files can be read into either the AWG A or AWG B waveform buffers. To read a stereo file use the Read WAV File button for AWG A. The Left channel will be loaded into AWG A and the Right channel will be loaded into AWG B. The 16 bit integer data is scaled and offset to fit within the 0 to 5 V range of the ALM1000. Up to 90,000 sample points ( 900 mSec ) will be loaded. The open source audio program Audacity is a good option for generating and editing wave files.

A small library of example waveform files can be downloaded HERE.

If the number of sample points in the waveform array is less than the time sweep the output of the AWG will continuously output the last sample value in the array until the end of the sweep. To repeat the data samples in the waveform array for longer time sweeps click on the Repeat option button.

Custom Math Waveforms

In addition to the built-in AWG wave shapes, ALICE Desktop provides a method of generating user defined wave shapes from equations or formulas using the AWG waveform buffers for channels A and B. The formulas are written in conventional Python syntax which is basically the same as you would expect to write any math expression. As with the Math plotting, any of the ALICE global variables can be used. Only difference is that the time increment variable (t) is not used. Care must be taken if the lengths of any arrays being used in the expression are of differing lengths. As a reminder the length of the waveform array(s) will be displayed below the % entry slot if the array for that AWG channel has been generated. The following example Python syntax allows setting the start and stop points to be used in the array:

AWGAwaveform[ start : stop ] where start and stop are integers.

For example to copy the CH A captured data from the VBuffA array to the AWGBwaveform array you would simply click on the Math option under the AWG B Shape menu and type VBuffA as the formula, as in figure 11.

Figure 11, Enter AWG waveform formula

As a more complex example let’s say we want to add noise to a waveform that was read from a file. The first step is to read the data into the AWGAwaveform array. The waveform chosen for this example is 8000 samples long and is a full wave rectified sinewave that is 1 V p-p, from 1.25 V to 2.25V. Then generate a noise waveform in the AWGBwaveform array by setting the AWG B Min and Max values to the desired amplitude of the noise ( 0.1 V in this example ) and the Freq ( 12.5 Hz or 80 mSec ) such that the period of the noise will be as long as the waveform in AWG A ( length = 8000 points ). Click on either UU Noise or UG noise. Now click on the Math shape button in AWG B and enter the following formula:

AWGAwaveform + AWGBwaveform + 1.25

The resulting output wave shapes are shown in figure 12. The CH A trace shows the shape as read in from the file. The CH B trace shows the calculated wave shape with the added noise and offset.

Figure 12, Math wave shape example

DC Example:

To demonstrate how to use the Oscilloscope Tool as a DC voltmeter consider the resistor voltage divider network, shown in figure E1. We wish to measure the voltages at the 4 nodes and the voltages across the 6 resistors. In the figure the nodes are numbered from N0 to N4 with N0 being the ground or common node that all the voltage measurements will be made with respect to. With the Oscilloscope Tool we can measure two node voltages at a time and the voltage difference between those two nodes. Set both AWG channels to Hi-Z mode in the AWG control window and from the Meas CA menu select from the –CA-V- section the Avg and CA-CB check boxes. Likewise from the Meas CB menu select from the –CB-V- section the Avg and CB-CA check boxes.

Figure E1, Test resistor network, measuring nodes N1 and N2

We start with the network powered from the fixed +5 volt power supply at node N1 and the channel A input also connected to N1. The channel B input is connected to node N2. Click on the Run button and the N1, N2 node voltages will be displayed along with the difference between them as CA-CB and CB-CA. We can now proceed around the network measuring pairs of nodes until we can fill out table 1 below. Figure E2 shows the voltmeter inputs connected to nodes N3 and N4. Any combination of two nodes can be measured and the voltage difference between the two nodes will be displayed.

Figure E2, Test resistor network, measuring nodes N3 and N4

NodeVoltage
N00.00
N14.931
N23.958
N31.770
N40.779

Table 1 Node voltages

From the measured node voltages ( and the difference voltages ) we can get the voltages across the 6 resistors shown in table 2.

ResistorVoltage
R1N1 – N2 =0.972
R2N2 – N0 =3.958
R3N2 – N3 =2.188
R4N3 – N4 =0.991
R5N4 – N0 =0.779
R6N2 – N4 =3.179

Table 2 Resistor voltages

From these voltages and the values of the resistors the currents through the resistors can be calculated.

The X-Y Plotting Tool:

When the X-Y Plot Window button is clicked in the Main Window the X-Y display Window should appear, as shown in figure 13. It is sub divided into 3 sections.

Figure 13, X-Y Plots window

The menu on the right allows selection of which of the four possible input channel waveform signals or Math formula is to be used for the X and Y axis. Given four possible signals, Channel A voltage and current, Channel B voltage and current, there are in theory 16 possible combinations for X and Y. Not all 16 have been implemented since, for example, plotting a signal vs itself such as CA-V vs CA-V is a rather meaningless straight line.

Under the -X Axis- heading there are two options to display the histogram of either the channel A voltage or the channel B voltage waveforms. The horizontal axis is in volts and controlled by either the CA or CB V/Div and V Pos controls. The vertical axis is the histogram count or number of hits at a given voltage level. The vertical axis scale is controlled by the CA or CB mA/Div control.

It is also possible to select Math on one or the other or both axis. If Math is selected for just one axis then the selected trace from the Math drop down menu is used. Only a few of the built-in Math traces are supported. If Math is selected for both axis then the entered X formula and Y formula, using the Enter X or Y Formula buttons, will be plotted. This allows greater flexibility in X-Y plotting at the expense of the typing in the function to be plotted. See the earlier section on how to enter Advanced Math Traces for the Oscilloscope display. The same applies here to the X and Y formulas.

Any one of the four vertical axis controls can be chosen for the X and Y axis using the Math X or Y Axis buttons. Generally when X-Y plotting using Math one or the other of the four channels are not being displayed and its axis controls will be available to be used.

The X-Cur and Y-Cur check boxes select vertical and horizontal cursor lines which operate much the same as the T and V cursors in the Time display grid.

There is also a check button to display the saved X-Y reference trace (see note above in Oscilloscope section on Snap-Shot option).

Oscilloscope and X-Y Plot Examples:

To demonstrate some of the features of the ALICE Oscilloscope and X-Y Plot Tools the following example circuit is offered. In figure E3 we see a simple NPN transistor ( 2N3904 ) in the common emitter configuration with a 100 KΩ resistor used to bias the base and a 1 KΩ resistor as the collector load. The collector load is supplied from the fixed +5 V power supply. We will use the ALICE software to plot IB vs VBE. We will also determine the value of CA-V corresponding to IC = 2 mA and then measure the input to output voltage gain around that operating point.

Figure E3, NPN common emitter amplifier

To plot VBE and IB we first start out with the channel B input (CB-V) connected to the base of the transistor. As the formula in figure E3 states, IB can be calculated by taking the difference of CA-V and CB-V and dividing by the 100 KΩ resistor value. 100 KΩ is chosen to simplify the calculations so that the current is found by just moving the decimal point of the measured voltage ( i.e. 1 V = 10 uA ).

Set up the AWGs as follows: Channel A, Mode set to SVMI, Shape set to Triangle, Min set to 0.0, Max set to 5.0, Freq set to 100. Channel B Mode set to Hi-Z. Be sure that the Sync AWG box is selected.

The time base should be set to 0.5 mSec/Div so that the rising half cycle from 0 to 5.0 volts will fill the grid. Set the Hold Off to 10 mSec so the start of the second cycle will be displayed. Under the Curves menu select CA-V and CB-V. Under the Math menu select CAV - CBV.

Press the green Run button. You should see something like figure E4.

Figure E4, VBE and IB plot

The green CA-V trace is the 0 to 5 V ramp that is being applied to the 100 KΩ resistor. The orange CB-V trace is the voltage on the base of the transistor or VBE. The magenta CAV-CBV math trace is the voltage across the 100 KΩ resistor and represents IB as 10 uA/V.

Pause or Stop the program ( red Stop button )

To make an XY plot of IB vs VBEopen the X-Y Plot Window and check the X-Y Plot box. In the X-Y Display window press the CB-V button in the -X Axis- section and the Math button in the -Y Axis- section. In the X-Y Window set the CB V Pos entry to 0.5 and the CB V/Div to 0.1. Press the green Run button. You should see something like figure E5.

Figure E5, IB vs VBE

The base current is very small when VBE is less than 0.6 V so there is likely to be noise in that part of the trace. Remember that the vertical voltage scale ( 0.5 V/Div ) is divided by the 100 KΩ resistor so it is 5 uA per division.

To plot the collector current move the Channel B input to the collector of the transistor. Now we need to go back to the time display window. Uncheck the X-Y Plot box and make sure the Time Plot box is checked. Under the Math menu select none for now.

Press the green Run button. You should see something like figure E6.

Figure E6, VCE plot

To turn the plot of VCE into IC we can use the gain and offset adjustment equation for channel B to calculate the equation for IC in figure E3. The “adjustment” equation is as follows:

V_dis = (V_raw – Offset )*Gain

Where:
Vdis is the “adjusted” ( scaled by some gain factor ) value to be displayed
Vraw is the measured value
Offset is the “adjustment” value entered for offset
Gain is the “adjustment” value entered for gain or scale factor

If we set the Offset equal to the actual value of the +5 V supply divided by the Gain adjustment (1.0) factor and change the sign of the Gain factor ( i.e. make it -1.0) we have the formula for IC from figure E3. After changing the channel B offset and gain factors press the green Run button and you should see something like figure E7.

Figure E7, IC plot

IC should be nearly zero where CA-V is less than 0.6 V. You may need to tweak the Offset factor to get IC to be exactly on the 0.0 grid line. An easy way to check this is to temporarily move the channel B input to the +5 V power supply. Now the difference between CB-V and the supply is exactly zero.

Remember that the vertical voltage scale ( 0.5 V/Div ) is divided by the 1 KΩ resistor so it is 0.5 mA per division. With the program paused, under the Options menu press the SnapShot button. This saves a copy of the displayed CA-V and CB-V traces. Under the Curves menus select RB-V. This will now display the saved IC plot.

Now move the channel B input back to the base of the transistor. Under the Math menu select the CAV-CBV math trace. Reset the Channel B Offset and Gain calibration factors to their normal values. Press the green Run button. You should see something like figure E8.

Figure E8, IC, IB and VBE plot

Now we have plots of IC ( dark orange ), IB ( magenta ) and VBE ( orange ) on the same grid as the base resistor bias CA-V is swept from 0 to 5 V ( green ).

Under the Curves Menu select the V cursor. Right click on the dark orange IC curve where it crosses the 1200uSec time grid. The voltage value at that point will appear next to the horizontal cursor line. The Use the mouse wheel it adjust the cursor up or down so it lines up exactly where the IC curve cross the time grid line. It should look like figure E9.

Figure E9, voltage cursor added.

The beta of the transistor can now be calculated by scrolling the cursor down till it lines up exactly where base current (magenta trace) at the same time grid line. The displayed voltage will represent the base current. Beta will be IC / IB. For this example IB is about 13 uA so beta will be around 154. The CA-V value where the green trace crosses the same Time Grid as IC = 2 mA should correspond to the base bias point where IC is equal to 2 mA. This is the bias point we would like to center our input signal on for the next measurement of the amplifier gain.

Move the channel B input back to the collector of the transistor.

Calculate new Min and Max values for Channel A by adding and subtracting 0.25 V to the 2 mA bias point we just measured. Enter these for Channel A. Set Channel A mode to sine wave. Under the Curves menu turn off the RB-V trace and under the Math menu select none. Set the time base to 2.0 mS/Div and the Hold Off to 0.0 so that two cycles of the input waveform are displayed. Under the Meas CA and CB menus in the -CA V- and -CB V- sections select Avg and P-P to be displayed.

Press the green Run button. You should see something like figure E10.

Figure E10, Amplifier input / output gain

The DC average of the output waveform should be at about 2 V ( 2 mA in the collector load resistor ) below the +5 V power supply or about +3 V. The voltage gain of the amplifier will be the Channel B P-P value divided by the Channel A P-P value. Which for this example is about 1.5.

The Spectrum Analyzer / Bode Plotter:

Window Setup:

When the Spectrum window button is clicked in the Main Window the Spectrum display Window should appear, as shown in figure 14. It is sub divided into 2 sections.

Figure 14, ALICE Desktop spectrum analyzer window

The menu buttons:

The following sections cover the functions of the various menu buttons. All of the program controls can be found under the buttons, there are no scrollbars, or rotating knobs.

File drop down menu

Save Config Load Config, commands for saving and loading configuration settings (.cfg file).

Save Screen, command for saving the graphics display area to an encapsulated postscript file (.eps)

Save Data, command for saving the captured channel A and B amplitude vs frequency data to a coma separated values file (.csv). The amplitude data can be saved as magnitude in Vrms ( type a 0 ) or in dBV ( type a 1 ).

Options drop down menu

Smooth, an option to enabling smoothing where spline curves are used to connect the FFT frequency points rather than the default straight lines.

Cut-DC, an option that will remove the DC component from the sampled data record. It element by element subtracts the average value of the sample record.

Store trace, no explanation required, you can store a reference trace with it.

Button to select the number of vertical divisions on the grid. With the Zero Stuff button, you can input the desired Zero Stuffing factor (power of 2).

Run, Stop

Start and stop buttons for the sweep.

Mode drop down menu

In Normal mode the trace is continuously refreshed.

In Peak hold, the peak or maximum value for each frequency bin is remembered. For each sweep if the new value is higher, then that new data point of the trace is saved and displayed.

In Average mode, the trace values are averaged. This smooths out the randomness in the noise floor.

In Single Shot mode a single sweep is obtained each time the Run button is pressed.

FFT window drop down menu

Used to select an FFT window function. It is generally better not to select the “Rectangle window” or no window. This window has a poor dynamic range due to the high side bands that are generated with no weighting function in the FFT calculation. The Flat Top window gives the highest amplitude accuracy but also has a large bandwidth, so less selectivity.

Samples +/- buttons

Used to change the number of samples in the FFT calculation. This number has to be a power of 2. More samples provides higher frequency resolution but a slower update rate for the screen. Fewer samples provides a lower frequency resolution, but a faster update rate for the screen.

Curves drop down menu

The Curves button allows the selection of which signal waveforms will be displayed. The All button selects all four curves to be displayed and the None button clears all four curves. The Marker option turns on a text marker which displays the amplitude and frequency at the peak of the displayed signal. Options to display the difference ( subtraction ) of the CA-dBV – CB-dBV traces or the CB-dBV – CA-dBV traces. It is also possible to select which of the possible stored reference traces, if saved via the Store trace option, will be displayed. The color of the CA-dBV and CB-dBV traces will turn red if the input signal goes beyond the 0 to +5 V analog input signal range.

Under the Curves Drop down menu there are selectors for displaying the F cursor ( frequency ) and dB cursor ( amplitude ). When selected if you right click anywhere within the display grid either a vertical or horizontal cursor line, or both, will be drawn at that location. The vertical, horizontal, or both values for that point will be displayed. Scrolling with the mouse wheel will move the vertical line left–right when only the F cursor is selected and the horizontal up-down when only the dB cursor is selected. When both are selected the mouse wheel moves the vertical line left–right.

Startfreq and Stopfreq

Used to set the start and stop frequency of the display.

Lin F and Log F selector

Select linear or logarithmic horizontal frequency axis scale.

dB/div +/- buttons

Used to set the dB’s per division. Can be 1, 2, 3, 5, 10, 15, or 20 dB/Div.

LVL +/- buttons

Used to set the top line of the grid or reference level. Sometimes called the “sensitivity”. 0 dB is equal to an input amplitude of 1 Vrms.

The Bode Plotter:

Window Setup:

When the Bode Plot window button is clicked in the Main Window the Bode Plot display Window should appear, as shown in figure 14B. It is sub divided into 2 sections.

Figure 14B, ALICE Desktop Bode plot window

FFT window drop down menu

Used to select an FFT window function. It is generally better not to select the “Rectangle window” or no window. This window has a poor dynamic range due to the high side bands that are generated with no weighting function in the FFT calculation. The Nuttall window function is set by default and is generally the best overall option. The Flat Top window gives the best amplitude accuracy but can have strange phase results at some frequency steps.

Curves drop down menu

The Curves button allows the selection of which signal waveforms will be displayed. The All button selects all four curves to be displayed and the None button clears all four curves. The Marker option turns on a text marker which displays the amplitude and frequency at the peak of the displayed signal. Options to display the difference ( subtraction ) of the CA-dBV – CB-dBV traces or the CB-dBV – CA-dBV traces. It is also possible to select which of the possible stored reference traces, if saved via the Store trace option, will be displayed. The color of the CA-dBV and CB-dBV traces will turn red if the input signal goes beyond the 0 to +5 V analog input signal range.

Under the Curves Drop down menu there are selectors for displaying the F cursor ( frequency ) and dB cursor ( amplitude ). When selected if you right click anywhere within the display grid either a vertical or horizontal cursor line, or both, will be drawn at that location. The vertical, horizontal, or both values for that point will be displayed. Scrolling with the mouse wheel will move the vertical line left–right when only the F cursor is selected and the horizontal up-down when only the dB cursor is selected. When both are selected the mouse wheel moves the vertical line left–right.

Lin F and Log F selector

Select linear or logarithmic horizontal frequency axis scale. This also determines how the frequency steps are spaced, linearly or logarithmically.

dB/div +/- buttons

Used to set the dB's per division. Can be 1, 2, 3, 5, 10, 15, or 20 dB/Div.

LVL +/- buttons

Used to set the top line of the grid or reference level. Sometimes called the “sensitivity”. 0 dB is equal to an input amplitude of 1 Vrms.

Sweep Generator

Under the Sweep Gen section are controls for generating frequency sweeps of the analog output sources. The screen is up-dated after each frequency step. First are radio buttons to select which AWG output channel, or none will be swept. When using the Bode plotter the selected AWG will be forced into SVMI mode with a Sine Shape. Use the AWG controls window to set the source amplitude. The other channel will be forced into Hi-Z mode. The selected output will be swept from the Start Frequency to the Stop Frequency. The number of steps can be set using the Sweep Steps entry.

The amplitude of the swept source is generally held constant across frequency but in some special cases it might be desirable to change the source amplitude at each frequency step. Checking the Sweep From File check box will prompt the user for a .csv file. The csv file should contain two columns of values one row for each frequency amplitude combination for the sweep. The first column should contain a monotonically increasing list of frequency steps in Hz. The second column should contain the corresponding amplitude value in dB. The Start, Stop and number of Steps will be filled in based on the contents of the file. After reading in the csv file the program will display the highest ( maximum ) amplitude value found and ask the user to input the desired maximum the values should be normalized to. This is done because the ADALM1000 has an upper limit to the range of output amplitudes ( around +4.5 dBV ). Also it might be useful to scale the amplitude values up or down to optimize the dynamic range of the swept signal.

Lastly, there is a radio button selector for single or continuous sweep. The frequency sweep is started, or restarted from the beginning each time the Run button is pressed.

Frequency Analysis:

The ALICE Desktop program uses the Fast Fourier Transform (FFT) to produce the frequency spectrum of a set of time samples of the input signals. The FFT takes as an input a set of time samples at a given sample rate and produces a set of frequency samples or values from DC ( 0 Hz ) to one half of the sampling frequency. In the case of the ALM1000 the sample rate is fixed at 100 KHz so the highest frequency will be one half of that or 50 KHz. The number of individual frequency bins the FFT produces is one half the number of time samples that are used. So the width of the bins or frequency resolution will be 50 KHz divided by one half the number of time samples taken. The number of time samples can be set from 64 ( 26 ) to 65536 ( 216 ) in the program.

What is an FFT window function?

In ALICE Desktop you can choose from a number of FFT window functions. But what is an FFT window and what is it doing? The principle is very simple. The program reads a number of samples from the ALM1000 and puts them in an array. The size of the array has to be a power of 2 for the FFT calculation, for example 2048. With no window weighting function, all samples have an equal contribution or weight in the FFT calculation. You should expect to have an optimal result, but that is not the case if there is not an exact number of repeating cycles in the array. Another way of thinking about this is the starting value of the time waveform must be the same as the ending value. The end of the waveform will line up with the beginning if wrapped around on itself. This will almost never be the case in actual practice.

An FFT windowing function weights the samples from the beginning of the array to the end. With higher weights at the center and weights closer to zero near the start and end. The samples at the beginning and at the end of the array, that probably don’t line up, hardly contribute to the FFT calculation. Why would we use a only part of the samples or even not at all? There are even FFT window functions in which some sample points counteract with the other sample points.

The reason why we need an FFT window can be seen figures 15-22 in the various spectrums using different FFT window functions. No FFT window (also called a Rectangular window), generates many side bands in the spectrum of the FFT calculation. That is very visible in the first spectrum plot of the Rectangular ( dark orange ) and Cosine ( light orange ) window functions. Very low amplitude signals close to the main signal cannot be measured. So the dynamic range around the large main signal is low. By using an FFT window, the side bands are much more attenuated, how much depends on the type of FFT window. The increased side band suppression is at the expense of the selectivity. FFT windows with a very high side band suppression and therefore a very high dynamic range, have much less selectivity.

Figure 15, Rectangular vs cosine window function

A Cosine window is a good compromise between a good selectivity and a good dynamic range.

Figure 16, Rectangular vs Triangle window function

Figure 17, Rectangular vs Hann window function

Figure 18, Rectangular vs Blackman window function

Figure 19, Rectangular vs Nuttall window function

At the expense of a little wider bandwidth the Nuttall window function provides the best side band reduction and may be the optimal compromise between good selectivity and good dynamic range.

Figure 20, Rectangular vs Flat Top window function

A special filter is the Flat Top filter. It has a flat top as the name implies. That is why it is very usable for accurate amplitude measurements. The peak of the signal does not have to be exactly on the center of an FFT frequency bin.

ALICE Desktop has 7 built in windowing functions.
Rectangular, no window function B=1
Cosine window function, medium-dynamic range B=1.24
Triangular non-zero endpoints, medium-dynamic range B=1.33
Hann window function, medium-dynamic range B=1.5
Blackman window, continuous first derivate function, medium-dynamic range B=1.73
Nuttall window, continuous first derivate function, high-dynamic range B=2.02
Flat top window, medium-dynamic range, extra wide bandwidth B=3.77

ALICE desktop also allows the user to enter a function, generally from the numpy library, for the FFT window. Under the FFTwindow drop down menu click on Enter User Function and type in the function. Then select User Defined Window. It is also possible to enter the FFT window shape as an array from a .csv file. The length of the window shape has to be a power of 2, i.e. 256, 512, 1024, 2048, 4096…. When using an FFT window shape from a file, changing the number of samples up or down is not permitted. The number of FFT samples will be set by the length of the shape file.

Zero Stuffing

With the menu button “Setup” you can set the factor for the Zero stuffing. What problem are trying to solve by Zero stuffing? The bandwidth of the FFT depends on the choice of the FFT window function. For a narrow FFT filter, the bandwidth is slightly larger than the difference between 2 FFT frequency bins. When the signal frequency is exactly between the 2 FFT frequency bins, the signal will be displayed lower than its actual value because half of the signal appears in each of the two bins. Figure 21 shows good example of this. The signal is slightly more than 1 KHz and lies exactly between the two FFT frequency bins. The actual peak value should be equal to 0 dB, but the displayed value of the two adjacent samples is lower. The signal level is not displayed correctly by either of the FFT frequency bins. This is called Scalloping loss.

Figure 21, Fundamental frequency not centered, no zero stuffing

Zero stuffing provides a simple solution to this problem. For 1x Zero Stuffing, we double the size of the time sample array. The original array was say 2048 samples. We add 2048 samples with the value zero and we get a new array with 4096 samples. This may seem counterintuitive, when we add zero’s we do not add extra measurement data. However, something happens in the FFT calculation with twice as many samples. The effect can be seen in figure 22. Extra FFT frequency bins have been added. Coincidentally, here the extra frequency bin coincides with the frequency of the signal and the level of the signal is displayed correctly. Also even if the signal frequency does not coincide with the frequency of the extra FFT bin, the measured error will be smaller. As we add samples with the value zero, the bandwidth of the FFT filter remains the same.

Figure 22, Fundamental frequency not centered, with zero stuffing

In the program, you can choose a value between 0 and 5 for the Zero Stuffing. As it is a power of 2, it is a value between 1 and 32. So 0x - 31x points will be added. As a result, the FFT calculation time will be up to 32x longer as well and the spectrum analyzer screen update rate will slow down considerably. One extra point (a value of 1 for the Zero Stuffing) is often good enough to keep the Scalloping loss acceptable. As an alternative, what you can do is set Zero Stuffing to 0, and use a Flat top window. The flat top is so wide, that even without Zero Stuffing, you will have little Scalloping loss, but you will have less frequency selectivity.

Spectrum Examples:

The following example shows a technique where the ALICE spectrum analyzer tool can be used to measure the amplitude vs frequency response of two simple RLC configurations. Shown in figure E11, first on the left is a parallel LC bandpass configuration and second on the right is a series LC bandstop configuration. Indicated by the green boxes are the connections to the ALM1000. Channel A is setup to output the driving function of the network. Channel B is setup as an input to measure the response seen across the LC network. For this example R1 is 1 KΩ, L1 is 15 mH and C1 is either 0.22 uF or 0.44 uF.

Figure E11 RLC circuits

In a linear system, the frequency response can be obtained by sweeping sinusoidal inputs over a range of frequencies. This series of sinusoidal signals at different frequencies can then be used to compute the frequency response. While the ALICE Desktop Bode Plotter does include a sweep generator function, a sweep with many frequency points using large FFT sample sizes can take many seconds or even minutes to up-date the plot. However, FFT analysis can be used to obtain the transfer function for a network from its impulse response. We can generate a test signal with a wide frequency content, a very narrow square pulse, which will produce a plot from a single sample record at a much higher up-date rate.

Using the FFT to get a impulse transfer function of a system is not overly complex and in fact the impulse response method gives better phase results than a sinusoidal sweep.

There must be an input to the network which you can observe and record. There must be an output from the network which you can observe and record. The input and output data has to be able to be read into an analysis program, such as ALICE Desktop, that can take the Fast Fourier Transform of both input and output data records. A basic concept of linear analysis is that the unit impulse response of a network and the transfer function of the network are a Laplace transform pair, or said another way, the transfer function is the Laplace transform of the unit impulse response. The implication is that we can obtain the transfer function by getting the Laplace transform of the unit impulse response.

Practical implementation.

If we set the number of FFT samples to 8192 the total sample time will be 81.92 mSec which is the same as one cycle at 12.2 Hz. By setting the Channel A function generator to a 12.2 Hz square wave with a very narrow duty cycle of only 4 – 6 samples wide the resulting test signal will contain frequency content every 12.2 Hz with nearly equal amplitude out to high frequencies. At 12 Hz each 10 uSec sample period is equal to about 0.012 % of duty cycle. We can set the duty cycle to anything from 0.012% to 0.08% and get similar results. The only difference is how fast the signal level falls off with increasing frequency. For a given pulse amplitude, the narrower the pulse the less energy in each 12.2 Hz spaced frequency but the flatter vs frequency they will be. The wider the pulse the more signal energy but a faster frequency roll off. 0.08% gives an acceptable frequency roll off out to 10 KHz.

The detailed settings for Channel A are as follows:
Shape - Square
Mode - SVMI
VMIN = 1.3
VMAX = 3.7 ( pulse amplitude set to allow some headroom for overshoot and ringing )
Freq = 12.2
Phase = 180 ( phase is set to 180 degrees to center the pulse in the time sample record )
DutyCycle = 0.08 ( can be adjusted down to 0.012% for flatter input signal energy )

Channel B is set in Hi-Z mode as an input.

Other Settings:
FFT Window – Flat top ( has a wide FFT bandwidth which is wider than 12 Hz )
FFT Samples = 8192
Start Freq = 100 ( set to something other than 0, to ignore DC content )
Stop Freq = 10000
ZeroStuffing = 0 ( can be adjusted but generally has little effect on resultant plot )

Below in figure E12 is a screen shot for the bandpass RLC configuration of figure E1. The green trace for channel A is the narrow pulse forcing function response. The light and dark orange traces are the output responses seen by channel B for C1 = 0.44 uf and 0.22 uF respectively. The light and dark magenta traces are the subtraction of the Channel A trace ( in dBV ) and the Channel B trace ( in dBV ). As we know subtraction in dB ( logs ) is the same as division in magnitude. The magenta traces are the actual input to output transfer function of the RLC network. The Yellow trace is the phase response.

Figure E12, Bandpass response

Similarly in figure E13 is a screen shot for the bandstop RLC configuration of figure E1.

Figure E13 Bandstop response

For Further Reading:

https://en.wikipedia.org/wiki/Fast_Fourier_transform
http://www.analog.com/media/en/training-seminars/design-handbooks/MixedSignal_Sect5.pdf
https://en.wikipedia.org/wiki/Window_function
https://en.wikipedia.org/wiki/Spectral_leakage
http://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.fft.html

Impedance Analyzer / LCR Meter

Background:

The basic concept that is used to make gain/phase, impedance and RLC measurements using ALICE Desktop is shown in figure 23. Channel A of the ALM1000 is used to apply a known frequency sine wave at VA and measure the applied voltage waveform. Channel B is used to measure the voltage waveform seen across the network under test. FFTs are calculated on the two waveforms which provide amplitude and phase information at the applied frequency. From these the relative gain ( CHB amplitude / CHA amplitude ) and relative phase ( CHB phase – CHA phase) are obtained. Further these values can be used to calculate the impedance (RLC) of the network in the dashed box. The resistor, REXT, is a known value. For the audio frequency range measurements possible with the ALM1000 hardware it can be adjusted as needed depending on the magnitude of the impedance being tested. Impedances in the range of about 0.1 to 10 times REXT can be accurately measured. REXT can range from 50 Ω to 50 KΩ.

The unknown impedance to be measured is modeled as a series circuit consisting of an unknown series resistance, RX, and an unknown series reactance, jXX. The magnitude of the impedance is ZX.

Figure 23: Basic Concept

Three voltages are measured:
1. VA is the applied voltage ( from Channel A of the ALM1000 ).
2. VZ is the voltage across the unknown impedance ( from Channel B of the ALM1000 ).
3. VI, the voltage across the known resistor REXT is calculated from VA and VZ and is related to the current in both REXT and the unknown impedance.

These three voltages are actually vectors and indicated in figure 24.

Figure 24: Vector Diagram

Using the law of cosines and referring to figure 23 the magnitude of VI can be calculated as:

VI = sqrt({VA/2} + {VZ/2} – 2*VA*VZ*cos(Φ))

The angle Φ is the measured relative phase between channel B and channel A. The law of cosines is used to calculate the cosine of the angle, Θ.

cos(Θ) = ({VA/2} + {VI/2} – {VZ/2})/ (2 * VA * VI)

The magnitude of the total impedance (including REXT) can be calculated as:

Za = R_EXT * VA / VI

We note from figure 1 that the sum of REXT and RX can be found by:

R_EXT + R_X = Za * cos(Θ)

Thus, we can solve for RX by:

R_X = Za * cos(Θ) – R_EXT

Taking possible measurement errors into account it is possible that RX could compute to be a negative value which is not likely to be the case. The thing to do if that happens is to set RX to zero. The impedance is purely reactive.

The magnitude of the unknown impedance can be calculated as:

Z_X = R_EXT * VZ / VI

The magnitude of the unknown reactance can be calculated as:

X_X = sqrt({Z_X/2} – {R_X/2})

Again taking possible measurement errors into account it is possible that the square root of a negative number might occur. If that happens then XX should be set to zero.

Once we have a value for XX, we can calculate either the series capacitance ( when XX is negative = XC ) or series Inductance ( when XX is positive = XL).

C = -1/(2πfX_C)

L = X_L/(2πf)

Making Measurements:

Connections to the ALM1000 and the network to be measured are shown in figure 25. In this case we show a simple series connected resistor and capacitor. REXT is 1000 Ohms and the series resistor RS is 100 Ohms and the capacitor CS is 1 uF. The channel A AWG generator output should always be set to be in source voltage mode (SVMI) and with a sine wave shape. The user can control the output voltage amplitude and offset with the Min and Max entry slots as when using the scope and spectrum analyzer displays. A good place to start is with Min set to 1.086 and Max set to 3.914 which produces a 1 Vrms amplitude centered on 2.5 V DC. The Channel B analog input is set in the Hi-Z mode when using the Impedance Analyzer and it always considered as an input.

Figure 25, Measurement setup

The current low level ALM1000 software only outputs signals as single shot bursts when the analog output signal is being sampled. The Sync AWG check box must be checked if you are using the ALM1000 function generator output as the applied signal source. If you are using an external signal source rather than CH A the box should not be checked. This will keep both channel A and B in a high impedance voltage measurement mode while capturing data.

Window Setup:

The main impedance analyzer window should appear, as in figure 26. It is sub divided into 2 sections.

Figure 26, ALICE Impedance Analyzer window

The Right Side Menu Section

Run, Stop

Start and stop buttons for continuously taking readings.

Samples +/- buttons

Used to change the number of samples in the FFT calculation. This number has to be a power of 2. More samples means a longer time sample which is important when low test frequencies are used. It also provides higher frequency resolution but a slower update rate for the screen. Fewer samples provides a lower frequency resolution, but a faster update rate for the screen. Increasing the zero-stuffing factor can improve the frequency resolution. The program starts up set to 16,384 samples.

FFT window drop down menu

Used to select an FFT window. It is generally better not to select the “Rectangle window” or no window. This window has a poor dynamic range due to the high side bands that are generated with no weighting function in the FFT calculation. The Flat Top window gives the highest amplitude accuracy but also has a large bandwidth, so less selectivity. Using the narrowest bandwidth FFT window and increasing the zero-stuffing factor can improve the measurement results. The program starts up set to the Nuttall window (BW=2.02).

File drop down menu

Save Config Load Config buttons. Commands for saving and loading the configuration settings to a file. (.cfg file)

Save V-Cal, Load V-Cal buttons. ALICE-VVM uses the same calibration file as the Voltmeter Tool. To load the saved calibration factors press the Load button. To save the calibration values to the file for future use, press the Save button. The values are saved to a file with a unique name for this particular ALM1000 board based on the first 9 characters of the board device ID serial number. For example something like: 203131543_V.cal.

Save Screen button. Command for saving the graphics display area to an encapsulated postscript file (.eps). The Help button will open a web browser to this document on the ADI Wiki site.

Options drop down menu

Cut-DC, an option that will remove the DC component from the sampled data record. It sample by sample subtracts the average value of the sample record. Any DC offset in the FFT could result in that being the peak amplitude and resulting in meaningless measurements. The program starts up with this turned on. This is important given the 0 to 5 V analog input range of the ALM1000 and the inherent 2.5 V DC offset.

The section along the right hand side contains the controls for making the measurements. There is a place to enter the external resistor value. The program starts up with this set to 1000. Next is a spin box to set the number of Ohms/div for the polar ( circular ) grid.

M1K Analog Inputs
ADALM1000 Low Capacitance FET Input Buffers
M1K Breadboard Adapters

Main Graphics area

The main graphics area is where the measured results are displayed. The impedance magnitude and angle along with the real and imaginary parts are drawn on the polar ( circular ) grid in Ohms. The real, series resistance component is drawn in green at 0 degrees phase. The imaginary part of the series impedance is drawn in red at either +90 degrees or -90 degrees depending on the sign. A positive impedance is inductive and an negative impedance is capacitive. The combined magnitude of the total series impedance is drawn in orange and at the measured angle.

To the left of the grid the relative gain of Channel B to Channel A is displayed in dB. Next the relative phase is displayed in degrees. Next the measured frequency in Hz is displayed. Next the measured Impedance Magnitude, Angle, R series and X series are displayed. Finally the calculated capacitance ( if X series is negative ) or inductance ( if X series is positive ) is displayed.

To convert the series values to the equivalent parallel values see section on Calculating Parallel Impedance further down in this document.

Additional setting information is also shown.

Impedance Analyzer Examples:

Example 1:

As an example to show the frequency dependent impedance of a series LC circuit we will use the ALICE impedance analyzer tool to examine the combination shown in figure E14 with L1 equal to 60 mH and C1 equal to 1 uF. We will use a 100 Ω REXT to be in line with the expected impedance level of the circuit.

Figure E14 Testing an series LC circuit

The LC circuit is tested at three different frequencies, the first much lower than the resonate frequency where the impedance is dominated by the capacitor shown in figure E15.

Figure E15 Measured results at low frequency, 200 Hz

The second much higher than the resonate frequency where the impedance is dominated by the inductor shown in figure E16.

Figure E16 Measured results at high frequency, 2500 Hz

The third at the resonate frequency where the negative impedance of the capacitor nearly cancels the positive impedance of the inductor shown in figure E17.

Figure E17 Measured results at resonate frequency, 653 Hz

In all three cases the series R measured stays nearly the same at about 155 Ω.

Example 2:

We can use ALICE Desktop to measure the input capacitance of channel B. We know that the input capacitance is small so we will need to use a large value for REXT and measure at a high frequency. In figure E18 we show the connections used which is simply to connect CHA to CHB with a 47 KΩ resistor.

Figure E18 Measure CH B input capacitance

In the ALICE Impedance Analyzer screen shot shown in figure E19 we see that Ext Res is set to 47000 and the test frequency is set to 19000 Hz. The calculated capacitance is 371 pF which agrees nicely with the capacitance reported in the document on the ALM1000 analog inputs.

Figure E19, Measured results for CH B input capacitance

If we use the formula from Calculating Parallel Impedance to convert the series R to the parallel resistance we get around 1 MΩ. This is right in line with the known design value.

To measure capacitors around the same value as the input capacitance or even smaller it would be useful to null out this stray parasitic capacitance. This can be done using the Gain Cor and Phase Cor Entry widgets to enter correction factors for the gain and offset. If we enter 7.4 (dB) from the measured Gain for the Gain Cor entry and 62.64 (degrees) for the Phase Cor entry we get the result shown in figure E20.

Figure E20 Gain and Phase have be corrected

Now the Measured Gain difference is 0.0 dB and the Measured Phase difference is 0.0 degrees. The calculated capacitance is 0.2pF. If we now add a 39 pF ceramic cap, from the Analog Parts Kit, from the channel B input to ground we get the results shown in figure E21.

Figure E21, 39 pF cap added to CHB.

Now the calculated capacitance reported is 36 pF which is what we can expect from a +/- 20% tolerance on the capacitor.

Calculating Parallel Impedance:

The method used in the ALICE impedance analyzer tool determines the series resistance and reactance. Sometimes the equivalent parallel impedance of a resistance and reactance are needed. All that is required is a mathematical series to parallel conversion as follows. The concept is to relate the real and imaginary conductance of the parallel network to the conductance of the series network. The numerator and denominator of the series network conductance is multiplied by the complex conjugate of the denominator to put the result in normal form.

1/R_P + 1/jX_P = 1/( R_S + jX_S) = (R_S – jX_S)/( R_S/2 + X_S/2)

where RS and XS are the series values and RP and XP are the parallel values.

By equating the real part we have the equivalent parallel resistance and by equating the imaginary part we have the equivalent parallel reactance:

R_P = (R_S/2 + X_S/2) / R_S

X_P = (R_S/2 + X_S/2) / X_S

Note that since the polarity of XS was known then the polarity of XP is also known and is the same sign.

DC Ohmmeter Window:

The method used to measure unknown resistance is based on the voltage divider configuration shown in the following figure.

Figure, Voltage Divider Method

If we assume that voltage source VS is known, resistance of R1 is known and we can measure voltage V2, the voltage across R2, we can use the voltage divider formula to calculate the resistance of R2.

V_2 = V_S*(R_2/( R_1 + R_2 ))

Which can be rearranged to:

R_2 = R_1 * (V_2 / (V_S - V_2))

There is a certain advantage to using this voltage divider method over the Ohm's Law method in that a much wider range of resistances can be measured. The Ohm's Law method is limited in one extreme by the maximum current that the ALM1000 can safely source ( about 200 mA or 5 Ohms ) and in the other by the minimum current that the ALM1000 can accurately measure ( about 200 uA or 25 KOhms). Using the voltage divider method, because we can choose a range of R1 values, we are only limited by the voltage measurement resolution of the ALM1000 ( about 100 uV ). R1 can range from as low as 10 Ohms to as high as 10 KOhms in practice which extends the range from 1 Ohm or less to nearly a MOhm.

For the highest values of R2 the internal 1 MOhm resistance of Channel B comes into effect and the software removes this parallel resistance when calculating the value for R2.

Slight Variation:

Built into the ALM1000 is a switch that can connect an on-board 50 Ohm resistor from the channel B input / output pin to ground. We can use this “known” resistor as R2 in the voltage divider figure and calculate for R1 instead.

R_1 = R_2 * ((V_S - V_2)/V_2)

The series resistance of the switch, which is approximately 1 Ohm, must be included in the value of R2. The actual value for R2 is more like slightly less than 51 Ohms. Of course the true value for R2 can be found by calibrating its value based on measuring a known precision resistor standard.

Both ways can be used in the DC Ohmmeter tool. The test voltage can be adjusted as well as the value of the known resistor. The Ext Int selector picks which variation will be used to calculate the unknown resistance.

Figure, DC Ohmmeter window

Digital I/O controls Windows:

The ALM1000 hardware provides four 3.3V CMOS digital input / output pins. The four general purpose input/output pins along with ground and the 3.3V power supply are provided on the digital port connector as shown in figure 27.

Figure 27 Digital I/O connector

Part of the ALM1000 rev D schematic is shown in figure 28. As can be seen each of the four general purpose PIO pins ( connector P3 ) is connected to a 220 Ω and a 470 Ω resistor. The 220 Ω resistors connect to Port A pins 0-3 and the 470 Ω resistors connect to Port A pins 4-7. This configuration with two digital port pins connected though two different series resistors is unique and not generally typical of digital pins in other small portable USB based hardware such as the Analog Discovery module.

Figure 28 ALM1000 digital interface input/output diagram

The state of the Port A pins can be controlled using the simple digital control interface shown in figure 29. At this time only static hi / low functionality is supported. Eight rows of selectors are provided, one for each microcontroller pin for Port A ( PA0-PA7). Each port pin can be set to either a logic low, 0, a high-impedance or floating state, Z or a logic high, 1. When in the high-impedance or floating state that pin can be used as a logic input.

Figure 29, Digital I/O control window

Using these pins for purposes other than digital

This configuration with two digital output drivers connected to a single connector pin through two different series resistors could be viewed in a different light. We might consider the CMOS output diver of the microcontroller pin as a three position single pole switch that can connect to ground or the 3.3 V supply or open circuit as shown in figure 30. This is more of an analog representation of the circuit. Looking at the circuit in this way it can perhaps be used in part to teach and learn concepts in DC resistor networks such as Thevenin and Norton equivalent circuits, series/parallel resistors, KVL, KCL, voltage dividers and nodal analysis etc.

Figure 30, Switch based analog representation of the circuit

There are nine possible combinations of the switches which give rise to the 8 Thevenin equivalent circuits shown in figure 31, with the ninth being of course an open circuit. It is important to note here that the resistance and voltage values given are for ideal nominal conditions and actual values may be noticeably different. It also assumes that the ON resistance of the MOS FET switches is zero which is actually never the case.

Figure 31, 8 Equivalent circuits

The first four cases are obvious. The next two are for the case where the 220 Ω resistor is connected in parallel with the 470 Ω resistor. The last two are for the case where the 220 Ω resistor is connected to ground and the 470 Ω resistor is connected to 3.3 V and the reverse.

A 9 level DAC can be created on each output pin by connecting an external resistor divider, R1, R2, as shown in figure 32. Using two 1 KΩ resistors as shown presents effectively a 500 Ω resistance to 3.3/2 (1.65) volts on one of the PIO connector outputs. This effective resistance to 1.65 V and the switchable equivalent circuits from figure 31 results in the 9 different output voltages shown in figure 32. Other values for R1 and R2 of course can be used to produce different ranges of output voltage.

Figure 32, Nine level “DAC” interface window

Simply shorting two of the PIO pins together results in 9 X 9 or 81 total possible combinations. Many are redundant and some give the same voltage but with different source resistance values. Shorting all four pins together results in 6561 possible combinations using no external resistors. Limited only by your imagination and far more than can be listed in this document.

In addition when one or the other digital window is open the state of PIO 0, PIO 1, PIO, 2 and PIO 3 from left to right and are displayed in the Oscilloscope graphics area and are updated once each time the analog scope display is refreshed.

Steps performed by ALICE Desktop Self Calibration:

ALICE Desktop can perform a self-calibration sequence. An accurate 2.5 V reference source such as the AD584 precision reverence from the ADALP2000 analog parts kit is used. Plug it into a solderless breadboard and connect as shown in figure 33. The AD584 is configured as a 2.5V reference by connecting pins 1 and 3 together. A more permanent suggestion is soldering the circuit onto a small piece of circuit board rather than using a solderless breadboard as shown in figure 34. Connect both input channels to the 2.5V output of the AD584 when directed to do so.

Figure 33, AD584 2.5 V reference connections

Figure 34, AD584 2.5 V reference on a circuit board

First, the program asks if user wishes to reset internal calibration values to default. The program expects the default values to exist in a file named: calib_default.txt and will ask for file if it is not found in the local directory.

If a calibration file from a previous self calibration for this board exists the program will ask if you want to load the settings from the previous file.

Next the programs requests user to: Connect an External Voltage reference (AD584) to both CHA and CHB inputs.

With both AWGs in disabled Hi-Z mode, program takes average of 1000 samples ( for this and all subsequent measurements ).

Program checks if measured values for CHA and CHB are within 2.2V and 2.8V to make sure the external reference was attached. If it measures results outside this range it asks user to check connections and tries again. Program assumes external voltage is exactly 2.5 V but variable AD584act can be adjusted if actual value is known ( see section on customizing ALICE below ). Program uses measured values and variable AD584act to calculate channel gain factors to adjust all subsequent measurements.

Next the program requests user to : Disconnect everything from CHA and CHB pins.

Program sets the following switches, CHA 2.5 V switch to open, CHA GND switch to closed, CHB 2.5 V switch to open, CHB GND switch to closed. With the AWG mode set to disabled ( Hi-Z ) it then measures the input offset ( ground voltage ).

Program sets the following switches, CHA 2.5 V switch to closed, CHA GND switch to open, CHB 2.5 V switch to closed, CHB GND switch to open. With the AWG mode set to disabled ( Hi-Z ) it then measures the internal 2.5 V rail. This voltage is later used in calculating actual current in ( internal ) resistor.

Program sets all the switches to open. Sets both CHA and CHB to SVMI mode DC voltage of 0.0 V. It measures the actual output when forcing 0.0 V.

Program sets all the switches to open. Sets both CHA and CHB to SVMI mode DC voltage of 2.5 V. It measures the actual output when forcing 2.5 V.

Program sets the following switches, CHA 2.5 V switch to open, CHA GND switch to closed, CHB 2.5 V switch to open, CHB GND switch to closed. Sets both CHA and CHB to SVMI mode DC voltage of 5 V. It measures the current when forcing 5 V into the internal 50 ohm resistors ( connected to ground). Program uses measured voltage and current values and variable OnBoardRes ( set = 50.83 to allow for switch Ron but can be set by user, see section on customizing ALICE below ) to calculate actual current.

Program sets the following switches, CHA 2.5 V switch to closed, CHA GND switch to open, CHB 2.5 V switch to closed, CHB GND switch to open. Sets both CHA and CHB to SVMI mode DC voltage of 0 V. It measures the current when forcing 0 V into the internal 50 ohm resistors connected to internal 2.5V rail. Program uses measured voltage and current values and variable OnBoardRes ( set = 50.83 to allow for switch Ron ) to calculate actual current.

Program sets the following switches, CHA 2.5 V switch to closed, CHA GND switch to open, CHB 2.5 V switch to closed, CHB GND switch to open. Sets both CHA and CHB to SIMV mode DC current of 0.0 mA. It measures the current and voltage when forcing 0mA into the internal 50 ohm resistors connected to internal 2.5V rail. Program uses measured voltage and current values and variable OnBoardRes ( set = 50.83 to allow for switch Ron ) to calculate actual current.

Program sets the following switches, CHA 2.5 V switch to open, CHA GND switch to closed, CHB 2.5 V switch to open, CHB GND switch to closed. Sets both CHA and CHB to SIMV mode DC current of +100.0 mA. It measures the current and voltage when forcing +100mA into the internal 50 ohm resistors connected to ground rail. Program uses measured voltage and current values and variable OnBoardRes ( set = 50.83 to allow for switch Ron ) to calculate actual current.

Program sets the following switches, CHA 2.5 V switch to closed, CHA GND switch to open, CHB 2.5 V switch to closed, CHB GND switch to open. Sets both CHA and CHB to SIMV mode DC current of -45 mA. ( -45 is used because internal 2.5 V may actually be less than 2.5 V and resistor is greater than 50 so that voltage does not go below ground ). It measures the current and voltage when forcing -45mA into the internal 50 ohm resistors connected to internal 2.5V rail. Program uses measured voltage and current values and variable OnBoardRes ( set = 50.83 to allow for switch Ron ) to calculate actual current.

Program returns all switches to open.

Program calculates all needed calibration factors from measured data and writes out values to a calibration file named based on last 16 digits of board serial number.

Program throws up a message window: “Finish” , “Successfully measured cal factors! ”

Program asks user if they wish to actually write new calibration settings to board.

Your ALM1000 is now calibrated.

Checking the Calibration

The way to check the calibration results is to set both AWG channels to Sine shape with 0.25 Min and 4.75 Max values set in SVMI mode. Also under Mode set the termination to the 2.5 V rail to on. You should now see about -45 mA to +45 mA or 90 mA p-p in the current traces, a little less due to the Switch Ron. Then turn off the termination (Open) and connect a known 50 Ω resistor from the outputs to the 2.5 V pin. The current traces should now be much closer to 90 mA p-p.

You can then switch to SIMV mode with -45 Min and +45 Max settings. Again with the termination to 2.5V rail turned on you should get 90 mA p-p but the voltage traces will be slightly larger due to the Switch Ron. And again you can compare to an external accurate 50 Ω resistor.

If the p-p values are more than 1 mA off from what is expected you can try changing the OnBoardRes variable and recalibrating. This can be done by entering the following line in the Command Interface window:

global OnBoardRes; OnBoardRes = Your_new_value

What if I don't have an AD584

If you don't have access to an AD584 ( or other accurate 2.5 V reference ) but do have access to an accurate DMM with enough resolution to measure 2.5 volts with 4 decimal places you can do the following. Plug in the ADALM1000 to the USB port to power it on. Let it set for ideally 10 minutes to reach a constant operating temperature. With your DMM set to the optimal range measure the on board fixed 2.5V supply pin on the analog connector with respect to the GND pin. Write this value down ( ideally with 4 decimal places i.e. 2.XXXX ). Open the Command Interface screen and enter the following line to change the AD584act variable to the value you just measured:

global AD584act; AD584act = Your_new_value

Run the Self Calibration as usual. When asked to connect the AD584 reference, connect the 2.5V pin to both CH A and CH B inputs using a Y shaped jumper wire with 3 male pins on each end. Remove the wire jumpers when prompted to disconnect everything from CH A and CH B. The program will now calibrate based on the now accurately measured value for the on board 2.5 V rail.

Support for Plug-In Boards

ALICE Desk-Top provides software interfaces for external plug-in boards which extend the functionality of the basic hardware. There are four types of external boards currently supported. External analog multiplexers to increase the number of analog input channels. External DDS based function generators such as the AD9837 based MiniGen from SparkFun. External serial 8 bit DACs such as the AD7303 based PmodDA1 from Digilent. External digital potentiometers such as the AD840X single, dual, quad family or the AD5160 based PmodDPOT from Digilent. A generic 3 wire SPI serial output interface.

The software interfaces for these can be enabled or disabled by setting the following variables to either 1 or 0 in the alice_init.ini file, see ALICE Advanced User’s Guide for more details.

EnableMuxMode
EnableMinigenMode
EnablePmodDA1Mode
EnableDigPotMode
EnableGenericSerialMode

EnableMuxMode is set to 1 by default, the rest are set to 0. When these variables are set a button to open their respective control window will appear in the right side of the main ALICE window.

Multichannel analog interface for the ADALM1000

The two analog input channels of the ADALM1000 provide a high input impedance and wide dynamic range which is very helpful for many of the measurements that a user would be making during laboratory activities. However, there are only the two analog inputs. Often, there are many more than two signals in the circuit under investigation that the user would like to monitor. Or there could be a number of low bandwidth sensors, such as ambient temperature or light levels around a room, that need to be measured or monitored over long durations of time when gathering experimental data. As a solution to this need ALICE desktop provides the necessary software interface to control an external multi-channel analog multiplexer such as these two breakout board from SparkFun based on the 74HC4067 16:1 MUX and the 74HC4051 8:1 MUX. There are also hook-up guides on their web site

Figure 35, Analog multiplexer schematic

The analog Mux control window is shown in figure 31. The CB voltage and current controls on the main scope window no longer function when this window is open and are replaced by the four new sets of voltage controls. The check boxes select which of the four Mux input channels will be displayed. The Mux-Enb checkbox sets PIO-2 either low ( when not checked ) or high ( when checked ) for Muxes like the CD4052 with enable low inputs or the ADG609 with enable high inputs.

Figure 36, Analog Mux Control window

The analog Mux interface in ALICE desktop uses a technique common in analog CRT oscilloscopes ( with a single electron beam ) where multiple input channels are switched to the beam deflection circuits on alternating sweeps. This trick requires periodic signals and that each sweep be “triggered” or synced from the same input signal. In this case the triggering signal will be channel A which is not multiplexed. This could be either the AWG generator output of channel A or an external signal input to channel A in Hi-Z mode. Because it is assumed that a MUX is connected to channel B the AWG output function for that channel is set to Hi-Z mode and also since channel B is always a voltage input the current waveform display for that channel has also been disabled. As an example note the screen shot in figure 37.

Figure 37, Four channel Mux display of ALICE desktop

One important feature of the program is that a sync or sweep start pulse is output on the PIO 3 digital output pin just before each analog sweep starts. The sync pulse can be set to either a high going or low going pulse with the selector next to the pulse shaped icon. Using this “reset” pulse would be necessary whenever this program is used to observe a circuit that contains “state” for example a digital counter or state machine.

External DDS based function generators

The ALM1000 has 4 general purpose digital input/output pins which can be used as a serial port (SPI). These pins are used to interface to direct digital synthesis (DDS) waveform generators such as the AD9837 and AD9833. These DDS generators are capable of producing sine, triangular, and square wave outputs. SparkFun offer a breakout board based around the AD9837 DDS called the MiniGen ($29.95).

In figure 33 we see that it is a relatively simple matter to connect the MiniGen board to the digital connector on the ALM1000. If a 6 pin right angle male header is installed as shown, the FSYNC, SDATA, and SCLK pins connect to PIO 0, PIO 1, and PIO 3 respectively. The other three header pins are open connections on the MiniGen board and the ground and power GND, The VIN pin can be wired to 3.3V and GND to GND with jumper wires. The solder bridge jumper, which shorts out the on board LDO, for powering the board directly from 3.3V will also need to be soldered in as shown. Installing a two pin female right angle connector to the analog output connection points is needed as well.

Figure 33 Adapting AD9837 MiniGen to ALM1000

The MiniGen control window, figure 34, allows the four possible waveform shapes to be selected. The master clock frequency can be set, the board comes populated with a 16 MHz crystal oscillator. And of course the output frequency can be set.

Figure 34, MiniGen control window

The MiniGen board produces a fixed 1 V p-p amplitude signal centered on the supply / 2 which is about 1.65 V in this case.

The AD9833 is a DDS waveform generator chip similar to the AD9837. The datasheet for the AD9833 indicates that the serial interface waveforms are the same as for the AD9837 and the configuration of the control, frequency and phase registers are the same as well so the ALICE Desktop interface will work for both devices by connecting which I/O pins map to FSYNC, SDATA and SCLK as needed.

Using MiniGen with Bode Plotter

As of the 6-19-2017 version of ALICE 1.1 Desktop it is possible to use the MiniGen as the sweep signal source for the Bode Plotter. If the MiniGen controls are opened before opening the Bode Plot window a third option will appear under Sweep Generator. The MiniGen has a fixed amplitude or 1 V p-p centered on one half the power supply, which is typically 3.3 V. The MiniGen is capable of generating much higher frequencies than the built in AWG sources. This allows sweeps all the way to just below the 50 KHz limit of the 100 KSPS.

External serial 8 bit DAC Pmods

The digital input/output pins can interface to the PmodDA1 4 channel DAC module sold through Digilent and other distributors such as Mouser.

Figure 35, PmodDA1

The PmodDA1 has two AD7303 8 bit dual voltage output DACs as shown in the block diagram in figure 36.

Figure 36, PmodDA1 block diagram.

The module has a 6 pin male connector which plugs directly into the digital port on the ADALM1000. Because of the “Top” component side of the ALM1000 actually faces down the PmodDA1 also needs to be plugged in with the “Top” component side facing down. Carefully note the pin labels on both boards before plugging in the Pmod. The 6 pin header on the module lines up with the pins on the ALM1000 digital connector and all four of the general purpose I/O pins are used as follows. PIO 0 connects to the SYNC input on both DACs. PIO 1 connects to the data input on the first AD7303. PIO 2 connects to the data input on the second AD7303 and PIO 3 connects to the SCLK serial clock input on both DACs.

There is no external access to the reference input voltage on the DACs so they must generally be configured to use VDD/2 as the reference. In this case VDD is wired to the 3.3 Volt suppled on the digital port connector. The voltage output range for all four output channels will be 0 to 3.3 V.

The AD7303 DACs are also available in 8 pin PDIP packages and could be used plugged into solder-less breadboards with other components of a circuit project.

Figure 37, PmodDA1 control window

Controls for the four DAC channels of the PmodDA1 are shown in figure 37. Enter the desired DC voltage(s) from 0 to 3.3 V ( less one LSB ) and click UpDate to send the new values to the DACs.

External digital potentiometers

The AD8402 dual 10 KΩ and AD8403 quad 10 KΩ digital potentiometer have 8 bit resolution and are available in PDIP packages that work well in solder-less breadboards. How to connect the AD8402 to the ALM1000 is shown in figure 39. The single 8 bit 10 KΩ digital potentiometer, AD5160, based PmodDPOT, figure 38, is also compatible with the same 6 pin male connector which plugs directly into the digital port on the ADALM1000. Because of the “Top” component side of the ALM1000 actually facing down the PmodDPOT also needs to be plugged in with the “Top” component side facing down. Carefully note the pin labels on both boards before plugging in the Pmod.

Figure 38, PmodDPOT

Connections for the AD8402 dual pot are shown in figure 39. Connections for the AD8400 single and AD8403 quad are similar.

Figure 39, AD8402 connections

Figure 40, Digital Pot control window

The digital potentiometer controls window has check boxes to select which of the up to four pots of the AD8403 are sent data. Each pot has a slider to control its value from 0 to 255. The radio button selects between the AD840X family which sends 10 bit data ( 8 bit value + 2 bit address ) and the AD5160 single pot which sends 8 bit data.

Generic 3 wire SPI output:

The digital input/output pins can output serial data to generic 3 wire SPI serial input devices. The provided interface allows the user to configure any of the 4 PI/O digital pins ( 0 – 3 ) as either the SCLK, SData, or Latch ( sometimes called CS or SYNC ) outputs. The user can set the number of bits to be sent in each digital write. The data word to be sent can be entered in either decimal ( integer ) form or Hex by using the 0x00 format. The “resting” sense, i.e. the level between writes, of the latch output can be set as well ( Latch Phase selector ). Some serial devices operate on the rising edge of the Latch (CS, SYNC) signal or on the falling edge. It is possible to select order in which the serial bits are sent, either LSB first or MSB first. The current data value is sent or written each time the Send button is clicked.

Figure 41, Generic Serial Interface screen

Applying Digital Filtering:

With this interface, ALICE Desktop can apply digital filtering to the captured Channel A and B voltage waveform data before being displayed in the Time and/or Frequency domains. ALICE uses the numpy convolve function to perform the filtering function. The supplied list of coefficients is convolved with the captured data buffer. The list of filer coefficients for either Channel A or B is first loaded from a single column .csv file by using the “Load CH A Filter Coef” and “Load CH B Filter Coef” buttons. The length ( number of coefficients ) and file name will then be displayed. The digital filter(s) will be applied to the voltage waveform data buffers if the “Filter CH A” and/or “Filter CH B” checkboxes are checked.

Figure 42, Digital Filtering Interface

The arithmetic sum of the coefficients should equal 1 for the “filter” to have an overall gain of one. A simple low pass filter for example has a rectangular (box-car) shape. The coefficients for a length of 2 would be [ 0.5, 0.5 ]. For a length of 4 the coefficients would be [ 0.25, 0.25, 0.25, 0.25 ] and so on. A few example filter files can be found here:

Alternatively, a formula for the filter coefficients can be entered using the CH A or CH B Filter formula buttons. The program puts up an entry window where the formula can be entered. Conventional Python syntax is used and all the math and numpy library functions are available as in the the rest of ALICE. The program looks at the arithmetic sum of the coefficients and scales them appropriately for an overall gain of 1 through the filter.

The DFiltACoef and DFiltBCoef array variable are used to store the filter coefficients. The Filter formula coefficient scaling feature can be used to scale a set of filter values read from a file. First read in the values from the file and then simply pass the array through the formula function by entering DFiltACoef or DFiltBCoef for the formula.

There are many filter design tools that can be found by searching the web. Here is one that works well but we are not necessarily endorsing it over any others that might be out there:

http://t-filter.engineerjs.com/

The array of coefficients ( filter taps ) that it generates as part of the C source code can be copy and pasted into a .csv file for use in ALICE.

The interface for the digital filters can be enabled or disabled by setting the following variable to either 1 or 0 in the alice_init.ini file, see ALICE Advanced User’s Guide for more details.

EnableDigitalFilter

Command Line Interface:

ALICE Desktop provides a simple command line interface for more advanced users who would like full access to the captured data and the inner working of the program and especially the Numpy library of array math functions. By default the button to activate this interface is not included in the Main ALICE window. To include the activate button, add the following line to the alice_init.inc file:

global EnableCommandInterface; EnableCommandInterface = 1

The interface is not complex to use if you are relatively familiar with Python syntax and the variable structure of ALICE. When creating ( using ) a variable for the first time it must be declared as global first. As a reminder, the interface starts up with the word global and a ; ( used to separate more than one command on the single line). To execute the command line either hit the <enter> or <return> key or click on the Execute button. The last line successfully executed is displayed just below where it says Last command:.

Figure 43 ALICE Command Interface

More advance information on the inner working of ALICE, variable and array names and the Numpy function library can be found in the ALICE Advanced User’s Guide.

One useful function that might come in handy is the Numpy function to write the contents of an array to a text file. For example, to save the VBuffA ( channel A voltage waveform buffer ) to a .csv file you would type:

numpy.savetxt(“my_data.csv”, VBuffA, delimiter=“,”, fmt='%2.4f')

Where “my_data.csv” is the name of the destination file, VBuffA is of course the data array to save, delimiter=“,” tells the function to use a , to separate the columns ( there won’t be multiple columns since most ALICE arrays are one dimensional ) and fmt='%2.4f' sets the format to 4 decimal places.

Customizing ALICE Desktop

This section has been moved to the ALICE Advanced User’s Guide.

Using the numpy library

This section has been moved to the ALICE Advanced User’s Guide.

For Further Reading:

Return to the Table of Contents.

university/tools/m1k/alice/desk-top-users-guide.1523380764.txt.gz · Last modified: 10 Apr 2018 19:19 by Doug Mercer