Go Down

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

#### serbar

##### Oct 15, 2012, 02:06 pm
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

#1
##### Oct 15, 2012, 02:37 pm
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

#2
##### Oct 15, 2012, 02:56 pm
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

#3
##### Oct 15, 2012, 03:23 pm
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

#4
##### Oct 15, 2012, 07:30 pm
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

#5
##### Oct 15, 2012, 07:59 pm
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

#6
##### Oct 15, 2012, 09:26 pm
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

#7
##### Oct 15, 2012, 10:45 pm
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

#8
##### Oct 15, 2012, 10:49 pm
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

#9
##### Oct 15, 2012, 11:01 pm

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

#10
##### Oct 15, 2012, 11:02 pm
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

#11
##### Oct 15, 2012, 11:42 pm

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

#12
##### Oct 15, 2012, 11:46 pm
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

#13
##### Oct 15, 2012, 11:59 pm
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

#14
##### Oct 16, 2012, 09:27 am

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

Please enter a valid email to subscribe