Electrical – How to convert a pulsed signal to an analog voltage

analogfrequency

I would like to measure the speed of a DC motor using a phototransistor and get as an output a voltage which varies linearly with frequency.

The motor speed can vary from 0 to say 3000 RPM. Using the phototransistor I can easily get a signal whose frequency varies from 0 (DC) to 50 Hz. I would like to convert this signal to a voltage which varies from 0 (or close to zero) to 5 V linearly with the speed of the motor (and therefore with the frequency of the signal obtained from the phototransistor).

I know that a simple solution would be to use a microcontroller to calculate the period of the signal from the phototransistor and then output the corresponding PWM voltage, but I'd like to keep things analog and not use a microcontroller, if possible. What circuit can I use to achieve this?

Best Answer

I made a circuit for this (different application).

Use a 555 in a one-shot configuration, circuit diagrams abound for this on the net.

Make the output pulse "relatively" short, that is short for your expected input frequency. For example, if you expect 100Hz input then your output pulse MUST be shorter than 10ms because, if triggered 100 times per second the output would be ON all the time. If too short, you lose sensitivity to frequency change. Figure out your maximum frequency and make your pulse width shorter than 1/maxfrequency.

Connect your optical circuit to trigger your 555 pulse. Every time you get an optical pulse, the 555 will generate a shaped output of fixed duration.

Couple the output of that pulse to a "smoother" (a low pass filter).

To build the LP, put a resistor in series with your pulse lead. Beyond the resistor, tie a capacitor between it and ground.

The sizing of both the capacitor and resistor are governed by several factors:

1) The 555 output current limit. Just use a 1K or larger resistor.

2) Response. The filtered DC output voltage of this will always track the frequency meaning that the motor frequency will change but the DC voltage will lag. The response is determined by multiplying R*C. Bigger is slower but also smoother.

3) #2 above should be designed by the input frequency, the higher the input frequency, the smaller The R*C. Don't worry too much about this, just build it and play with the values until you get what you like. Good starting values might be 10K resistor and 100uF capacitor.

BTW, I tested this circuit with expensive equipment (equiv to $1000ish equipment in today's dollars) and it was within about 5% linear and accurate. The trick is the shaped output pulse.