Go Down

Topic: Counting rpm (Read 2632 times) previous topic - next topic

dhenry

" would use 100K."

Be careful there. The pin's input capacitance is about 7pf. With a 100k resistor, the cut off frequency is about 200khz. For a 10 teeth wheel, that means the shaft cannot rotate more than 20krpm - many dc motors can go that fast.

And if you factor in parasitics, that number is even lower.

This is a case where the resistor should be as low as possible.

gardner

I was suggesting using a 5V zener diode to clip the top of the waveform and the negative part.  Then the resistor can be small - 330R or something, since problematic voltages go through the zener to ground.

If you then feed the resulting waveform into a comparator with the reference voltage at 0.5V or 1V, and you should get a nice clean square wave.

Dyslexicbloke

Thanks for the correction Peter, its always good to learn.
If I knew where the box was I would probably still want to think outside it!

Feel free to be blunt ... Its how I learn.

serbar

Hi.

I made the circuit on the atached file, and collected the following oscilogram.

1. Do you suggest some improvements on this for noise or something else?

2. How can i count this pulses on arduino?

Thanks.

serbar

Sorry for the huge image of the oscilogram...

Some aditional information:

I collected the oscilogram with chanel A at the output of LM 393 and gound, and chanel B (they are superimposed) at input of non inverting input and ground.

Horizontal scale- 1 ms/div

Vertical scale - 5 V/div

The sensor is inductive pick up and has one terminal connected to ground.

By the way, why are the negative pikes smaller than the positive ones?

PS: This is my first circuit with ampops.

Thanks.

serbar

Allready wrote a sketch for this to work, and it works fine. Some noise when i disconnect motor on the op amp but i will study something to avoid this.
Code: [Select]
volatile float npulse=0;
volatile int  freq=0;
volatile int rpm;
//////////////////////////////////////////////////

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

  pinMode(2,INPUT);

  digitalWrite(2,HIGH);

  attachInterrupt(1,react,FALLING); 
}

//////////////////////////////////////////////////////

void loop()
{
if (freq<1500)

{

  Serial.println("Frequencia do sinal");
  Serial.println(freq);
  Serial.println();

  Serial.println("Rot por segundo");
  Serial.println(rpm);
  Serial.println();

  Serial.println("Rot por minuto");
  Serial.println(rpm*60);
  Serial.println();
  Serial.println("---------------------------");

  delay(1000);
}
else
{
  Serial.println();
  Serial.println("RPM maximo atingido");
  Serial.println("---------------------------");
  delay(3000);
}
}
/////////////////////////////////////////////////////////

void react()
{
  volatile float n2pulse = micros();
  volatile float ndentes=10;

  ///////////////////////////////////////////////////////// 

  freq=1000000/(n2pulse-npulse);

  rpm=1000000/(ndentes*(n2pulse-npulse));

  //rpm*=60;

  npulse = n2pulse;

}

///////////////////////////////////////////////////////////////



Go Up