0

I have a RPi and attached to an input pin I have an ADC (MCP3002) and an op-amp (MCP601) and a piezo element connected to them. The RPi reads the input pin, gets the digital data and at the moment generates a graph using Matplotlib.

I want to take this data and store it in a meaningful way so I can analyse the input from the piezo and determine the frequency of the vibration. I understand I may need to use a codec (not sure how to develop using this) and to get the data I plan on using FFT algorithm to establish the frequencies present. The code I have used is an adaptation of the code found here

The voltage generated is digitized and converted to it's digital number equivalent and plotted on a graph to generate a waveform graph. I just want to convert it to a WAV file or something that can be analysed effectively using FFT.

1

If you are using matplotlib, then you are using Python, correct? If so, then for FFTs, you'll likely want to look at scipy or numpy.

For generating WAV files, Python includes a library called wave that can generate wave files from raw samples.

  • I've also been on a raspberry pi forum and it's been suggested that I could use CSV format and find a FFT algorithm to analyse raw values – JamesDonnelly Oct 6 '15 at 15:27
  • If your values were in CSV format, you could read the values into Python (csvreader is a Python library), and then use numpy or scipy to do the FFTs. But there's certainly also many programs that can just read in and display an FFT from a CSV (it's even something you could do in Excel (I think with a plugin)). – Brian Oct 6 '15 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.