Analogue Function Generator

Every electronics lab needs a function generator!  The one describe here, when fully built, produces sine, square and triangle waves at a range of frequencies from about 0.25Hz up to about 160kHz. A symmetry control is available which will vary the slope on the triangle wave and the ratio of the square wave; it also does strange, but predictable, things to the sine output. If the full unit is built, then the output will be up to about plus or minus 6V and capable of supplying about 200mA; though the continuous power is fairly small so it cannot supply the full voltage and current simultaneously for very long but you can apply a heatsink to extend this capability.  The OPA551 amplifier used as the output does however have thermal and current limits and a signal output for when they are exceeded.  Nothing is calibrated but there is space on the control panel to put stickers for your favourite settings.

Most of the parts are available from CPC Farnell and the prices given are approximate as of 2016.  Some of the lower cost parts are only available in small bulk but the excess components are generally useful for your bits’ box.  The nuts, bolts and washers I got off amazon from Connex, part numbers DP8500055 and DP8500056.  One is a kit of nuts and bolts and the other of washers.  These kits are both very useful and a worthwhile addition to your bit’s box.  They cost about £5 each with p&p about the same.

The unit is built on a custom printed circuit board which you will need to have made up.  There are several manufacturers providing a range of services.  Some will provide 1 board quickly and some 10 boards slowly but all cost roughly £30.  So if you want 10 boards and don’t mind waiting about 4 weeks you buy your boards from China – I use iTead.  If you want one board quickly you get them from Europe – sometimes within a day or two.  Whichever service you use you will almost always require the Gerber files.  These are a set of several text files which describe in detail how your board will be created, layer by layer.  I used Eagle to create my design and having tried several other circuit design programs this is my preferred one.  Possibly due to reading Simon Monks excellent book on the subject.  I hate re-inventing the wheel and Simons book describes the whole process exceptionally well.

There are 2 templates included which need to be printed to scale so that the control panel width is 165mm and the height is 210mm and the holes in the IEC C14 connector are 40mm apart.  If printed to a scale of 100% this should be right.  Do not be tempted to print once and photocopy the second unless the photocopy is a better size in which case use 2 photocopies.  The front panel template is used twice and if both templates are not exactly the same size it won’t work correctly.  Photocopiers rarely produce an exact scale copy.

Tools you will need

You may have several of these from previous projects.

  •    Soldering iron and solder.  15 or 25 W iron should do.
  •   Drill with 1.5, 3.5, 4.5, 5, 6 and 10mm bits.
  •     Sharp knife.
  •     Metal ruler.
  •     Junior Hacksaw.
  •     File.
  •    Computer with PDF reader and printer. (duh)
  •     Centre punch.
  •     13mm and 14mm spanners for the controls or adjustable spanner for those sizes.
  •   Screwdrivers.
  •    Heat gun to shrink the sleeving but you can use the soldering iron, it just takes longer.
  • Multimeter.

Tools it would be desirable to have

  • Temperature controlled soldering iron instead of above soldering irons.
  • Folding metal ruler.
  • Vice (I have several)
  • Glue gun
  • Office laminator
  • 10mm Q max cutter instead of 10mm drill bit.  This makes a much neater hole
  • Oscilloscope

I use the glue gun several times to fix the front panel label and to anchor long wires.

For the resistors and capacitors I bought kits of parts:

  • Resistors 5%                                   RE07593             £11.00
  • Ceramic capacitors                       CA08363             £11.00
  • Electrolytic capacitors                  CA08364             £9.00

For the wiring from the Printed circuit to the control panel I used flat ribbon cable.  This is very useful if you are doing a lot of projects.  I bought a 100 foot roll of 9 way for about £20.  You can split off any number of wires quite easily and it makes the job tidier.  Note that the capacitance between adjacent wires is about 30pF a metre which you may have to take into account on some projects.

I definitely recommend the resistor kit and will assume you’re using it in this project as I think it’s a no brainer.  The electrolytic kit does not have the 1000μF 50V capacitor but does have a 25V one.  Using the 25V one is sailing a bit close to the wind as there can be slightly more voltage across it.  However the kits are all good value if you intend to create more projects.  I am not providing part numbers for the 5% resistors and the capacitors in this article that you can use from the kits.

My simple guidelines for good soldering are no butts and no bulges.  If you just butt 2 connections together they can be pulled apart easily: Wrap wires round tags and hook 2 wires together.  If the solder bulges out, then it is not welded to one or both of the connections or there is too much of it.

The PCB as received

The PCB comes all on one board but the Power supply could do with separating off from the remainder of the electronics.  You will need a sharp knife, small vice and a folding metal ruler to use the method below.  You can use the board as it comes but there is a small risk of hum pickup.  You will also need to build the Power supply first and set up the voltages before putting the other electronics on the board.

Insert the board between the 2 halves of the ruler, then line up the ends of the ruler, tape them together and line up the board within it so that the dividing line is just visible.  Put the assembly in a vice so that the ruler is between the jaws, not too tightly or you will damage the board. Score lightly and evenly along the line on both sides of the board using the ruler as a guide.  You will see that there are 3 connections between the two boards.  These need to be cut completely to prevent the tracks being torn from the board in the process of separating them.  There is provision for wiring them together subsequently. Take care to only score along the line or you may damage some of the other copper tracks which would be quite difficult to repair. Repeat the scoring, using heavier strokes as you progress.  You will get to a point where the boards separate easily.  This method is less prone to mistakes than others I have tried.

PCB ready to be cut

The Seperated PCB

Inside the finished unit

I am building the function generator into a low cost sloping front enclosure.  This is Farnell part number EN55108 and costs about £7.00.  All the drilling will be done at once as adding holes once you have started building can be difficult without damaging the circuitry.  Refer to the picture above for the placement of the parts.  This does not have to be exact. 

I am working on a small static mat and I recommend you also do this.  Static discharge may not produce immediate problems but equipment is weakened and may fail later.

The Box

The box itself requires a few holes cutting in it:  2 of 4mm to mount the transformer, 4 of 3.5mm for the power supply electronics, a bit of an awkward shape for the IEC C14 socket and the 3.5mm holes for the posts for the main electronics.  You don’t have to use the IEC C14 socket; you can run the cable through a suitable grommet with cable clamps to secure it.  The socket is a better solution though and I recommend it.

This not to scale.  print it with scaling so that the holes are 40mm apart.

Note that I haven’t slavishly copied the shape of the IEC C14 and a 4mm radius on the corners is acceptable.  Print the sheet out, cut out the template and tape it where you want the socket.  I placed it on the back between the transformer (see photo above) and the left-hand side. The dashed line on the template is 2mm from the edge so you can centre punch round it at 4mm intervals, drill first with a 1.5mm bit then with a 4mm one.  This gives better accuracy than drilling with the 4mm straight off.  You will then need to file out the shape or pare it off with a strong craft knife.  The 2 holes on either side are 3.5mm:  Centre punch them through the template or if you have done the larger hole through the holes in the socket, then drill with 1.5mm then 3.5mm.

The holes for the transformer mounting are 74 mm apart for the part specified:  Check the transformer you have bought as it may be different.  I have done a 4 mm hole 10mm from the back and 70mm from the left hand side.  The other hole is 74mm towards the front from this.

Eight more holes are needed to mount the power supply and electronics boards.  To complete the drilling of the box you will need:

  •   10mm M3 machine screws         16               FN00719             2.60 (50)
  • 12 mm standoffs                             8                  PC01656             0.70 (10)
  •   Power supply PCB
  •   Electronics PCB

Using the power supply board as a template centre punch the box on the outside.  Use the picture to get an idea of its position.  Drill the holes using a 3.5mm bit.  With M3 screws attach the standoffs loosely to the inside of the box and screw the board onto the standoffs with more 3mm screws.  Tighten up the screws on the box.  Remove the board ready for making up the power supply electronics later.  Repeat the process for the electronics board.

Front Panel – drilling

The aluminium front panel on this box is only 1mm thick so care will be needed if you are not to damage it.  I have produced a template for this which you use twice:  Firstly to position the holes in the panel and secondly to decorate the front panel with labels for the controls.

I recommend using a 10mm Q max punch for the holes for the controls. These are available online for about £10. The Q max cutter produces a very neat hole and is a very useful tool to add to your toolbox if you are doing a few control panels as most rotary panel components mount in a 10mm hole.  You will need to supply an Allen (hex) key to use it and you need to grease the whole hole cutter for good operation.

Print out a copy of the front panel template and tape it in position to the front panel.  Centre punch the locations for each of the 10 holes, each marked with a cross inside a circle and an extra hole near to the output socket; this will be 3mm.  then drill a 1.5mm hole at each position.  Drill out the upper hole for the power to 5mm and the lower one to 6.5mm.  Do not be tempted to drill out the holes to full size straight away as you will lose accuracy and they won’t be as neat.  Drill out the holes for the controls and output socket to 6.0mm.  Now using your Q max cutter or 10mm drill make the holes for the controls up to 10mm lining them up as well as you can.

Front panel – labelling

The following is my preferred way of labelling the front panel as it is fairly easy and quite durable.  You do not need to laminate the paper template but it tends to get grubby and worn quite quickly if you don’t. 

Print out another copy of the front panel template and cut it out along the dotted lines.  Laminate it on an office laminator and cut out the laminated template about 3mm bigger than the template all around.  You then need to create holes for the various controls and screws.  I used a leather punch for the smaller holes and the Q max for the controls.  If you have been careful with your drilling and punching everything should line up.  I scored along the line between the top and bottom of the template and folded it slightly to fit the bend in the control panel.  I then glued it, using a hot glue gun, to the panel making sure the holes all lined up.  If you don’t have a glue gun then double-sided sticky tape will do.

Power Supply

I am going to start the electronics with the power supply, which is very simple.   You need to do this first  if you haven’t split the board

You need the following parts:

  • Mains on/off switch                                    1             SW02851         0.90
  • IEC C14 chassis socket                                1             CN14818         0.70
  • 6mm heat shrink sleeving                         1            CB10959         2.00
  • transformer 12VA, 15+15V                         1            TF01340           5.60
  • Rectifier 1N4007                                           4           SC07337          3.60(10)
  • Capacitor 1000μF 50V                                 2            CA05182          1.80
  • Capacitor 10μF 25V                                      2             from kit
  • Power Regulator IC 7815                             1             SC08386          0.20
  • Power Regulator IC LM337                         1             SC08262         0.70
  • Trimmer 1k                                                    1             RE04242        0.80(5)
  • resistor 1k                                                       1             from kit
  • resistor 120R                                                   1            from kit
  • Power supply PCB
  • heat sink
  • heat sink compound
  • small nuts and bolts

The numbers in brackets are the minimum order quantities.  In some cases, you will end up with quite a lot in your bit’s box.  I recommend that instead of the 2 resistors you get a kit of resistors as mentioned earlier.  This will build up your bits box with useful components and some of the parts will be useful later in the function generator electronics.  It’s also cheaper than buying the minimum quantity of each value you will need.

In designing a power supply everything has to be larger than life.  The capacitors C1 and C2 will have a full 25V or more across them as the transformer has a regulation of 16%. This means that with no load it gives out 17.4V AC on each winding – not 15V, rectification and smoothing will multiply this by 1.414 to the peak of the sine wave giving us 24.6V.  Mine actually measured at 26V. This also means that your rectifier diodes have to be at least 50V to cope with both halves of the voltage swing.  The diodes specified can take 1000V!  this may seem excessive but the minimum order is 10 and they don’t cost any more than the 50V ones so you will have some good general purpose rectifiers in your bits box.  The transformer also has to have a lot of leeway on the power rating as running one at its full power rating will make it very hot indeed.  The one used is 12VA but 2 x 15V x 200mA only appears to demand a 6VA one.  The 12VA transformer still gets quite warm.

When playing with Power supplies after having them plugged in you should always discharge the large capacitors after you subsequently switch off.  Even though this is a low voltage unit if you accidentally discharge a capacitor through another component you may well destroy it.  With high voltage supplies If you fail to discharge the capacitors the voltage on them can kill you.  The voltage may remain on the capacitors for several hours after they have been disconnected from the mains.  Discharge is best done through a resistor; the bang you get from doing it with a pair of insulated pliers may be fun but it doesn’t do the capacitor or your pliers any good.

The switch, transformer and socket should all be wired before they are assembled to the box as it will be awkward afterwards.  I used a short length – about 300mm – of mains flex to do the mains wiring.  Remove the three cores from the overall insulation.

Firstly, wire up the IEC C14 socket using about 100mm of wire on each of the neutral (blue) and earth (yellow/green) and 300mm on the live (brown).  Solder the wires to the plug, using the normal colour convention for mains wiring, then thread about 20mm of the heat-shrink sleeving onto each wire, make sure it covers the solder joint and as much metal as possible, then shrink it onto the joint. You can use the heat of the soldering iron to do this or – with care – a heat gun such as that used for paint stripping.  Thread the wires through the hole cut in the box for the socket and screw the socket onto the box using M3 nuts and bolts – preferably countersunk.

Now wire the transformer.  I’m doing this for 230V. The 115V connections need insulating with the heat-shrink sleeving but it is not necessary for the 15V connections as they give no shock hazard.  The transformer has 4 pairs of connections:  2 marked 0-115V and 2 marked 0-15V.  On each of these connect the centre connections together, solder the 115V ones ensuring you have used heat-shrink sleeving to insulate them – leave as little bare metal as you can.  Connect the neutral wire from the socket to the connection marked 0 on the unconnected 0-115V terminals – use sleeving to insulate it!  Connect the earth wire from the socket to the centre of the 15V connections.  Use normal connecting wire and connect 3 wires, one from each of the unconnected, outer 0-15V terminals; I used yellow wire for this and one green wire to the 2 earth terminals at the centre.  Make them about 200mm long.  These will later connect to the power supply PCB.

The switch is in the live wiring and needs all the connections carefully insulating.  Put the sleeving on the wires before soldering them on.  Connect the live wire from the IEC socket to an end connection on the switch – insulate it.  Wire the centre connection of the switch to the unwired 115V connection on the transformer.  It is important to not wire the live connection to the centre contact on the switch as when you switch it off the other end connection will then become live.  From the photo you can see that the connections on the transformer have a bare metal part projecting above the connecting tags.  I have insulated these with heat shrink on the mains side but the bare metal is visible on the low voltage side.

Now screw the transformer in place using M4 nuts, bolts and washers.  Use washers on the transformer fixing outside the box to reduce the chance of it breaking the plastic box as it is quite heavy.

Power Supply Electronics Board

Now we will use the power supply board we used as a template when drilling the box to make the electronics for the power supply.

Solder in the low-lying components first:  The resistors, rectifiers and the trimmer, then the 10μF capacitors.  Take care to fit the rectifiers, 10μF and 1000μF capacitors the right way round.  Fit the heatsinks on the 2 regulators spreading heat sink compound on the metal area of the regulators and using the small nuts and bolts to fit them.  Solder the regulators to the board with the metal side facing out.  Now fit the 2 large 1000μF capacitors.  Connect wires to the output of the Power supply.  These go on the 3 connections on the side of the board.  The positive goes nearest the end, the ground in the centre and the negative on the remaining connection. I use red for positive, green for earth and black for negative.

Connect the transformer to the Power supply board. This is connected to the 3 connections on the end of the board.  The ground connection goes to the centre connection and the two other wires to the outside connections’ it doesn’t matter which way round the 2 yellow wires go.  The negative voltage will now need adjusting to match the positive voltage.  You need to do this before connecting to the function generator as the voltage can go to about -20V which is more than some of the components can safely take.  Plug in to the mains, switch on and measure the positive voltage between the green and red wires.  This should be about 15V (mine was 14.6V).  Now measure the negative voltage between the green and the black wires; adjust this with the trimmer until it matches the positive voltage just measured.  Unplug from the mains.

Control Panel

You should already have completed the drilling for this when drilling the box so let’s add the actual controls.  You will need the following parts:

  • Potentiometer 100k                                  3            RE04393              5.00
  • Potentiometer 100k twin gang               1             RE04433              2.70
  • Switch 2 pole 6 way                                   1            SW04136             1.50
  • Switch 4 pole 3 way                                  1            SW01435              1.60
  • Socket BNC                                                  2            CN06849              2.80
  • Knob pointer (legacy)                               6            SW05328              3.60
  • LED 5mm                                                     1            SC11574              0.80 (5)
  • Resistor 2.7k                                                1            from kit
  • 3mm nut and bolt                                       1           from kit
  • Connecting tag                                             1           PC01452        4.00 (100)
  • Heatshrink tubing as above

There are no scales on the control panel as this instrument  is uncalibrated and scales would be misleading.  You can however add your own markings with a fine erasable marker.

I chose the legacy pointer knob because it is cheap and very easy to see where it is pointing.  You can, of course, choose your own.  I use BNC sockets as it is convenient to use oscilloscope probes on x1 setting for the connections.  If you use a ‘scope probe you may find the x10 setting a useful way to get a really low signal as this puts a 9 megohm resistor in series.

Cut the shafts on the potentiometers and switches down to about 8mm in length using a junior hacksaw and clean up the ends with a file or sandpaper.  Take care with the rotary switches as there is often an end stop consisting of a loose ring on the base of the shaft; if this is allowed to move away from the body of the switch it can be difficult to find its correct position again.  You may want to mark the position with a marker pen before removing the nut.  Attach the controls and BNC sockets properly now, using a spanner to tighten the nuts.  Do not overtighten as you may break the control.  The 6-way switch is the range control.  The 3-way switch is the function control.  The 100k twin gang potentiometer is the frequency control.  All the other controls are 100k single gang pots.

The LED should be a tight push fit in the 5mm hole, a little hot glue would be useful here to hold it in.  Don’t attach the power switch yet.  Next attach the control knobs.  For the potentiometers you should turn the potentiometers fully anticlockwise and screw the knob on pointing to the most anti-clockwise mark.  When you turn it fully clockwise it should point to the most clockwise mark.  For the function switch turn it to the centre position and fit the knob pointing straight up to the triangle position.  The range switch should be turned fully anti clockwise and the knob fitted pointing to the left hand mark.

Bolt the connecting tag to the back of the front panel using the 3mm nut and bolt.

You then need to do some wiring on the control panel.  The LED which is not shown on the schematic and the scan socket and circuit.

Wire the earth tag on each of the BNC sockets to the connecting tag.  Don’t solder the output socket connection yet as this is wired to the electronics board.

Hook the 2.7k resistor onto the long lead on the LED and solder them together.  Hook a piece of red wire about 15cm long onto the other end of the resistor and solder that. Slip a piece of Heatshrink down to cover the wires and the resistor and shrink it on.  Repeat this process using black wire on the other end of the LED but without a resistor.  Connect the centre tag of the frequency potentiometer closest to the panel to the centre tag on the scan socket.

The Electronics Circuit Board

This is a fairly straightforward assembly but some decisions need to be made before starting. One is how the wiring from off the board to the control panel and power supply is to be attached.  There are two main choices:

  1. Soldered directly on to the board. This is the method used here.
  2. Plug and socket. This is the most convenient way in the long run but assembling the cables can be a bit laborious.  This is also the most expensive option.  You will have to select your own plugs and sockets for this job.  I use KK connectors usually.

Another decision is adding a heatsink to the OP551 amplifier.  This will increase the power output substantially.  I used thermal adhesive tape which you can buy in a small sheet for about £10.  With care this can last you for many heatsinks but if you don’t need the power it is an unnecessary expense.

You will need the following parts:

  • Heatsink                                    Optional             SC10775             £0.50
  • Heatsink tape                           Optional             SC10691             £9.50
  • Electronics PCB
  • LF347 IC                                     1                           SC07963             £1.00
  • OPA551 IC                                  1                           SC07897             £4.00
  • 200k Trimmers                         3                           RE04196             £2.00
  • 1N4148 diodes                           10                        SC07316             £0.40 (10)
  • 100pF ceramic capacitor          1                         from kit
  • 1nF ceramic capacitor              1                         from kit
  • 10nF ceramic capacitor            1                         from kit
  • 100nF ceramic capacitor          5                         from kit
  • 1μF ceramic capacitor              1                          from kit
  • 10μF electrolytic capacitor      2                          from kit
  • 6k8 resistor                                 1                          from kit
  • 12k resistor                                 1                          from kit
  • 1k0 resistor* (1k0)                     1                          RE03722             0.80 (50)
  • 24k resistor* (22k)                     2                          RE03746             0.80 (50)
  • 200R resistor* (220R)                 1                          RE03738             0.80 (50)
  • 620R resistor* (680)                    2                          RE05326             0.80 (50)
  • 100k resistor* (100k)                  2                          RE03724             0.80 (50)
  • 15k resistor                                   1                          from kit
  • 56k resistor                                   2                          from kit
  • 68k resistor                                   1                          from kit
  • 5.5-50pF capacitor                       1                          CA06916              5.00(5)

The resistors in the triangle to sine convertor shown with an * should, strictly speaking, be high tolerance 1% devices to get the best result but you can get away with nearby 5% values if you can stand a bit more distortion.  You can get a kit of 5% resistors, as previously recommended, quite cheaply but the 1% resistors would have to be bought in individual values – usually in quantity; a kit containing these values costs about £100 and you end up with a lot of resistors you will never use. The bracketed values are the recommended 5% resistors.  The part numbers given are for the 1% values; it is assumed that you will buy the resistor kit for the 5% resistors.

The highest components on this board are the 10μF capacitors so you can just mount the rest in any order you like.  Take care to orient the diodes and IC’s the correct way round.  The IC’s have a notch or dimple at one end which matches up to a notch on the outline on the board.  The diodes have a band at one end to match up to the one on the board.  You may like to use sockets for the IC’s

Putting it all together

This entails a lot of wires between the control panel and the electronics!  If you make the wires too long it will degrade the signal:  Too short and you won’t be able to work on it.  I screwed my front panel upside down on the right hand side of the box and then wired quite loosely.  I used ribbon cable because I’d got it.  You can use ordinary connecting wire; stranded preferably.  In most cases you will need to refer to the schematic and use your multimeter to trace out the connections.  There is no easy way to label these up on such a small PCB.  Reference to the PCB layout (shown below) is a great help here.  All the potentiometer connections have the wiper at the centre.

Rotary switches have a convention whereby all the wipers are labelled with letters:  A, B, C etcetera’s and the tags with numbers.  A will switch to 1,2 etc in clockwise direction and on, say, a 4-way switch B will connect to 5,6 and so on.  On a 6-way B will start at tag 7.

If you have replaced C6 (10μF) with 10pF then you may want to change your wiring accordingly so that C6 is connected to the rightmost position on the switch or straight to the wiper connection.

Your Power supply should be working by now; check the voltages, switch off and connect the Power supply to the electronics.  I used Red for Positive, black for negative and green for earth.

PCB connections

Setting it up

This really, really needs an oscilloscope but you can fudge it with a multimeter.  Note that you may have to reduce the output amplitude to prevent clipping of the triangle wave

  1. Monitor the output with the function switch set to sine. 
  2. Adjust the triangle wave using R6 until you get the best sine wave. 
  3. Set the function to triangle and read the peak to peak voltage. 
  4. Set the switch to sine once more and adjust the peak to peak voltage of the sine to the same as the triangle using R5.
  5. Adjust the square wave similarly with R7. 

As it stands the square output probably has a lot of ringing.  The cure is to put a capacitor across R21, this is C17 and it is adjustable.  Set the function to square and the range switch to the 4th position then monitor the output with your ‘scope set to about 10uS/div and adjust C17 until you get the best waveform.

50 kHz with ringing

50kHz with compensation

Most of the artefacts on the output of this unit are created in the OPA551.  If you wish you can replace this with a more normal op-amp. You lose the output power though.  This is displayed at 20uS/div so the rise and fall times are about 1uS.

Schematic (click on image to get an enlarged view)

How it works

You may want to print out the schematic here 🙂

The heart of this circuit is IC1B and IC1C.  IC1B is an integrator which, when the input is switched from one voltage to another will make the output ramp up or down in a linear fashion.  Its output is fed into a Schmidt trigger formed by IC1C.  The output of this will switch between the extreme high and low voltages when the input reaches set levels determined by R12 and R13.  This output is fed back into the integrator (By way of IC1A which is a buffer).  The result is that the output of IC1B is a triangle wave and that of IC1C is a square wave.

To make life more interesting (really?) I’ve added a symmetry control.  This varies the rate at which the triangle wave rises and falls.  It also changes the shape of the square and sine waves, varying the high and low ratio of the square wave and the curve of the sine wave.  IC1A buffers this control to prevent the symmetry control affecting the frequency too much (it still does a bit).  The symmetry control varies the rate of ascent and descent of the triangle wave by sharing the charge through D3 and D4.  D1 and D2 compensate for the non-linear characteristics of D3 and D4.

C1 to C6 are the timing capacitors for the integrator.  These control the frequency of the function generator.  You have a choice in creating a range according to the value of these components.  As these cannot be polarised capacitors then the higher values, representing the lower frequencies, can be quite expensive.  Trying to use the lower values – 100pF or less can be problematic due to the inherent capacitance of the wiring and a fault known as microphony.  Microphony is a problem whereby the movement of the connecting wires varies the capacitance by a small amount thereby altering the signal.  This is generally solved by not letting the wires move!  Both these can be overcome for one value only by connecting the lowest value capacitor directly rather than through the switch; unfortunately, the value of that capacitor is then added to all the others.  C6 is actually connected this way.

The jungle of diodes and resistors after the triangle generator is a fudge to make an approximation to a sine wave and it actually works quite well.  The distortion though is quite high and there are better convertors but they are a lot more complicated.

The output of the integrator – triangle, the Schmidt trigger – square and IC1D – sine, are selected by SW2 go to the output buffer IC2 by way of the amplitude control.  The buffer has a gain of about 2.  The OPA551 is optimised for a gain of 1 which is why we get some unwanted artefacts such as ringing.  The inverting input of this amplifier is connected to the Offset control which adds a voltage to the signal.

The Controls

Most of the controls are pretty much self-descriptive but I will provide a – mainly – short guide to each.


This selects between the three waveforms available:  Sine, Square and Triangle.  This switch is probably the best place to monitor the signal before it goes to the output stage.





This selects the range of frequencies which the Frequency control uses.  Each stop on the switch changes the frequency by a factor of about 10.  This factor is approximate and is dependent upon the accuracy of the capacitors C1 to C6.  If you need better accuracy you may select these components to be as close to a scale of 10 from each other as you can.  This is best achieved by padding the lower values up to the higher ones:  First find the capacitor which produces the lowest frequency for its range – not the lowest frequency overall but the lowest you would expect at its setting.  You then add small capacitors to the others to make them more exact in their scale to it.  I wouldn’t go too mad though; one well selected capacitor on each range will usually do a pretty good job.


This controls the output amplitude which at a maximum should be about 20V peak to peak. This needs to be adjusted with the resistors R5,6 and 7. If you need better control nearer the lower amplitudes, you may prefer to use a logarithmic potentiometer for this.  If you set the amplitude too high, then you will experience clipping of the waveform.


As with all the controls this is approximate and does not provide a calibrated output.  The frequency is dependent upon the capacitors on the Range switch.  My unit provided the following range:

  • 1                     0.25Hz – 10Hz
  • 2                     2.7Hz – 100Hz
  • 3                     140Hz – 1kHz
  • 4                     750Hz – 10kHz
  • 5                     4kHz – 125kH
  • 6                     See below

You may omit C6 altogether but the result is not predictable.  At the higher frequencies the slew rate of the op-amps takes control rather than the feedback capacitor.

That lowest frequency range may be too low for your taste so you may want to use different capacitors C1 to C6.  You may also want lower frequencies; for instance to provide a very slow ramp from the triangle wave.

Now we will now reveal the purpose of the Scan socket!  It’s quite simply an output providing a voltage proportional to the rotation of the frequency control.  If you have an oscilloscope with an X-Y input then you can connect the Scan output to the X channel of the ‘scope, the Y channel to the output of a frequency dependent circuit and the output of the function generator to the input of the frequency dependent circuit.  As you turn the Frequency control you will generate a graph of the frequency response of your circuit on your ‘scope.  Lots of result for little effort – yeah! (But it’s not perfect)


The basic function of this control is to change the ratio of the up and down ramp speeds of the triangle wave.  In doing this it changes both the square and the sine wave outputs.  The ratio is quite large at lower frequencies but is limited at high frequencies by the characteristics of the op-amps.

Square wave at one extreme of the symmetry control

The effect on the triangle wave

and the sine

With square waves it changes the pulse width ratio; the timing of the high and low voltages and with sine waves; erm, well, judge for yourself.  You might, possibly find it useful, maybe, sometime.  I suppose you could set the ratio to an integer: 1:2, 1:3 etc. and get the harmonics


This adds an offset voltage to the output – negative or positive.  This can be particularly useful to generate logic level outputs on the square wave.  It is limited by the maximum output voltages of the output amplifier and the signal may be clipped to remain within those.

Too much offset on a sine wave 

Suggestions for extending the unit

The unit has been purposefully overbuilt in some respects:  The case has loads of room in it and the power supply has some overhead.  This gives reasonable space for expansion.

A dead simple mod is to extend the power supply outside the case to use with other projects.  The best way to do this is to put a 3pin socket or 3 terminals on the case wired to the supply.  Do not use a socket which could be mistaken for a mains input!  You may also want to put a heatsink on the regulator IC’s – I did.

The Burr-Brown data sheet has a circuit for increasing the current output of the OPA551 to about 1A.  If you do this, you will need to upgrade the power supply.  You may want to replace the OPA551 completely with your own output power buffer.

The OPA551 has a flag output which supplies a pullup current of about 120μA when the chip is overloaded and cuts out.  This operates when the chip reaches 160˚C and allows the chip to function again when its temperature drops to 140˚C.  You might want to make this operate an LED on the front panel or provide an output – preferably buffered.

With a bit of research, you could almost certainly find a better – if more complex – triangle to sine convertor.  The one used here was chosen for its simplicity.

Component layout

One thought on “Analogue Function Generator

Leave a Reply

Your email address will not be published.