Measuring a variable freq/length pulse and generating more pulses.


Closed Thread
Results 1 to 11 of 11
  1. #1

    Default Measuring a variable freq/length pulse and generating more pulses.

    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.

    Name:  CommSense.JPG
Views: 576
Size:  5.7 KB

    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.
    Attached Images Attached Images  

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: Measuring a variable freq/length pulse and generating more pulses.

    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

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Measuring a variable freq/length pulse and generating more pulses.

    The system is error tolerant so waiting for the first CMA pulse complete is to fine.

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: Measuring a variable freq/length pulse and generating more pulses.

    Wouldn't it be easier and more accurate to offset 2 more sensors?

    Robert

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: Measuring a variable freq/length pulse and generating more pulses.

    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.

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: Measuring a variable freq/length pulse and generating more pulses.

    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

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: Measuring a variable freq/length pulse and generating more pulses.

    another thought
    maybe some type of bucket brigade

  8. #8
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: Measuring a variable freq/length pulse and generating more pulses.

    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...
    Last edited by Amoque; - 14th September 2014 at 13:08.

  9. #9
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Default Re: Measuring a variable freq/length pulse and generating more pulses.

    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
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  10. #10


    Did you find this post helpful? Yes | No

    Default Re: Measuring a variable freq/length pulse and generating more pulses.

    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.

    Name:  0996b43f80207f96.gif
Views: 423
Size:  56.0 KB

    This show the motor exposed.

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

  11. #11


    Did you find this post helpful? Yes | No

    Default Re: Measuring a variable freq/length pulse and generating more pulses.

    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

Similar Threads

  1. HSERIN for variable length string
    By Pic2008 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 19th February 2010, 05:58
  2. Replies: 9
    Last Post: - 26th October 2009, 19:38
  3. need help for measuring two freq at same time
    By vu2iia in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd January 2009, 04:48
  4. help generating low freq tones
    By Darrenmac in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 23rd June 2007, 08:45
  5. Measuring pulse widths
    By Dangerous in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 13th June 2004, 12:10

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts