Pages: 1 [2]   Go Down
Author Topic: Counting rpm  (Read 1874 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

" 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.
Logged

Ontario
Offline Offline
God Member
*****
Karma: 20
Posts: 835
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Staffordshire UK
Offline Offline
Full Member
***
Karma: 1
Posts: 132
Just a little bit out there ...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the correction Peter, its always good to learn.
Logged

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.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 51
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* schematic.png (16.66 KB, 1100x550 - viewed 16 times.)

* oscilogram.JPG (2063.87 KB, 3264x2448 - viewed 14 times.)
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 51
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 51
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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;

}

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

Logged

Pages: 1 [2]   Go Up
Jump to: