Using Mozzi Library With 5 Potentiometers




Introduction: Using Mozzi Library With 5 Potentiometers

Getting Started

The goal of this project was to create filters and controls to that can manipulate sound that is being generated through an Arduino. Normally Arduino can only generate simple tones that are not useful if you are trying to achieve complex sounds and do sound manipulation. In order to do this project Mozzi library was used. This library helps Arduino to create complex sounds and also have real time input. Mozzi does all the job for you in the background with a non-blocking code that allows you to have multiple inputs at the same time.

What you need

  1. Arduino
  2. Mozzi Library
  3. 100K Potentiometes - x5
  4. Male headers
  5. Female headers
  6. 1/8" Audio Jack
  7. Audio Cable
  8. Speaker

What is an Arduino?

Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It's an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board.

Arduino can be used to develop interactive objects, taking inputs from a variety of switches or sensors, and controlling a variety of lights, motors, and other physical outputs. Arduino projects can be stand-alone, or they can communicate with software running on your computer (e.g. Flash, Processing, MaxMSP.) The boards can be assembled by hand or purchased preassembled; the open-source IDE can be downloaded for free.

For more information check out:

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Setting Up Mozzi Library

What is Mozzi?

Currently your Arduino can only beep like a microwave oven. Mozzi brings your Arduino to life by allowing it to produce much more complex and interesting growls, sweeps and chorusing atmospherics. These sounds can be quickly and easily constructed from familiar synthesis units like oscillators, delays, filters and envelopes. You can use Mozzi to generate algorithmic music for an installation or performance, or make interactive sonifications of sensors, on a small, modular and super cheap Arduino, without the need for additional shields, message passing or external synths.

Check out Mozzi:

Download Mozzi Library:

Setting Up

Once you download the Mozzi library, unzip the file and put it in your Arduino➞libraries folder. Quit Arduino (if open) and reopen it. You should now be able to see Mozzi in the list under Arduino➞Sketch➞Import Library and also under the examples.

Step 2: Putting It Together - 1


First get 5 pairs of 100K potentiometers. The middle output of the potentiometer is always the analog output. The other 2 outputs on the left and right are either power (5V) or ground. Solder your red, black and white wires on to the potentiometers. After get enough of male headers and solder them to the ends of each wire. This will make it easier to put it together on the Arduino afterwards. The reason that I did not solder the wires on a proto shield is to make it removable so it can be replaced with a different kind of input like sensors.

Step 3: Putting It Together - 2


Get your Audio Jack and solder a white wire to one of the positive outputs and solder the black wire to the negative output. After solder male headers to each end of the wires, same as the ones we did for the potentiometers.

To figure out the positive and negative outputs of the Audio Jack, check out these images:

Audio Jack image 1

Audio Jack image 2

Female headers

I created this part to have a terminal where I can connect all my power or my ground connections, but this is not the best way of doing it. I would recommend using an Arduino proto shield with a breadboard to connect everything together. If you would like to do it the quick and easy way I did it, then solder the bottom parts of the female headers together so they all connect with each other. After solder on male header to the bottom to connect it to the Arduino.

Step 4: Connect All the Pieces

  1. First of all connect all of your potentiometers to Arduino. Get all the white wires and connect them to the ANALOG IN starting from A0 up to A4. It does not matter which potentiometer comes first.
  2. Connect all the black wires to one of the terminals we have created and connect that terminal to Ground (GND) on the Arduino.
  3. Connect all the red wires to the other terminal and connect that one to Power (5V).

Connect the Audio parts

Get the Audio Jack you have soldered the wires on and connect the white wire to pin ~9 on the DIGITAL (PWM~). After connect the black wire to the Ground terminal where we connected all the other black wires on or to any other Ground (GND) pin.

Now your audio output is almost ready. Plug in one end of your audio cable to your audio jack and the other end to your speaker.

Step 5: Upload and Run the Arduino Sketch

I have used an already existing sketch (code) from the Mozzi library that only works with 3 inputs. I tweaked the code a little bit and added more inputs to manipulate and control the sound.

Open up your Arduino software and open the example sketch: File ➞ Examples ➞ Mozzi ➞ Knob_LightLevel_x2_FMsynth

Upload and run the sketch.

Your first 3 potentiometers will be able to control 3 different effects.

  1. Carrier Frequency
  2. Intensity
  3. Modulation Rate

Now downlod and upload the sketch I tweaked. In this sketch there are now 2 extra controls and also some value changes to the maximum and minimum control values for the initial 3 effects. One of the extra controls now effects the modulation and frequency level at the same time in a smaller scale enabling the new set of frequency scale to be generated.

int freqVal = mozziAnalogRead(LDR3_PIN); // value is 0-1023
int FRQ = mapThis(freqVal);

carrier_freq * mod_ratio * FRQ;

FRQ is the new control value that I added to the code.

The second control effect the intensity with a new scale of values.

int knob2 = mozziAnalogRead(LDR4_PIN); // value is 0-1023
int knob2Val = mapThis(knob2);
fm_intensity = ((long)LDR1_calibrated * knob2Val * (>>8;

knob2Val is the control value.


6 People Made This Project!


  • Raspberry Pi Contest 2020

    Raspberry Pi Contest 2020
  • Wearables Contest

    Wearables Contest
  • Fix It Contest

    Fix It Contest

9 Discussions

Bunny Kawaii
Bunny Kawaii

8 weeks ago

Thank U so much!
It was my first project =]

Captura de Tela 2019-11-10 às 10.39.22.png

Question 1 year ago

I'm Stuck with the error message "MozziGuts.h: No such file or directory" I moved it from the mac file system into general mozzi and it still didn't work. Any suggestions? I'm so close.


1 year ago

Thanks for the great intructions! Just built it today

Midi over Usb would be great with that little synth! Would it be possible to achieve that with some extra coding? thanks Thomas


2 years ago

video link is dead


2 years ago

Hi, I'm fairly new to coding and such. I just orderd an Arduino Uno and I wanna make this project. I looked a little to the code an such, but where does the actual input sound comes from? Can I put an jack connector for input somewhere?

Greetings from Holland


3 years ago

Can someone explain what each control is called from A0 to A4 as I will be writing the names of each control on my enclosure. This project is awesome.


3 years ago

I just hooked this thing up and it is really cool. Thanks so much for the clear and concise instructable!


3 years ago

Is there a way to have 6 or 8 pots in this program?