Lissajous figures occur when two harmonic signals are plotted against each other. They were studied by the French physicist Jules Antoine Lissajous, which is why they are known under his last name.

Before the days of digital frequency meters and phase-locked loops, Lissajous figures were used to determine the frequencies of sounds or radio signals. A signal of known frequency was applied to the horizontal axis of an oscilloscope, and the signal to be measured was applied to the vertical axis. The resulting pattern was a function of the ratio of the two frequencies (source:

In this exercise we will use Ubidots' math engine to generate trigonometric series, and then plot them in XY graphs to explore Lissajous figures.

Creating a Lissajous graph

  1. Create an account or login to Ubidots
  2. Create a data source and a variable "t"

The variable "t" will be an incremental series between 0 and 1000. It will act as a seed variable for us to generate all the other functions like "sin(t)" or "cos(t). We will create that data from a Python script later on. Make sure to take note of your "variable id".

3. Create trigonometric functions using the "derived variables" option

One of the cool things about Ubidots is that is allows you to generate new data from Math expressions. Inside your data source, click on "Add Derived Variable" and type the corresponding math formula. Do this procedure one time for each trigonometric function you wish to explore. In our case, we generated the following functions:

  • Adding "sin(2t)" derived variable

4. Create the XY widgets in your dashboard

Now that we have prepared our math functions, let's prepare the dashboard to plot some of data. Go to the dashboard tab and click on "Add new widget" then click on the "Scatter Plot" widget type and then select which series to graph. In our case, we created 6 scatter plots. At the end you should have several blank widgets waiting for some action assuming you are following this tutorial and not using raw data from a device.

Creating Derived Variables

  • Blank Dashboard waiting for some data

5. Create a Python script to send data to the seed variable "t"

We have all set to start sending data!

Let's grab your API Key from your Ubidots profile:

Make sure you have the Ubidots Python Library installed:

sudo pip install ubidots

Then create a file ""with the following code: 

from ubidots import ApiClient
# Create a Ubidots object
api = ApiClient('492f8bf3298e2244d20aa607b5c81b0d23fd91c7')

# Get our t variable using its variable ID
t = api.get_variable('55107b677625424f46b91fc4')

# Send a series of values between 1 and 1000
for i in range(1, 1000):

Finally, run the Python script and watch you dashboard get filled with dots creating nice Lissajous graphs!


Did this answer your question?