PlainDSP plotter

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.

PlainDSP plotter

Does the following window look familiar to you ?

processing

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):

processing1

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:

processing5

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:

  1. Download and install Processing from here
  2. Download the Processing sketch from the download area
  3. Open this sketch with the Processing IDE
  4. 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
  5. Set the serial port in the Processing sketch in the variable named portName as per follow:

processing4

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:

viewer_tweaking

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/

HTH

Plaindsp Support Team

PlainDSP in a scientific application

The plain dsp team is very glad to announce the first official publication featuring the PlainDSP kit. Our congratulations go to Kostas and his team for designing such an awesome detector. Although PlainDSP kits can be used in the context of ludic applications, it provides all the means necessary for the design of much more serious games! Enjoy the reading of “HARDWARE IMPLEMENTATION OF A SYSTEM CLASSIFYING THE OPTOACOUSTIC SIGNATURE OF INSECTS WING-FLAP”. Downlaod publication from here

publication

Meet us at the Gamer Assembly

HL2 group is now the team behind Arduinoos. We are very much involved in the development of local and national initiatives in the world of open data, open software and open hardware. The team co-funded QuaiLab a very active FabLab which has been selected for managing a Maker Assembly aside the now famous Gamer Assy.

ga2015-logo

So, you are mostly invited to …

meet_us_gamer_assy_m

… at the Gamer Assy.

This amazing small robot has been extrapolated from an idea raised at QuaiLab, featuring an Arduino UNO, PlainDSP, a pair or servo-motors, a printed frame, two o’rings and a bunch of screws! The robot is driven by tones generated by a cell phone, or by instructions from Arduino IDE console and it can record and replay the recorded path. A detailed description of this project will come soon after the show.

The doppler effect and PlainDSP

John Pritchard, from the Iowa State university, recently released amazing works which illustrate the Doppler effect. This is an other example (John is also the author of the Machine To Machine application) of the combined used of the Plain DSP audio shield along with the PlainDSP library.

For those who are not familiar with the Doppler effect, this phenomenon happens when you (the observer) are standing next to a road while a honking car (the moving object) is travelling in front of you. Under these conditions, you have the feeling that the frequency of the honk increases as the car is approaching and then this frequency decreases when the car moves away. The reason is that the car produces a constant sound (i.e. an acoustic wave) but as the car moves along its path, the waves are compressed in front of the car and released behind the car as illustrated below:

doppler

Sound pressure waves depending of the observer position relative to the car

The shortest the wave period, the higher the corresponding frequency and conversely, hence the  resulting sound for an observer standing next to the road.

The purpose of John’s experiments is to compute the speed of a car using the Doppler effect. Assuming the car produces a base frequency f0, the observer will hear a frequency f1 as per the formula below:

formula1

With:

  • f1 the frequency in Hz heard by the observer
  • f0 the frequency in Hz produced by the honk of the car
  • c the speed of sound in free air (340.29 m/s)
  • vr the velocity of the observer in m/s
  • vs the velocity of the moving car in m/s

Assuming that the observer does not move, vr equals 0. The speed of the moving vehicle can be computed from f0 and f1 with the following formula:

formula_2

John used the sound from this video .

Then, using the PlainDSP audio kit, he recorded three measurements:

  •  f0: the frequency of the car honking at stop
  • The minimum and the maximum frequencies when the car moves in front of the observer. These frequencies are both the f1 of the formulas above, one when the car is approaching and one when the car is departing

Next are the results of this experiment. The PlainDSP kit is responsible for acquiring raw sound data and computing the frequency spectra using FFT, and uploading spectra to the computer via the serial communication port. Then the data are plotted using MATLAB and its Arduino support package:

experiment

Source frequency (left) and frequency change as car passes (right). The X coordinate is the frequency bin as used in the FFT algorithm.

 

The above illustration is extracted from the Quick notes on Doppler Measurements.pdf prepared by John. The measured frequencies are:

  • f0 : 1.2188 kHz
  • f1 (car approaching) : 1.2656 kHz
  • f1 (car departing): 1.1719 kHz

So the resulting car speeds are:

  • When the car is approaching:

experiment8

  •  When the car is departing:

experiment7

Starting from there, one can easily assume that the car was travelling at an average speed of 30 mph.

Well, many thanks John, this is an other exciting application which proves that this simple audio kit can achieve spectacular results! Enjoy and keep us posted with your comments.

PlainDSP rev. g

The PlainDSP development and support team is happy to announce the release of PlainDSP rev. g.

There are very minor modifications in the code. However, we decided to introduce a much more efficient documentation system which we hope will help you to get the most from the code. Doxygen has been chosen to generate an html based interactive documentation which replaces the stone age looking reference manual.txt ascii file. If you have one, keep it as a collector. You may resell it later! Or, said differently, the computer archeologists from the fourth milenary will have a big laugh at it or get lost in conjectures. Blah! In fact we keep willing to deliver the simplest (plain) material, with no crap, just plain fun with clean code so that we tried various options and decided to go for this de-facto standard in open source documentation.

After downloading the PlainDSP_1g.zip file, uncompress it to your “arduino\library\” folder. You now have a doc sub-folder, followed by an html sub-folder. Get there and start from the index.html file.

Note: If you upgrade form an earlier version of PlainDSP, move this directory to another location prior to un-compressing the latest release.

PlainDSP works like a charm on the UNO and the MEGA compatible boards. As many of you gave the MEGA a try, we decided to make the blink parametric so that it will work from scratch without needing to change any line of code. In terms of code performance, the main difference between the two types of board is the amount of memory. While the UNO allows 128 samples of data, the MEGA 2560 can handle 512 samples. However, the computational speed will stay the same as both types of board are clocked at the same frequency (16 MHz). In other DSP words, the MEGA will help in gaining a better spectral resolution compared to the UNO.

Many thanks to John and Mickael who updated the source code for achieving this documentation. We hope you will like it and look forward to reading your feedbacks soon.