Build a Square Wave Oscillator - Part 1 of DIY Modular Synths

260,803

358

214

Introduction: Build a Square Wave Oscillator - Part 1 of DIY Modular Synths

Synthesizers have become an incredibly prominent instrument in modern music; it's difficult to hear a track without one anymore! Unfortunately, many synthesizers are incredibly expensive and hard to acquire, making it rather difficult for the hobbyist or budget musician to get any of those sounds. This instructable won't teach you how to build one of those feature-rich, user friendly synths, but it will start you off with a very simple device that can be used with other units to create interesting and unique sounds.

The following is the simplest and most fundamental piece of a synthesizer - an oscillator. This particular oscillator is a "Square Wave" oscillator, and has limited functions, but can still be used every now and then for fun sounds.

This model is powered either by a 9v battery or an external 9v power supply, has one 1/4" output jack, and has two controls: volume and frequency.

Let's get started!

Step 1: Gather Your Parts

The square wave oscillator is a rather simple device, so not much is needed to construct it.

I've attached a saved shopping cart for Newark.com for all of the components you'll need. The total cost of this shopping cart is $36.54 before shipping, so it's a pretty cheap build!

Here's a (linked!) list of everything you'll need:

You will also need a few tools:

  • Drill Press
  • Drill Bits of Varying Sizes
  • Drill Bit Index
  • Sharpie
  • Breadboard
  • Safety Goggles
  • Soldering Iron
  • Solder

Step 2: Plan Your Layout

Now that you've got all the parts, you'll need to do a bit of planning to properly arrange all of the pieces inside the enclosure. Because the output 1/4" and 9v power jack (or battery) take up space within the enclosure, it is a good idea to both visualize and physically place the pieces within the box such that nothing is overlapping with anything else, and that it will all fit nicely inside the closed project enclosure.

For this model of the oscillator, I placed the two jacks at the top, and the two potentiometers opposite from the jacks, as shown in the photo below.

With a sharpie, mark with either a dot or small "x" where you want the potentiometers and jacks to sit in the final product. These will be your guide when drilling holes in the enclosure.

If you decide to arrange the jacks in a different manner than what I have here, be sure to take time with this step, otherwise you may end up having to drill more holes than you want in your final product.

Step 3: Drill Project Enclosure Holes

Next, we take the now marked enclosure to a shop that has a drill press. Before actually making any permanent punches, you need to determine what size these holes need to be. In order to do this, we'll use the drill bit index.

To ascertain the correct sizing, take the piece that you're drilling the hole for, and strip it of all nuts and washers, so the thread is on the outside. Take the piece and find the hole on the drill bit index that it fits into snugly. Make sure it's a snug (but not forced) fit. Once you figure out what size of drill bit to use, write down the size and its corresponding component. Repeat this process for all of the components that will be mounted in the enclosure, which includes the 1/4" audio and 9v jacks, the LED, and the two potentiometers.

Find all of the different size drill bits you'll need and head over to the drill press. Order of drilling doesn't really matter, so start with whichever hole you'd like.

Begin by securely clamping down the enclosure in the drill press's vice, as shown below. Next, place the desired size of drill bit in the "chuck" (the drill bit holder), and tighten it down with the chuck wrench as shown. While powered off, lower the drill bit and adjust the location of the enclosure so the bit will drill through your marks. After this, put your safety glasses on, turn the drill press on, lower, and drill! Repeat for all marks until you have a hole for the two potentiometers, both jacks, and the LED.

After you have an enclosure with all holes drilled, like shown below, test all of the sizes by placing all of the pieces in their respective spots.

Step 4: Lay Out and Solder Circuit

This next step requires the most skill out of the others, namely the ability to read a schematic and the ability to solder. Both have an incredible amount of resources both on and offline, so even if you aren't the most technically minded, you should be able to learn both incredibly quick. One that I would suggest is Sparkfun's "How to Read a Schematic."

Above is the schematic used for the square wave oscillator. If you're unfamiliar with schematics, it may look daunting, but take some time reading up on schematics and you'll be able to put together this circuit rather easily.

Note that I have also included a pdf version of the schematic, in case the first one is hard to read in your browser.

If you've never soldered before, I would suggest testing out your skills on a couple of extra wires and components before you try your hand on your actual circuit.

Also, I would suggest getting a "Breadboard," which is a tool that allows you to lay out a circuit and test it before making anything permanent. The second image above is an example layout of the breadboard that will work. Because breadboards are designed to be easily changed and are for prototyping purposes only, your breadboard will probably not look exactly like the one shown here.

If you're new to breadboarding, Sparkfun.com has a really great tutorial to check out.

After you've assembled your circuit, you need to transfer it to the "Perf" Board to be permanently soldered on. Take your time with this step and make sure that all of the connections are correct and that no excess wires are touching.

When you're ready, solder all of the points, and then cut all of the excess wire off. Shown above is the Perf Board, both soldered and unsoldered.

Step 5: Put Everything Together

Almost there! You have your circuit and your enclosure ready to go, now it's time to put it all together. After soldering the excess components (the jacks, LED, and potentiometers), place all of them in their respective drilled holes and secure them with their washers and nuts. Gently place the perfboard in the enclosure and press to make sure that it will all fit.

To prevent short circuiting, you will need to tape up the lid with some sort of non-conducting material. I chose duct tape.

After everything's secured, place the lid on the back of the open enclosure and secure it with the provided screws. Shown below is what it should look like after this. I had a few extra knobs laying around, so I put those on the potentiometer posts.

Congratulations, you now have a square wave oscillator!

Step 6: Decorate As Desired

Have fun with this step! Get some paint, sharpies, anything you can get your hands on and make your oscillator look fun and exciting!

For mine, I just drew a simple little design with black sharpie.

Step 7: Make Weird Noises

This oscillator works with any standard 9Volt wall adapter, commonly used for guitar pedals, shown in the pictures below. Simply plug it in to the 9V jack, take a standard 1/4" cable, plug it in to some speakers, and you're ready to make weird noises!

You've now opened a can of worms as far as electronic projects go, as there are countless other synthesizer modules that can be built: filters, envelopes, more complex oscillator structures; the list goes on and on.

For some idea of what kind of sounds you can get out of this box, here's a video showing the unit in action:

8 People Made This Project!

Recommendations

  • Game Design: Student Design Challenge

    Game Design: Student Design Challenge
  • Make It Bridge

    Make It Bridge
  • For the Home Contest

    For the Home Contest

214 Comments

0
dnhushak
dnhushak

7 years ago on Introduction

Hello everyone! I never anticipated this would become such a popular instructable! Because of its popularity, I'm going to be making some updates addressing the most common questions I've been asked.

First, I have uploaded a much nicer looking schematic, with more detailed notes on it. There is one embedded in the instructable as well as a pdf download for easier/more convenient reading.

Other planned updates:

-A fritzing diagram for the breadboard layout

-An eagle file so you can order a PCB custom made for this project!

-Information on how to get different frequency ranges

-A troubleshooting guide for some of the most common problems people have

If any of you have any suggestions for things you would like to see added/improved, please let me know!

0
dnhushak
dnhushak

Reply 7 years ago on Introduction

Update #2!

I have just designed an eagle pcb for this, I've ordered a set and will confirm that it does what it's supposed to do, and then I'll post the eagle file, so everyone can have a nicely laid out PCB!

0
abstruseharmonic
abstruseharmonic

Question 4 years ago

Does it work with a 9v battery?
Because I'm using a 9v battery, and the led is glowing but there is no sound.

0
chrisk358
chrisk358

Answer 4 months ago

i can confirm that it does work with 9v battery, it’s just pretty quiet, you need an amplifier….

0
ceponatia
ceponatia

2 years ago

Looking forward to trying this. Unfortunately some of the parts on your shopping list are no longer carried so I'll have to do a little research.

0
dnhushak
dnhushak

Reply 2 years ago

They're pretty standard components, so between Newark, Adafruit, Sparkfun, Mouser, etc. you should be able to get everything you need. Feel free to comment if you can't find the pieces!

0
RemoneT
RemoneT

Question 4 years ago on Step 4

Whats the Range for the frequency of this?

0
dnhushak
dnhushak

Answer 4 years ago

The schematic is based mostly around the "Square Wave Oscillator" portion of this website, which has a handy calculator for you:

http://hyperphysics.phy-astr.gsu.edu/hbase/Electro...

One of the resistors is replaced with a variable resistor, allowing the frequency to change. If I recall correctly the base frequency of this design swings between about 200 Hz and 1kHz.

0
Syfers
Syfers

Question 4 years ago on Introduction

Hello,
I did your project and it's work well, just an issue about the sound level. Do you plug your output to a pre-amp to have a resonable audio level ?
And thank you for this project, it's my first electronic project !
Thanks in advance.

0
dnhushak
dnhushak

Reply 4 years ago

If I recall correctly, it's supposed to come out at "line" level, or close to it, which will require some sort of amplifier to either drive headphones or a set of speakers.

(short answer is "yes"!)

Glad it worked for you, I'm amazed that this project still gets hits =)

0
Syfers
Syfers

Reply 4 years ago

So between the oscillator and the moog you have a pre-amp ? That's it ? Sorry for the none understanding..

0
dnhushak
dnhushak

Reply 4 years ago

The moog input is an odd use of it, but it does have a bit of a preamp with some gain on it, but the moog output still needs to go to some kind of preamp to drive speakers or headphones.

If you're plugging in powered speakers into this, you should be able to get decent volume out of it. Hope that helps!

0
Jim Wylde
Jim Wylde

Question 4 years ago on Introduction

This will be my first project. If succesful, would there be a way to duplicate the build to have two osc in the same box using one power source and one output?

0
dnhushak
dnhushak

Answer 4 years ago

There would be! Essentially you'd be using the same "power" section of the circuit for both, and adding a second "Oscillator" section. I don't have a schematic for something like this, but look into a summing amplifier circuit: https://www.electronics-tutorials.ws/opamp/opamp_...

With that, you take the "Oscillator Output" from both oscillator sections into two inputs of a summing amplifier, and have one output.

Hope that helps!

0
dnhushak
dnhushak

Question 4 years ago

Hmmmm... Unfortunately it's really hard to diagnose problems from pictures of breadboards. The top problems are usually making sure that the op amp is the same, and that the pinout for the op amp is correct. You can also bypass the "output volume" stage and go straight to your speaker (what would be the "tip" output can go to the "oscillator output" wire).

The different potentiometers probably shouldn't affect much, it'll change the frequency range, and should be a similar volume curve.

Another one is make sure all of the ground connections are all connected together, across all of the circuits.

Last thing is is the speaker powered by an external power source or battery? The circuitry won't drive a normal speaker, as it doesn't have an amplifier on its output stage.

Hope some of those suggestions help!

0
2881070
2881070

Question 4 years ago

Hi, I am currently having a hard time, and can't get any sound. I am on a breadboard to test out the circuits and am hooked up to a portal speaker. As for the parts mentioned in the instructable I am using the exact list, with the exception of using a 250kohm rotary potentiometer ((PDA241-HRT02-254A2-Rotary Potentiometer, Carbon, 250kohm, 250 mW, ± 15%, PDA241 Series, 1 Turns, Log (Audio)), instead of a 500kohm rotary potentiometer. I hope you can help me come up with a solution for my current problem. I have also uploaded some pictures of what I am using and what I have so far.

IMG_20180427_115551.jpgIMG_20180427_115819.jpgIMG_20180427_115849.jpg
0
DanielC852
DanielC852

4 years ago on Step 2

What if I had a triangle oscillator circuit, can I connect the 2 or more circuits together via an “and” “or” gate so they can work together or seperate? So we can change the sounds Attack, decay, sustain, release ect... I know I’m missing specific details but I’m new and I’m sure the pic will explain what I want to do : )

D0EFEB6D-A462-4609-86DF-69C7D162AF10.png
1
dnhushak
dnhushak

Reply 4 years ago

Hi there! Thanks for the comment. It seems as if you have two separate questions which I'll answer as best I can here:

1 - can you also have a triangle wave generator?

In short, yes, but not through an AND or OR gate - those are digital gates, and their output is either OFF or ON, so no analog signal (being the sine wave or triangle wave in this case) would pass through them. What you would need is a summing amplifier between the "oscillator section" and the "volume and output section" in the schematics above. Here's a good tutorial on a summing amplifier: https://www.electronics-tutorials.ws/opamp/opamp_... In that example, your sine wave output could be V1, your triangle could be V2, and if you wanted to add additional oscillators, you could chain on v3, or add a fourth, fifth, etc.

2 - As far as adding an ADSR envelope generator, that is going to be an incredibly complicated task well beyond the skill level of this instructable. The gist is that you'd need to have your oscillator output go through a "multiplier circuit" - in practice a VCA circuit. You'd also need a lot of complicated circuitry to generate the ADSR envelope, as well as an additional gate input to "trigger" the ADSR.

In short, I'd say skip the ADSR for now - but this is a design of modular synthesis, so you can build the oscillator as is in my instructable and add in an ADSR envelope generator later on without needing to modify the original circuit!

Hope that helps!

0
MarkB651
MarkB651

5 years ago

hi, I'm just starting as an electronic engineering student as was wondering what effect different values of resistors and capacitors would have? Also do you need to be a premium member to download the eagle file?

0
dnhushak
dnhushak

Reply 5 years ago

Hi there! Unfortunately, I haven't gotten around to uploading the eagle file, so sorry about that! If you're starting as a student I would still recommend getting the experience of breadboarding and perfboarding before you order a custom PCB. Trust me, it'll make you appreciate the PCBs a lot more ;).

As far as changing the resistor and capacitor values, the short answer is "a lot of different things would happen," as the different caps and resistors have various purposes:

R2 and R4 "divide" the 9v battery signal into ±4.5v rails for the op amp, and as such their value isn't *super* important, as long as they are both the same. Lower values will drain your battery faster though.

R1 serves as a current limiter through the diode, so again lower values will drain your battery faster. higher values will most probably dim your LED, but feel free to play around with those. The highest value of resistor with an acceptable LED brightness is your ideal.

All of the resistors and capacitors in the "oscillator" section of circuitry are what actually define the frequency of the oscillator. Without getting into too much depth here, the easiest way to see how they affect things is playing around with the calculator on this website:

http://hyperphysics.phy-astr.gsu.edu/hbase/Electro...

R9 works with the volume potentiometer to "divide" the signal as a voltage divider. Messing around with these will just change the output volume.

C2 and R11 just form an RF filter circuit, so you don't inadvertently create an antenna and radio tuner circuit from your mess of wires and have it end up in your audio signal down the chain. Changing those won't have any audible difference for you.

Hope that helps, happy tinkering!