Using other devices with Spectrogram.py

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
planetside
 
Posts: 3
Joined: Mon Oct 15, 2018 2:43 pm

Using other devices with Spectrogram.py

Post by planetside »

re: the software tool found here: https://learn.adafruit.com/fft-fun-with ... s/software

Spectrogram.py looks like a nice tool and I'd like to use it with hosts other than the Teensy - could someone please give an example of the data sequence to be sent over serial?

It seems to be:
send fft size
send sample rate
send magnitudes

I'd be great to have a working example packet.

Thanks,
Andy

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: Using other devices with Spectrogram.py

Post by adafruit_support_mike »

Porting the code to other microcontrollers will be a medium-difficult challenge.

The code relies on the M4 microcontroller's Single-Instruction-Multiple-Data (SIMD) hardware to process the FFTs. That part of the chip does most of the calculations in parallel rather than making the ALU chug through the same operation for a whole list of data points.

User avatar
planetside
 
Posts: 3
Joined: Mon Oct 15, 2018 2:43 pm

Re: Using other devices with Spectrogram.py

Post by planetside »

That's ok, I'm not looking at porting the FFT processing part yet - I'd just be really helpful to know the exact series of data that Spectrogram.py is looking to receive over serial so that I can display it.

The communication sequence isn't documented - it's just fft size, sample rate and then the magnitudes? Is that to be sent as one line, multiple lines, separating characters, are the magnitudes floats or ints etc?

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: Using other devices with Spectrogram.py

Post by adafruit_support_mike »

The command set is listed in the COMMAND PARSER FUNCTIONS section at the bottom of the spectrum.ino and toneinput.ino sketches for the microcontroller.

User avatar
planetside
 
Posts: 3
Joined: Mon Oct 15, 2018 2:43 pm

Re: Using other devices with Spectrogram.py

Post by planetside »

Thanks Mike. I wrote a test script for Arduino which sends random data to Spectrogram.py

Code: Select all

// Arduino test script for Tony DiCola's Spectrogram.py

long randNumber;

void setup() {

Serial.begin(38400);

randomSeed(analogRead(0));// use analog value as random seed

}
void loop() {

  Serial.println("256"); //send fft size

  Serial.println("128"); //send sample rate in hz
  
  while(1){
  
  for (int i=0; i<256; i++) // send magnitudes 
  
   {
       randNumber = random(829);
       Serial.println(randNumber);  //send random magnitude
   }
  
  delay(500);
  }
}
spectrogrampy.PNG
spectrogrampy.PNG (94.53 KiB) Viewed 79 times

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: Using other devices with Spectrogram.py

Post by adafruit_support_mike »

Glad to hear you got it working. Happy hacking!

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”