STORY

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: Math.com).

In this exercise we will use Ubidots' synthetic variables 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 device 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 allows you to generate new data from Math expressions. Inside your data source, click on "Add Synthetic 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 function: 4. Create a Python script to send data to the seed variable "t"

We have all set to start sending data! Make sure you have the Ubidots Python Library installed:

``sudo pip install ubidots``

Then create a file "send_t.py" with the following code:

``from ubidots import ApiClient# Create a Ubidots objectapi = ApiClient('PUT_YOUR_API_KEY_HERE')# Get our t variable using its variable IDt = api.get_variable('VARIABLE_ID')# Send a series of values between 1 and 1000for i in range(1, 1000):    t.save_value({'value':i})``

Finally, run the Python script and watch you variables get filled with dots to create nice Lissajous graphs!

``python send_t.py`` 5. Create the XY widgets in your dashboard

Now that we have 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" widget type and then select which series to graph. In our case, we created 6 scatter plots. 