Simple LM324 squarewave and sawtooth generator.

3 years ago 5212
  • Description
  • Documents
  • BOM
  • Attachments
  • Members
  • Comments

Description

A simple LM324 squarewave and sawtooth generator with triangle to adjustable duty cycle pulse output.

Triangle output is roughly linear by being set to a small section of an exponetial charge and discharge.

How it works:

The actual oscillator is made up of the components around U2. See "Figure 27. Squarewave Oscillator" in: http://www.ti.com/lit/ds/symlink/lm124-n.pdf

U1 just generates an approximately mid swing voltage that is needed to make the relaxation oscillator built around U2 work with a single supply. You could dispense with U1 and split R3 into a pair slung across the ground and supply with their common node connected to the non-inverting inptu of U2. I just use U1 instead because there are 4 LM324 in a box and I needed the same voltage it generates at the input of U3 anyway

U2 is a standard non-inverting comparator with hysteresis (defined by the high and low output swing and the resistor potential divider set by R3 and R4 and the output voltage of U1).

The output of U2 switches fully to the low and high extremes and as well as providing the positive feedback it is also used to feed the switched output back into C1 via RFREQ+R5.

This sets up an exponential charge and discharge of C1 but because the target voltages are quite a bit larger than the comparator hysteresis trip points the charge looks almost linear because it only traverse a small part of the exponential curve in both rising and falling slopes.

U3 buffers and amplifies the relatively small swing at the junction of C1 and RFREQ up to the maximum that the LM324 can achieve before it's output hits the ground and supply side output limits of it's swing (which is close to ground but only to about 1.5V below the +ve supply: see the LM324 datasheet).

U1 supplies an output at slightly below 6V because it is set to the middle of the output swing of U2. This is because the symmetry of the squarewave is set by the symmetry of the LM324 outputs. If it swung to 0V and 12V then U1 would need to generate 6V. However, as just explained, the LM324 output swing down very close to ground but up to only about 1.5V below VCC (i.e. VCC-1.5 as in the datasheet).

Therefore, U1 has to generate about 10.5V/2 i.e. 5.25V in order to set the reference for the hysteresis levels of the comparator formed by U2 at approximately mid-swing to ensure that the charge and discharge of C1 is symmetrical.

The buffer U3 also has it's reference set by the output of U1 so that the output swings just within the limits of the LM324. Again R6 could be split and slung across the supplies to supply the reference but U1 is available for that so what the heck.

U4 is just to play with really. It's there in the box with the other 3 so it's used to generate an output with an adjustable pulse width.

It might be worth noting that if the pot is set to 50% or the inverting input of U4 is just tied to MIDBUF then the output of U4 will be pretty much exactly in quadrature with SQUARE.

Of course, if desired, the inputs of U4 can be swapped over to reverse the polarity of the PWM output.

One more thing to note: the LM324 is a useful device in this application because it behaves nicely even if the differential input voltage is equal to the output swing (i.e. one input at ground, the other at VCC-1.5V).

It also plays nicely if the input common mode voltage is at either of these extremes.

Note that not all opamps play that nicely under those conditions and not all comparators maintain a high impedance input with large differential input voltages (have a careful read of the "Application Hints" in:

http://www.ti.com/lit/ds/snosbw6a/snosbw6a.pdf

and "Figure 6. Input Characteristics" in:

http://www.ti.com/lit/ds/symlink/lm319-n.pdf)

Why not play with the simulations and see what happens?

Try replacing the name of the opamp with TL081EE which is a realistic in-house model of the TL081 opamp. As hinted at above, the TL081 is a nice device spoilt by some very bad habits...

:)

  • This project also demonstrates the basic relaxation oscillator.

This generates a pulse and a sawtooth output.

For a detailed analysis, see:

https://en.wikipedia.org/wiki/Relaxation_oscillator

For similar circuits using single Schmitt Trigger input logic gates, see:

https://easyeda.com/andyfierman/How_to_use_EasyEDA_Schmitt_Trigger_input_logic_gates_as_an_oscillator-lSQqYPXR9

Documents

The basic relaxation oscillator.

Simple LM324 squarewave and sawtooth generator.

BOM

ID Name Designator Footprint Quantity Manufacturer Part Manufacturer Supplier Supplier Part Price LCSC Assembly Mounted
1 LM324 U1,U2,U3,U4 DIP08 4
2 1Meg R5,RFREQ,R2 R3 3
3 330k R4,R7 R3 2
4 33u C1 1206 1
5 6 V1,V2 2P-5.0 2
6 200k R1 R3 1
7 100k R5,R3,R6,R8,R9 R3 5
8 12 V1 2P-5.0 1
9 1.1Meg R1 R3 1
10 1Meg RPWM TRIM_POT_PTH 1

Attachments

None
Success
The owner does not allow comments in this project now

Comments (0)

goToTop
你现在访问的是EasyEDA海外版,使用建立访问速度更快的国内版 https://lceda.cn(需要重新注册)
如果需要转移工程请在个人中心 - 工程 - 工程高级设置 - 下载工程,下载后在https://lceda.cn/editor 打开保存即可。
有问题联系QQ 3001956291 不再提醒
svg-battery svg-battery-wifi svg-books svg-more svg-paste svg-pencil svg-plant svg-ruler svg-share svg-user svg-logo-cn svg-double-arrow
We use cookies to offer you a better experience. Detailed information on the use of cookies on this website is provided in our Privacy Policy. By using this site, you consent to the use of our cookies.