Converting period to Miles Per Hour


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Oct 2011
    Posts
    4

    Default Converting period to Miles Per Hour

    Hi,
    I'm utilizing the 18F46K22 on a project. I'm using all of the CCP modules for other purposes.

    My problem is that I cannot figure out a formula to calculate miles per hour using the period between two positive pulses. The pulses are generated by rotor bolts on a wheel. There are 5 bolts, and the circumference of the wheel is 78.4 inches. It seems to me that there should be a formula that will allow me to measure the period using an interrupt driven routine, and the calculate miles per hour. But I don't know how.

    Can someone help? I'm using PicBasic Pro.

    Roy

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: Converting period to Miles Per Hour

    Hi, Roy

    1 wheel turn = 78.4 inches ... 5 bolts per turn

    15.68 inches per pulse

    1 mile is 63360 inches ... = 4040.816 pulses ( or 1 034 449 / 256 ... )

    Done.

    BTW ... does PBP Silver edition support the 46K22 ???

    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 " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default Re: Converting period to Miles Per Hour

    Adding to Alain's expert analysis of distance.

    RATE * TIME = DISTANCE, so... If 1 rotation takes 1 second then:

    78.4 inches per second * 60 seconds = 4704 inches per minute. Multiply by 60 minutes to find distance per hour = 282,240 inches per hour or (dividing by 63,360 inches in one mile) = 4.45 MPH.

    -OR-

    [INCHES PER SECOND] * 3600 / 63360 = MPH

    The above works only if the inches in one second are known. So, we must also know how to calculate the [INCHES PER SECOND]... Take the example of .4 seconds per rotation:

    To calculate the [INCHES PER SECOND] multiply the reciprocal (1/X) of rotation period by the wheel diameter (78.4) to find:
    1 / .4 = 2.5 rotations per second. 2.5 rotations (2.5 * 78.4) = 196 inches = [INCHES PER SECOND]. Now, complete the formula above (11.136 MPH) . Not remarkably this is 2.5 times the 4.45 MPH figure calculated for 1 rotation per second - allowing for rounding.


    DISCLAIMER: The accuracy of these figures is only as correct as the time base from which they are figured. IE: timer overflow vs atomic clock.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: Converting period to Miles Per Hour

    Hi, Amoque

    Here we meet the precision problem with reciprocal calculations ....

    sooo ... I would suggest, depending on the pulse count or the pulse duration, to choose the value that gives the minimum error to the result.

    I.E. ... @ low speed, let's consider pulse duration ( big number gives better resolution ) and @ High speed let's consider the pulse count.

    But ... as our "friend" didn't tell what he wants to measure ( snail or car racing ??? ) ...

    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 " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default Re: Converting period to Miles Per Hour

    Hope is not lost, Alain. He may be back as he left his answer here - only leaving his wallet would motivate him to return more promptly. We need only wait for him to notice then... nab him and we shall have answer!

    It may be we may cajole him into revealing where the [leftover] pumpkin pie is hidden as well!

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: Converting period to Miles Per Hour

    http://sfodesigns.com/aboutsfodesigns.html

    that could match the question ... and create some ...

    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 " !!!
    *****************************************

Similar Threads

  1. Measuring Period of a pulse
    By c_moore in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th February 2012, 05:15
  2. DS1307 12-hour mode with AM/PM divisor
    By JNOR07 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 30th August 2007, 13:26
  3. MILES TAG 2xx code problems
    By sphinxifm in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th June 2007, 15:22
  4. Time Period of Timer1
    By arnol34 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 4th May 2007, 00:31
  5. Hour and minutes
    By Leonardo in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 8th February 2007, 03:50

Members who have read this thread : 0

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

Tags for this Thread

Posting Permissions

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