how to get rpm using freqin
sport270
Posts: 82
in BASIC Stamp
Have been using count on 37 & 20 tooth sprockets. But not getting the resolution needed because of the multiplication when reading 3 shafts for 500 ms .
Can't really find any examples of calibrating odd sprockets for true rpm
Can't really find any examples of calibrating odd sprockets for true rpm
Comments
I used count for 500ms then *2 for full second count..... then tried *162 then / 100 to correct for 37 teeth instead of 60.... that locked up the register going over 65,000 count..
so then tried /100 & *162 and that wouldn't read..... so I'm wanting to try freq in but don't know how to correct it...
If that is the case a 37 tooth sprocket turning at 650 RPM would yield a count of just over 200 in 0.5 seconds, or 400 per second.
Divide 400 by 37 and we get 10 in integer only math. (Actually 10.81). Multiply 10 rev/second by 60 and you will have 600 RPM. Error caused by integer math.
If we scale up the 400 by 10 to 4000, divide by 37 and then multiply by 6 the answer becomes 648, much closer to 650.
I admit I'm not sure what the *162 /100 is supposed to do.
400 */ 415 comes out at 648, but 400 */ 416 comes out at 650.
And also I was actually wanting tips on how to calibrate using Freqin where you only measure the time of one pulse. ...low to high to calculate rpm. ...
500 * 162 = 81000, which is a larger number than the stamp can handle. Believe me, the method using the fractional multiply operator */ will simplify the Stamp workload.
About pulsin, the faster the rpm, the shorter the pulse. You can measure the many pulses and average them to take out some of the variation from one tooth to the next. The math is basically a constant divided by the pulse width. The constant you probably calibrate empirically, because it will depend on the shape of the tooth and the diameter out to the sensor.
It may be possible to measure the period *between* sprockets which would likely give you more resolution (since the sprockets are further apart than their width).