Kids' Basics - Function Generators

Simple circuit for beginners

Daniel Koch

Issue 70, May 2023

Some easy and simple, but still very useful, function generator circuits for your test bench.

Makers need test equipment to help make sure their creations are working and to find out why they're not. From simple mulitmeters to measure resistances and voltages around a circuit, all the way up to fancy oscilloscopes with analysers of all sorts built in that cost more than most cars, we all use some test equipment in some way.

A function generator is one of those pieces of equipment. Over the last couple of months, we have built different types of amplifiers for Kids' Basics, also aimed at being pieces of workbench test equipment that you can keep using to find out if a smaller part of a larger project is working as you build it. When we were developing those, we used a function generator to give us a signal with which to test the amplifier both in whole and in part.

The function generator we used has two output channels that can be controlled independently, we can vary the frequency (number of waves or cycles per second) between zero and twenty-five million (0Hz to 25MHz) and choose from different waves like square, triangle, sine, sawtooth, and many more. There are a bunch of other controls too, like amplitude and duty cycle.

If that sounds like another language to you, don't worry! Many of those terms are not words people at the beginning of their electronics journey need to know. We'll explain the important ones later. We don't even use all of those features. However, function generators are expensive. Ours was one of the cheaper ones around and it cost us $750 when we bought it three years ago, and prices have only gone up since then.

Even so, a function generator is still very useful, so we're going to build a very basic one. It has a fixed frequency, for reasons we'll explain in 'How It Works', and it can output a square wave, triangle wave, and sine wave. The sine wave is not terribly pure, and the triangle wave is not perfect either, but both do the jobs we are going to ask of them perfectly well. You can use it to give a known test signal when you are making or testing amplifier circuits, but also filters, counters, and many other circuits as well.

The whole circuit first on one solderless breadboard with room to spare. There is one thing we've had to do this month that we really don't like doing. Because of space and board-crowding, there are two resistors which sit end-on in the board. The reason we dislike this is that the photos and Fritzing are both less clear this way. It's harder to see exactly where the legs go and you cannot see the resistor colours. We'll try to be very clear when the time comes.

The photo below shows how the leads are bent and trimmed and end up in rows next to each other.


We encourage you to read all the way to the end of the article before you build. Not only will you then have a better feel for the overall picture as you build, but we sometimes discuss options or alternatives that you will need to have decided on. You will need some basic hand tools for most builds. Small long-nosed pliers and flush-cut side cutters meant for electronics are the main ones. Materials like tape or glue are mentioned in the steps, too. We always produce a tools materials list if you have to go shopping, but anything that is lying around in most homes is just stated in the steps.

As always with Kids' Basics, we avoid soldering to make the build more accessible to more people, but having an adult around can still be helpful. You won't need any particular skills besides being able to identify components at a basic level, and even then, we help as you go along. If, for example, you don't already know what a resistor is, you'll probably be able to work it out from the photos and description in each step.

We do provide a schematic or circuit diagram but this is just helpful if you already know how to read one. Don’t stress if you have never learned, but take the chance to compare the digital drawing of the breadboard layout (which we call a 'Fritzing' after the company that makes the software) to the schematic and see if you can work some things out. You can make this project from the Fritzing and photos alone. You might also like to check out our Breadboarding Basics from Issue 15.

The Build

Parts Required:IDJaycarAltronicsPakronics
1 x Solderless Breadboard-PB8820P1002DF-FIT0096
1 x Packet Breadboard Wire Links-PB8850P1014ASS110990044
4 x Plug-to-plug Jumper Wires-WC6024P1022ADA1957
1 x 1kΩ Resistor*R1RR0572R7558DF-FIT0119
3 x 1.5kΩ Resistors*R3, R4, R5RR0576R7562DF-FIT0119
1 x 150kΩ Resistor*R2RR0624R7610DF-FIT0119
1 x 300kΩ Resistor*R7RR0631R7617DF-FIT0119
1 x 470kΩ Resistor*R9RR636R7622DF-FIT0119
1 x 620kΩ Resistor*R6RR0639R7625DF-FIT0119
1 x 1MΩ Resistor*R8RR0644R7630DF-FIT0119
1 x 4.7nF Capacitor*C1RM7047R3009BDF-FIT0118
4 x 100nF MKT Capacitors*C2, C3, C4, C5RM7125R3025BDF-FIT0118
1 x 2.2µF Electrolytic Capacitor*C6RE6042R5028DF-FIT0117
1 x NE555 Timer ICIC1ZL3555Z2755-
1 x LM324 Quad Op Amp ICIC2ZL3324Z2524-
1 x 9V Battery-SB2423S4970B-
1 x 9V Battery Snap-PH9232P0455DF-FIT0111

Parts Required:

Step 1:

Place the breadboard in front of you, with the outer red (+) rail facing away from you and the outer blue (-) rail closest to you. Install two wire links, one joining the two red (+) rails and one joining the two blue (-) rails.


Insert an NE555 timer IC near the left-hand edge of the board, and an LM324 quad op amp IC a bit to the right of that. Both ICs have pin 1 to the left, and pin 1 is marked by a dot above it, or a notch in the end of the package. Don't be fooled by the big dot in the middle at the other end of the IC: This is a mould mark.


Install five wire links. One goes from the upper red (+) rail to pin 8 of the NE555, one from the lower blue (-) rail to pin 1 of the NE555, and another from the lower red (+) rail to pin 4 of the NE555. There are two for the LM324: One from the upper blue (-) rail to pin 11, the very middle, and one from the lower red (+) rail to pin 4.


Add a 1kΩ resistor (BROWN BLACK BLACK BROWN SPACE BROWN) between the upper red (+) rail and pin 7 of the NE555. Insert a 150kΩ resistor (BROWN GREEN BLACK ORANGE SPACE BROWN) between pin 7 and a row to the right of the IC. Install a wire link between the end of this resistor, and pin 6.


Place three wire links around the NE555 so that pin 6 is connected to pin 2. Also add a 100nF (100n or 104) capacitor between pin 5 of the NE555 and the upper blue (-) rail, and a 4.7nF (4n7 or 472) capacitor between pin 2 and the lower blue (-) rail. We used MKT capacitors but yours might be ceramic or greencap and will look different.


Install three 1.5kΩ resistors (BROWN GREEN BLACK BROWN SPACE BOWN). One goes from pin 3 of the NE555 to pin 3 of the LM324; one from pin 1 of the LM324 to pin 5, and one from pin 7 off to the right. Also add an uninsulated wire link, which we have coloured so you can see it, between pins 1 and 2 of the LM324, and another between pins 6 and 7.


Insert three 100nF (100n or 104) capacitors. One goes from pin 3 of the LM324 to the lower blue (-) rail, one from pin 5 to the lower blue (-) rail, and one from the end of the last 1.5kΩ resistor to the lower blue (-) rail. Also place two wire links: One from the end of the last 1.5kΩ resistor to jump the gap in the board, and another to go from there to pin 10 of the LM324.

Step 8:

Place an uninsulated wire link between pins 8 and 9 of the LM324, and a 2.2µF electrolytic capacitor with its positive leg (unmarked) in the same row as pin 8, and its negative (striped) leg in the row to the right. Add a wire link from the negative capacitor leg, to pin 12 of the LM324.

Step 9:

Install a 620kΩ resistor (BLUE RED BLACK ORANGE SPACE BROWN) from the upper red(+) rail to pin 12 of the LM324, and a 300kΩ resistor (ORANGE BLACK BLACK ORANGE SPACE BROWN) vertically between pin 12 and pin 11. Connect the red battery snap wire to the upper red (+) rail and the black one to the lower blue (-) rail.

Step 10:

Add a 1MΩ resistor (BROWN BLACK BLACK YELLOW SPACE BROWN) between the upper blue (-) rail and pin 13 of the LM324. Add a 470kΩ resistor (VIOLET YELLOW BLACK ORANGE SPACE BROWN) vertically between pins 13 and 14 of the LM324. Connect four plug-to-plug jumper wires: One to the lower blue (-) rail, one to pin 3 of the NE555, one to pin 7 of the LM324, and one to pin 14 of the LM324.


Place an LED in the board, with its legs in two different rows, and add a 470Ω resistor (VIOLET YELLOW BLACK BLACK SPACE BROWN) from the short leg (cathode, -, or negative) to the nearest blue (-) rail. Connect a battery to the battery snap, and plug on the wire from pin 3 of the NE555. You should get light from the LED. If you don't, unplug the battery, and check your connections. Start with the LED to make sure it is the right way around with the jumper plugged into its long leg side, and the resistor from there to the blue (-) rail. It does not matter what side of the LED the resistor is on but it does matter which way electricity flows through the LED. Then, check the connections and component placement around the NE555.

If you do get light, unplug the jumper and try the one from pin 7 of the LM324. You should also see light from the LED. If you do not, check the connections on this side of the IC, and the ground connection to the upper blue (-) rail on the other side. Finally, check the jumper from pin 14. If it does not light, check the connections on that side one at a time.

Final testing is best done with an amplifier, like the one we made last month. This is also the way we intend the circuit to be used, and is the reason we included that last jumper wire in the lower blue (-) rail. Two different circuits must have the same ground if we are to be sure that current will flow in them properly. Connect the jumper from the lower blue (-) rail, the blue (-) negative rail being the ground rail, and plug it into the ground rail on the other circuit. Then, use the probes from the IC pins to test the inputs to different circuits as a signal source. Here, we are using the function generator to test the amplifier section of our bat detector circuit from one of this month's projects. Notice how the jumper from pin 14 of the LM324 is plugged into a mid-point of the circuit, because we're just testing this part.


We'll start with IC1, the NE555. This is set up as an astable multivibrator circuit, an NE555 mode that Kids' Basics regulars are very familiar with. This one operates at very close to 1kHz (1000 Hz), or one thousand cycles per second. Herz, abbreviated as Hz, is the name for the unit of frequency. It's the last name of one of the early pioneers of electronics. We chose this frequency because it is very useful for testing audio circuits and has a bunch of 'harmonics' in it, which are useful too.

Pin 8 is the supply voltage connection, and pin 1 is the ground. Pin 4 is the reset pin and is also connected to the supply voltage. A high allows the IC to reset, while a low would stop it. Pins 2 and six are connected together. When power is first applied, current flows through the 1kΩ resistor R1 and the 150kΩ resistor R2, to the capacitor C1, charging it. As it charges, the voltage across it rises. Both pins 2 and 6 measure the voltage across this capacitor. Pin 3, the output, is high or on while this happens.

Pin 6 is the threshold pin, and when the capacitor voltage reaches two thirds of the supply voltage, this pin activates a device inside the NE555 called a flip flop. This turns the pin 3 output off, or low, but it also controls a transistor inside the NE555, connected to pin 7, and turns that transistor on. This means pin 7, the discharge pin, is now connected inside the NE555 to ground. That discharges the capacitor, through R2 only. The current through the 1kΩ resistor also goes straight to ground. Because R2 at 150kΩ is so much bigger than R1 at 1kΩ, the charge and discharge times are nearly the same. This is referred to as the 'duty cycle' and it means the amount of off time versus on time as a percentage of the whole cycle. So, a 10% duty cycle means the wave is high for one tenth of the cycle, and low for the other nine tenths.

Pin 2 is the trigger pin, and when the voltage across the capacitor falls to one third of the supply voltage, the flip flop changes back. The output goes high, or on, and the discharge transistor turns off, allowing the capacitor to charge again. Therefore, the output of pin 3 is close to a square wave, and this is where our first jumper lead is plugged on for our square wave output. Pin 5, the control voltage pin is not used, and is connected by a 100nF capacitor to ground to keep it stable and quiet.

The square wave output is fed to a resistor-capacitor, or RC, network. The resistor R3 at 1.5kΩ slows the current flowing into the 100nF capacitor C3, which means the voltage across the capacitor rises more slowly than the square wave's voltage. This also affects the discharge of the capacitor because the NE555 sinks current (sends it to ground) when low, so C3 discharges through R3. Some ICs are just off, isolated and inactive, when low, and do not sink current. The wave here is not quite usable just yet, but this screenshot from our oscilloscope shows both the square wave and the wave on the other side of the first RC network.

The output of the RC network goes to the non-inverting (+) input of IC2a, the first of four independent operational amplifiers (op amps) inside IC2, the LM324, which share nothing but power connections. The inverting (-) input of IC2a is connected straight to the output. Op amps amplify the difference between their outputs. Because we have connected the output to the inverting input, the voltage at the output is whatever the voltage on the non-inverting input is. This is called a unity gain buffer, because unity means one and gain is the amount of amplification. A gain of one is neither above or below the input.

Why would we bother? It does two things. It isolates stages from one another, and also provides current. The inputs of op amps have a very high impedance. Impedance is like resistance but is made up of many more parts than just resistance itself. For this discussion, you can think of it as resistance. The higher the impedance, the less current that flows, which means very weak signals can be used. Many versions of this circuit just use three RC networks in series, with the wave being taken from each point as shown.

However, because resistors drop voltage for a given current, the waves at the three points of the RC network get smaller. This is called amplitude, the high of the wave, which in this case is the voltage. Therefore, the sine wave has a much lower voltage than the square wave that made it. You can see this by the overlay we made here. Our oscilloscopes, though we have two, are both two-channel. We had to make this out of two separate screenshots after moving the probes, but they are at the right scale and it is not a diagram we drew.

This is why we use buffers. The buffer's output is at the same voltage as the input, but the current is now flowing through only one resistor, not three. In the series RC network, current flows through all three resistors to ground, changing the voltage at each point. The buffer means that more current is available for the second stage, and the stages do not interact with each other. There are still small losses, however, as we'll discover shortly.

The second RC network is exactly the same as the first, with R4 being 1.5kΩ and C4 being 100nF. This further shapes the waveform, which is then buffered by IC2b. The output of IC2b is now a triangle wave and is where we connect the second jumper. This is before one final RC network made up of 1.5kΩ resistor R5 and 100nF capacitor C5. This is fed to the buffer made from IC2c. However, there has been a slight problem. The bottom of the wave has been getting further and further from ground, which we call DC bias. Yes, it's an AC wave but it never crosses 0V and so this is called the DC bias.

That's a problem in some cases so we need to deal with it. We do that by taking the output of IC2c to the positive side of a 2.2µF capacitor, C6. Capacitors only pass current when they are charging or discharging. That means the charge on one side is the opposite of the charge on the other, but the actual voltages don't matter. Therefore, the capacitor passes the AC signal but removes the DC bias, because we measure the other side against ground again.

There have also been small losses along the way to this point, so to make the wave out of the capacitor slightly larger to restore its amplitude, we connect it to an amplifier rather than a buffer, built out of IC2d. The non-inverting input (+) is biased by resistors R6 at 620kΩ and R7 at 300kΩ. This voltage divider sets a false ground, a voltage which the incoming wave is either above or below. We chose these values experimentally to make the output wave close to ground at its lowest point.

The inverting input sets the gain. We want a gain not far above 1. The gain of a non-inverting amplifier is set by the relationship between the feedback resistor, which in our case is R9, and the input resistor, which in our case is R8 connected to ground. Gain = 1 + (R9 ÷ R8), which becomes 1 + (470 000 ÷ 1 000 000), which simplifies to 1 + (0.47). Our gain is therefore 1.47. The output of the last amplifier is where we connect our jumper for our sine wave.

There is something else to know about RC networks, too. For the purpose of shaping square waves into sine waves, we need specific values. We cannot use just any capacitor or resistor. What we actually need is to know the time constant of the RC network. Capacitors take time to charge. If current is allowed to flow into a capacitor freely, the capacitor charges at a known rate called the time constant.

It does not just charge straight up, but charges more slowly as it gets closer to full. The graph is included to show you. Starting from 0V, one time constant is the time it takes to charge the capacitor to 63.2% full. However, over that same time again, the capacitor only charges to 86.5%, then 95% after three, and 98.2% after four time constants. After five time constants, the capacitor is 99.3% charged and is considered fully charged in general terms.

If we add a resistor to limit the current, we change the rate the current flows into the capacitor and therefore change its time constant. Also, there is a maximum frequency a capacitor is useful at, because it may not charge far enough at higher frequencies. The time constant is made up of the value of the capacitor, and the resistance. If there is no resistor, there is always at least some internal resistance in the capacitor. The time constant, T, is the resistance in Ohms multiplied by the capacitance in Farads; it is written as T = RC. Remember, we use micro, nano, and pico Farads so you'll have to work on powers (x10-9, for example) or convert first into a big decimal. If you're not already familiar with this, we covered this in detail in Kids' Basics, Issue 43.

Thankfully, you don't have to worry about figuring out the time constant and then doing more maths to see if it suits your frequency. You'll still need to convert capacitor values into Farads, but there is one formula which will tell you exactly what frequency your capacitor and resistor combination will work at to shape the wave the way we want. The italic ƒ represents frequency in our formula. The other odd character is the Greek letter pi, also in its mathematical font and not classical Greek. It is a function on your calculator, and an entire maths subject on its own. If you don't already know a little about it, don't worry too much.

The great thing is, you don't need to worry. At the end of the article, we have a 'Reading and Resources' section, with a link to a website that we found where you can enter capacitor and resistor values, and find the frequency they will work at. Try it by adding in the 100nF and 1.5kΩ we used, then see if you can find other values to work at 1kHz.


The first thing you might like to do is make more usable probes than the jumper leads we used. However, that's only if you want to poke and prod. Try using commercial probe ends like Jaycar's PP0425. If you want to plug into a breadboard at the other end, jumpers are perfect. The main improvement here is soldering. To make this a long-term, reliable piece of test equipment, it needs to be more permanent and more rugged. Solderless breadboards are neither. You can get solder versions of these breadboards which are hole-for-hole copies. However, you will need soldering skills or the help of an adult who can solder. This image shows one such board that we drew on with marker to show where the rails and rows are. This is the kind of thing you'll need to make this circuit permanent.