# Speedometer conversion using NJM4151 Frequency Voltage Converter - Questions

Discussion in 'The Projects Forum' started by jonnyphenomenon, Jan 24, 2011.

Not open for further replies.
1. ### jonnyphenomenon Thread Starter Active Member

Nov 10, 2008
59
2
I am working on a project design for a speedometer converter. I would like for it to be a universally adjustable converter, but my initial design is very job specific.

in this particular case, my design must adapt the mechanical speedometer drive from an old VW bus to work with an instrument cluster from a newer model VW passat. to do this, I am taking a frequency signal from an electronic speed sender driven from the cable, which pulses 4 times per wheel rotation, and I need to multiply this signal a precice amount of times to match the signal required by the cluster.

My plan is to use two NJM4151 VFC/FVC IC's. where I will first convert the frequency to voltage with one, then convert the voltage back to a different frequency ratio with the second. Inevitably, I should be able to adjust this ratio by the turn of a single potentiometer.

the datasheet for the NJM4151 can be found here:

Following the datasheets Figure 5 schematic for single supply FVC, I have the first part of my schematic on my test board right now. it is functional, but I am having a little trouble with the math.

Some Information about the circuit in question:
---the circuit needs to operate from 0hz, (zero miles per hour) to at least 140hz, (@100 miles per hour, with 4 pulses per wheel rotation and ~800 wheel rotations per mile) for the sake of universal applications, a wider range may be needed, but unlikely to exceed the 1khz range ever.
----the voltage of the source is 12v, (automotive application) but it will be irregular, so I will probably use a regulator to bring it down to 10v stable.

the datasheet says this IC can "operate with a full scale frequency anywhere from 1.0hz to 100khz" So I dont think I will have any trouble with low speeds and this IC.

So my question is,
what values do I need to employ for components Rs, Rb, Ro, Co, for a circuit that will operate with a full scale frequency input of 0-1khz and an output of 0v to something less than 10v (since my supply will probably be a regulated 10v), with the ability to tune the frequency scale up or down with the turn of a single pot?

I have done a bit of trial and error, and tried to work out the formula in reverse to find my values for these components, but I seem to be missing some critical step. my figures just dont come out right on the proto board.

Note: I have read through this thread http://forum.allaboutcircuits.com/showthread.php?p=7150 where hgmjr wrote a nice explanation of the theory of this circuit and his included examples. it was very informative, and given time I think I might be able to answer my own questions, but I am hopeing someone can help me find the missing piece of the problem.

So if anyone has any input on this, I would greatly appreciate it. I know a lot of VW owners who are looking to install a modern VR6 engine into their busses will also be very greatful.

2. ### jonnyphenomenon Thread Starter Active Member

Nov 10, 2008
59
2
forgive me if my original post didnt make any sense, I was just interupted before I could proofread so I just hit submit!

3. ### jpanhalt AAC Fanatic!

Jan 18, 2008
5,675
899
I suggest two options: 1) a microcontroller-based solution (i.e., digital); and 2) a frequency-multiplier based solution (i.e., digital/analog).

With either method, you may not need to do a frequency-to-voltage conversion, but that might depend on the characteristics of the signal.

Which method would you prefer? What are the signal characteristics? In particular, what is the duty of the current signal? Is it constant, or does it vary with speed?

John

4. ### jonnyphenomenon Thread Starter Active Member

Nov 10, 2008
59
2
Hi John, thanks for your interest in my project. I initially considered using a microcontroller for this task but since I havent had much real experience with them, I didnt know where to start. I designed a rudimentary program to run on a parallax basic stamp, but found the stamp was just not powerful enough for my needs. I have some atmega stuff, a pair of stm8s, and a small handful of pic microchips but I didnt feel that trying to learn a new programming language was in my best interest when I had a possible solution with these vfc's available.

So with that being said, I feel very vested in the solution I have outlined above. I really do think I am close to a breakthrough here.

I have an electronic speedometer sender which I have connected to the drive cable coming off of my busses wheel. it is a spinning magnet, with three wires coming out of it, 12v, signal and ground. I believe this is the hall effect type. it produces a fairly clean square wave signal at 50% duty cycle at a rate of 4 pulses per wheel rotation.

for this circuit to be universal, I will need to be able to take the signal from any common impulse sender device, and convert it to a similar impulse signal of a different rate. one should be able to drive at a certain speed (like by following another car at 50mph) and turn a dial until the electronic speedometer accurately reads the actual traveling speed.

This speedometer adapter will be used in automotive applications where modern engines and instruments are installed in a vehicle other than the original recipients of them. - in the automotive world the term "Hybrid swap" is used a lot. Street rodders would use this when they put a hot rod engine in a really old car. - but I personally am going to use this in an old VW bvus I am putting a v6 engine into.

5. ### jpanhalt AAC Fanatic!

Jan 18, 2008
5,675
899
After reading the datasheet for the NJM4151, I think your approach to do F to V followed by V to F is is probably simplest. How far have you gotten with that approach? What problem(s) have you run into? John

6. ### jonnyphenomenon Thread Starter Active Member

Nov 10, 2008
59
2
heres a couple pics of my test setup so far.

7. ### jonnyphenomenon Thread Starter Active Member

Nov 10, 2008
59
2
so far I am taking small steps. I was hoping someone could get to the root of the math in this formula and tell me which values to use for those components.

Vo = Fi * K^-1 where K = 0.486(Rs/Rb*ro*Co)(Hz/V)

To keep things simple, lets assume I want to have a full scale range output of 0 to 10 volts. if I have a full scale frequency range of 0hz to 200hz, then I would have a step increase of of .05 volts per hz.

I am narrowing it down, but my math is a bit rusty and its hard with a wife and kid and a housefull of distractions to concentrate.

8. ### jonnyphenomenon Thread Starter Active Member

Nov 10, 2008
59
2
I think Ill have another go at it.

is this relevant to my needs? I'm not sure what this is about.

note: in step 3, they say output voltage at pin 6, when I think they mean 1. thoughts?

Anyway, if I change this all around, and say I have a supply voltage of 12v, a full scale input of 200hz, full scale output of 10v, I should be able to make this happen
2: T=.75(1/200)=3.75msec.
so, 0.003/1.1=0.00341
0.00341 /.1uf = 34090 = 34k.

let Ro=34k, and Co=0.1uf

Last edited: Jan 24, 2011
9. ### jpanhalt AAC Fanatic!

Jan 18, 2008
5,675
899
I was actually just doing a trial calculation myself. Rather than add confusion, I think you have the approach right. I would first calculate my maximum frequency, say 1 KHz. For a 50% duty cycle, the maximum T could be would be 0.5 mS (i.e., 5 X 10^-4 seconds). I would then calculate Ro and Co using common values for the capacitor and the formula, T= 1.1RoCo.

Then it is just a question of calculating Rs/Rb.

John

10. ### jonnyphenomenon Thread Starter Active Member

Nov 10, 2008
59
2
couple questions here. in step1, wjhere ot says Rs=14k. why 14k? whats this for?

in step2, where T=.75(etc, why .75? where did this value come from?
step3, it says OUTPUT on pin 6, but thats my input, so what gives?

moving on, step4, Rb=5v/100uA=50k
where did the 100uA come from?
I can change the 5v to 10v, so 10v/100uA=100k. - this should set my full scale output voltage range to 10v right?

11. ### jpanhalt AAC Fanatic!

Jan 18, 2008
5,675
899
As I recall, 14K is the fixed resistor plus about half of the pot that is in series with it.

Everything is turned off right now, so I will take a look at it tomorrow, as well as your other questions.

John

12. ### jonnyphenomenon Thread Starter Active Member

Nov 10, 2008
59
2
lets see if I have values for all of these Rs, Rb, Ro, Co.
Rb=100k
Cb=1.0uf?
Rs=14k?
Ro=34k
Co=0.1uf

13. ### jonnyphenomenon Thread Starter Active Member

Nov 10, 2008
59
2
OK. so I installed resistors and caps in the values Ive come to in the figures above. the results are promising! but not quite right.

heres what I put in for each part, following the figure 5 simple schematic.
Ro=34k
Co=.1uf (104)
Cb=1.0uf (105)
Rb=100k
Rs=14k - I used a 10k resistor and a 5k pot dialed to 14k.

the results are .6v for 10hz. damn close to what I want. but the strange thing is that it doesnt stop at 10v. it goes up to 11.2 volts at 200hz.

Im going to grab a different pot for Rs and see what kind of range I can get.

14. ### jonnyphenomenon Thread Starter Active Member

Nov 10, 2008
59
2
Nailed it. I swapped Rs with a 100k pot. I can adjust it for my range of 0-200hz between 0 and 10v. it works precicely 10hz to 100hz, but the function generator in my DSO Nano only goes 10hz increments to 100hz, then skips to 200 so I cant test in between. at 100hz it reads 5v exactly, but 200hz it reads 9.2v. luckily, for my application the bus willnever see speeds that high. haha.

now I just need to assemble the basic violtage to freq, pair them up and see if I can get a usable output.

15. ### jpanhalt AAC Fanatic!

Jan 18, 2008
5,675
899
I'm glad for you. Capacitors have relatively high tolerances compared to resistors. A 5% resistor and 10% (or worse) capacitor can need a lot of fine tuning, not counting the fact that the exact calculated values may not be what you have available. John

16. ### jonnyphenomenon Thread Starter Active Member

Nov 10, 2008
59
2
You aren't kiddin! I was just looking through a bunch of 5.1k resistors, and every single one of them was 5k exactly. Makes me want to check all of my resistors before I use em.

I am pretty well stocked on electronics components at home. I tend to buy loads of extras any time I have a project, and I keep them pretty well sorted. And mouser has been a huge asset with its huge online catalog and search features.

17. ### jonnyphenomenon Thread Starter Active Member

Nov 10, 2008
59
2
Double post oops. Stupid phone posting.

Last edited: Jan 25, 2011
18. ### jpanhalt AAC Fanatic!

Jan 18, 2008
5,675
899
If you are going into production, you might want to consider the LM331/331A or KA331 series chips. I couldn't find the history of the entire xx4151 line, but apparently, the RC4151 and RC4152 have been replaced. I did not check availability of the NJM version. If it is not RoHS compliant, that may be a problem for the future.

In any event, for a prototype, I would not change chips right now.

John

19. ### jonnyphenomenon Thread Starter Active Member

Nov 10, 2008
59
2
I have a couple ka331's, and those look almost identical to the njm4151's. I've also got a handful of lm2917's and lm2907's. Although I think those have been replaced with nte something or others. I don't plan on making a run of these, instead just a pair of them, and then ill publish the design on instructables.com for free use.

Edit: Honestly, I chose the njm4151 because the datasheet was so informative. The ka331 and lm29n7's sheets were either too brief or just not helpful enough.

The 2\$ price tag wasn't to bad either.

Last edited: Jan 25, 2011