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' math engine to generate trigonometric series, and then plot them in XY graphs to explore Lissajous figures. At the end, you should get graphs like these:
1. Create an account or login to Ubidots
Go to http://app.ubidots.com/accounts/signup and create a Ubidots account.
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:
4. Create your XY widgets in your dashboard
Now that we prepared our math functions, let's prepare the dashboard to plot some of them against each other. 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!
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 "send_t.py"with the following code:
Finally, run the Python script and watch you dashboard get filled with dots creating nice Lissajous graphs!