March 29, 2011 by Hexorg Hello everyone, I've come up together with a few circuits that will produce an oscillating signal with variable frequency. Unfortunately, I couldn't remember some formulas, and I don't have the time right now to look for them online. You are more then welcome to correct me, and add anything. :) Here we go. Manual starting Wien-bridge sine oscillator: ``````C1 = C2 = C R1 = R2 = R V1 = V2 = Vout (peak) F = 1 / (2*pi*R*C) To begin oscilations, set (Rf/Ri) > 3, then to keep the stable oscillations, set (Rf/Ri) = 3 `````` Self starting Wien-bridge sine oscillator using zener-diodes: ``````A little modification allows for a self-starting oscillator. C1 = C2 = C R1 = R2 = R V1 = V2 = Vout (peak) F = 1 / (2*pi*R*C) Zeners' Vref should be smaller then V1 This is easy to build, but will NOT result in a clean sine-wave `````` Self starting Wien-bridge sine oscillator using JFET: ``````C1 = C2 = C R1 = R2 = R V1 = V2 = Vout (peak) C3 is electrolytic (!) F = 1 / (2*pi*R*C) Rf= 2 * (R3 + r'ds) !!! r'ds is a drain-source resistance of JFET (look in JFET's datasheet for this value) `````` Triangular-wave oscillator: ``````The first op-amp works as a comparator, second - as an integrator. f = (R2 / R3) * ( 1 / (4*R1*c)) `````` Square-wave oscillator: ``````Unfortunately no formulas. `````` Nice Stan, thank you. The op-amp is a 741 or equivalent correct? V2 would be a negative power supply correct? Now some circuits driven by the mcu would be interesting. Pin change high/low and PWM signals. Thanks to the formulas I should be able to work out the parameters so that I can learn how to read/understand my oscilloscope. I have my Forrest Mims Electronics Tablets with similar circuits but I like having them here. Ralph Yes, op-amp is 741 (those guys are really useful). Yes, V2 is negative, sorry I didn't mark them, but generally on a DC power supply symbol the side that ends with a longer line is positive, and the side that ends with a shorter - negative. If you want something cool, driven by the MCU, try this: Integrator: ``````C1 = C R1 = R Vc = ( Ic / C ) * time Iin = ( Vin / R ) Ic = Iin ( Change in Vout ) / ( change in time) = - ( Vin / ( Ri*C )) `````` Differentiator: ``````R1 = R C1 = C Vc = Vin Ic = ( Vc / t )*C Vout = Ic * R Vout = -( Vc / t )*RC `````` Digital to Analog converter: This can be a really useful circuit. Not too expensive either - for an N-bit converter you need 1 op-amp and N+1 resistors. It just works as weighted summing amplifier. Resistor 2R is twice as resistive as R, 4R is 4 times, and so on. You HAVE to keep this pattern. ``````LSB Vout = -Vin*(Rf / R), since TTL levels are 0 and +5v, we can rewrite that Vout = -5*( Rf / R ) when we input 1 on LSB `````` The whole expression is (D0 - voltage at LSB; D8 - voltage at MSB): ``````Vout = -( D0*(Rf/R) + D1*(Rf/2R) + D2*(Rf/4R) + D3*(Rf/8R) + D4*(Rf/16R) + D5*(Rf/32R) + D6*(Rf/64R) + D1*(Rf/128R)) `````` Note the "-" at the beginning. If you want positive output, just pass it through an inverting amplifier. The output of this will be composed of a series of "steps" of voltages, instead of smooth analog signal, this is known as alaising. To smooth out the signal, (operation known as anti-alaising), just connect the output of the DAC to an integrator mentioned above. Oh! it's off-topic, but I'm getting the same scope XD The main problem with that type of DAC is that you need very accurate resistors. In order for R and 128R to be in the same ratio, you need better than 1% tolerance, or else test a lot of resistors to find ones that match the best. If you actually want to build this circuit for use with the MCU, I'd stick to 6 or fewer bits (stop at 32R). (or use a resistor ladder) bretm, Yea you are right, if you really need a precise DAC. If someone just wanted to test their oscilloscope with it, or just to play around, that'd work with any 10% tolerance resistors :) But if you don't need a precise DAC, you can just use 5 bits instead of 8 in which case 10% is appropriate anyway.