Go Down

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

serbar

Hello.

I want to count rpm on a small dc motor, i made a 10 teeth wheel ring and tied to motor axle. I applied a inductive rpm sensor from a car engine at more or less 2 mm from wheel.

Scanned the signal with osciloscope and it gives a fine AC wave. Max motor speed is 6000 rpm that correspond to a max voltage in the sensor output of 50 V (25 V half wave), sensor impedance is 2,16 Kohm.

My idea is connect a resistance in paralel with the sensor to lower max voltage (calculate resistance value to have max voltage of 5 V for example in max speed conditions), then rectify the wave to half or full wave with hardware and map the values to 0-1023 ADC resolution.

I don t know if this is feasible. If it his how can i measure the time of one pulse in arduino then? I need it to calculate speed. I don t understand very weel interrupts an if it is possible to count a pulse of time between two low activations for example.

What do you think?

Thanks.

PaulS

Quote
Scanned the signal with osciloscope and it gives a fine AC wave.

Then toss that sensor and get one that produces a fine DC wave. You can't feed AC into an Arduino.

Or, pay attention to the scope. Is it really AC?

Quote
I don t understand very weel interrupts an if it is possible to count a pulse of time between two low activations for example.

It may be possible to simply poll. It may require that you use interrupts. It all depends on how many pulses per revolution, and how many revolutions per second.

serbar

Yes it is AC. im sure about that.

My goal is to understand a litle more about this kind of sensors and associated circuitry among other things. i d rally want do use this inductive sensor to do this.

And using external signal conditioning?


Dyslexicbloke

If you are going to use a rectified AC signal to get an RMS value proportional to RPM then the frequency is largely* unimportant.
You will want to use a an ideal rectifier based on op-amps as opposed to diodes so that the forward voltage drop of you rectifier is effectively 0
After that integrate and scale your signal. (essentially smooth it to DC, if you google op-amp integrator)

* Largely because the slew rate of your amp and and the time constant of the integrator will limit the frequency's that will work well

However that is less accurate and harder than the alternative.
Take your AC and pass it through a resistor.
When the current is positive generate a high and when it is 0 or negative generate a low, an op-amp again.
Now detect positive edges and either time between them or count pulses over time.

There is a hybrid alternative ...
Make pulses as above, differentiate the positive edge and then sample and hold the differentiated signal on the negative edge.
What you will, be doing is making a ramp of known slope and detecting the voltage after some time, time that is directly relative to your frequency.
PC game ports on sound cards used to work this way simply by charging a capacitor through a pot in the joystick.

Hope that helps.
Al
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

I dont have any experience on signal conditioning, have to learn first, allreday requested a good book for it.

Based on the few knowledge i have i think second option the most easy...or not...;) Now its time to learn how to do this.

Many thanks.

PeterH

Are you sure it's an inductive sensor? Is there a magnet in your toothed wheel?
I only provide help via the forum - please do not contact me for private consultancy.

gardner

I believe you could feed your sensor output through a diode clamp, and into a comparator circuit to get a clean square wave, then feed this into a pin 2 interrupt.  Then make a super-simple interrupt handler that counts interrupts.  Finally, in your loop() you would sample the current count value and elapsed time, and calculate motor speed from that.

Dyslexicbloke

Peter,
Many inductive sensors contain magnets, the toothed wheel simply gate's the flux which produces enough variation in flux density to induce voltage in a coil.
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

Quote
Are you sure it's an inductive sensor? Is there a magnet in your toothed wheel?

Its a crankshaft position sensor (CKP) from a mazda 6. Its inductive now doubt, all CKP sensors are.

Quote
I believe you could feed your sensor output through a diode clamp, and into a comparator circuit to get a clean square wave, then feed this into a pin 2 interrupt.  Then make a super-simple interrupt handler that counts interrupts.  Finally, in your loop() you would sample the current count value and elapsed time, and calculate motor speed from that.


Like i said i have no knowledge on signal conditioning, i have to be familiar with this kind of circuitry, but your option seems so clean and simple it seduce me.

Thanks for the opinions. Great forum and great people. ;)

PeterH


Peter,
Many inductive sensors contain magnets, the toothed wheel simply gate's the flux which produces enough variation in flux density to induce voltage in a coil.


That type is usually referred to as a magnetic variable reluctance (MVR) sensor, which is quite different to an inductive pickup.
I only provide help via the forum - please do not contact me for private consultancy.

dhenry

If all you need is to know the rpm, you don't need to adc the signal. Feed it to the mcu's counter / capture pin via a small resistor (like 1k - 10k).

You can either counting it or input-capture. Counting it has the advantage of reading stability but requires lower time for low rpm cases. Input capture is better for low rpm cases but will generate more fluctuations in reading.

You can design some intelligence into your program to switch between the two.

dc42


If all you need is to know the rpm, you don't need to adc the signal. Feed it to the mcu's counter / capture pin via a small resistor (like 1k - 10k).


This is the method I would use, however as the input is 25V peak, you need a higher value series resistor to limit the current into the input protection diodes to a safe value. I would use 100K.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

serbar

Quote
Feed it to the mcu's counter / capture pin


Sincerely i don t know what pin in arduino as this capabilitie, or is some software that enable a analog pin to sense the signal?

dhenry

It is fairly simple. Grab a copy of the datasheet for your device.

1) for the counter approach, you will need to identify the counter input pins, T1/T2/T3... for timer/counter 1/2/3..., respectively.
2) for the input capture approach, you will need to identify the input capture pins, ICP1/2/3... for timer 1/2/3..., respectively.

The datasheet lays out quite clearly as to what needs to be done for this to work.

If you have specific questions, you can always ask.

dc42


Quote
Feed it to the mcu's counter / capture pin


Sincerely i don t know what pin in arduino as this capabilitie, or is some software that enable a analog pin to sense the signal?



Alternatively, feed it to any digital input pin, and count the pulses in software.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Go Up