Understanding the Output from a microphone

Hi guys. I have a project involving measuring the vibration on a frame. I aim to use the contact microphone(link below) connected to an Arduino

What exactly does the sensitivity of 40V/mm in the datasheet mean?
https://www.te.com/usa-en/product-CAT-PFS0013.datasheet.pdf
Should I connect a resistor in series with it with connecting up to my Arduino Uno?

Welcome to the Arduino forum. Your microphone or any microphone does not "measure" anything. It converts mechanical movement to AC electrical voltage.
To "measure" you must first calibrate the microphone output with known mechanical vibrations. Only then can you relate the AC voltage to the vibration of your frame.

Connecting that microphone to anything depends on the voltage output of the microphone. I suspect the microphone output would have to be amplified before any Arduino could be used.
Paul

You might need a preamp. You can either try it or measure it with a multimeter.

Typically regular acoustic microphones put-out millivolts but a piezo vibration sensor sometimes puts-out more.

It does put-out AC so you either need to bias the signal or otherwise protect the input from negative voltages.

Bias circuit
Audio Input Schematic

The bias circuit should will give you a reading of about 512 with no signal and that's normally subtracted-out in software to get the true positive & negative readings.

Protection circuit
Audio input 2

The protection circuit "kills" the negative half of the waveform and the distorted waveform is no good for any kind of frequency analysis. It just gives you the amplitude. But, it does allow you to use the optional 1.1V ADC reference if you need more sensitivity. (You can't use the 1.1V reference with the input biased at 2.5V.)

Since your sensor has a capacitively coupled output you can leave-out the capacitor from these circuits. (The capacitor also means you need a DC reference/current path to keep the Arduino input from "floating", which both of these circuits provide.)

Well, you won't get 40V out of it but with 1/10th of a millimeter vibration you should get 4V (within the specified frequency range).

According to the datasheet, the microphone has a "low-noise electronic preamplifier" , would that not provide the necessary amplification of he output signal to volts from millivolts?

Who knows? How much vibration do you have? If you whack it with a hammer you'll probably get enough signal. :smiley:

Condenser microphones have a similar built-in amplifier circuit but acoustic sound waves are weak and they still need a preamp.

I connected the red wire to 5V, White wire to analog pin A0 and the shielding wire to ground. I've used the following code to read the values

const int MicrophonePin = A0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);

void loop() {
  // put your main code here, to run repeatedly:
  int MicrophoneReading = analogRead(MicrophonePin);
  Serial.print("Microphone reading is ");
  Serial.println(MicrophoneReading);
  delay(200);

But the readings gradually increase. Anyone know why?

That's one reading.
Can you tell from a single picture of a person if he/she is walking/running/jumping?
Should't you take samples continuously if you want to detect vibration?
Leo...

How would I go about doing that?

A suggestion, Ground A2.

With A2 grounded.

Did that sop the thing do from happening?

const byte microphonePin = A0;

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println(analogRead(microphonePin));
}

This sketch should be able to measure vibration (your requirement),
and display it on the serial plotter.
You didn't tell us what you want to do with it.

Vibrations could happen thousands of times per second.
Note that I just removed the delay(), to measure continuously (not 5 snapshots/sec).
Leo..

Because the Arduino's input will "float" to an undefined value when there is no DC current path. Series capacitors block DC and the vibration sensor's built-in amplifier has a capacitor.

At a minimum you need a resistor-to-ground on the Arduino's analog input (10K or more should work).

And if you want to play it safe and protect the Arduino from negative voltages, use one of the circuits I suggested. The bias circuit puts the input at half the supply voltage and the other circuit puts the input at zero. (Then your vibration signal is added.)

If it works you should get "random looking" readings but you should be able to see the difference between small & large vibrations. Even with a large signal it's negative half of the time (ignoring any bias) and it crosses-through zero twice per cycle. But every cycle also has a positive & negative peak. Without any bias the negative half will read zero so about half of your readings should be zero.

Or if your readings are constantly too low you need an amplifier.

And you should take the delay out of your loop since you want to read it frequently.

LM386 amplifier

Would this be a suitable amplifier module to amplify the sensor reading?

The LM386 amplifier is for small speakers and headphones. You can buy microphone modules with built in amplifiers from adafruit and sparkfun, among others.

Maybe but nobody knows how much amplification you need. If you aren't getting any readings without the amplifier, probably nothing is going to work. :frowning: (When you have a very-weak signal, a lot of amplification ends-up amplifying lots of noise.)

You will have to bias the AC audio output from that amp (2 equal resistors).

If the vibration is in the audio range you can connect a speaker to the LM386 and hear if it's getting picked-up and amplified.

The datasheet is behind a login! How stupid.

That's properly a job for an accelerometer or calibrated vibration sensor. I can't see the datasheet so can't help.

It does say it contains a preamp in the description.