This page is about my DIY Mozi based FM synth using an Arduino. Alhtough I write about how I built it I'll get a bit deeper in what each building block is doing and why that works. There are tons of tutorials about how to get started with Arduino and electronics, this is not one of them.

I think this synth is great for beginners. With that said though I'm not discussing the basics understanding of Arduino and electronics. To build the synth you'll need some basic DIY electronics tools like a soldering station, wires, stripboards, breadboards etc. so I just assume you have them.

I knew that I wanted to use this synth as part of a bigger modular system so I decided to build the Arduino board for it to save space and make sure it'll fit in my future Eurorack case. This page explains how to build an Arduino board but the synth will obviously work just as well with a stock Arduino Uno. If you want to use a regular Arduino Uno and don't want to mess with building your own, then jump right ahead to the "Using a stock Arduino Uno" section.

Project summary

What's this?

It's an Arduino ynth using the Mozzi library

How does it sound?


DIY Arduino board with +5V power supply, single carrier, single modulator signal with waveform selection, modulation speed and intensity knobs and a noise source. Notes control: either by MIDI input or knob+button (continuous frequency).



Bill of materials



ZFM Github repository


There's no point in denying that I fell into the deep rabbit hole of building electronic instruments. It started with a simple DIY active speaker then a couple of MIDI controllers. I promised myself that I'm not going to start building modular synths because once one steps on that road, there's no way back. Of course a couple of weeks later I had a complete plan of the modules I'll build in the next year or so.

In the meantime I read Arduino for Musicians which had a simple example of a Mozzi synth, so I decided that before diving in analog gear, I'll build an Arduino based FM synth using the Mozzi library.

What is an FM synth?

An FM synth is an instrument that generates sound based on FM synthesis. It's a fucking cool thing to make dirty bass sounds, annoying bleeps and noises. Great for tech house.

Frequency modulation synthesis (or FM synthesis) is a form of sound synthesis whereby the frequency of a waveform is changed by modulating its frequency with a modulator. The frequency of an oscillator is altered "in accordance with the amplitude of a modulating signal". (Wikipedia)

If this doesn't make much sense then just watch this amazing explanation by Andrew Huang.

What is Mozzi?

Mozzi is an Arduino library that turns the Arduino into a synthesizer. It deals with all the hassle from reading knobs, MIDI input to generating the sound and sending it to one of the output pins. If you're completely new to Mozzi I highly recommend to go through their introductionary tutorial to get a feel of it. (Mozzi site)


With its 16Mhz clock speed, the Arduino Uno is not a powerhouse so a complex featureset would compromise its performance. That's why I went with a simple design that still has a wide variety of sounds: a single carrier and a single phase modulator signal with 4 basic selectable waveshapes (sin, triangle, saw and square) plus an additional noise control. With modulation speed and intensity controls it became a pretty versatile little thing.

To control the notes, originally I wanted a MIDI input only. During prototyping though I used a temporary button to enable the output and pot to control the frequency. I immediately fell in love with the sound of quick continuous frequency changes, so at the end I added MIDI input and kept the frequency knob + button (which I called "Intergalactic").

Circuit building blocks

For this project I built an Arduino board instead of using a standard Arduino Uno. The main reason was because I wanted to learn how to build one and that I'm planning to build this synth to my future Eurorack and I needed to save as much space as possible.

Of course everything will work fine with any stock Arduino Uno too. If you plan to use a stock Arduino then you can skip building the "power supply" and the "DIY Arduino board" sections.

The building blocks are:

  1. The power supply converts any voltage between cca. 9-12V to a steady 5V. This is needed for the Arduino board to operate properly. If you use a stock Arduino Uno, you don't need this.
  2. The Arduino board is the heart of the system which continuously reads the knobs, listens to MIDI messages and outputs sound based on all these incoming parameters.
  3. There's a MIDI in circuit that converts the output of a MIDI keyboard to MIDI messages that the Arduino will process.
  4. Finally, a small amplifier/filter circuit gets rid of some unwanted high frequencies, removes all DC voltage to avoid distortion and and makes sure that the output gets enough current to actually make some sound.

How will this make any sound?

The Arduino is constantly "listening" to MIDI messages on its RX pin through the MIDI input circuit. It also is constantly calculating, constructing and sending a waveform to its output. The pitch of the waveform is based on the incoming MIDI, the sound characterisic is based on the input knobs.

When a key is pressed on the MIDI keyboárd then a MIDI message with the given note is sent to the Arduino. The Arduino recalculates the waveform based on the MIDI note and the actual state of the knobs, and sends it to its output pin. The output signal finally goes into the amp/filter circuit that removes noise and some unwanted high frequencies and sets the output level. This is what goes into the speaker and what you'll hear in the end.

Since the Arduino Uno is only capable to output digital signal (i.e. 0 or 5V, nothing between) we need some way to (1) represent waveforms digitally and (2) convert that into an analog signal which will sound more or less musical.

Mozzi is using wavetables to store waveforms. Wavetables are basically arrays of numbers. Each number represents the amplitude of the sound at a certain time through the cycle of a waveform.

This digital representation of the final wave is converted to audible waves using PWM (pulse-width modulation).

Circuit details

You can download the schematic of the synth from here.

Power supply

(Only needed if you build your Arduino board.)

Every stock Arduino Uno has a built in regulator circuit which converts the input voltage to 5V. This lets you use various voltage sources like a 7.5-15V adapter or a 9V battery to power it. If you build your own Arduino though you'll need to build this regulator circuit first. Here's the schematic for it:

What each component does?

The centerpiece of this circuit is the LM7805 voltage regulator (U1): this converts the input voltage to 5V. We could simply connect the output of our 9V battery or adapter to the input of the LM7805 and we would measure 5V on the output but our circuit would not be safe from high currents and the signal would be pretty noisy and unstable.

That's why we need a couple of condensers: one on the input side (C1) and another on the output side (C2). They make sure that the circuit gets enough juice even if the voltage temporarily drops on the input or the output of the regulator. The one on the input side also deals with random input transients that might happen e.g. when you plug in the adapter.

There's a diode D1 and a resettable fuse F1 connected in series with the input of the regulator. The diode is used here simply to make dead sure that there's no current flowing to the adapter. And the fuse is there to protect the circuit from very high currents if e.g. the adapter gets faulty – in that case the fuse gets hot and starts to act like a very high value resistor which limits and eventually blocks the incoming current.

Lastly I added a LED LED1 (and a resistor R1 to protect it from burning out) that indicates if the synth is turned on.

Power supply resources
How to build a power supply circuit

DIY Arduino board

(Only needed if you build your Arduino board.)

The heart of the arduino board is an ATMEGA328 microcontroller and acutally you need just a couple of extra parts to make it work.

The first thing to do is to connect all grounds and VCC (+5V) pins: pin #8 GND goes to ground and pin #7 VCC to +5V. There're a couple of ones on the right side too: pin #22 GND goes to ground while AREF and AVCC connect to +5V. (AREF is the reference voltage that makes sure that 5V is getting on the output pins of the IC when needed).

What each component does?

To make the board work, you need a 16MHz crystal X1. It's a piece of quartz crystal cut precisely to a size so that it resonates on a certain frequency (16MHz in our case). These are the same kinda crystals that are used in quartz watches so they are pretty accurate. The crystal should be connected between pin #9 and #10 of the ATMEGA328. To make sure that it actually starts to resonate you'd need two condensers C3 and C4 on each leg of the crystal. They should be connected to ground.

Pin #1 on the ATMEGA328 is the reset pin. It's active low which means that the microcontroller will reset if this pin is connected to ground. So in order to avoid our IC constantly resetting it should be connected to HIGH (i.e. 5V). That's what's happening through a 10K resistor R2. There's also a reset button RESET connected between pin #1 and ground so that it's possible to reset the circuit manually if needed.

(We'll use pin #2 to continously listen to MIDI but you don't need to deal with that just yet.)

Onto the right side of the ATMEGA328: except for the pins we connected already to ground or 5V (pins #20, #21 and #22), all the pins here are programmable input or output pins. Pin #23-#28 are 6 analog inputs which we'll use to read potentiometers (yeah, there's only 6) POT1 to POT6.

How to connect the pots

All the other pins are digital. I used pin #18 to read when the "Intergalactic" button is pressed (this is the button that enables the continuous frequency on the output).

Next I connected a LED LED2 through a protective resistor R3 to pin #19 – this is the standard LED on a stock Arduino board that e.g. shows if a program is being uploaded to it. I also use this led to blink when there's an incoming MIDI message. It's okay to not connect this LED and resistor, the synth will still work.

And finally, pin #15 is where Mozzi sends the output signal so that'll be going to our little amp/filter circuit.

DIY Arduino board resources
Arduino on a proto board
Arduino on a breadboard

Using a stock Arduino Uno

If you don't want to build the Arduino board, you can use a stock Arduino Uno isntead. This is much simpler, a bit more expensive and takes up more space. Here's how you should connect in up an Arduino Uno for the synth. (Note that you will still need to build the MIDI in and amp/filter circuits.)

Even though an Arduino Uno uses an ATMEGA328 microcontroller the pin numbering of the two are different: for example, the digital pin #13 on the Arduino Uno is connected to pin #19 on the ATMEGA328. Here's the pin mapping between an ATMEGA328 IC and an Arduino Uno:

MIDI in circuit

This is a standard MIDI input circuit that is used in any MIDI device. It utilises a 6N138 optocoupler which will produce fairly stable output MIDI messages for the Arduino. The MIDI input circuit's output is connected to the RX pin of the Arduino board. However, when uploading any program to the Arduino this pin should not be connected. That's the reason for the switch SW1 – it enables cutting the connection between the MIDI in circuit and the Arduino while uploading a program.

To learn more about the MIDI protocol, circuits and messaging check out this great MIDI walkthrough by Sparkfun.

MIDI circuit resources
MIDI overview
Build MIDI input circuit on Arduino

Amplifier/filter circuit

The audio output from the Arduino first goes into a passive low pass filter built from a resistor R7 and a capacitor C5. I used one of the opamps of an LM358 IC as a buffer (here's an amazing explanation opamps as buffers). The other opamp (B) is unused. Finally there's an AC coupling capacitor C6 on the output that removes all potential DC signal from the output. This makes sure our wave is oscillating around 0V.

Amp resources
All you need to know about op amps

The built circuit

I built the circuit on a stripboard which lets me use VCC and ground strips very easily (I usually mark those strips with red and black markers). The whole circuit fits on a fairly small board and this includes the power supply and the DIY Arduino board too. If I used a stock Arduino Uno then the whole circuit (amp/filter + MIDI in – the two rightmost on the board below) fits on the third of this.

Uploading code to DIY Arduino board

Note that there is a switch and 5 jumper sockets on the top of the board – this is needed to be able to upload and update the code on the DIY Arduino board via an stock Arduino Uno board. This tutorial by Notes and Volts explains very thoroughly how to do it. I followed it and worked like a charm.

The first four sockets are connected to pin #19, #18, #17, #1 (reset pin) of the ATMEGA328 chip. The rightmost one to ground. The switch is there to be able to switch off the connection between the output of the MIDI circuit and the RX pin of the ATMEGA328.

I added jumpers sockets and a switch to be able to update the code on the DIY Arduino board
Using an Arduino Uno to upload code to the DIY one


I'm not going into any details of the actual Arduino code here, please refer to the code itself and the comments for explanation on the ZFM Github repo.


Connecting the pots, the buttons and building the panel is like the icing on the cake. I haven't done a proper panel for this synth yet, just drilled a couple of holes on an IKEA tablet holder and cut some plywood to make it higher so that the board has enough space. I printed this stencil as a guide for the holes on the panel and I just used some black tip marker for the labels, nothing fancy, the panel is a prototype.

Bill of materials