PDA

View Full Version : Measuring a variable freq/length pulse and generating more pulses.



retepsnikrep
- 8th September 2014, 18:30
I have a system where a motor position sensor provides six pulses per revolution.
As rpm rises to a maximum of 6000rpm of course it goes up to 600 pulses a second.

Lets say it's CMA in the diagram.

7440

If I wanted to generate two more pulse trains CMB & CMC identical to the incoming one but 20 degrees apart from each other and the one I am reading, what do the collective think would be the best approach?

Lets assume a basic 12F683 8 pin pic running at 8mhz and a 12F1822 running at 32mhz.

Timer 1 interrupt to get the pulse length?
Timer 1 gate control mode?
How to generate the other pulses at the reqd point.

The system needs to work with accuracy from 1 rpm upto 6000 rpm.
At low rpm I expect timer 1 will overflow causing issues but we could increment a second counter to keep a track of how many times if overflows at low rpm.

Demon
- 8th September 2014, 23:15
Interesting, so 2 cents worth:

You can only start generating CMB and CMC after a full cycle of CMA has completed. They're never going to be matching the "current" CMA, only the previous one.

Or is there a trick around this? And do you care?

Robert

retepsnikrep
- 9th September 2014, 07:30
The system is error tolerant so waiting for the first CMA pulse complete is to fine.

Demon
- 9th September 2014, 17:34
Wouldn't it be easier and more accurate to offset 2 more sensors?

Robert

retepsnikrep
- 12th September 2014, 18:04
The system actually has three sensors in the format offset as per the diagram.

However they are a royal pita to get out, so I'm looking at if one fails ignoring it, and creating the missing pulses from the remaining one/s.

richard
- 13th September 2014, 13:43
some ideas
if cmc is the missing pulse then c_replacement lag would be 2x the lag between a and b ,duration is cma duration
if cmb missing then b_replacement lag is half the lag between a and c ,duration is cma duration (some info would be lost )

all calc have t0 at rising edge of cma
problem is to scale a timer to get sufficient resolution over minimum and maximum expected pulse widths

richard
- 13th September 2014, 13:47
another thought
maybe some type of bucket brigade

Amoque
- 14th September 2014, 13:01
It seems to me that monitoring the sensors for failure and producing the pulse train you describe could be two functions. By assigning one pin to each sensor - the presence of a second pulse on any pin, at any rotational speed, will require that one pulse will have occurred on all other pins - except failed sensors. The speeds are not great, even at 600 RPM either of the list MCUs should not have issue. Likely, even without interrupts.

I'm not sure how "error tolerant" the system is, but it seems that there will be need of some... as, when the shaft is speeding up or slowing down, calculating from the previous pulse will be flawed, unless you intend to use some pretty complex math - far beyond me, disregard post...

Producing two pulses, offset by 20 degrees, does not require monitoring three incoming pulses. Monitor one - any one - and divide the rotational speed by (360/20) 18 to determine the offset; repeat on the second signal for the third. Or, you might take the time between any two functioning sensors directly. A pre- or post-scaler may help scale the numbers; I cannot recall if these are settable by software but, if so, add a bit to the prescaler on a timer rollover, deduct one as timer values approach 0; the manual approach, counting rollovers, will work as well.

I may be way off in my approach, but I'm a little confused by the description you provided. In the initial post you describe 6 pulses per rotation, then later suggest 3 sensors provide the pulse pattern you attached. Neither is there any indication of scale or style of the pulses. The drawing seems to indicate square waves, like an encoder, but I would expect pulses from such a device to be equally spaced around the rotation and to have fewer sensors. Hall sensors would typically present a much shorter high (or low) pulse with variable time between pulses, but the drawing does not show this. Not exactly sure the hardware setup, so just some general thoughts...

Acetronics2
- 14th September 2014, 20:01
looks it's the job for a 3x PLL device like a 4046 ...

but 1 to 6000 range implies to switch capacitors depending on the freq to multiply ... will the device driven tolerate the PLL locking time ???
this is the good question ...

nice project ...

Alain

retepsnikrep
- 18th September 2014, 08:38
Thanks for the replies. Food for thought.

There are three sensors in the encoder and an encoder disk which passes by them and produces the pattern I described.
Each sensor is activated/toggled 6 times per revolution of the motor.

7448

This show the motor exposed.

http://www.insightcentral.net/encyclopedia/enmotor.html

retepsnikrep
- 18th September 2014, 09:10
The PLL looks like a good/interesting idea.

If we had one good signal I assume you could feed that into two PPL circuits to provide the other two outputs 20 and 40 degrees offset from the original with the same duration (duty)?

Or do dual/two stage PLL devices exist?

So in effect generate the waveform I pictured in the first post