Home
Software
Electronic
About me

Last update: 2017/03/04

The circuit shown in the figure 1 can be used to generate both a ramp and square signals. To solve this circuit set $v_{d1} = v_{d2} = v_{OH} / 2$ , where $v_{OH}$ is the maximum voltage produce by the op-amp output.

So given as parameters the voltage span $\Delta v$, the frequency $f$, the maximum output voltage $v_{OH}$, and the values of $R_3$ and $C$, the values of $R_1$ and $R_2$ are, $$R_2 = R_3 {\Delta v \over v_{OH}}$$ $$R_1 = \left({{ 1 \over 2f} - t_d}\right) \cdot {1 \over 2 {R_2 \over R_3} C}$$ Here $td$ is the delay time introduce by the finity voltage slew rate of the op-amp (see the example at the end).


Figure 1. Ramp and Squeare wave generator.

The operational amplifier is powered with a single supply $Vcc$. A ramp signal will be generated at the node $v_a$, and a square signal at the node $v_b$. Next, the equations to determine the frequency and shape of the signals will be explained. Considering and ideal op-amp, the currents $i_{R1}$ and $i_C$ should be the same, and are given by the next equations: $${i_{R1}} = {i_C}$$ $${V_{R1} \over R_1} = {C {dV_c \over dt}}$$ $${{v_b - v_{d1}} \over R_1} = {C {d \over dt} {(v_{d1} - v_a)}}$$ But $v_{d1}$ is constant, so $${v_b - v_{d1}} = {-R_1 C {dv_a \over dt} }$$ Then taking the integral on both side we get: $${(v_b - v_{d1}) t} = {-R_1 C v_a + k}$$ Solving the last equiation for $v_a$, also the vonstant $k$ change to $v_0$, $${v_a} = {v_0 - {v_b - v_{d1} \over R_1 C} t} \tag{1}\label{1}$$ It is clear that the voltage $v_a$ is a ramp. If $v_b \gt v_{d1}$ then the slop is negative, otherwise it is positive. The voltage $v_a$ will increase or derease untill it get equal to $v_{d2}$, when this happen the voltage $v_b$ change it value because of the schmitt trigger configuration of $U_2$.

Now an equation that relates $v_a$ with $v_{d2}$ will be derived. The voltage $v_c$ is given by: $${v_c} = {v_a + v_{R2}} = {v_a - I_{R2} R_2} $$ $${v_c} = {v_a - {v_a - v_b \over R_2 + R_3} R_2} = {v_a \left({1 - {R_2 \over R_2 + R_3}}\right) + v_b {R_2 \over R_2 + R_3}}$$ $$ {v_a {R_3 \over R_2 + R_3}} = {v_c - v_b {R_2 \over R_2 + R_3}} $$ Finaly $v_a$ is given by, at the point were $v_c$ is equal to $v_{d2}$, $${v_a} = {v_{d2} {R_2 + R_3 \over R_3} - v_b {R_2 \over R_3}} $$ And after doing some algebra, $${v_a} = {{R_2 \over R_3} \left(v_{d2} - v_b \right) + v_{d2}} \tag{2}\label{2}$$ The last equation means that $v_a$ will move around $v_{d2}$ by a factor of the difference $v_{d2} - v_b$. And so there will be a value $v_aH$ and $v_aL$, the voltage $v_b$ will have values $v_bH$ and $v_bL$.

The figure 2 show the signal $v_a$.


Figure 2. Ramp and Squeare signals.

The next values are considered, $$v_{bH} = v_{OH}$$ $$v_{bL} = 0$$ $$v_{d1} = v_{d2} = v_{OH} / 2$$ Where $v_{oH}$ is the maximum voltage the the op-amp can deliver. With this values, we can obtaing $v_{aH}$ and $v_{aL}$. $$v_{aH} = v_a(v_{bL}) = v_a(0) = {R_2 \over R_3} v_c + v_c$$ $$v_{aL} = v_a(v_{bH}) = v_a(v_{OH}) = {R_2 \over R_3} \left(v_c - v_{OH} \right) + v_c$$ And so, the value $\Delta v$ is, using $\eqref{2}$, $$ \begin{align} \Delta v & = v_{aH} - v_{aL} \\ \Delta v & = {R_2 \over R_3} v_c + v_c - {R_2 \over R_3} \left(v_c - v_{OH} \right) - v_c \\ \Delta v & = {R_2 \over R_3} v_{OH} \tag{3}\label{3} \end{align} $$ This result means that the span of the ramp signal is given by the ratio of $R_2$ and $R_3$.

Now we can find the time $\Delta t$ required by $v_a$ to change by a voltage $\Delta v$. So, using $\eqref{1}$, $$ \begin{align} \Delta v & = v_a(t_0) - v_a(t_1) \\ \Delta v & = v_0 - {v_b - v_{d1} \over R_1 C} t_1 - v_0 + {v_b - v_{d1} \over R_1 C} t_0 \\ \Delta v & = - {v_b - v_{d1} \over R_1 C} \Delta t \end{align} $$ But in the interval between the points 1 and 2 the slope is negative, this means that $v_b$ is $v_{bL}$ which is $0$, and $v_{d1} = v_{OH} / 2$, $$ \Delta v = {1 \over 2} {v_{OH} \over R_1 C} \Delta t \tag{4}\label{4}$$ Combining the result $\eqref{3}$ and $\eqref{4}$, $$ {R_2 \over R_3} v_{OH} = {1 \over 2} {v_{OH} \over R_1 C} \Delta t $$ And solving for $\Delta t$ we get, $$\Delta t = 2 {R_2 \over R_3} R_1 C \tag{5}\label{5}$$

Example

Consider $Vcc = 3.3V$, $v_{OH} = 2.7V$, $f = 20kHz$, $\Delta v = 2V$, $R_3 = 100k\Omega$ and $C = 1nF$, the equations $\eqref{3}$ and $\eqref{5}$, gives the next values for $R_1$, $R_2$, $$R_2 = R_3 {\Delta v \over v_{OH}} = 100.0 \times 10^3 \cdot {2.0 \over 2.7} = 74k\Omega$$ $$R_1 = { 1 \over 2f} \cdot {1 \over 2 {R_2 \over R_3} C} = { 1 \over 2 \cdot 20 \times 10^3} \cdot {1 \over 2 \cdot 0.74 \cdot 1 \times 10^{-9}} = 16.8k\Omega$$ A simulation using LTSpice and the op-amp LT1013 produce a ramp signl with a frequency of $15Khz$, this is due to the very low voltage slew rate of $0.4 V/\mu s$. This means that to switch from $2.7V$ to $0V$ needs $6.75 \mu s$. The parameter $\Delta t$ can be adjusted to $\Delta t - t_d$, where $t_d$ is the delay time to switch from $v_{OH}$ to $0$ given by the device slew rate. This change gives a new value for $R_1$, $$R_1 = \left({{ 1 \over 2f} - t_d}\right) \cdot {1 \over 2 {R_2 \over R_3} C} = \left({ 1 \over 2 \cdot 20 \times 10^3} - 6.75 \times 10^{-6} \right) \cdot {1 \over 2 \cdot 0.74 \cdot 1 \times 10^{-9}} = 12.3k\Omega$$ The new value change the signal frequency to $19.4kHz$.



Web page designed by Claudio Alvarez Barros - calvarez@lantern.cl