Go Down

Topic: Vibration measuring (Read 184 times) previous topic - next topic

dvalin


687/5000
Hello,
I'm pretty untaught of vibration measurement. my goal is to measure the natural vibration of a pc fan.
I have a piezo film sensor and the fan. I stuck the sensor on the fan so that the weight can swing freely.
parallel to the piezo I have a 1Mohm resistance. from there the "-" of the piezo goes to GND and the "+" to A0.

the program looks like this:
Code: [Select]
#include <Bridge.h>
#include <Console.h>

const int piezo = A0;
const int fan = 12;
String cmd;

void setup()
{
  Bridge.begin();
  Console.begin();

  pinMode(fan, OUTPUT);

  while(!Console);
}

void loop()
{
  if(Console.available()>0)
  {
    char c = Console.read();
    if (c == '\n')
    {
      functionChoose(cmd);
      cmd = "";
    }
    else
    {
      cmd += c;
    }
  }

  functionVibration(); 
  delay(1000);
}

//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------


void functionChoose(String cmd)
{
  cmd = cmd.substring(0,cmd.length()-1);

  if((cmd == "fon") or (cmd == "foff"))
  {
    if(cmd == "fon")
    {
      digitalWrite(fan, HIGH);
      zustand[0] = true;
      Console.println("Fan ON");
    }
    else
    {
      digitalWrite(fan, LOW);
      zustand[0] = false;
      Console.println("Fan OFF");   
    }
  }
}

float functionVibration()
{
  int piezoADC = analogRead(piezo);
  float piezoV = (piezoADC / 1023.0) * 5.0;
  Console.println((String)"ADC: " + piezoADC + "\tVoltage: " + piezoV + " V");
  return piezoV;
}


Unfortunately, I only get a very small value sporadically (1-10). Can I somehow increase the accuracy of the piezos? or is this simply not suitable for this measurement?

I am grateful for every help and every advice.

MarkT

Piezo's are bipolar, you have to bias one end of the piezo to mid-rail voltage (ie 2.5v) and the other to
the analog pin.

Try increasing the 1M to a higher value for more sensitivity, this resistor is converting a current to a voltage,
so the higher the value the more voltage you'll get (upto some limit).  Piezo elements are current sourcing,
not voltage sourcing, which is why the resistor is used.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

dvalin

First of thanks for the quick help.
because I was not sure how you meant it with the mid rail voltage. I've tried that as described in png.
but both circuits did not work as they should. in version 1 I had permanently about 2.5V. or is it intended that 2.5V then represents my new zero point? Then I would have to subtract only the offset in my program. or am I on the wrong track?

with version 2 I got no results which I could interpret meaningful somehow.

I increased the parallel resistance to 2M, which also brought an improvement, but only a very small one. I have just run out of resistance, I have now ordered a 4,7M, I hope it will arrive tomorrow, then I test it again.

Go Up