Greg M.

asked • 06/19/15

I need a formula to code my microprocessor to tell me how fast my model train is going in MPH

Thank you for helping me with this. I am not very good with long algebra problems. It must be my "ADD". I am a 63 year old experimenter and I experiment with just about everything; engineering, electronics, software and mathematics.

I am building a speedometer for large (1/8th) scale locomotives. I am using a Basic Stamp microprocessor which is capable of counting the teeth on one of the drive sprockets during a number of "periods". Each period is 400 us (microseconds).

The code function used is called COUNT. If I tell the system to COUNT 320 it gives me back the number of teeth that it COUNTs during 320 X 400 us. BTW, I have empirically done this and 320 is fairly close to correct. The result needs to be given in actual "full scale" MPH *10 enabling me to read tenths of a MPH (ie: 75 = 7.5 MPH). Remember I want to display actual MPH, not scale MPH.

Here is the other info needed:

The locomotive wheel is 15.71" in circumference and has a sprocket with 72 teeth so that for each 15.71" traveled, my gear tooth sensor gets 72 "ticks". In actuality, I have a 5" diameter wheel and a 2:1 gear box with a 36 tooth sprocket. There is a geartooth sensor on the sprocket that COUNTs teeth as they go by and gives them to my microprocessor.

Can you help me create a formula I can use for doing this? It would be greatly appreciated. I have rather complicated code running my Locomotives and having a accurate speedometer would be wonderful.

Thanks for helping me with my project.

Greg

1 Expert Answer

By:

Greg M.

Thanks for getting back to me.
 
I am sorry, but I don't think I was clear.  I am building a digital speedometer for my train.  I need the formula to know how to program the microprocessor based speedometer that I already have.
 
The formula needs to solve for the number of 400uS periods I need to specify in the software so that the result of my system reading the frequency of the sprocket teeth will be in MPH * 10.  I am only interested in actual MPH not scale MPH.
 
400uS is fixed for my microprocessor speed.
 
Currently, I know that using 320 * 400uS or (140mS) gives me a readout that is pretty close.  I measured the speed of the train using a GPS speedometer in my smartphone.  I want to be able to use a formula  to come up with a replacement for 320 so my speedometer will read perfectly at any speed.
 
Greg
Report

06/19/15

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.