View previous topic :: View next topic |
Author |
Message |
mrbean
Joined: 30 Oct 2007 Posts: 1
|
speedo frequency divider |
Posted: Tue Oct 30, 2007 2:25 pm |
|
|
Hello. I have an imported car that is reading in Km/h and I thought I might be able to use a PIC to alter the speed signal to display Mph.
As far as I can tell, the speed sensor generates a 4 pulse (square wave), for each revolution. The frequency of the square wave varies with speed.
So I need to read the input frequency and divide it by 1.609, to generate a new frequency, then output that new frequency to the speedo dial.
What would be the best way to measure the input frequency and also to generate the modified ouput pulse stream?
The input pulse is 0V - 11V, which I can scale using a potential divider before connecting it to the input pin of the PIC. I am hoping I can use a transistor to amplify the output pulses back to the 11V level.
Any help with any of this would be greatly appriciated.
I have a couple of PIC18F452 chips here. Would they be suitable for a project such as this?
Many thanks. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Oct 30, 2007 4:33 pm |
|
|
Do a Google search for this:
Quote: | Piclist frequency multiplier |
The first hit is a thread on Piclist where they discuss this topic.
Example:
Quote: | I've got a variable frequency signal (200hz to 4khz) whose
frequency I want to increase by 30% (5v signal). i.e., if the input
frequency is 1000hz, I want to output 1300hz. |
|
|
|
Guest
|
|
Posted: Tue Oct 30, 2007 8:36 pm |
|
|
What is the max frequency of the pulses? This will dictate how much code you can have running - a hardware solution would be to use a low cost DDS chip and have the PIC program the chip for the proper divide ratio. A DDS (like the ones made by Analog Devices) are essentially fractional dividers.
This is a good use of a PIC though!
:-)
HTH - Steve H. |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Wed Oct 31, 2007 3:31 am |
|
|
What about the good old analog electronic frequency multipliers? Because of the non-integer multiply factor the analog option could be easier and more accurate to implement. |
|
|
Ttelmah Guest
|
|
Posted: Wed Oct 31, 2007 4:32 am |
|
|
5 pulses out, for each 8 in, would be as close as is needed (speedos are rarely better than a few percent accurate). At speed, it'd be quite easy. The problem will be getting smooth behaviour at low pulse rates, while keeping a good response.
Find out the actual pulse rates involved. Minimum say for 5mph, to perhaps 100mph. This can be calculated if you find the wheel diameter of the car, transmission ratios (diff), and how many pulses per rev the system gives. Then a solution would be to time the period between sucessive pulses using the CCP, and program a PWM, changing the frequency of this based on the 5/8 ratio. This can update on a 'per cycle' basis of the output PWM, so the lag will be tiny.
Best Wishes |
|
|
|