Drawing Lissajous Curves on a Oscilloscope

Lissajous curves (http://en.wikipedia.org/wiki/Lissajous_curve) are two dimensional figures where the points (x,y) are defined by sine functions with different coefficients:

x = sin(t)
y = sin(at+b)

By modifying a and b over the period t, a wide variety of fascinating curves can be drawn, some of which look almost 3D!

For example, if y is a sine wave that is exactly 90 degrees offset (“out of phase”) from x, the plot is a perfect circle:

x = sin(t)
y = sin(t+pi/2)


(credit: Wikipedia)

In the lab, an oscilloscope is the ideal instrument for plotting x and y coordinates. Typically, an oscilloscope will plot the voltage of an primary input on the y axis vs. time on the x- axis.

scope_5

However, most oscilloscope will allow you to supply an external input that will allow you to directly control the x axis. We can connect a function generator to both the x and y axis and begin to draw Lissajous patterns.

IMG_0920

IMG_0888

By shifting the frequency and phase of the signals, you can get different shapes. However, even at the office we don’t yet have two (working) function generators which can be phase locked. In the picture above, you can see that we’re using a HP33120A and a HP 200AB. The 33120A has a trigger input, but no such luck for the old-school 200AB. With some fiddling, they can be brought into phase, but it’s much easier and more fun to build our own frequency generators. That’s where the DAC Shields and an Arduino come in.

IMG_0914

The DAC Shield has inputs for positive and negative power and an output for the signal. For this exercise, we’ll be using two bench power supplies (Mastech HYB3003 and Mastech HYB3003), but you could also use two batteries.

IMG_0925

The output of one shield is connected to the X-axis input of the ‘scope the other is connected to the Y-axis. On the Tektronix 2246 shown here, channel 1 can be set to drive the X-axis.
The trick to initially plotting a circle is to make sure that the amplitude of both axis move the cursor equal amounts, so make sure to set both “volts/div” settings the same.

IMG_0933

To start with a circle we simply write a program that generates a sine wave at a given frequency on channel 1 and then creates a second sine wave on channel two which is 90 degrees out of phase.

while(true):
write(channel1, sin(t));
write(channel2 sin(t+pi/2))

While this pseudo code is close, some considerations have to be made due to the discrete nature of the DAC. For instance, the resolution of the DAC will determine the value of the minimum output, zero and the maximum output. In this case we have a 12bit DAC with positive and negative supply rails at 10 V and -10V, respectively. Writing a “0″ to the DAC will result in an output of -10V. Similarly, writing “2048″ will output 0V and “4096″ will output 10V.

Thus, we need to scale our original pseudo equations:

write (channel1, (sin(t) * 2048 + 2047))

Where t = 0 would be 2047, t=pi/2 is 4096 and ….

Another consideration is the base frequency for the sine wave; this will depend on how fast you can write to the DAC and how many cycles it takes to compute the sine wave. Inserting different delays between samples of the wave generates different frequencies. For example if you the second channel is doubled in frequency from the first you will generate the following shape.

IMG_0931

Also by increasing the phase of one the the sine wave though every iteration of the loop the figure can be animated as seen here on a Rigol MSO4050 in which we are evaluating.

Example source code and schematic for the DAC shield can be found on Github here, Also the Power DAC Shield can be purchased from Tindie.

power_dac_shield_banner1-01

 

This entry was posted in Eletronics. Bookmark the permalink.

One Response to Drawing Lissajous Curves on a Oscilloscope

  1. alan says:

    love your site – these homebrew project are where it’s at. Any upcoming planned projects?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>