Shop OBEX P1 Docs P2 Docs Learn Events
How do you mesure time??? — Parallax Forums

How do you mesure time???

krazyideaskrazyideas Posts: 119
edited 2008-10-22 14:28 in Propeller 1
Hello

I want to mesure time. How would you do that?
Would you or could you get the clock count when a pin went high and then get it again when it went low and subtract them to get how many clock cycles passed??

And if you need really accurate measurements from something spinning mechanicly, would it be better to find a decoder wheel with perfectly cut marks and then use light shows, or use hall effects or what?? How would you measure the RPM and what could you use??

any help would be very appreciated, cuz I don't have much of an idea

Thanks

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-22 04:53
    You've got the right idea. Save the value of CNT when the starting condition occurs, then save the value of CNT when the ending condition occurs. Subtract the two values. The result is the elapsed time in system clock ticks.
  • Keith DKeith D Posts: 15
    edited 2008-10-22 09:59
    If you want reasonably accurate rotation readings you could use the Austria Microsystems AS5040 but it is surface mount!

    Reprap foundation sell kits of these that should be reasonably easy to interface to the propeller (I have 3 but need to build them) or Austria Microsystems may still allow you to order 3 free from their website as samples.

    At least this is how I intend to measure rotation in my project!

    Cheers
    Keith
  • Joel RosenzweigJoel Rosenzweig Posts: 52
    edited 2008-10-22 14:28
    Hall effect sensors work great if you can mount a magnet on the thing you are measuring. You might want to mount TWO magnets 180 degrees apart (and one reverse polarity) so that you don't disturb the balance of the rotating part. Reversing the polarity of one of the magnets ensures that you only get a single pulse per revolution instead of two. I suggest using two magnets instead of one magnet + some other weight, simply because its generally easier to balance out if you start with the same volume of the same material. It will get you in the right ballpark faster. If the thing you are measuring would be insensitive to a small imbalance, then you don't need to bother with the counter balance. Generally, vibration is the enemy with all things mechanical, so at least consider doing something about it.

    Other options include projecting an infra-red beam at a piece of reflective tape stuck to the rotating object. There are sensors that are great for this, such as the OPB700TX http://www.optekinc.com/datasheets/OPB700TX.pdf

    In your original post, you mentioned measuring time as well as measuring RPM. Measuring the CNT at the start of the condition and again at the end of the condition will give you a pulse duration. That doesn't directly give you RPM though. For RPM, consider measuring the time between the start of each pulse. Divide 1 second (in clock cycles) by this interval between pulses (in clock cycles) and multiply by 60 to get RPM. You can determine RPM after just two pulses this way. And then update the RPM every pulse afterwards. You could build a counter to count the number of pulses in a certain amount of time, but that will give you a slower update rate.

    Joel-
Sign In or Register to comment.