How do I use pin5 to control duty cycle of a 555 based PWM?

I have built a simple PWM using a 555 IC to drive a motor for an optical chopper and I want to be able to use the output of the chopper signal as a speed correction feedback for the PWM. I think I should be able to do this using pin 5 on the 555 chip but I have no real idea how to do it. The current idea is to take the signal from the chopper through a F/V converter, into some sort of comparator and then use that output to increase/decrease the duty cycle of the PWM to adjust the speed of the motor up or down. I think I'm on the right track, I just have no real idea how to go about doing it because I'm an astronomer who dabbles in electronics but doesn't have any real training in circuit design. Please help if you can.

The solution suggested by tcrosley is an old favorite, uses very inexpensive parts, and it does include the 555.

If you'd like to try another type of chip, the LTC6992 is literally designed for this kind of application. It's in a fairly small 6-pin SMT package so you'd need a breakout or an evaluation board to work with it unless you're making a PCB. It accepts a 0-1V control signal and you can program the frequency and frequency range with (at most) three resistors on the SET and DIV pins, from less than 4 Hz to 1 MHz.

I found the following circuit here, which says: it "will adjust duty cycle 0-100% while keeping the base frequency rock steady". You can use the variable voltage from your feedback loop instead of the pot to feed the + input of the comparator.

Astable 555 Timer

The following image is the wiring of a 555 in Astable mode according to wikipedia: The voltage of pin 6 will "bounce" between $$\0.5V_\text{ctrl}\$$ and $$\V_\text{ctrl}\$$. When the voltage of pin 6 is on the way up pin 3 is held high, and when the voltage on pin 6 is decreasing pin 3 is held low. The duty cycle and period of the pulses will depend on the resistances and capacitance you choose.

In this arrangement the voltage at pin 5 is held to $$\V_\text{ctrl} = 2/3 V_\text{cc}\$$, however you can override this if you hold pin 5 at a different voltage. Doing so changes the upper limit (and lower limit) of the voltage on pin 6. To understand how this affects the timing requires us to delve into the math of a charging capacitor. Of course, the voltage of a charging capacitor can be modeled with the following: $$V(t) = V_0(1-e^{\frac{-t}{\tau_c}})$$ In this equation $$\V(t)\$$ is the voltage of the capacitor at time $$\t\$$, $$\V_0\$$ is the difference between the initial voltage and the steady-state voltage for the capacitor, and $$\\tau_c\$$ is the charging time constant. For the astable 555: $$\\tau_c = (R_1 + R_2) C\$$.

"On" Time

Let's assume that the 555 has already gotten warmed up and the output is switching from low to high, this corresponds to the moment when the capacitor has a voltage (let's call that $$\V_C\$$) of $$\0.5 V_\text{ctrl}\$$. After this moment the capacitor will be charging; when $$\V_C\$$ reaches $$\V_\text{ctrl}\$$ the output will switch from high to low and the capacitor will start discharging (more on this later). Let's call the amount of time that the capacitor spends charging $$\t_\text{on}\$$. Taking the moment that the capacitor starts charging to be $$\t=0\$$ we can state the charging equation for the capacitor as: $$V(t) = (V_\text{cc} - 0.5 V_\text{ctrl})(1-e^\frac{-t}{\tau_c}) + 0.5V_\text{ctrl}$$ Based on the aforementioned definition: $$\V(t_\text{on}) = V_\text{ctrl}\$$. Taking these together we can solve for $$\t_\text{on}\$$ (this is an exercise for the reader). $$t_\text{on} = \tau_c \ln\left(\frac{V_\text{cc} - 0.5V_\text{ctrl}}{V_\text{cc} - V_\text{ctrl}} \right)$$

In the standard astable 555, $$\V_\text{ctrl} = \frac{2}{3}V_\text{cc}\$$, using this we can simplify the above equation to $$\t_\text{on} = \tau_c \ln(2)\$$. This should be familiar to the reader. However, when we adjust $$\V_\text{ctrl}\$$ we will see that the value for $$\t_\text{on}\$$ varies dramatically as shown below (with asymptotic behavior as $$\V_\text{ctrl} \rightarrow V_\text{cc}\$$). "Off" Time

Now we will show that the "off" time isn't dependent on $$\V_\text{ctrl}\$$. We know that a discharging capacitor can be modeled with the following relation: $$V(t) = V_0 e^\frac{-t}{\tau_d}$$ Where $$\V_0\$$ is the initial voltage (in this case $$\V_0 = V_\text{ctrl}\$$), $$\V(t)\$$ is the voltage at time $$\t\$$, and $$\\tau_d\$$ is the discharge time constant ($$\\tau_d = R_2C\$$).

Let's say that $$\t_\text{off}\$$ is the length of time that is required for the capacitor to discharge from $$\V_\text{ctrl}\$$ to $$\0.5V_\text{ctrl}\$$. Plugging this information into the discharge equation we get: $$0.5V_\text{ctrl} = V_\text{ctrl}e^\frac{-t_\text{off}}{\tau_d}$$ Solving for $$\t_\text{off}\$$ gives a familiar relation for the 555 timer in astable mode. $$t_\text{off} = \tau_d \ln(2)$$

Conclusion

As we have seen, applying a voltage to pin 5 will change the duty cycle and period by changing the amount of time the output is high while the amount of time the output is low is constant. The variation of $$\V_\text{ctrl}\$$ and $$\t_\text{on}\$$ is basically linear when $$\V_\text{ctrl} < \frac{2}{3}V_\text{cc}\$$, so take that under consideration as you set up your feedback.

With regard to your application, I'm not sure what signal you were intending to feed-back to pin 5. If you want some advice on that you will need to post a schematic of your circuit!