Author Topic: sound analyzer for automating quality checks?  (Read 5621 times)

0 Members and 1 Guest are viewing this topic.

Offline engineheatTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: us
sound analyzer for automating quality checks?
« on: December 14, 2018, 12:28:53 am »
Let's say for a quality check on a gearmotor, you want to check whether everything has been built correctly. If correct, the gearmotor should make a low humming noise, if not, it will make loud noise with a different sound profile. Damaged teeth might cause this for example.

The gearbox are coming off an assembly line and currently a person manually check the noise for each unit by turning it on/off. But there is already a station on the line that turns the motor on/off for function test and I wonder if there are sound analyzers that I can put there that can differentiate between a good/bad motor, and then send a signal to the PLC to accept or reject.

By the way, there is ambient noise too.

What do I need to buy to implement something like this? I'm guessing an industrial PC, a sound analyzer at the minimum. thanks
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #1 on: December 14, 2018, 03:06:58 am »
Put a piezotransducer on a golden reference and record it.  Do an FFT and  set up a mask test on the FFT.
Schatten sells a guitar transducer which is quite flat up to about 8 KHz for around $20.

I'd guess that you can't do a mask test on an FFT on most DSOs, but you should be able to store a reference FFT and do a difference.

Problem is, the people who write the FW for DSOs have no idea at all of how to use one.

So if you want to plot the hysteresis of a core material you have to buy an ancient LeCroy or build an analog integrator.  Cause we just ain't going to let you choose anything but an XY plot  of two adjacent raw input channels.  The A list OEMs want to sell you another instrument for that.  And at $20K for a DSO it's ridiculous that you can't plot CH1 vs  Integral(CH2).
 

Offline engineheatTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #2 on: December 15, 2018, 02:21:50 am »
any other ideas?
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #3 on: December 15, 2018, 03:05:45 am »
Record 10-20 seconds with  a good  microphone and sound card  to a PC.  Decide what you want your resolution bandwidth to be.  Break the long trace into pieces of the required length, FFT and sum them frequency by frequency using Octave or MATLAB.  Plot it with guard band curves on the PC screen.

 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12298
  • Country: au
Re: sound analyzer for automating quality checks?
« Reply #4 on: December 15, 2018, 03:22:09 am »
To get around the majority of the ambient noise, I might suggest you use a contact microphone that can be reliably placed for consistent pickup.  An isolation booth would be the preferred option, but I guess that won't be practical.  Even so, if it is possible to set up a couple of panels on two or three sides that have sound absorbent material fitted, this can reduce a lot of ambient noise.

Once you have the sound collection process sorted, there will need to be some signal analysis with a go/no go output.  This is going to be the bigger challenge and the solution will depend on just how precise the analysis will need to be - but the basic spectrum analyser part can be done with a cheap Arduino.  The go/no go assessment will require a bit more effort - unless someone has already written some code to do that.  Even so, tuning it in for defining the correct pass/fail mask could be fun.


Sounds like a fun project, actually.  Wish I had the time.
« Last Edit: December 15, 2018, 03:32:04 am by Brumby »
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #5 on: December 15, 2018, 02:52:43 pm »
With a stereo sound card you can play a WAV file with the outputs looped back to the inputs and correct all the analog and ADC errors.

There is quite a lot of processing to do this properly.  An Arduino is not going to do a very good job and will be a huge pain to make work.  Lower resolution ADC and it would require building the analog front end.  After all that work, even an ARM based Arduino is likely to lack the performance needed.  It's a lot more than doing a single FFT.

Microphones have poor low frequency response and piezo transducers have limited high frequency response,  My Schatten guitar transducer peaks at about 8 KHz and then rolls off when attached to the voice coil of a coneless tweeter and swept.  A stereo sound card will allow using both sensors.  A MEMS 3 axis accelerometer such as the ADXL335 will have a frequency response all the way to DC but would require 2 sound cards and a good deal more math. But it would perform better than a single axis accelerometer such as the Schatten.
 

Offline engineheatTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #6 on: December 18, 2018, 03:16:54 am »
Thanks for the response so far.

I think I will go with the microphone/PC/FFT route. That's what I initially thought. I'm not really familiar with piezoelectrics.

The motors will arrive in group of 4. I can't record each one's sound individually because all 4 will be turned on at the same time for a function test. Testing motors individually will require too many change to the existing machine which adds cost and my company is pretty risk averse. It'll also slow the rate of production to an unacceptable level. This function test is just a part of an assembly line and I don't want it to become a bottleneck.

So with all 4 turned on at the same time, the idea is that if any one of them makes weird or loud noises, the FFT solution will still work hopefully (will it?) And all 4 will be sent to a manual rework station as a group.

While I get the rough idea to proceed, I hope you guys can give me more details on implementation, like what software to use. I heard MATLAB being mentioned. Another problem is that whatever decision the software makes, I somehow need to send that signal to the PLC (Siemens). How will I do that?

I'm a newbie right now to PLCs. This project will be a great learning experience.

Thanks
 

Offline johnwa

  • Frequent Contributor
  • **
  • Posts: 255
  • Country: au
    • loopgain.net - a few of my projects
Re: sound analyzer for automating quality checks?
« Reply #7 on: December 18, 2018, 08:40:52 am »
The search term you are looking for is "condition monitoring". There should be plenty of equipment available off the shelf.
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #8 on: December 18, 2018, 03:29:40 pm »
Octave is free.  MATLAB is not.  For commercial use it  was around $1500 the last time I looked.

Basic algorithm is as follows:

Collect about 10 seconds of data at 44.1 KSa/S (standard CD sampling)

Break it into 100 pieces 4096 samples long

Multiply the samples by weights from 0 to 1 to 0 with 1 in the middle

Compute the FFT of each of the pieces

Average the modulus (absolute value of a complex number) of all 100 pieces

Plot the first 2048 samples of the average.

The result will be the amplitude spectrum from 0 to 22.05 KHz at a resolution of 10.8 Hz

Schatten pickups are cheap:

https://www.stewmac.com/Pickups_and_Electronics/Pickups/Violin_Pickups/Schatten_Soundboard_Transducer.html

If you glue them to a disk magnet slightly larger diameter they should be durable and quick to install and remove.  They are fragile if not reinforced. They are limited to about 8 kHz but that should be quite adequate.  If the housing is not magnetic then they are not a viable solution.
 

Offline engineheatTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #9 on: December 19, 2018, 12:28:49 am »
Octave is free.  MATLAB is not.  For commercial use it  was around $1500 the last time I looked.

Basic algorithm is as follows:

Collect about 10 seconds of data at 44.1 KSa/S (standard CD sampling)

Break it into 100 pieces 4096 samples long

Multiply the samples by weights from 0 to 1 to 0 with 1 in the middle

Compute the FFT of each of the pieces

Average the modulus (absolute value of a complex number) of all 100 pieces

Plot the first 2048 samples of the average.

The result will be the amplitude spectrum from 0 to 22.05 KHz at a resolution of 10.8 Hz


Thanks. Why break it into 100 pieces and take the average? Why multiply the samples with 0 to 1 using the method you mentioned? How would the intensity of the sound (distance from source to microphone) affect the DFT? Only the amplitude will change right?

Do you think it's necessary to do a DFT on the ambient noise as well and maybe filter the ambient noise out first?
 

Offline cdev

  • Super Contributor
  • ***
  • !
  • Posts: 7350
  • Country: 00
Re: sound analyzer for automating quality checks?
« Reply #10 on: December 19, 2018, 12:44:54 am »
You can get bare piezo discs for less than a dollar (or less in quantity), and wrapped in a small plastic case slightly less suitable for use as a contact mic. but more durable for under $2.
« Last Edit: December 19, 2018, 12:48:38 am by cdev »
"What the large print giveth, the small print taketh away."
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #11 on: December 19, 2018, 01:48:31 am »


Thanks. Why break it into 100 pieces and take the average? Why multiply the samples with 0 to 1 using the method you mentioned? How would the intensity of the sound (distance from source to microphone) affect the DFT? Only the amplitude will change right?

Do you think it's necessary to do a DFT on the ambient noise as well and maybe filter the ambient noise out first?

You average 100 samples to reduce the variance of your estimate.  The reason that most DFTs on DSOs are so bad is because the programmers did not do that. 

The triangular, Bartlett, window is so the spectral peaks are not smeared out.  In the frequency domain it's a (sin(x)/)**2 rather  than the sin(x)/x of a rectangular window.  I've yet to see a DSO that offered a Bartlett window.  Check wikipedia on the subject of window functions.  Install gnuplot, set samples to 10000, plot the two functions and take a look at the sidelobes.

The lower the amplitude the greater the quantization noise component.

I could compensate for the ambient noise, but I suggest you use a sound isolation box instead.  You really don't want to learn that much about DSP or spend the amount of time it would take to code it properly.  It is not trivial. 

Most of a seismic processor's time is spent suppressing noise.  How you do it depends upon what type of noise it is and where it is coming from.  Data acquisition contracts have many pages of stipulations about noise levels and there is a company representative on hand to check them continuously during the entire acquisition.  You can't shoot if another boat is closer than so many miles.  You can't shoot if the waves are higher than some value, etc.

Install Octave and get to the point you can do the steps I outlined previously.  You'll have a much better appreciation of the problem you have posed.  It's very sensible and readily done, but it is not something you do in an afternoon.  In your case, starting from square one it will probably take a week or more of work just to do a proof of concept.

Personally, if I were doing this I'd write a C program.  I'm not impressed by the software engineering of Octave.  I cannot compile it on Solaris.   It claims to be able to read WAV files and I think it will interface to a sound card, but frankly I don't know.  I use Octave from time to time to prototype solutions to problems, but that is all.  Octave/MATLAB are not really designed for solving production problems.  They are research tools.  I only suggested using those because of the complexity and the amount of work a production quality C program would require.

Octave/MATLAB are good enough to produce a proof of concept.  Make WAV format recordings of a good gearbox and a bad gearbox in a quiet environment and compare them using the process I outlined.  A Zoom H1 recorder for $100 will give you a good stereo WAV file to work with.
 

Offline engineheatTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #12 on: December 21, 2018, 04:51:11 am »


Collect about 10 seconds of data at 44.1 KSa/S (standard CD sampling)



Thanks for your responses so far. Turns out I cannot collect 10 sec of sound, more like 0.5 sec to 1 sec. This is due to the nature of the existing production line. I can't slow down the rate, nor will they let me. Can 1 sec of sound sample work?

I'm thinking of using Python (with the scikit-learn and pyaudio package). I'm more familiar with Python, and it has a package to interface with the PLC too.  How powerful of a computer do I need for this? The processing must be done in matter of tens or hundreds of millisecond in order to not slow down the production.

 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #13 on: December 21, 2018, 12:31:15 pm »
You can use 10 samples.  The variance of the spectral estimate is 1/sqrt(N) which is why I recommended 100 samples.  Any PC will be fast enough.  An Arduino probably would not.  Also,  with a PC you can save the spectra for each unit.  That will be important for establishing the spectra for good units and bad units.  You can also then compute average spectra on an hourly or shift basis to look for problems caused by changes in the production process, for example ambient temperature.

If you collect 40960 time samples you can use 10  samples  4096 long with 11 Hz resolution or 20 samples 2048 long with 22 Hz resolution or 40 samples with 43 Hz resolution.  The variance of the estimates at 43 Hz resolution will be 1/2 the variance at 10 Hz resolution.

You should record a known good unit and a known bad unit for 1000 seconds and then compute the averaged spectra for the various window lengths to establish how many samples to average and what your resolution bandwidth needs to be.  It would be very desirable to collect recordings from more than one sample unit so that you get some data on the variance of the good and bad gearmotors themselves.

I'm not all that familiar with python, but I'm sure that it has all the features you need.  So if you are comfortable using that, use it.
 

Offline engineheatTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #14 on: January 13, 2019, 11:36:41 pm »
You can use 10 samples.  The variance of the spectral estimate is 1/sqrt(N) which is why I recommended 100 samples.  Any PC will be fast enough.  An Arduino probably would not.  Also,  with a PC you can save the spectra for each unit.  That will be important for establishing the spectra for good units and bad units.  You can also then compute average spectra on an hourly or shift basis to look for problems caused by changes in the production process, for example ambient temperature.

If you collect 40960 time samples you can use 10  samples  4096 long with 11 Hz resolution or 20 samples 2048 long with 22 Hz resolution or 40 samples with 43 Hz resolution.  The variance of the estimates at 43 Hz resolution will be 1/2 the variance at 10 Hz resolution.

You should record a known good unit and a known bad unit for 1000 seconds and then compute the averaged spectra for the various window lengths to establish how many samples to average and what your resolution bandwidth needs to be.  It would be very desirable to collect recordings from more than one sample unit so that you get some data on the variance of the good and bad gearmotors themselves.

I'm not all that familiar with python, but I'm sure that it has all the features you need.  So if you are comfortable using that, use it.

Okay, I think I appreciate your response a lot more now. I first tried to record 1 sec of sound (sample rate =44100) and did DFT on all 44100 samples. The spectrum looked different each time, even as I tried to control the settings the best I can. I then downloaded a FFT spectrum analyzer to my smartphone and it turns out the spectrum is fluctuating quiet a bit.

So if I understand you, I will split the 1 second into ten 100ms chunks, do a DFT on each of those and average the result. I understand this decreases the variance. I do have some background in statistics, it's just the DSP part that I'm weak on. If I have less samples each time, my frequency resolution will be bigger (but this doesn't seem to be an issue), is that right?

Thanks
 

Offline engineheatTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #15 on: January 14, 2019, 12:16:12 am »
I recorded a 1 second clip of audio using pyaudio, sample rate 44100, format=pyaudio.paInt16.

I got 44100 samples, the values ranged from -100 to 100 roughly. I took the max and it's 102. The recording was pretty quiet. Had I made some noise, the values would've been in 5 figures. But anyway...

I took the FFT and plotted it, the max magnitude of the FFT is around 191689.921.

I want the magnitude of the FFT to match the amplitude of the input, if I remember correctly I have to divide FFT values by the number of samples, but that still would not get me anywhere close. I expect to see a max FFT magnitude of 102, what is wrong?

Thanks
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #16 on: January 14, 2019, 12:34:33 am »

Okay, I think I appreciate your response a lot more now. I first tried to record 1 sec of sound (sample rate =44100) and did DFT on all 44100 samples. The spectrum looked different each time, even as I tried to control the settings the best I can. I then downloaded a FFT spectrum analyzer to my smartphone and it turns out the spectrum is fluctuating quiet a bit.

So if I understand you, I will split the 1 second into ten 100ms chunks, do a DFT on each of those and average the result. I understand this decreases the variance. I do have some background in statistics, it's just the DSP part that I'm weak on. If I have less samples each time, my frequency resolution will be bigger (but this doesn't seem to be an issue), is that right?

Thanks

You've got the idea.

There are 3 normalizations used in FFTs.  1/N on the either the forward or the inverse or 1/sqrt(N) on both.  I prefer the latter. Also the exponent can be either +1 or -1 for the forward transform.  The inverse will be the opposite.

I strongly recommend getting a copy of

Random Data
Bendat & Piersol

I started with the 2nd ed, but also have the 3rd and 4th which is the last as Piersol passed away.  You should be able to get a 2nd ed very cheaply and it treats everything you need to deal with very thoroughly.
 

Offline L_Euler

  • Regular Contributor
  • *
  • Posts: 86
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #17 on: January 14, 2019, 01:09:43 am »
Get one of these, or similar and a piezo probe or microphone.  You can use GPIB to automate the testing, pass/fail, and data recording.
« Last Edit: January 14, 2019, 11:57:03 am by L_Euler »
There's no point to getting old if you don't have stories.
 
The following users thanked this post: engineheat

Offline engineheatTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #18 on: January 15, 2019, 03:46:24 am »
Get one of these, or similar and a piezo probe or microphone.  You can use GPIB to automate the testing, pass/fail, and data recording.

Thanks, I'll look into it.
 

Offline engineheatTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #19 on: January 15, 2019, 03:53:34 am »

Okay, I think I appreciate your response a lot more now. I first tried to record 1 sec of sound (sample rate =44100) and did DFT on all 44100 samples. The spectrum looked different each time, even as I tried to control the settings the best I can. I then downloaded a FFT spectrum analyzer to my smartphone and it turns out the spectrum is fluctuating quiet a bit.

So if I understand you, I will split the 1 second into ten 100ms chunks, do a DFT on each of those and average the result. I understand this decreases the variance. I do have some background in statistics, it's just the DSP part that I'm weak on. If I have less samples each time, my frequency resolution will be bigger (but this doesn't seem to be an issue), is that right?

Thanks

You've got the idea.

There are 3 normalizations used in FFTs.  1/N on the either the forward or the inverse or 1/sqrt(N) on both.  I prefer the latter. Also the exponent can be either +1 or -1 for the forward transform.  The inverse will be the opposite.

I strongly recommend getting a copy of

Random Data
Bendat & Piersol

I started with the 2nd ed, but also have the 3rd and 4th which is the last as Piersol passed away.  You should be able to get a 2nd ed very cheaply and it treats everything you need to deal with very thoroughly.

Dumb question...you are supposed to average the magnitude of the spectra right? not the FFT (complex numbers)...

anyway, I got a crude version working. I used Python with the Pyaudio package and recorded 10 seconds of sound just for test. Sample rate =44k, each frame is 1024 samples. For each frame I plotted the magnitude, and made a dynamic plot thru the 10 seconds. It actually works. I was able to see the magnitudes change as I made various sound.

However, I also downloaded a FFT analyzer to my smartphone and compared the results as I turned on a motor. The smartphone app is able to display relatively constant spectrum (not much flutuations) right from the start. In my plot, the magnitudes are very high upon turning on the motor, and only "settled" after a couple of seconds.

I wonder why that is. Is it due to my sound card or laptop mic? I tested using another laptop and got similar result. Could it be I recorded in Mono mode? The spectrum changes too much as I move the motor, whereas on the smartphone the spectrum is more stable.

Is it because I didn't use a Window function?

Thanks
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #20 on: January 15, 2019, 05:14:17 am »

Dumb question...you are supposed to average the magnitude of the spectra right? not the FFT (complex numbers)...


Yes, that is correct.  You would need to synchronize the windows if you wanted to also get the phase information.

Quote

anyway, I got a crude version working. I used Python with the Pyaudio package and recorded 10 seconds of sound just for test. Sample rate =44k, each frame is 1024 samples. For each frame I plotted the magnitude, and made a dynamic plot thru the 10 seconds. It actually works. I was able to see the magnitudes change as I made various sound.

Each frame is  only 23 mS.  Try using a longer window 4096 or 8192 samples.

Quote

However, I also downloaded a FFT analyzer to my smartphone and compared the results as I turned on a motor. The smartphone app is able to display relatively constant spectrum (not much flutuations) right from the start. In my plot, the magnitudes are very high upon turning on the motor, and only "settled" after a couple of seconds.

I wonder why that is. Is it due to my sound card or laptop mic? I tested using another laptop and got similar result. Could it be I recorded in Mono mode? The spectrum changes too much as I move the motor, whereas on the smartphone the spectrum is more stable.

Is it because I didn't use a Window function?

Thanks

Probably.  You're asking me to guess what someone else's program is doing without being able to probe it.  Post some plots of the time domain and frequency domain without any averaging using the longer window.

If the first and last samples in the window are very different, the discontinuity will distort the spectrum.  Put the triangle taper on the window and it should be much more uniform from spectrum sample to spectrum sample.

Find a way to create a constant frequency tone, record it and then post plots of the time and frequency domain.  If nothing else, just whistle or hum with as constant a pitch as you can manage.

Then compare the spectrum you get if you start the recording before the tone and if you start the recording after the tone.

The triangle window will give you the sharpest spectral peaks.  Try it also using a cosine taper.   (cos(-pi) + 1)/2 to (cos(0) +1)/2 at each at the start and the reverse at the end.  Then vary the number of samples in the range from -pi to 0 so you change how steep the taper is.
 

Offline engineheatTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #21 on: January 15, 2019, 01:17:03 pm »
Get one of these, or similar and a piezo probe or microphone.  You can use GPIB to automate the testing, pass/fail, and data recording.

Hi, can you program these devices to make pass/fail decision on its own (using your own algorithm) or do you need to connect a PC to grab the signal and perform custom analysis?

Thanks
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #22 on: January 15, 2019, 10:43:53 pm »
Attached is the algebra of correcting for sound card errors on a stereo sound card by playing a computed WAV file and recording it.  This is for each frequency in the spectrum.  Ideally you would do it at all amplitude levels to correct for non-linearities in  the ADC and DAC.  I've got a reputation for going a bit overboard. :)

It requires that you be able to play and record at the same time. It requires playing each channel back into itself and the opposite channel.  So 4 equations in 4 unknowns.

I'm cleaning up clutter and found this, and I thought it might be useful to someone.  This seemed a good place to post it.  It's essential to making a THD analyzer using a sound card.  Which, naturally, you will need if you read "Max Wein, Mr. Hewlett and a Rainy Sunday Afternoon" by Jim Williams and get motivated to build an ultra low distortion audio signal generator for testing audio gear.
 

Offline engineheatTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #23 on: January 16, 2019, 01:01:02 am »
Attached is the algebra of correcting for sound card errors on a stereo sound card by playing a computed WAV file and recording it.  This is for each frequency in the spectrum.  Ideally you would do it at all amplitude levels to correct for non-linearities in  the ADC and DAC.  I've got a reputation for going a bit overboard. :)

It requires that you be able to play and record at the same time. It requires playing each channel back into itself and the opposite channel.  So 4 equations in 4 unknowns.

I'm cleaning up clutter and found this, and I thought it might be useful to someone.  This seemed a good place to post it.  It's essential to making a THD analyzer using a sound card.  Which, naturally, you will need if you read "Max Wein, Mr. Hewlett and a Rainy Sunday Afternoon" by Jim Williams and get motivated to build an ultra low distortion audio signal generator for testing audio gear.

Thanks.

Turns out the problem was due to the auto boost feature of the mic which I deactivated.

Now that I got my FFT correct. BTW, I applied a Hanning window to each frame prior to doing FFT. The data comes in both negative and positive quantities. I just applied the window (1024 length array) to the data.

Next step is to find features/attributes to differentiate the good and the bad based on the averaged FFT. I noticed bad products makes sounds more in the higher frequency range, whereas for good products the magnitudes are pretty similar across all frequencies (up to 6000k). What are some good attributes to try? I'm thinking average magnitudes across all frequencies (just in case bad ones are louder). Or perhaps average magnitudes across certain frequency ranges.

The ambient noise peaks at a few hundred Hz and sharply drops off. If I want to filter out the ambient noise (probably not necessary, but for learning's sake), isn't it as simple as subtracting the magnitudes? And then if I do an inverse FFT I should get a signal with only the motor sound right?

Thanks
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
Re: sound analyzer for automating quality checks?
« Reply #24 on: January 16, 2019, 01:33:12 am »
 How much tolerance do you have for serious mathematics?  You don't need to actually learn the details anymore than you need to learn the details to do an FFT, but you will need to not run away in fear.

If you record a number of motors with various defects and motors which are good, you can do what I call a "sparse L1 pursuit".  The concept is extremely simple, but the mathematical proofs are the most difficult stuff I've ever encountered.  The proof of one theorem is 15 pages long!

In simple terms, you solve Ax=y where y is your measurement and A is a large array of *all* the possible cases you want to consider.  You then solve this with linear programming or some other L1 (least summed absolute error) solver.  I use GLPK which is excellent.  I've never had it fail.

Each column of the A matrix is a spectrum for an example device, good, bad, or intermediate.  The result of the  pursuit was named a "Dantzig selector" by Emmanuel Candes in  honor of the inventor of operations research and the simplex method.  What you get back is an x vector which is mostly zeros except for the particular set of columns whose sum best matches the DUT.  Given the genomes for a bunch of patients with some exotic disorder, this finds the particular genetic alleles involved.

This is absolute state of the art stuff.  I call it "sparse L1 pursuits" because there are numerous algorithms and applications.  This was the heart of the code that won the Netflix prize.  I've posted about this a good bit, so do a search of "sparse L1 pursuit" and my ID and read some of the stuff.

I stumbled across it by accident.  I was doing it and realized I was solving problems I'd been taught could *not* be solved.  I got very interested in how this could be and spent 3 years reading and rereading over 3000 pages of pure mathematics in order to understand how this could be.  It's the coolest applied math in 80 years.  But I'd been doing it for 6-9 months before I started on the "how can this be" problem.  My degrees are in English lit and geology.  I did learn a lot more math trying to get a PhD, but this is *way* beyond anything I ever studied.

The beauty of it is all you need to know is how to create the A matrix.  For your application you only have to do that once unless you discover other failure cases you want to check for. In which case you just add them to the A matrix.  If the 4 motors run at different speeds it will tell you which gear trains are good and which are bad.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf