math help
TC
Posts: 1,019
I need a little math help. I am making a bike speedometer from leftover parts. I am using a BS2, a MAX7219, a three digit LED display, a Unipolar Hall-Effect switch, and 16 high power magnets. I would like to use all three digits of the display to display Mile per hour.· I was thinking of using the COUNT command for one second. I figured there is going to be 12293 pulse per mile· ((26.25” diameter *pi)/63360 inches in one mile)*16 magnets. I would like the output to show the 1/10 MPH, and I am using the code for the MAX7219 with some modifications for three digits.
Thanks TC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
We all make mistakes when we are young………That’s why paste is edible!
Thanks TC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
We all make mistakes when we are young………That’s why paste is edible!
Comments
At 1mph, if you accumulated COUNTs for 1sec and divided by 3.414 you'd get mph.· So, if you accumulate COUNTs for 293 msec (1/3.414) the accumulated COUNTs will equal mph.· If you accumulate for 2930 msec, you will get mph*10 (your 1/10mph).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
We all make mistakes when we are young………That’s why paste is edible!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
We all make mistakes when we are young………That’s why paste is edible!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
We all make mistakes when we are young………That’s why paste is edible!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
We all make mistakes when we are young………That’s why paste is edible!
One way would be to average a series of 1 second readings and interpolate.
Another way to approach this is to measure the time between magnets, rather than to COUNT the number per second.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
We all make mistakes when we are young………That’s why paste is edible!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
We all make mistakes when we are young………That’s why paste is edible!
One way to measure times with the Stamp is with a PULSIN command. An external flip flop circuit could toggle from high to low as alternate magnets pass by, so that you would have a square wave cycle intead of a series of pulses. The PULSIN command on the BS2 has a resolution of microseconds. It will measure up to 0.131 second before it times out, but longer times for you would be an issue only for speeds under 2.3 mph, and there are ways around that. Once you have the pulse time (in units of 2 microseconds), a formula to convert to xx.x mph is,
Something like that would call for a smoothing filtering to iron out the difference between magnets. The reed switches have to be debounced with RC circuits in any case.
Alternatively, ithe PULSIN could measure the time high without an external filp flop. But that requires a bit of a fudge factor to account for the time the switch is closed, and a calibration too for the air in the tire.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
http://cgi.ebay.com/New-LCD-Bike-Bicycle-Computer-Odometer-Speedometer-K53_W0QQitemZ260275460238QQcmdZViewItem?hash=item260275460238&_trkparms=39%3A1%7C66%3A2%7C65%3A15%7C240%3A1318&_trksid=p3286.c0.m14
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
We all make mistakes when we are young………That’s why paste is edible!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
We all make mistakes when we are young………That’s why paste is edible!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
We all make mistakes when we are young………That’s why paste is edible!
If you want "big numbers",·you could set up a push-button to alternate between mph or·feet/min readings or km/hr,·something like that.·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
We all make mistakes when we are young………That’s why paste is edible!
Post Edited (TC) : 8/20/2008 12:55:00 AM GMT
Now I'll make a·suggestion.· Your idea is good, you've found that reality bites, but stay on track.