PDA

View Full Version : distance speed time



brianD
- 17th February 2010, 12:13
good afternoon.

i have a question i would like to pose.

lets say for example i have a circle with circumference of 10 cm.

i want to work out lets say the speed.

eg
in this circle is a thin wire attached to a pin.so if lets say a shaft is spinning in this circle,also with a metal wire which will pass past the other metal wire and thus make contact with the pin.

is there a formula to calculate how long it takes for the metal strips to cross or would it be better to manipulate the time and then just try determine how many times te two metal pieces have crossed(touched )

if a)the two mtal strips pass each other(pin high)and inside chip starts counting.
b)if metal strips pass each other again ( 1 revolution)

i am battling to get (within that revolution) the chip to count (seconds)
thus having the time taken.

please note that i havent actually programmed this,but it the point of departure-the starting point of the programming this that boggles my mind.

mackrackit
- 17th February 2010, 15:19
Not sure I understand the question.
Is the RPM of the rotating pin fixed or variable?

Archangel
- 17th February 2010, 16:41
Hello BrianD,
Setup a timer to overflow at a rate you can use to determine seconds easily and track those overflows in a count variable. have switch, reset the timer and counter and send data to your display by using an interrupt routine. Assuming you are talking about a Slow RPM.
So let's say timer overflows every 10 ms, then 100 overflows = 1 second, so if interrupt occurs after 250 overflows you know it went 2.5 seconds, so you have data to cypher out the rate of travel. Clear as mud? :D
Probably 10ms is a bit far fetched but the numbers were easy.

brianD
- 18th February 2010, 06:20
the outer disc is fixed.the rpm of the inner pin,spiining is variable.

i was thinking of using the count function,but if the osc is 20,then the pin would count the high every 4us.what if the rotation is 5us.

joe.
i will try your suggestion.

however! i would fancy only one rotation,and be able to work out te time taken for that rotation.

mackrackit.

what i am trying to do is to determine wind speed.hence the shaft spinning in the wind (hopefully),which will be the spindle in the bigger disc.

mackrackit
- 18th February 2010, 07:39
http://www.picbasic.co.uk/forum/showthread.php?p=83582

Melanie
- 18th February 2010, 07:47
Really you have to work out sensible limits and then choose the kind of methodology you are going to use...

If your mechanical shaft/disc is spinning every 5uS it has a rotational speed of 12,000,000 (twelve MILLION) rpm! This I would like to see... (I'd stand there with a stopwatch and measure the length of time until your mechanical contacts disintegrate and bearings turn to dust!). If you are measuring Wind-Speed, there is a direct correlation between the wind pushing the Cup, the Diameter of the Vane and the shaft rotation. Assuming a total vane diameter of 200mm, a single pulse per rotation every 5uS (and not taking any friction into account) a bit of math calculates a wind speed of 281,100 mph (two-hundred and eighty-one THOUSAND)... methinks a pitot tube would struggle with that one!!!!

Now, you really only have two choices - and each has it's limitations...

(a) You COUNT the number of PULSES in a given set time... this method is good for FAST Data, but falls apart for slow Data (eg you're counting one second but it takes 17 days for the shaft to rotate!).

(b) You COUNT TIME between the start of one Pulse and the start of the next... this method is good for SLOW Data, but falls apart for fast Data because of the speed limitation of the PICs.

brianD
- 18th February 2010, 13:20
thanks melanie for your comments,but it was not what i actually meant.
obviously the shaft won't turn that fast.

i get where you are going with this,but all i was looking for was a sensible formula within the chip.everything else was hypothetical.



thank you for the link mackrackit

Melanie
- 18th February 2010, 14:01
Well, start by deciding your limits of measurement...

For the sake of argument, let's over-simplify this...

If I was doing wind-speed down here on Earth, then I'd choose limits between 0 and say 150mph.

Next I'd decide how I'd measure the Wind-Speed... So I'm going to have a Vane diameter of 200mm... That means one rotation equates to 628mm of travel...

150mph equates to 67 metres per second...

67 metres per second divides down to about 107 pulses per second.

Is this good enough for what I want? If I was doing it, then I'd probably say No - mainly because I'd want more pulses per second so I could improve the resolution (unless you are going to have a really long sampling time which then means you won't be able to measure gust). And so the design process continues.

Only once I know what the worst-case scenario is, would I then decide on how my PIC is going to process this information - that's the easy part!

You want to run with a 20MHz PIC... probably total overkill for this application.

I certainly wouldn't go with a shaft with a contact on it (because contact bounce will give you nightmares)... I'd consider a magnet bonded to the shaft with a Hall-effect switch, or a slotted vane and an optical sensor (best option for improving resolution at minimal cost whilst still keeping the shaft balanced for reduced frictional losses).