Arduino Sequencer and Theremin

My experience of engineering something portable, streamlined, versatile, and fun.

Manu Gandham - 2011

During the fall of my senior year in high school I studied Arduino development as part of an exploratory course in Computer Science. Enthralled and excited by the possibilities of engineering with Arduinos, I decided to take on what I considered to be a very challenging project for my final project in that class: building an Arduino-based musical sequencer. I had some programming experience and plenty of designs in my imagination, and was eager to showcase my creativity and technical prowess. However, I had never before used a soldering iron, PCBs, or circuit diagrams, and many challenges arose along the way. Despite this, I stuck with the project from start to finish, always staying true to my original design, until I finally had a finished product that I was proud of. The experience of building this sequencer has taught me so much about engineering, and here I hope to share the details of the project with you. Enjoy!

Description:

My sequencer allows a user to place tones of variable duration and frequency into a sequence. The sequencer loops through this sequence infinitely, and whenever the user pushes the "place note" button, a new note is added to the sequence. By adjusting the speed at which the sequence is played and the frequencies of the notes you place down, you can achieve some interesting musical effects and make some really catchy, hypnotizing, sounds.

My device also has a Theremin function, which allows the user to modulate the tone being played by waving his hand over the device.

The Gandham Sequencer/Theremin:

Gandham Arduino Sequencer and Theremin


Design:

December 2010

Before I started building anything, I drew out a rudimentary design of what I envisioned would be my final product:

Diagram showing the configuration of all the items on the sequencer

The device would have two basic modes: A sequencer mode, where the user would be able to place notes of different frequencies into a sequence that would loop infinitely, and a Theremin mode, where the device would play sounds of different pitches based on how much light it was receiving. There would be buttons that would allow the user to place a new note, increase the length of the sequence, clear the sequence, and calibrate the Theremin, and there would be knobs that would allow the user to adjust the frequency of the next note, adjust the duration of each note, and control the volume. There would be switches to select between sequencer and Theremin mode, and to turn the device on and off, and there would LEDs that would flicker in time with the sequence, indicate if the device was on or off, and indicate which mode the device was in. Finally, a photovoltaic cell would gather light input for the Theremin.

I also drew the device's side panel:

Diagram showing the configuration of all the items on the sequencer's side panel

I wanted the USB port on the Arduino board to be accessible after everything was mounted in its case, as that would allow me to easily tweak the device's code after it was all put together. I also wanted the DC jack on the board to be accessible, so I could power the device with DC power. The device would also have a headphone jack that would output the sequence, and a headphone jack that would output the currently selected note, as a "preview," to allow the user to tell exactly what sound he was about to add to the sequence.

More details on this design can be found in my Design Document, here.

These designs were modified extensively as I learned more about what would be feasible and what wouldn't be, but all in all, my final product stayed mostly true to this initial vision.


Code:

The code for the sequencer can be found here.


Construction:

December 2010 - January 2011

My Computer Science teacher provided us with an Arduino Starter Kit which contained the Arduino board, and a few buttons and potentiometers. Using these basic materials and components, I assembled an initial prototype of the sequencer, to see how feasible it would be, how well it worked, and if I could get the code to work:

Initial prototype of the sequencerDetail of initial prototype interface

As you can see, my initial prototype consisted of the Arduino Board, a breadboard, 3 potentiometers, a button, and an 8-ohm speaker. The functions of these components as well as the prototype as a whole are illustrated in this demonstration video: If you'd like to skip the technical jargon and see the prototype in action, skip to the 1:00 mark.

So far so good! I was pleased with how easily things seemed to be going, but there were still many components to be wired on and functions to be programmed. I also knew that in order to expand my project further, I would have to purchase several components not found in the Starter Kit.

So I went shopping:

Plastic project box with initial holes drilled inA button, knob, switch, and LEDPCBs and Battery clips

I made frequent trips to RadioShack to buy things I'd need, the most noteworthy being the black plastic Project Box shown above, which would house my sequencer once it was done, and several buttons and electrical components. Pretty soon, the counter I was using as a work area had turned into this:

My work area

I decided that the next function that should be added onto the sequencer should be the Theremin mode. I'd have to attach a switch to select between modes and a photoresistor to be able to sense how much light the device was receiving.

In order to attach wires to the components I had bought, I had to use a soldering iron. I had never done this before, save for a little practice in class, but nevertheless I went out to Harbor Freight and bought myself a soldering iron and some resin-core solder. Then I got to work:

Soldering

After soldering that first switch, I wired it onto the breadboard, alongside a photoresistor that I obtained from the Starter Kit:

Sequencer + ThereminOverview of Sequencer + Theremin

After testing these components to make sure they worked correctly, I proceeded to go ahead and solder leads onto a few more components and wire them onto the breadboard:

Sequencer + more components

Once these components were wired on, I programmed them to serve as the buttons to place a note, add more beats to the sequence, and clear the sequence. Things were shaping up nicely, although soldering proved to be more difficult than I expected, and I spent a fair amount of time re-soldering connections I had butchered.

It was around this point that I also connected a potentiometer to serve as a "pentatonic multiplier," which was essentially a way to place notes along the same pentatonic scale, which just made things sound a lot nicer. I also wired on a button to switch between the major/minor pentatonic scales, and some lights to indicate the beats of the sequence. All these new collective functions are detailed and demonstrated in this video. Please excuse the mess of wires :)

Now that sequencer was essentially working as intended, it was time to get it off the breadboard and into the project box. In order to do this, I started by using a hot plastic knife to cut out sections of the project box:

Project box with more holes

By using ample amounts of SuperGlue, I was able to mount my interface components in the lid of the project box:

Sequencer InterfaceSequencer Interface Side View

Although I originally intended for the sequencer to play through an output stereo/headphone jack, by this point in the project I had grown pretty fond of that external 8-ohm speaker. I decided then to mount it into the project box:

Project box with speaker

I also mounted the headphone jack and the remaining buttons and switches into the side panel of the device, as you can see here:

Sequencer side panel with components

Because SuperGlue isn't really that great on uneven surfaces, and my rotary tool/plastic knife experience was literally non-existent, my components almost never fit perfectly within the holes I had made for them, and copious amounts of electric tape had to be used to make things look neater and hold everything together. It detracts a bit from the aesthetic appeal, but it's a sacrifice I can live with considering it made my final result possible.

The next item on my agenda was to transfer the connections I had made on my breadboard to my printed circuit boards. This was by far the hardest part of the project, essentially due to my lack of experience with PCB-mounting, and I made many mistakes along the way which required me to stop and restart. It was a challenge, but things slowly came together:

Internal connections and PCBs of the sequencer

At every stage of making these connections and soldering components onto the circuit board, I stopped to test that everything was still working. Sometimes connections would be weak and would need to be resoldered. Sometimes the leads I had obtained from the starter kit needed to be replaced with more versatile wire of my own. And just when I thought I had things working, an LED would fail to light, or a button press wouldn't register. The entire process was taxing and there were many moments where I was very very close to giving up. However, due to my determination (or stubbornness,) I refused to give up.

My next task was to try to fit everything, including the Arduino board, into the narrow confines of the project box. Here you can see things being wedged in, bit by bit:

Circuitry going into the Project Box

Once I had managed to squeeze everything inside, I still found that occasionally things failed to work. I had to repeatedly take everything apart and check the internal configuration over and over again, slightly adjusting where things lay. Finally I got everything into the box and working:

Finished product

At last, I was done! This was a great moment for me because I had literally poured all my time, effort, and energy into this project, and despite facing obstacles I had never encountered before, I was ultimately successful! Additionally, I had created something compact, portable, and REALLY fun to use, and within a couple minutes of playing with my sequencer, all the weeks of work suddenly became more than worth it. Here is a video demonstrating how the sequencer works:

If you have questions, comments, or suggestions about this project, please feel free to email me at manugandham "at" gmail.com. Thanks!

web counter