# Converting Pulse to a inverse voltage

#### Kanesmithnz

Joined Mar 4, 2021
6
I have a basic understanding of electronics but am trying to put together a circuit for a project I'm working on. I am wanting to replace a 10k potentiometer in a 5V circuit with a signal from a proximity sensor representing rpm. I have included a diagram of the signals i have currently at the pot. Basically I need close to full voltage down the signal wire at 0 rpm and as the rpm increases to a max of around 100 rpm (adjustable 80-120 in a perfect world) i need it to receive more of the 0V connection. Any help on the matter would be greatly appreciated.

#### AnalogKid

Joined Aug 1, 2013
10,951
What you want certainly is doable, but it is not a "basic" circuit. One way is with a circuit called a frequency-to-voltage converter followed by something to adjust that signal so it has the correct range. A problem with this type of circuit is ripple in the output voltage at low frequencies.

Another approach is more digital, involving a counter and a digntal-to-analog converter. This is more complex, but is cycle-to-cycle accurate without any output filter delay. Again, there will be problems for very low frequencies. For example, at 0.1 Hz it will take 10 seconds to produce an accurate output.

Is the lowest possible input frequency really 0.00 Hz, or just a really low frequency?

ak

#### Kanesmithnz

Joined Mar 4, 2021
6
At what frequency does it become a problem? .3hz could pass for the low end

#### Sensacell

Joined Jun 19, 2012
3,406
A microcontroller and a digital pot is where I would go with this.

#### Kanesmithnz

Joined Mar 4, 2021
6
A microcontroller and a digital pot is where I would go with this.
is there any chance you could offer me some more guidance on how to build this?

#### LesJones

Joined Jan 8, 2017
4,174
I think I would use a D to A converter for the output rather than a digital pot. How many bits resolution do you require ?
I would also consider generating more than one pulse per rev. That could be done by putting a gear wheel on the shaft and using a gear tooth hall effect sensor. A optical encoder is another option. Which microcontrollers are comfortable programming ?

Les.

#### Ian0

Joined Aug 7, 2020
9,533

#### Kanesmithnz

Joined Mar 4, 2021
6

#### Ian0

Joined Aug 7, 2020
9,533
isn't that more for hitting a predetermined threshold? i need it to scale smoothly
No, it's a frequency to voltage converter. See Fig.15 and Fig. 19 in the datasheet

#### Kanesmithnz

Joined Mar 4, 2021
6
I think I would use a D to A converter for the output rather than a digital pot. How many bits resolution do you require ?
I would also consider generating more than one pulse per rev. That could be done by putting a gear wheel on the shaft and using a gear tooth hall effect sensor. A optical encoder is another option. Which microcontrollers are comfortable programming ?

Les.
i think 8 bit resolution would work, i can increase the signal frequency to what ever we need it to be using a gear tooth, Ultimately what i am trying to do is take the the pedal speed from my stationary bike and convert that to the throttle on a force feed back steering wheel for a more interactive bike training/car racing gam experience. My microcontroler programming knowledge is pretty limited, but i am willing to learn, I come from a millwright/electrician/automation background

#### Kanesmithnz

Joined Mar 4, 2021
6
No, it's a frequency to voltage converter. See Fig.15 and Fig. 19 in the datasheet
Do you have any interest in helping me with the design? I can physically build it but need help putting together the plan

#### Ian0

Joined Aug 7, 2020
9,533
Your application is a bit unusual as your output voltage needs to be zero at full speed and 5V at zero speed. Do you have any other power supply voltages available apart from +5V and 0V? What is the output from the proximity sensor?

#### LesJones

Joined Jan 8, 2017
4,174
As you can increase the frequency (To get round the slow update problem mentioned in post #2) by using a toothed wheel I think Ian's solution using an LM2917 may be easier for you. The fact that output voltage from the LM2917 goes up with frequency can be worked around using an op amp. The non inverting input would be connected to a positive reference voltage of say 5 volts. And assuming the output of the LM2917 was scaled to go from 0 to +5 volts this would be connected to the inverting input of the op amp by a resistor (Say 10K) You would also have a resistor of the same value connected between the op amp's output and its inverting input. This would modify the signal to meet your requirements. If you only have +5 volts available you would need an op amp the had rail to rail input and output specification or scale down your signal levels. I suspect this is what Ian was planning to suggest when He asked about what voltages you have available. The microcontroller I was thinking of suggesting (A PIC16F18446) only has a 5 bit D to A converter. There are probably others that do have an 8 bit D to A or you could use an external D to A or ladder network.

Les.

#### Ian0

Joined Aug 7, 2020
9,533
Well predicted @LesJones !
Because the LM2917 has most of its internal op-amp connections pinned out, reversing the output without a further op-amp may be possible, but may not be feasible from a single +5V supply.
Also, the output of the sensor is important. If it is the type of sensor that generates a pulse without needing a power supply, the 8-pin version of the 2917 can be used.