RPM Counting Continuous


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Pic_User View Post
    Skimask, the adjustable prescaler idea is a really good idea.
    -Adam-
    I thought it was kinda slick. Came in handy for a low end freq counter from awhile back, worked from near 0 to something like 50khz with oscillator precision, (+/- 1 count of course). Same principle on the rpm thing.

  2. #2
    Join Date
    May 2007
    Location
    Harvest, Alabama
    Posts
    10


    Did you find this post helpful? Yes | No

    Default RPM Issue

    I have first to thank everyone for responding quickly.
    The problem with my RPM calculation is that it needs to be fairly precise and in fairly close to real time. The preferred device I have to count is an optical counter which will have a wheel and blank spaces so I have the option of counting either the length of the width of the blank space or of the null from the disk. High or low pulse counting option is what I am looking at. I really need to count the specific one pulse width issue and maybe keep a sum of these like 5 in a stack because this is fairly "now" use data.

    The next thing I need to do is execute a pulse to do my control function that varies in length with RPM. (Function of degrees of turn of the device and latency of the control circuit) This I expect will be on a lookup or a formula depending on the math I can do. This pulse will be executed a period of time delay after the timing (RPM count) pulse comes in and will execute a turn off of the pulse after a short period of time based on the RPM.

    I am needing help figuring out the way to count the pulse so that the counter does not affect timer accuracy and responds with about 1/10,000 sec accuracy.

    The RPM will be slow relative to some of the response posts. It will be 0-1,800 RPM. At this time it is more likely to stay below 600 RPM. The device will have extreme torques on it allowing a substantial variance of the RPM in time so I need to respond in real time. It may seem that the speed of response is not critical but the device is definitely needing this accuracy. 1/1,000 it too inaccurate. Honestly I would like to push it closer to 1/100,000 sec.

    If somebody thinks Hall Effect is better for this I can use it. The latency is the issue. The sensor latency needs to be low. I am looking at 1/1000 to 5/1000 delay in the sensor as is. Circuit delays are real issues in this device. If somebody knows a sensor with wheel package already done up I am all ears.

    So I have 2 issues. Pulse width measuring or RPM counting by other means and timer interrupt On and timer interrupt off counting without the first timer failing the operations of the second timer.

    This could be 3 timers operating, I expect that. (1) to keep up with RPM. (2) To time the initiation pulse ON condition. (3) To time the initiation of Pulse Off condition.
    Better Ideas are always welcome.

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by CluckShot View Post
    Better Ideas are always welcome.
    The method I mentioned above will give you an almost instantaneous rpm reading, so long as you can figure out how to keep good track of time (that's up to you, I'll help you along, others here will help you along, somebody here might spell it out for you and even write the whole program, but I, for one, am not going to write the complete code for you).
    You read one pulse, save the time that pulse happened (read one of the timers), you read the next pulse, save the time the 2nd pulse happened, and subtract the 1st pulse from it. Read the 3rd pulse, subtract the 2nd pulse from it, etc.etc.
    After reading a pulse, do the math on it, reciprical functions (i.e. 1 pulse per second = 1 rpm, 2 pulses per second = 2 rpm, etc., less time per pulse = more rpm).
    Assuming you use PBP math functions to do the multiplication/division on it, you could easily get a solution within 1/1000 of a second. Use a few look-up tables and a fast PIC, and that number could go down into the microseconds.
    As far as controlling whatever you are controlling, you're looking at using a PID control loop to keep the rpm constant under varying loads. It's the same principle with microprocessor controlled voltage regulators, only an electrical load vs. a mechanical load.

    And give a hard thought about what you really NEED vs. what YOU want . I can't think of very many things that need instantaneous correction within one us...and I can think of fewer things that can possibly respond inside of a handful of microseconds, much less 10 us.

  4. #4
    Join Date
    May 2007
    Location
    Harvest, Alabama
    Posts
    10


    Did you find this post helpful? Yes | No

    Default I guess I was explaining

    I have really only wanted a basic description of the process solution. I am not asking for code so much as use timerO to count ... and timer1 to count. This is sort of a process thing rather than expecting detailed answers. I did ask and get a detail question on pull-up resistors because I simply didn't know the answer for sure. Thanks all

Similar Threads

  1. Interrupt RPM and Taylors Elapsed time on 18F4620
    By Tobias in forum mel PIC BASIC Pro
    Replies: 70
    Last Post: - 3rd February 2010, 16:12
  2. Slow code needs a tune up
    By Tobias in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 5th January 2010, 15:05
  3. Pulsin vs. Interrupt RPM measurement
    By Tobias in forum General
    Replies: 1
    Last Post: - 31st December 2009, 01:29
  4. 16f877A and tmr1 external crystal question
    By comwarrior in forum General
    Replies: 3
    Last Post: - 13th July 2009, 00:40
  5. RPM - DIV32 Problem
    By davewanna in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 11th April 2008, 04:33

Members who have read this thread : 0

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