CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

speedo frequency divider

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mrbean



Joined: 30 Oct 2007
Posts: 1

View user's profile Send private message

speedo frequency divider
PostPosted: Tue Oct 30, 2007 2:25 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Oct 30, 2007 4:33 pm     Reply with quote

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








PostPosted: Tue Oct 30, 2007 8:36 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Oct 31, 2007 3:31 am     Reply with quote

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







PostPosted: Wed Oct 31, 2007 4:32 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group