What is this post about ?
Some of the example sketches released with PlainDSP library will export data in numerical form. These data are arranged so that they can be copy/paste from Arduino serial port monitor to most spreadsheets editors. Although this feature is yet convenient for exporting data, this method is pretty boring and not dynamic at all. The support team of plaindsp heard your sighings and prepared this nice solution for you.
The proposed solution features Processing which is one of Arduino’s best friend software composer. The code is made simple enough so that any one can use it and tweak it.
So enjoy and keep us posted with your feedback.
Does the following window look familiar to you ?
It is the processing IDE. For your records, the Arduino IDE is based on this original IDE.
According to the processing website https://processing.org/: “Processing is a programming language, development environment, and online community”.
It is based on the Java language and it provides an easy way to develop small applications, especially graphical applications. With few lines of code, you can draw complex pictures such as the following one (produced from a Processing built-in example):
The plaindsp support team has developed an open source Processing sketch that prints dynamic charts from the data sent by an Arduino board!
Using advanced DSP algorithms may be tricky while developing an application, having a graphical representation of the data makes things much easier. Here is an example of the Processing sketch output:
This screenshot is taken from the spectrum plotter example sketch running on an Arduino UNO board plugged onto a plaindsp audio shield . The Arduino board uploads the acquired data to the computer through a USB cable and the Processing application retrieves this data and prints it as a chart . You can see the frequency in Hz on the x-axis and the signal amplitude on the y-axis.
To get this application running, go through the following steps:
- Download and install Processing from here
- Download the Processing sketch from the download area
- Open this sketch with the Processing IDE
- Open a plotter example from the PlainDSP library and upload it to an Arduino board (don’t forget to plug the plaindsp audio shield if you are recording sounds). Please also note the serial port used by the Arduino IDE, you will need to specify it in the Processing sketch. This port name is given at the bottom right side of the Arduino IDE
- Set the serial port in the Processing sketch in the variable named portName as per follow:
Run the Processing sketch and enjoy ! As a bonus, if you click on the plotter window, it will take a snapshot and save it in the sketch directory.
For an advanced use, you can also modify the Processing sketch. For example, you can disable the y-axis auto scaling by commenting out the following lines:
The output will look like the following video:
Note 1: The baud-rate of the serial port has been raised to 1,000,000 bps in both the processing sketch and the PlainDSP Arduino example sketch in order to decrease the delay needed to upload data down to 15 ms.
Note 2: The music samples come from http://www.bensound.com/
Plaindsp Support Team