Introduction: Reprogrammable Arduino Synthesizer

This tutorial makes up part of the portfolio submission for a creative research project based around DIY instrument builders and online DIY communities that I undertook in the final year of my BA. The aim with this build was to provide a bridge between a number of open source software and hardware platforms. I designed it with musicians and artists in mind who may have some experience in DIY electronics and who wish to consolidate this knowledge by building an instrument with real functionality that can be easily expanded upon. For more information on this project please visit my website here.

This tutorial will show you how to build a simple synthesizer from start to finish using an Arduino nano, the MOZZI audio library for Arduino and a few common electrical components, the total cost of which should only be in the region of £15. I have provided two different programs that you can upload to the Arduino to get two different sound engines. I would love it if people started to experiment with the code and build their own synthesizer engines for the hardware or add additional features to the ones that I have created.

Step 1: Necessary Tools and Materials

To build this project you will need a few readily available components, these should all be easy to find online. I sourced my parts from ebay

Parts:

  • 3X 10K Linear Potentiometer
  • 1X Momentary SPST Switch (I find that larger switches have a nicer feel and are more playable than smaller ones)
  • 1X Mono 6.35mm Audio Jack Socket (It is worth investing in a Neutrik socket as this part can be put under a lot of mechanical stress.)
  • 1X Strip Board (These are cheap so it is best to buy a few in case you make a mistake when soldering)
  • 1X Arduino Nano (Generic clones can be found on Ebay and similar sites for much lower prices than real Arduino's, they are completely legal but if you can afford it the authentic ones are probably more reliable and it is ethical to support the foundation that created them.)
  • 2X 15 Male IC Pins (Only necessary if your Arduino has been supplied unsoldered without them.)
  • 2X 15 Female IC Pins (These are usually supplied with the Arduino but it is definitely a good idea to have a few spare sets in case of mistakes.)
  • A Reel of 22 Gauge Solid Hookup Wire. (This is very cheap so just buy a few meters and it can then be used in other projects as well.)
  • A reel of solder
  • A Suitable Enclosure (I used a tupperware container that I purchased as a pack of three in Poundland with dimensions of approximately 10cm by 7cm. You can use anything with enough space for this but bear in mind the material/thickness. I chose this tupperware container because I don't have access to a drill and it is thin enough to be cut into with a craft knife to make holes for the components.)

Tools:

  • Soldering Iron
  • Wire Cutters
  • Wire Strippers (Not 100% necessary are you can strip wires without them, but they do make life a lot easier)
  • A sharp craft knife
  • Duct tape
  • A Computer for programming your Arduino.

Step 2: Cutting the Strip Board to Size.

The first thing you want to do is cut the strip board to a suitable size for your enclosure. You can get an idea for the size that you want by placing your Arduino on the board before you cut it to see how much space you feel comfortable leaving around it. In theory this could be as small as 10 holes wide by 17 holes high. This would leave 2 rows beneath the Arduino for your power and ground rails along with one column either side of it to attach your components to the Arduino's pins. However this would prove extremely tricky to solder and leave absolutely no room for error or messy soldering. I would recommend keeping the strip board as large as you can whilst still fitting it in the enclosure. Mine ended up being a comfortable 17 holes wide by 20 holes high but depending on how handy with a soldering iron you are you could definitely get this substantially smaller. However this is the size I will be using in the tutorial and any references to coordinates will be specifically for a strip board of this size.

The best way to cut a strip board in my experience is to score along the edges with your craft knife a few times until there is a groove and then position it over the side of a ledge and snap it. Make sure you have orientated the board correctly before you cut it as you want the copper traces running horizontally. I have managed to ruin more than one board doing this so be extremely careful and have spares on hand for if you do.

Step 3: Cutting the Strip Board Traces

Strip boards are great because they have conductive traces running along them which you can use to link components without having to solder them directly to each other or link them with wire. This is a massive time saver but it does mean that we need to cut some of the traces to stop them short circuiting the pins of your Arduino.

This can be done by using a craft knife to carefully scratch away the copper to destroy the connection. I find it easier to take the blade out and use it without the handle so you can be more precise with your movements. We want to scratch away one of the rows down the middle of where the Arduino will be sitting to stop it linking the left side pins to the right side pins. If you cut your board to the same size as mine that means you will scratch away the copper down the 9th column as you can see in my image.

Step 4: Solder the Female IC Socket to the Strip Board

The two sets of pins need to be spaced 5 columns apart starting at the top of the strip board. If you are using the same size board as me, you should leave 5 columns on either side. You can see this on the circuit layout I have provided.

Please bare in mind that components go on the side of the board without the copper traces that isn't visible in my diagrams. All of my circuit diagrams are from the side of the board with the copper traces. I have put all the components on the board to help you to see where they go. I have kept them transparent to signify that they will not actually be visible from this side of the board.

Insert one set of pins at a time and carefully solder each pin to secure it to the strip board. The best way to make sure that the IC socket stays straight is to solder the top and bottom pins first to hold the socket in place and then gently correct it by bending should it be off centre. Finish by soldering the rest of the pins.

Once both sockets are attached try gently inserting the Arduino to make sure everything fits. Once you know everything is secure make sure to remove the Arduino again before soldering anything else to the board as the heat from the soldering iron can damage to components on the board.

Step 5: Create Your Power and Ground Rails on the Circuit Board

You need to create a power rail for the potentiometers and a ground rail for the rest of the components. This is accomplished by using two small pieces of wire to connect the pins labelled 'GND' and '+5V' to their own trace on the strip board below the Arduino. Its good practice to leave a couple of rows between these rails as if they some how short circuit, they will completely fry your Arduino (trust me I have made this mistake myself). If you are using the same dimensions as me on your strip board then please consult the image above to see where these wires run from. The second image shows what the underside of your board should look like.

Step 6: Prepare the Potentiometers.

This is an additional step that I have started using for my builds, it may not be 100% necessary for you depending on your soldering skills and the type of potentiometers you are using.

Whilst prototyping this build I kept running into a strange problem where everything would work perfectly when laid out on a breadboard but as soon as I started soldering, the potentiometers would stop working and start returning random values. After a lot of trial and error I found that the problem was caused by the potentiometers becoming too hot when I was soldering the wire to their terminals. This was leaving them looking fine on the outside but completely fried inside. Now as a precaution I add a small bit of strip board to each one so I am not soldering directly to the pot itself. Since doing this I haven't had any problems.

To do this you need to cut a small piece of strip board to 5 holes wide by 4 holes high, with the copper traces running vertically. This must then be soldered to the potentiometer as pictures.

To this piece of strip board you will then need to solder 3 pieces of wire (one for each terminal on the pot). It's best to be quite generous with the length of wire as you can always cut it shorter before soldering it to the main strip board. You need to do this for all three pots. Make sure that you match the trace that you are soldering the wire to with one that is attached to a terminal on the potentiometer.

If you choose to skip this step just carefully solder the wire to the potentiometers terminals applying as little heat as is necessary to get a solid connection.

Step 7: Prepare the Switch and the Jack.

Solder one wire to each of the terminals on the switch and do the same for the Jack (the Jack connectors I used have two duplicate sets of terminals, so you only need to solder two of these. If your switch mounts to the enclosure in the same way as mine you will need to insert it before soldering.

Step 8: Attach Your Potentiometers to the Arduino Board

With the potentiometer shaft facing upwards and the terminals facing towards you, label the terminals 1, 2, and 3 from left to right. Terminal 1 is the ground and so must be connected to the ground rail we created on our strip board. Terminal 2 is the potentiometers output, this needs to be connected to the analog input A0 on the Arduino which on my build is the 4th trace from the top on the left hand side of the IC pins. Terminal 3 needs to be connected to a power source and so must be soldered to the power rail we created. Terminals 1 and 3 on the other two potentiometers need to be soldered in the same way as the first. Terminal 2 on the second pot should be soldered to analog pin A1 (5th row down on my board) and on the third pot it should be soldered to analog pin A2 (6th row down on my board). See the diagram for a visual representation of this which should clear things up if you are confused.

Step 9: Solder the Jack Connector to the Circuit Board

The tip of the Jack connector needs to be attached to digital pin D9 and the sleeve to the ground rail. Again I have included a diagram to make this clear. On my jack connector the tip is the terminal furthest from the hole where the jack enters the connector.

Step 10: Solder the Switch the The Circuit Board

One terminal on the switch needs to be soldered to the ground rail and the other to digital pin D8. Please see diagram. It's hard to tell which terminal is which on the switch, it doesn't matter too much though because in order to reverse the function of the switch you only need to change one line of code.

Step 11: Prepare the Enclosure

The soft plastic of the tupperware I used for my enclosure made it easy to cut into with a craft knife. Without a drill I resorted to cutting small squares out of the plastic and the wedging the components in and securing them with the nuts they were supplied with. If you don't cut the square too large this is actually surprisingly secure and doesn't look much different to a drilled enclosure. The least secure part of the whole thing is the USB cable poking out of the back of the enclosure as this can be easily detached from the Arduino. To deal with this I secured it to the back of the enclosure with duct tape which so far has stood up to being tossed around in the bottom of my rucksack for a few weeks. The nice this about using tupperware for the enclosure is that the lid can be unfastened giving easy access to all the components should something fail or should you want to make modifications to the circuit.

Step 12: Attach the Arduino

Slip the Arduino into the IC pins so that the USB port is at the top of the board.

Step 13: Attach the Components

Poke your components through the squares that you cut into the enclosure and then secure them with the nut provided. For the potentiometers, make sure the one on the left is connected to A0, the one right A1 and the one at the bottom A2. Finally connect the USB cable supplied with your Arduino through the whole in the back that you have cut. This then needs to be secured with duct tape. Be generous with the tape as you don't want this to come unplugged.

Step 14: Install the Arduino IDE and the MOZZI Library

Download the Arduino IDE from this page and install it. Then visit this page and follow the instructions to install the MOZZI audio library.

Step 15: Upload Your Code to the Arduino

Now that your synthesizer is fully assembled you will want to use the Arduino IDE and the code that I have provided to get it to make some sounds. Open up the file included below in the Arduino IDE, connect your synthesizer to your computer using the usb cable and click the upload button. If all goes to plan the lights on your Arduino should flash and then as soon as the upload is complete it should begin making sound.

Step 16: Making Adjustments to the Code

The first thing you want to check is whether or not the switch is working correctly. Without holding the switch down, turn the bottom knob. If you hear the filter sweep smoothly from low to high then your switch is working fine, if you hear the filter sweep multiple times then the polarity of your switch is reversed and you need to make a small adjustment for this in the code. Find the line near the top that reads 'if(digitalRead(8) == LOW) {' and change it to 'if(digitalRead(8) == HIGH) {'. If you have done this and completed all the other steps correctly you should now have a fully functioning synthesizer!

Step 17: Using the Program Provided.

The program I have provided turns your synthesizer into a 2 oscillator drone machine. Pot 1 controls global pitch, Pot 2 adds a series of overtones and Pot 3 controls the cutoff frequency of a resonant low pass filter. Holding down the button sends the synthesizer into 'chaos mode' which extends the range of the pitch and overtone controls and also allows you to sweep the filter multiple times in a single rotation of Pot 3. Despite the simple control scheme, this synthesizer is actually quite musical, especially when paired with an FX unit. The code can also be easily modified and please let me know if you manage to coax some interesting sounds out of this unit.

Here is a link to a sound demo:

Step 18: Alternative Synthesizer Engine.

Here is another synthesizer engine for you to try that I adapted from the MOZZI Wavepacket synthesis example. It works really nicely with the hardware we've built and in my version I have added a reverb to thicken out the sound and programmed it so that you can create feedback swells by holding down the button. Be careful because this can get noisy.

Have a listen to some basic sounds from this synthesizer engine here.

Step 19: Powering Your Synthesizer

I purposefully decided to use a USB cable to power this unit to keep the build simple as a USB cable is needed anyway to program the unit. The supplied cables aren't very long but USB extender cables are cheap as are USB to mains adapters. This is one option for those who wish to power their unit from a mains socket. Another alternative that I have been using is a portable power bank designed to charge smart phones. Small ones can still give you a couple of hours of play back and cheap power banks can easily be found online. Adding a built in rechargeable battery would be more convenient but would significantly increase the cost and difficulty of this project and so I have decided to go with the solution above.

Comments

author
Swansong (author)2017-04-21

Looks good :)