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

Introduction

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

Other

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.

Touch

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.

Sound

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.

Visuals

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 Name Quantity Unit Price Total Price Source
Custom PC board 1 4.00 4.00 Lab
RS 232 Connector 1 1.00 1.00 Lab
Touchscreen 1 0.00 0.00 Sampled
ATmega644 1 0.00 0.00 Sampled
74HC595 15 0.462 6.93 Digikey
LEDs 117 0.07 8.19 Lab
Solder board (6 inch) 2 2.50 5.00 Lab
Resistors, capacitors a lot 0.00 0.00 Lab
Power supply 1 5.00 5.00 Lab
Header sockets 72 0.05 3.60 Lab
DIP socket 15 0.50 7.50 Lab
Foam-core 1 6.99 6.99 Cornell Store
PVC sheets 3 2.49 7.47 Cornell Store
Brass hinges 1 pair 0.99 0.99 Cornell Store
TOTAL 56.67

For more detail: ToneMatrix Touch Sequencer Using Atmega644


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top