# Voltage to PWM Circuit, need to understand frequency

This is an off shelf component that might fit my need. Unfortunately the documentation is terrible. It should convert a 0-5v or 0-10v analog to PWM (0-5v/0-10v is a jumper). The analog voltage signal controls the duty cycle. The potentiometer controls "Precision" per the description. I think they mean it can offset the duty cycle from the control signal. I don't care about that, I can program the control signal. This should be perfect for me if the PWM frequency is 21-28KHz.

I can't find/get any info about the frequency. It was cheap enough that I picked one up and started mapping out the traces. I've been trying to learn for a few hours now and I can't quite figure it all out. I think the 555 is controlling the frequency, but this doesn't look like any examples I have found. I want to know specifically which resistors/capacitor are controlling frequency and what it calculates to. I have the ability to rework the board and change them if needed. I don't have an oscilloscope right now, but I'm working on borrowing one. I'm hoping to figure this out and get any possibly needed components before I borrow the scope.

The picture should show connections, sorry if it is ugly. I will gladly clarify anything if confusing. FYI, I just used purple when it would cross over another red line.

• Looks like the 555 is being used as a ramp signal generator and the LM393 compares the analog Vin (after jumper & trimpot) to the 555's ramp. Q1, R6, R8, etc probably form a constant(ish) current source to charge the 555's timing cap (probably C2) in order to make a nice straight ramp. – brhans Nov 3 '18 at 4:36
• 21-28KHz .... you should be able to use the audio input of your computer and an audio recorder such as Audacity to display the waveform audacityteam.org – jsotola Nov 3 '18 at 17:40

## 2 Answers

Your circuit will look something like this:

simulate this circuit – Schematic created using CircuitLab

Help understanding how to use a SG3525

And the PWM frequency will depend on $$\C_2\$$ and $$\R_6\$$ values.

$$\Q_1\$$ together with $$\R_6 , D_2 , D_3\$$ forms a constant current source.

And this current will be around $$\I_S = \frac{0.66V}{R_6} = 140\mu\textrm{A} \$$

And this current will charge the $$\C_2\$$ capacitor. And if the voltage across the capacitor reaches the NE555 threshold value (2/3 Vsup). The 555 will quickly discharge the capacitor to 1/3Vsup.

So, the equation for PWM frequency will look like this

$$\\Large F \approx \frac{3 \cdot I_S}{C_2 \cdot V_+} \$$

So for 5V supply, as you have in your circuit the equation becomes

$$\\Large F \approx 0.6 \cdot\frac{I_S}{C_2} \$$

I'm trying to simplify all the resistors and jumper leading to U2+ (R9,R10,R1,R3,R4). Suppose I don't need the option to jumper to a 0-5V input and only using 0-10V input. Also would like to eliminate adjustability with R1. From testing I know that for best function R1 is set at 8k Ohm between jumper above R3, and 94k Ohm to ground below R3.

In theory, this voltage divider at the input should do the job:

• Thanks for all the great info so far. Follow up with request of application info. The VCC will be 5V, but the VAnalog signal will be 0-10V (with jumper in 10v position). The 0-10V analog signal is coming from an aquarium controller. I can program it to change signal voltage (0-10V) based on tank temperature, pH, etc. The result of the PWM should be 5V modulated at Fout. This will signal a good 4-pin PC type fan for ventilation. It runs at 12V but uses a 5V PWM for speed. Advice was based on 5V supply, does that mean VCC, or signal? I didn't mention VCC (sorry), does this info change formula? – Diznaster Nov 6 '18 at 1:12
• @Diznaster V+ is the internal voltage provided by AMS1117. And this voltage will be equal to around 5V it should be within this region 4.9V...5.1V. – G36 Nov 7 '18 at 16:44
• Sorry It's been a while, other stuff... I measured the frequency at 55kHz (I also got a response of "around 50kHz" from seller). So if I understand correctly C2 is probably about 1.5nF. I'm going to remove it and measure it. If confirmed then a replacement of 3.3nF should get me around the desired 25kHz? – Diznaster Jan 12 '19 at 0:54
• @Diznaster You will never know for sure until you change the C2 and measured the output frequency. – G36 Jan 14 '19 at 15:21
• I removed C2, measured it and replaced it with close to what was calculated for desired frequency. It worked as expected and I could just quit, but I still want to learn a few things and try to simulate. The 0-5v/0-10v part of the circuit with the jumper is confusing to me. Could you show a version with only 0-10v. Also I will need values for diodes 1-3, if you can offer any baseline guess on those. I'm honestly reading a lot, using datasheets, and learning, not just asking for answers handed to me. I like to see the answer and figure out how you got to it. – Diznaster Jan 19 '19 at 3:18

Assuming that C2 = 10nF and Regulator output is 5Vdc 140uA will flow on C2 which will raise the voltage at a rate of 14000 volts per second. If Vcc is 5Vdc (at the regulator output) the 555 will threshold at 3,33V and retrigger at 1.66V. C2 voltage travel is then 1.66V = 1/3 of Vcc This will take 1.66/14000= 119uSec
or a free running frequency of 1/119uS = 8.4 kHz. Any change is C2 value or regulator Voltage will inversely change the frequency. Double C2, Fout will be half, double Vcc Fout will be half (because Q1 collector current is independent of Vregulator).

Your best bet is to measure the output frequency when your analog Vin is at 1/2 Vcc(measure it). Then change C2 accordingly. Some caution about this simple relation: Check your output impedance. If the output is connected to a load that is near the 2.2k R5 and or is capacitive or inductive you may endup with erratic behavior.

It would have been usefull if we knew what this circuit would be utilized for, along with a little more details about the output driving what ? Bottom line C2 is your target for Fout adjustment. Good success with your project :)