You Are Here: Home » AVR ATmega Projects » LED Projects » ToneMatrix Touch Sequencer Using Atmega644

ToneMatrix Touch Sequencer Using Atmega644

ToneMatrix Touch

by Jane Park, Michael Chin

We can be reached at {jp624 | msc247} at cornell dot edu.

—a touch-based, interactive matrix that plays music corresponding to active grids and displays playback state using LEDs

ToneMatrix Touch Sequencer Using Atmega644


The ToneMatrix Touch (TMT, aka Teenage Mutant Turtle) is a touch-based music-synthesis device based on an ATmega644 microcontroller.
We were inspired by a flash application called the ToneMatrix. Fans of the ToneMatrix describe this application as being “simple,” “beautiful,” “addictive,” and “hypnotic.” By bringing this application to hardware and adding on a tactile dimension to allow physical interaction, we sought to create a more interactive version of the original ToneMatrix.

The ToneMatrix Touch features a matrix of LEDs that display the playback state, a touchscreen for user input, and speakers. Our final product interacts with the user through sight, touch, and sound to create a truly multi-dimensional experience.

High Level Design

Source of Idea: the Original Tone Matrix

The original ToneMatrix is a Flash application featuring a 16 X 16 grid. The user can click on each grid to activate or deactivate it, and the application continuously loops through columns, playing back the combination of notes corresponding to highlighted grids in each column. Since the ToneMatrix uses a pentatonic scale (B, A, F#, E, D), any combination of grids sounds pleasant. Ripples of waves emanating from grids denote which grids have been selected or are being played back.

Background Math

Tones are created by using the Karplus-Strong algorithm discussed in lecture which simulates a string being plucked or hammered. An array of white noise is fed into a delay one for each tone generated. The delay line is then fed into a filter, which specifically in this case is a low pass filter that averages adjacent samples.

The output of the filter is then fed back into the delay line creating a positive feedback loop. Therefore, the gain of the filter must be less than one for stability.

Given a desired fundamental frequency Fd, and a sampling frequency of Fs, a delay length of Fs/Fd is required. Intuitively this can be seen as increasing the length of the string being simulated, which corresponds to a lower frequency.

Because the TRT kernel does all the scheduling, delays are strategically placed to try to maintain a constant sampling rate.

Logical Structure


There were no particular standards relevant to our project, and to the best of our knowledge there are no existing patents, copyrights, and trademarks relevant to our project.


Hardware Design

A single ATmega644 microcontroller interfaced with three main peripherals: the touchpad for input, speakers for audio output, and LED bank for visual output. We had to do ADC conversions to interface to the MCU, and DAC conversions to the outputs.

We kept our hardware modular by having three main “panels.” We had one panel designated to the LEDs, another for the resistors for each of the LEDs, and a controller panel where our LED drivers, MCU, and music and touchscreen connections were made. This modularization made it easier to test individual components and to split the soldering between the two of us.


A 5-wire resistive touchpad was used to receive user input. Four input wires allow voltage control of each corner. The single output wire connects to the lower layer of the touchscreen, which is where the reading is made. The upper layer behaves exactly likely a voltage divider. When the touchpad is pressed, it creates a connection between the upper and lower layers of the touchscreen, outputting the voltage divided at the upper layer.

By alternating between setting the upper corners to high and the lower corners to low, and then swapping so the left corners to high, and right corners to low, we could get the x and y coordinates of a press in terms of voltages. The analog voltages are then converted to digital values using the built in ADC in the MCU. These digital x and y values were then processed by in software.


By using the pulse width modulation ability of the timers on the MCU we outputted the amplitude of the desired sounds. By low-passing the output of each of the PWM outputs, the PWM output is filtered passing only the amplitude of the wave. These were then passed to speakers, which physically played the music. NOTE: Measure RC values.


Since our touchscreen is transparent, we were able to overlay it above a grid of LEDs, which each LED in the grid corresponding to a “playing” grid. That is, as the ToneMatrix looped through the columns, the corresponding column of LEDs would lit up. Also, when the grid detects an input, four yellow LEDs–two at the ends of the corresponding column, two at the ends of the corresponding row–light up to verify the input for the user.
We spent many days in lab soldering.

ToneMatrix Touch Sequencer Using Atmega644

Given that LEDs are rather simple devices, driving an entire grid of more than a hundred of them proved to be a lot more challenging than we anticipated. At first we intended to use charlieplexing, but were not happy with the results when we tried it out on a 4×4 sample grid. The lights were too dim, and we were not happy with the fact that in lighting any single LED, multiple other LEDs would be simultaneously lit, however negligible the brightness of those were. We consulted another group that was driving multiple LEDs, and learned that they were using SIPO latches to drive their LEDs. In our final design, we use fifteen 74HC595 8-bit SIPO shifters to drive the 117 LEDs.

Parts List:

Part NameQuantityUnit PriceTotal PriceSource
Custom PC board14.004.00Lab
RS 232 Connector11.001.00Lab
Solder board (6 inch)22.505.00Lab
Resistors, capacitorsa lot0.000.00Lab
Power supply15.005.00Lab
Header sockets720.053.60Lab
DIP socket150.507.50Lab
Foam-core16.996.99Cornell Store
PVC sheets32.497.47Cornell Store
Brass hinges1 pair0.990.99Cornell Store

For more detail: ToneMatrix Touch Sequencer Using Atmega644

Leave a Comment

You must be logged in to post a comment.

Read previous post:
Automated grapefruit segmenter Using Atmega644

Part I. High Level Design 1 Rationale and Problem Overview As regular grapefruit consumers, both of us could appreciate the value...

Scroll to top