![]() |
![]() |
![]() |
|
|
|||||||
| Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
This is just the highlevel planning I'm using to design my speedometer based on a vehicle speed signal output. If you see any glaring or enormous errors or a better way to do this, let me know. My chip of choice, since its what I have, is a 16F628A. A 2007 Ford Crown Victoria has a vss wire in easy access that is not being used so that will be used.
My best information, so far, is that the vss either pulses 4000 or 8000 times per mile. Based on 1hour = 3600sec, the vss would pulse once at .9sec (3600/4000) Therefore, if my final output were simply a count of pulses until .9sec I should not need to do any math, just put the number on the lcd display. If it were to pulse 8k/sec then just divide the number by 2. .9seconds, though, is too slow of a refresh rate. I was thinking of having 9 counters. The idea being, start each one .1sec later than the prior one. When the first gets to .9sec take it out, manipulate it, display it, clear it, go to the next one. This will assure that the counter being manipulated is the counter of the last .9sec but will be refreshed every .1sec. The vss would be on the int pin. Again this is just thinking right now, but I figured I'd run it by you guys and see what you think or maybe suggest. |
|
|
|
|
|
|
(permalink) |
|
There are two ways to do this.
One is to count the pulses (use RB0 and an interrupt on INT0 to detect the pulses) in a preset time. This time is easily and consistently definable if you use one of the timers with an appropriate prescaler and an interrupt. So .......... Pulse -> jump to interrupt increase counter check if counter has overflowed - if it has then you are either going too slowly or standing still. return from interrupt Timer interrupt Load counter into a temp counter variable reset counter return from interrupt while everything else is still going on then calculate the MPH from the temp counter variable - this will be pulses/time The other way is to set the prescaler on the timer to a value which will cover the time period between your desired pulses. Every time a pulse is detected you load the timer value into a temp register, reset the timer and work out your speed by the time interval between the pulses. I have a commercial product which uses both these methods and the timer interval allows for rapid updating while the pulse counts allow for the accuracy. |
|
|
|
|
|
|
(permalink) |
|
I am looking for the pulses/time, I believe. The reason for the 9 counters is to allow a suitibly long samply time, 0.9sec with a decent refresh time of 0.1 seconds.
Is there a better way of accomplishing this goal, or am I on the right track? |
|
|
|
|
|
|
(permalink) |
|
Slight omission in your "spec"...
While there may be 4000 pulses per mile, you seem to have missed the fact that the pulse train will speed up as the car goes faster... That's why most commercial digital speedos dont actually start reading until you get above walking speed. 1mph = 0.9sec between pulses 5mph = 0.18sec 30mph = 0.03sec etc etc etc... Your best option would be to set a timer, and count the pulses in a prescribed amount of time, say 0.5 sec.. The low end resolution will be crap, but with increasing speed, the accuracy will go up... BTW, I am also working on a speedo, but mine is based on GPS.. Completely portable, and useable on bikes, skateboards, skis, freefall etc etc etc.... Hope this helps...
__________________
==== Shax. ==== A bus station is where a bus stops... A train station is where a train stops... On my desk I have a work station... Nuff Sed!!! |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Speedometer | Kiko | Micro Controllers | 131 | 29th November 2007 05:33 PM |
| Speedometer Assistance / Question. | argenstyle | Electronic Projects Design/Ideas/Reviews | 7 | 18th September 2007 06:17 AM |
| Pulse divider for a Speedometer | spestis | Electronic Projects Design/Ideas/Reviews | 3 | 25th July 2006 02:16 AM |
| Using sensors in Path planning with unknown obstacles | subhasis | Robotics Chat | 0 | 5th October 2004 05:36 AM |
| Electronic Speedometer using stepper motor | roryp | General Electronics Chat | 6 | 10th April 2003 12:05 PM |