Giter Club home page Giter Club logo

arbitrary-waveform-generator's Introduction

arbitrary-waveform-generator

Define and generate waveforms to output with your favorite DAC

This python module lets you define synchronized waveforms and sample them to be output through a multi-channel DAC. So far, the code maily targets the the FL2k USB-to-VGA dongle using osmo-fl2k software, although the code could easily be modifed to output other formats. At the moment, the output is in an 8-bit signed format for use with osmo-fl2k.

Example Usage

See example.py for more details on usage, but the main points are highlighted here:

Define the number of channels and pre-equalization. You can select the number of channels to be defined. Additionally, you can opt to use DAC pre-equalization to flatten the DAC response. This compensates for the effect of the DAC's zero-order hold, which rolls off high frequencies. See this page from Maxim for more details.

    # create 3 waveform channels
    arb = arbgen.Arbgen(channels=3, pre_equalize=False, equalization_taps=7)

Create waveforms. First, select a channel to define. Next, you may set the output value, define a delay until the next event, define one of several types of edges and pulses, define sine waves, or supply your own mathematic function to define the waveform. In this case, we'll create a 400 ns wide Gaussian pulse with 100 ns rise and fall times:

   # define a 400 ns Gaussian-edged pulse wih 100 ns transitions
   arb.channel(0)
   arb.setValue(0)
   arb.delay(200e-9)
   arb.posPulse(shape='Gaussian', rise_time=100e-9, fall_time=100e-9,
                width=400e-9, amplitude=1)
   arb.delay(200e-9)

Pulse edges are defined by the 50% amplitude point by default (this can be changed with other parameters to the call), so the pulse edge is 200 ns after the start of the waveform in this example. The rise and fall times are measured at the 10% and 90% amplitude points by default (this can be changed), and the pulse width is measured at the 50% amplitude points. Pulse and edge shapes can be Gaussian, ramp (linear), exponential (RC), or square.

Save Sampled Waveforms. The example code saves the waveforms to three files. One call is shown here.

 # save sample
    arb.save(filename='chan0.dat',
             channel=0, sample_rate=sample_rate, cycles=cycles)

Preview Waveforms. The example code plots the output waveforms as sampled at 100 MS/s. The plot is shown here: Waveform Preview

Output Waveforms. The osmo-fl2k library was used to output the example waveforms at 100 MS/s. No filtering was used at the output of the DACs. The result is shown in the following oscilloscope image. Note that the pulse widths and rise times correspond very closely to those defined in the code.

Oscilloscope Image

arbitrary-waveform-generator's People

Contributors

tedyapo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.